I'm trying to play sounds in a Java game with the following code:
AudioStream audioStream = new AudioStream(stream);
AudioPlayer.player.start(audioStream);
The stream
variable is just an InputStream to the resource. By the first time this code is called, the sound is played as expected, but by the second time the program just hangs, not even an exception is thrown.
I don't know what's going on or how to prevent this. If I try closing either stream
or audioStream
after the above code, the program doesn't hang, but no sound is ever played at all.
Any tips are welcome, thanks.
0
between calls, or some sort of loop property you can set totrue
? – ashes999 Apr 14 at 4:20