From aef1f56dd9326b4147fc55eee80b6a201c93620f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 11 Oct 2017 18:36:53 -0400 Subject: [PATCH] Don't allow device format changes in Mix_OpenAudio(). This tends to cause problems when you get a float32 format on WASAPI or CoreAudio but expected Sint16. This change is only for the legacy API: if you want more control here, use Mix_OpenAudioDevice() instead. --- mixer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mixer.c b/mixer.c index 9d255690..4e1cc75b 100644 --- a/mixer.c +++ b/mixer.c @@ -518,8 +518,9 @@ int Mix_OpenAudioDevice(int frequency, Uint16 format, int nchannels, int chunksi /* Open the mixer with a certain desired audio format */ int Mix_OpenAudio(int frequency, Uint16 format, int nchannels, int chunksize) { - return Mix_OpenAudioDevice(frequency, format, nchannels, chunksize, - NULL, SDL_AUDIO_ALLOW_ANY_CHANGE); + return Mix_OpenAudioDevice(frequency, format, nchannels, chunksize, NULL, + SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | + SDL_AUDIO_ALLOW_CHANNELS_CHANGE); } /* Dynamically change the number of channels managed by the mixer.