Skip to content

Comments

Remap Vorbis channels to match SDL channels, and some *UpdateSection() changes.#803

Merged
icculus merged 3 commits intolibsdl-org:SDL2from
dkosmari:remap-vorbis
Jan 20, 2026
Merged

Remap Vorbis channels to match SDL channels, and some *UpdateSection() changes.#803
icculus merged 3 commits intolibsdl-org:SDL2from
dkosmari:remap-vorbis

Conversation

@dkosmari
Copy link

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.c backend had a bogus check for section change, so it would never really call OGG_UpdateSection(), if the number of channels or sample rate did change.

@icculus icculus merged commit 298fcf5 into libsdl-org:SDL2 Jan 20, 2026
8 checks passed
@sezero
Copy link
Contributor

sezero commented Jan 20, 2026

Seeing that this is for the SDL2 branch, I assume SDL3_mixer is good?

@dkosmari dkosmari deleted the remap-vorbis branch January 20, 2026 13:38
@icculus
Copy link
Collaborator

icculus commented Jan 20, 2026

I assume SDL3_mixer is good?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants