Hello Guest

oggEffect.isPlaying() dies with UnsatisfiedLinkError

  • 9 Replies
  • 9104 Views
oggEffect.isPlaying() dies with UnsatisfiedLinkError
« on: February 06, 2011, 11:30:56 »
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.

Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #1 on: February 06, 2011, 11:40:20 »
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. :)

Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #2 on: February 06, 2011, 20:29:05 »
Sorry I've forgotten to tell that the problem occurs very sporadically. Usually the sound works.
Regards. Cottonwood.

Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #3 on: February 06, 2011, 21:48:57 »
That's unusual though.

*

Offline Matzon

  • *****
  • 2242
Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #4 on: February 06, 2011, 22:40:43 »
multiple threads?

Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #5 on: February 07, 2011, 00:54:54 »
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

Code: [Select]
       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.

*

Offline Matzon

  • *****
  • 2242
Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #6 on: February 07, 2011, 06:34:09 »
I dont recommend using multiple threads accessing OpenAL. Try to use only 1 thread - specifically, the one that creates the OpenAL context.

Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #7 on: February 07, 2011, 14:03:20 »
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.

*

Offline Matzon

  • *****
  • 2242
Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #8 on: February 07, 2011, 17:52:27 »
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

Re: oggEffect.isPlaying() dies with UnsatisfiedLinkError
« Reply #9 on: February 09, 2011, 11:01:20 »
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.