This is a really elusive bug to reproduce. From the crash reports I receive from players, it crops up randomly if one does pause(), setPosition(), play() or dispose() repeatedly. I'm not sure if its hardware related or due to some timing issue. While I could reproduce it consistently with a code similar to #5316 , I'm pretty sure it is not related.
Just the render() of an empty ApplicationListener:
Music music = null;
@Override
public void render() {
int frameNumber = (int)Gdx.graphics.getFrameId();
Gdx.app.log("CRASH", "Frame " + frameNumber);
switch (frameNumber) {
case 0:
// Frame 1
music = Gdx.audio.newMusic(Gdx.files.external("any_audio_file.ogg"));
music.play();
break;
case 1:
// Frame 2
music.setPosition(26.300f); // must be within at least 200ms from the end
break;
case 2:
// Frame 3
music.setPosition(26.300f); // must be within at least 200ms from the end
break;
case 3:
// Frame 4
music.dispose();
break;
case 4:
// Frame 5
music = Gdx.audio.newMusic(Gdx.files.external("any_audio_file.ogg"));
music.play(); // Crashes here
break;
}
}
1.9.9-SNAPSHOT
com.badlogic.gdx.utils.GdxRuntimeException: Unable to allocate audio buffers. AL Error: 40963
at com.badlogic.gdx.backends.lwjgl.audio.OpenALMusic.play(OpenALMusic.java:83)
at game27.DesktopMain$2.render(DesktopMain.java:270)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
i'm able to reproduce with the libgdx MusicTest.
First case :
Second case :
Unable to allocate audio buffers. AL Error: 40963
libgdx code properly unqueue buffers but as per OpenAL doc : The unqueue operation will only take place if all n buffers can be removed from the queue.
maybe OpenAL can't cancel some running buffers which lead to a kind of accumultation due to allocation/free frequency.
Maybe those kind of use are extreme and maybe Sound should be used instead.
I have the exact same error on Windows :( - Any news on this ?
Scenario:
Also happens with LWJGL3, haven't found a solution thus far.
Most helpful comment
i'm able to reproduce with the libgdx MusicTest.
First case :
Second case :
Unable to allocate audio buffers. AL Error: 40963
libgdx code properly unqueue buffers but as per OpenAL doc :
The unqueue operation will only take place if all n buffers can be removed from the queue.
maybe OpenAL can't cancel some running buffers which lead to a kind of accumultation due to allocation/free frequency.Maybe those kind of use are extreme and maybe Sound should be used instead.