question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenALMusic - Unable to allocate audio buffers. AL Error: 40963

See original GitHub issue

Issue details

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.

Reproduction steps/code

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;
                }
            }

Version of LibGDX and/or relevant dependencies

1.9.9-SNAPSHOT

Stacktrace

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)

Please select the affected platforms

  • Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
NikolajPaghcommented, May 15, 2020

I have the exact same error on Windows 😦 - Any news on this ?

Scenario:

  • Playing Music one
  • Player selects some action
  • Stopping Music one
  • Start Music two
  • Crash with Unable to allocate audio buffers. AL Error: 40963
2reactions
mgsx-devcommented, Jul 20, 2018

i’m able to reproduce with the libgdx MusicTest.

First case :

  • run WAV example with looping disabled
  • play with the cursor back and forth several times
  • let the song finish
  • you can’t start the song (it fails silently)

Second case :

  • run WAV example with looping disabled
  • play with the cursor back and forth several times
  • change the music (mp3 or ogg) before it finish
  • it crashes : 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Libgdx Audio Buffer Error - Stack Overflow
The thing is libgdx's audio class have a logic like this: when do u calling play(); method is adding the object to an...
Read more >
Have a music file that plays when we are in a certain zone ...
GdxRuntimeException : Unable to allocate audio buffers. AL Error: 40963' , similar to this guy : https://github.com/libgdx/libgdx/issues/2537.
Read more >
Game crashes on disasters or even small fire... - TheoTown
GdxRuntimeException: Unable to allocate audio buffers. AL Error: 40963 at com.badlogic.gdx.backends.lwjgl3.audio.OpenALMusic.play(OpenALMusic.java:84)
Read more >
Replay the Spire :: Discussions - Steam Community
A place too hopefully store all the bug reports in one area ... GdxRuntimeException: Unable to allocate audio buffers. AL Error: 40963
Read more >
LAsso - Bountysource
Issue details. Running gradle checkGwt task results in build error. ... LWJGL2 OpenALMusic - Unable to allocate audio buffers. AL Error: 40963 $...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found