What is the meaning of this "java.lang.IllegalStateException: Decoding thread is terminated" and how can I solve it?

what is the meaning of this Exception and how can I solve it?
java.lang.IllegalStateException: Decoding thread is terminated
at com.jme3.audio.openal.ALAudioRenderer.checkDead(ALAudioRenderer.java:236)
at com.jme3.audio.openal.ALAudioRenderer.updateListenerParam(ALAudioRenderer.java:589)
at com.jme3.audio.Listener.setLocation(Listener.java:99)
at com.jme3.audio.AudioListenerState.render(AudioListenerState.java:84)
at com.jme3.app.state.AppStateManager.render(AppStateManager.java:300)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:250)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:197)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Thread.java:748)

and this is another exception throws:

java.lang.AssertionError: Unexpected sound status. OAL: Stopped, JME: Paused

I think you are calling an audio method, before game/state initialization or after game destruction"it’s likely to be" (inappropriate time of calling a method or function that’s dependant on jme), so check your method’s locations & order carefully ,may be showing a code snippet would be benefit ,

https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html

     VS

https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html

1 Like

I just pause all sounds and play theme like this:

/**
     * pause all sounds in the soundMager list
     */
    public void pause_all_sound() {

    ArrayList<AudioNode> toPause = new ArrayList();

    soundList.forEach(sd -> {

        sd.getList().forEach(sound -> {

            if (sound.getStatus() == AudioSource.Status.Playing) {
                toPause.add(sound);
            }
        });
    });

    for (int i = 0; i < toPause.size(); i++) {
        AudioNode tmp = toPause.get(i);
        tmp.pause();
    }

    toPause.clear();

}

/**
     * resum all sounds in the soundMager list
     */
         public void resum_all_sound() {

    ArrayList<AudioNode> toResum = new ArrayList();

    soundList.forEach(sd -> {

        sd.getList().forEach(sound -> {

            if (sound.getStatus() == AudioSource.Status.Paused) {
                toResum.add(sound);
            }
        });
    });

    for (int i = 0; i < toResum.size(); i++) {
        AudioNode tmp = toResum.get(i);
        tmp.play();
    }

    toResum.clear();

}

using a for() loop solved first problem but still I have the second problem:
java.lang.AssertionError: Unexpected sound status. OAL: Stopped, JME: Paused

Why are you using multi-dimensional array looping here ? , From what I understand is the soundList array have a list of lists of sounds & each list has its own sounds , then you loop into the 2nd dimension & add sounds to a new list of array of auidonodes & pause them ,I cannot understand this part , could you explain ?

EDIT : I am now a little bit sure of your problem ,assertion means an instance declaration error , it’s a programmatical logic error & not an exception & must not be handled anyway !

you should notice that , audioStatuses are instance dependant which means when you need to stop a music you do :
musicInstance.pause();
& The same goes with play() but what you have done here is you actually get the soundList from the sound manager system & paused them if they are playing (1st line of instances) , then you do make a different local instances (2nd line of instances)& used them to do the reverse of the effect & the system is unaware of their statuses(because they are different instances , although they are the same soundEffect), so you must use the same instance to call stop() & play() or use a static reference for the instances

You may Try : using the pause method without resuming & watch for this error

1 Like