How can i reload a wav file using openAL (java)

I made up an application which loads a .wav file, but it loads it only once. I want to be able to reload a wav file after the first track ends.How can i make that in java? Also, if i hit play twice after the end of the track(while the selected track is loaded) it throws an



IllegalThreadStateException.

if (threadStatus != 0 || this != me)

throw new IllegalThreadStateException();



the code i use to load the file is this:



OpenAL openal = new OpenAL();`

source = openal.createSource(new File(Audioplayer.path));

System.out.println(source.toString());

source.play();

source.setGain(0.75f); // 75% volume

source.setPitch(0.85f); // 85% of the original pitch

source.setPosition(0, 0, 0); // -1 means 1 unit to the left

source.setLooping(false); // Loop the sound effect

j=source.getBuffer();

System.out.println(j);

for (i=1;i<=10000;i++){

Thread.sleep(1); // Wait for 10 seconds

}

source.close();

openal.close();

You’re not using jME3 … Or are you?



This forum is for jME3 sound support only, we do not support other libraries here.

Sorry, i didn’t know

So were to put this topic? Because there is no “Video Forum”

@mathieu-roux222 said:
So were to put this topic? Because there is no "Video Forum"


On someone else's forum?... because it wasn't anything to do with JME at all. And I don't know what you mean about "Video Forum" since this had nothing to do with video.

o wait nvm, i confused avi and wav, nvm then :P, Sorry

I think you also confused OpenAL-specific with JME-specific.

Ya sorry :slight_smile: