Setup:
- Windows XP, 32-bit
- Sun's JRE 6 Update 18
- LWJGL 2.3
Calls to AL.create intermittently fail, even though the native library path is correct. In the course of looking for a way to reliably reproduce the problem, I came up with the following test case:
import org.lwjgl.*;
import org.lwjgl.openal.*;
public final class AudioTest {
public static void main(String[] args) {
for (int idx = 0; idx < 100000; idx++) {
System.out.println(idx);
try {
AL.create ();
AL.destroy();
} catch (LWJGLException ex) {
System.err.println(idx);
ex.printStackTrace();
}
try {
Thread.sleep(5);
} catch (InterruptedException ex) {
}
}
}
}
This just creates and destroys OpenAL instances non-stop. Generally, it works,
however, and that's the point, when I click on a button in the Windows taskbar (holding down the mouse) while the program is running, exceptions start occurring:
org.lwjgl.LWJGLException: Could not locate OpenAL library.
at org.lwjgl.openal.AL.create(AL.java:153)
at org.lwjgl.openal.AL.create(AL.java:104)
at org.lwjgl.openal.AL.create(AL.java:191)
at AudioTest.main(AudioTest.java:10)
In other words, if the user happens to be switching applications using the taskbar while the LWJGL app is trying to initialize OpenAL, AL.create() will fail and there'll be no sound.