oggEffect.isPlaying() dies with UnsatisfiedLinkError

Started by Cottonwood, February 06, 2011, 11:30:56

Previous topic - Next topic

Cottonwood

My program dies while asking for "ogg sound is playing or not". The only hint I found in the web is in Spanish and seems not to hit the problem exactly:
http://www.javahispano.org/forum/javacup/es/bug_en_visor_opengl/

Exception in thread "Thread-5" java.lang.UnsatisfiedLinkError: org.lwjgl.openal.AL10.nalGetSourcei(II)I
   at org.lwjgl.openal.AL10.nalGetSourcei(Native Method)
   at org.lwjgl.openal.AL10.alGetSourcei(AL10.java:881)
   at org.newdawn.slick.openal.SoundStore.isPlaying(SoundStore.java:437)
   at org.newdawn.slick.openal.AudioImpl.isPlaying(AudioImpl.java:73)
   at de.virginiacity.software.JukeSound.playSound(JukeSound.java:77)
   at de.virginiacity.software.MusicPlayer.run(MusicPlayer.java:112)
   at java.lang.Thread.run(Unknown Source)

JukeSound.java:77    while (oggEffect.isPlaying()){

What can I do to solve the problem?
Regards. Cottonwood.

broumbroum

check your java library path. It must find the openal dynamic library file.
check what version of lwjgl/slick you're running and maybe get to the latest release. :)

Cottonwood

Sorry I've forgotten to tell that the problem occurs very sporadically. Usually the sound works.
Regards. Cottonwood.

broumbroum


Matzon


Cottonwood

My program has some threads. In this part there are two. The player starte always with it's own thread, I think. Meanwhile I prepare the next title

       if (firstRun){
            try {oggEffect = AudioLoader.getAudio("OGG", new FileInputStream("temporary.ogg"));
            } catch (IOException e) {e.printStackTrace();return;}
            firstRun = false;
        }else{
            try {oggEffect1 = AudioLoader.getAudio("OGG", new FileInputStream("temporary.ogg"));
            } catch (IOException e) {e.printStackTrace();return;}
            while (oggEffect.isPlaying()){
                try{Thread.sleep(100);
                } catch (InterruptedException e) {e.printStackTrace();return;}
            }
            oggEffect = oggEffect1;
        }
            oggEffect.playAsMusic(1.0f, 1.0f, false);


But it happend somewhere within a title. At that moment the program must have been in the loop.
Regards. Cottonwood.

Matzon

I dont recommend using multiple threads accessing OpenAL. Try to use only 1 thread - specifically, the one that creates the OpenAL context.

Cottonwood

Maybe we missunderstand each other. The java program has to create the next sound. Otherwise there will be a long gap between two songs. The second thread ist the sound itselvf.
Regards. Cottonwood.

Matzon

I think you need to reorder your stuff a bit :)

Simple games only need 1 thread. You should not sleep while you are playing the 1st sound. Instead the thread should be busy rendering and handling AI, Input and whatnot.

Consider looking at the SoundManager for the space invaders example, which is a fairly simplistic approach, but gets the job done: http://lwjgl.org/wiki/index.php?title=Examples:SpaceInvaders_SoundManager

In this case you'd feed the soundmanager using addSound and then play them when you need to

Cottonwood

Thank you for the answer. Sorry, but at the moment I have urgent things to do. I'll come back in a few days.
Regards. Cottonwood.