So, I am wanting to use Godot to get a (binary) file using HTTP and then either save it or, even better, turn it into a Resource in memory that I can use. It'll be WAV files that I'm getting in return (trying to implement MaryTTS, which is running as a server on localhost). I had a look at the docs for HTTPRequest, but can't seem to get a working solution.
$HTTPRequest.request("http://...") when a particular keypress is made, and I have the
_on_HTTPRequest_request_completed() function, but this never seems to be called. I tried with the function in the same Node as the request (as per the docs' example), and I also tried putting it as part of a script for the HTTPRequest Node. If I hit the triggering key fast enough, it gives an error ("HTTPRequest is processing a request"), but if I do it slower, it doesn't give that error, so it appears it is finishing. It just doesn't do anything when it finishes. HTTPRequest gives a return value of 0, which I assume means no error? (Or should this give me HTTP status codes?)
Any idea what I'm doing wrong? Can HTTPRequest handle binary files? How do I get this working? Should I be using HTTPClient instead?
(Any suggestions on a better way to implement MaryTTS are also welcome).
Edit: have made some progress using HTTPClient. My code now looks like the below, where I can get a response (and even manage it in its own thread, so there's no freezing of the main game), but the audio player doesn't play anything.
Code is here: https://www.dropbox.com/s/ey71w3g09raf4bw/httpTest.gd?dl=0