OpenAL exception when closing an application

Hello,



I am using a streamed background music (ogg) in my game and everything works great. However, when I close the application, the following exception is thrown:


Exception in thread "Thread-4" 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:819)
   at com.jmex.audio.openal.OpenALStreamedAudioPlayer.update(OpenALStreamedAudioPlayer.java:260)
   at com.jmex.audio.openal.OpenALStreamedAudioPlayer$PlayerThread.run(OpenALStreamedAudioPlayer.java:361)



It is totally harmless because it only appears at the Java console and does not seem to affect the closing process at all (at least what could be noticed by a user). What is more curious, the exception is not thrown in all cases - sometimes it appears and sometimes not.

Is there anything I can do to avoid it? I am always using the latest sources of jME (from CVS) and the most recent versions of all libraries.

Thanks,
Filip

Are you calling cleanup on AudioSystem?

Of course. This is what I call at the cleanup() block:


        if (AudioSystem.isCreated())
            AudioSystem.getSystem().cleanup();

Ah well then what is probably happening is that one thread kills openal just as the other is about to issue openal commands.  We can probably take care of much of that (musicqueue and environpool sounds anyhow) in the system's cleanup method.

hey … i got the same problem also … same error … how do you guys solve the problem? please … ://

I got the same error even if calling AudioSystems cleanup in my class derived from BaseGame.

I got rid of it by manually removing all tracks from the track queues before calling cleanup().



AudioSystem.cleanup() does a clearTracks() on the queues and clearTracks() only clears the ArrayList while

removeTrack() calls AudioTrack.stop() and AudioPlayer.cleanup().



(jme2, lwjgl2.0.1)

Hi and welcome :slight_smile:



Can you write a test showing the problem and the solution?

I found out that if I don't call cleanup at all then I get no errors. IF I call AudioSystem.cleanup() then I have to manually clean up tracks:


protected void cleanup() {

        MusicTrackQueue mtq = AudioSystem.getSystem().getMusicQueue();
        mtq.clearSongListChangeListeners();
        while (!mtq.getTrackList().isEmpty()) {
            mtq.removeTrack(mtq.getTrackList().get(0));
        }

        EnvironmentalPool ep = AudioSystem.getSystem().getEnvironmentalPool();
        ep.clearSongListChangeListeners();
        while (!ep.getTrackList().isEmpty()) {
            ep.removeTrack(ep.getTrackList().get(0));
        }
        AudioSystem.getSystem().cleanup();

        super.cleanup();
}


.. or else I get the error.