haskell-game / sdl2

Haskell bindings to the SDL2 library
Other
363 stars 87 forks source link

SDL.Audio: Fix openAudioDevice Changeable check #229

Closed spinnylights closed 2 years ago

spinnylights commented 3 years ago

This is a simple bugfix. foldChangeable expects the value for Mandate as its first argument and the value for Desire as its second, but changes in openAudioDevice had them reversed, so this simply swaps the two values there.

I noticed this when trying to run audio-example. I use JACK as my SDL audio driver; JACK expects samples as 32-bit floats. Under those circumstances, SDL will set the audio format to AUDIO_F32 unless you insist otherwise. As written, audio-example was erroring out with "unsupported audio format" as a result of this, because Mandate Signed16BitNativeAudio was actually setting SDL_AUDIO_ALLOW_FORMAT_CHANGE. With this fix, audio-example runs properly in my environment.

ocharles commented 2 years ago

Thanks, and sorry this took so long to merge!