How do I fix an SDL Mixer "Unsupported block alignment" error?

103 views Asked by At

I'm using SDL2 and the SDL mixer library to attempt to play a WAV file. After calling the Mix_LoadWAV_RW function, I get the following error string: "Unsupported block alignment" In case it matters, I'll note that I got the *SDL_RWops by calling SDL_RWFromMem on a WAV file I have embedded into my source code as an array of bytes. That is, the first several bytes are the WAV header containing the text "RIFF: and "WAVE".

I'm guessing this means I need to re-encode my WAV file to a sub-format with a supported block alignment, but that is mostly a guess. Given I go with that guess, it seems like I would need to know what block alignments are supported. I'm unable to find any relevant info in the docs about which alignments are supported.

I've also tried searching this github mirror of the source code for SDL mixer for "Unsupported block alignment" but I didn't get any results. Does that mean that the error is coming from some dependency of SDL Mixer or something?

Does anyone know more about this error, where I can find more information on this error, or even a reasonable guess as to how I should change my WAV file to work here?

1

There are 1 answers

0
Ryan1729 On

For the record, I ended up just re-encoding the WAV file with default settings in Audacity, and it seems to have worked after that.