Remap Vorbis channels to match SDL channels, and some *UpdateSection() changes.#803
Merged
icculus merged 3 commits intolibsdl-org:SDL2from Jan 20, 2026
Merged
Remap Vorbis channels to match SDL channels, and some *UpdateSection() changes.#803icculus merged 3 commits intolibsdl-org:SDL2from
*UpdateSection() changes.#803icculus merged 3 commits intolibsdl-org:SDL2from
Conversation
added 3 commits
January 19, 2026 21:26
- Don't discard decoded samples when stream configuration changes.
Contributor
|
Seeing that this is for the SDL2 branch, I assume SDL3_mixer is good? |
Collaborator
Oh, I thought I had channel maps set up for this in SDL3_mixer, but apparently I don't. It definitely doesn't need this patch--SDL3 audio streams can handle this for us--but I'll open a separate issue to deal with it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a function to remap channels in Vorbis and Opus sources to SDL channels. Without it, front center/right get swapped, and all following channels get shuffled.
While looking at the surrounding code, I noticed that any change in the section (sample rate or number of channels) will discard the data that was just read, in the
*_UpdateSection()functions. Instead of a free/malloc pair, I changed them to realloc the buffer (only if it's larger) in order to preserve the decoded data.The
music_ogg_stb.cbackend had a bogus check for section change, so it would never really callOGG_UpdateSection(), if the number of channels or sample rate did change.