Hey folks,
I’m using Audiere under java, and my sounds seem to be repeating, even though I’m telling them not to.
If I call .setRepeating(true) on the streams, they loop ‘tightly’, i.e. as soon as the sound ends, it starts again. But when I call setRepeating(false), the loop is different - there’s a gap of about a second between repeats.
Anyone experienced this problem?
My code is here:
public static OutputStream[] streams;
public static void init()
{
try
{
AudioDevice device = new AudioDevice();
streams = new OutputStream[SOUND_FILES.length];
for (int i=0; i<SOUND_FILES.length; i++)
{
streams[i] = device.openSound("res/"+SOUND_FILES[i]+".ogg", true);
streams[i].setRepeating(false);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void playSound(int id, int worldX)
{
float pan = (worldX - cameraX) / WORLDWIDTH;
if (pan < 0) pan = 0;
else if (pan > 1) pan = 1;
streams[id].reset();
streams[id].setPan(pan);
streams[id].setRepeating(false);
streams[id].play();
}