I' m trying to add looping sound streams to my game, basically one in the game' menu and one
in the game. I use the game state system and I have one state for the menu and one for the
game. So what I actual want to do is play the looping stream when a state is activated and
stop or pause the looping stream of the deactivated state.
Now everything works fine when I play the sound and stop or pause it, but I can not play the sound
again when a state is re-activated.
Do I have re-create a stream after stopping or pausing? Don't I just have to use
SoundSystem.play(streamName) again?
Here is an exception I got after pausing and attempted to play the sound again.
Exception in thread "Thread-7" org.lwjgl.openal.OpenALException: OpenAL error: Invalid Value (40963)
at org.lwjgl.openal.Util.checkALError(Util.java:56)
at org.lwjgl.openal.AL10.alBufferData(AL10.java:1044)
at com.jmex.sound.openAL.objects.util.StreamPlayer$Player.stream(StreamPlayer.java:432)
at com.jmex.sound.openAL.objects.util.StreamPlayer$Player.play(StreamPlayer.java:458)
at com.jmex.sound.openAL.objects.util.StreamPlayer$Player.run(StreamPlayer.java:509)
at java.lang.Thread.run(Thread.java:595)
Searching through the methods of SoundSystem there's no method for destroying/cleaning
a stream or all streams. Shouldn't there be methods such as:
/**
* Clean all the streams.
* Note that after this the registered streams will not play again.
*/
void cleanStreams()
/**
* Cleans the stream with the specified <code>streamName</code>.
* Note that after this the specified stream will not play again.
*/
void cleanStream(int streamName)
as well as
/**
* Cleans the sample with the specified <code>sampleName</code>.
* Note that after this the specified sample will not play again.
*/
void cleanSample(int sampleName)
/**
* Cleans the node with the specified <code>nodeName</code> and
* and all contained samples of the node.
* Note that after this the specified node and contained samples will not play again.
*/
void cleanNode(int nodeName)
/**
* Clean all the nodes and their contained samples.
* Note that after this the nodes and their registered streams will not play again.
*/
void cleanNodes()
/**
* Clean all the nodes, samples and streams.
* Note that after this the nodes, registered samples and streams will not play again.
*/
void cleanAll()
the soundsystem needs a good run through…don't seem like it's very much tested(i guess people add sound late in their projects, and most often don't get all the way there)