Hi, I’m having a problem with Joal. The code below crashes Java when I run it. If I change it, so that the sources are deleted in the same order as they are created then there are no problems, but when I delete the sources in a different order than they were created in, then an Java crashes with the error “java.exe has encountered a problem and needs to close. We are sorry for the inconvenience.”. Is there anything I can do? Since my system is to be dynamic, I need to be able to delete sources at any point in time, and thus not just in the order they were created…
import net.java.games.joal.*;
import net.java.games.joal.util.*;
public class TestSound {
private AL al;
public static void main(String[] args) {
TestSound se = new TestSound();
}
public TestSound() {
try {
ALut.alutInit();
al = ALFactory.getAL();
} catch (OpenALException e) {
e.printStackTrace();
System.exit(1);
}
al.alGetError();
int[] source0 = new int[1];
al.alGenSources(1, source0);
if (al.alGetError() != AL.AL_NO_ERROR) {
System.err.println("Error generating source0."); System.exit(1);
}
int[] source1 = new int[1];
al.alGenSources(1, source1);
if (al.alGetError() != AL.AL_NO_ERROR) {
System.err.println("Error generating source1."); System.exit(1);
}
al.alDeleteSources(1, source1);
if (al.alGetError() != AL.AL_NO_ERROR) {
System.err.println("Error destroying source1."); System.exit(1);
}
al.alDeleteSources(1, source0);
if (al.alGetError() != AL.AL_NO_ERROR) {
System.err.println("Error destroying source0."); System.exit(1);
}
ALut.alutExit();
}
}