Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - FabianLC

Pages: [1]
1
Other Support / Sound System problems with cleanup and backgroundMusic
« on: November 23, 2017, 08:58:44 AM »
I've been trying to prevent the Sound System from "crashing", but I haven't succeeded yet, I'm using the LWJGL library and the code does fails in two situations, when I play background music and during a cleanup. Here's what the console prints.

Exception in thread "Thread-11" java.lang.NullPointerException
   at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:259)
   at paulscode.sound.libraries.SourceLWJGLOpenAL.play(SourceLWJGLOpenAL.java:616)
   at paulscode.sound.Library.play(Library.java:706)
   at paulscode.sound.libraries.LibraryLWJGLOpenAL.quickPlay(LibraryLWJGLOpenAL.java:795)
   at paulscode.sound.SoundSystem.CommandQuickPlay(SoundSystem.java:1866)
   at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2438)
   at paulscode.sound.CommandThread.run(CommandThread.java:121)

and this happens during cleanup and makes my game freeze for a while

SoundSystem shutting down...
java.lang.NullPointerException
   at com.jcraft.jorbis.DspState.init(DspState.java:178)
   at com.jcraft.jorbis.DspState.synthesis_init(DspState.java:216)
   at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:315)
   at paulscode.sound.libraries.SourceLWJGLOpenAL.preLoad(SourceLWJGLOpenAL.java:687)
   at paulscode.sound.Source.stream(Source.java:928)
   at paulscode.sound.StreamThread.run(StreamThread.java:129)
Error in class 'LibraryLWJGLOpenAL'
    Stream thread did not die!
Ignoring errors... continuing clean-up.
    Author: Paul Lamb,

I've also been wondering if it's normal to have that many threads, I've gotten errors up to thread 22.

Exception in thread "Thread-22" java.lang.NullPointerException
   at com.jcraft.jogg.StreamState.packetout(StreamState.java:186)
   at paulscode.sound.codecs.CodecJOrbis.readBytes(CodecJOrbis.java:575)
   at paulscode.sound.codecs.CodecJOrbis.read(CodecJOrbis.java:354)
   at paulscode.sound.libraries.SourceLWJGLOpenAL.preLoad(SourceLWJGLOpenAL.java:691)
   at paulscode.sound.Source.stream(Source.java:928)
   at paulscode.sound.StreamThread.run(StreamThread.java:129)

My code:
if(!musicLoaded) {
   soundSystem.backgroundMusic(mus, path, loop);
   //soundSystem.play(mus);
   musicLoaded=true;
}
else {
   soundSystem.stop(mus);
   soundSystem.removeSource(mus);
   soundSystem.backgroundMusic(mus, path, loop);
   //soundSystem.play(mus);
}
mus is just a string I made to avoid writing "";
I call cleanup() whenever I change the game's state or level, because the memory usage keeps going up, and even after calling cleanup() it still goes up.

Pages: [1]