Skip to content

fix audiostream cutouts from openal buffer underrun#7456

Open
Goober5000 wants to merge 2 commits into
scp-fs2open:masterfrom
Goober5000:fix/openal_underrun
Open

fix audiostream cutouts from openal buffer underrun#7456
Goober5000 wants to merge 2 commits into
scp-fs2open:masterfrom
Goober5000:fix/openal_underrun

Conversation

@Goober5000
Copy link
Copy Markdown
Contributor

When a streaming OpenAL source plays through all queued buffers it transitions to AL_STOPPED. Per the spec, queueing more buffers after that does not auto-resume playback -- alSourcePlay must be called again. This is the likely cause of music and briefing voices cutting out.

To fix this, check for underrun and call alSourcePlay if needed. Also double MAX_STREAM_BUFFERS from 4 to 8, bumping the margin to ~2s of queued audio.

Tested with menu and mission audio; also tested with a forced underrun to prove that underrun recovery works successfully.

When a streaming OpenAL source plays through all queued buffers it
transitions to AL_STOPPED. Per the spec, queueing more buffers after
that does not auto-resume playback -- alSourcePlay must be called
again. This is the likely cause of music and briefing voices cutting
out.

To fix this, check for underrun and call alSourcePlay if needed. Also
double MAX_STREAM_BUFFERS from 4 to 8, bumping the margin to ~2s
of queued audio.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Goober5000 Goober5000 added fix A fix for bugs, not-a-bugs, and/or regressions. sound A feature or issue specific to music and sound labels May 14, 2026
@Goober5000 Goober5000 force-pushed the fix/openal_underrun branch from 03f6b79 to 1245546 Compare May 14, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. sound A feature or issue specific to music and sound

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant