@@ -1800,18 +1800,21 @@ static bool OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
18001800 SDL_copyp (& spec , inspec ? inspec : & device -> default_spec );
18011801 PrepareAudioFormat (device -> recording , & spec );
18021802
1803- /* We impose a simple minimum on device formats. This prevents something low quality, like an old game using S8/8000Hz audio,
1804- from ruining a music thing playing at CD quality that tries to open later, or some VoIP library that opens for mono output
1805- ruining your surround-sound game because it got there first.
1806- These are just requests! The backend may change any of these values during OpenDevice method! */
1807-
1808- const SDL_AudioFormat minimum_format = device -> recording ? DEFAULT_AUDIO_RECORDING_FORMAT : DEFAULT_AUDIO_PLAYBACK_FORMAT ;
1809- const int minimum_channels = device -> recording ? DEFAULT_AUDIO_RECORDING_CHANNELS : DEFAULT_AUDIO_PLAYBACK_CHANNELS ;
1810- const int minimum_freq = device -> recording ? DEFAULT_AUDIO_RECORDING_FREQUENCY : DEFAULT_AUDIO_PLAYBACK_FREQUENCY ;
1811-
1812- device -> spec .format = (SDL_AUDIO_BITSIZE (minimum_format ) >= SDL_AUDIO_BITSIZE (spec .format )) ? minimum_format : spec .format ;
1813- device -> spec .channels = SDL_max (minimum_channels , spec .channels );
1814- device -> spec .freq = SDL_max (minimum_freq , spec .freq );
1803+ if (!SDL_GetHintBoolean (SDL_HINT_AUDIO_ENFORCE_MINIMUM_SPEC , true)) {
1804+ SDL_copyp (& device -> spec , & spec );
1805+ } else {
1806+ /* We impose a simple minimum on device formats. This prevents something low quality, like an old game using S8/8000Hz audio,
1807+ from ruining a music thing playing at CD quality that tries to open later, or some VoIP library that opens for mono output
1808+ ruining your surround-sound game because it got there first.
1809+ These are just requests! The backend may change any of these values during OpenDevice method! */
1810+ const SDL_AudioFormat minimum_format = device -> recording ? DEFAULT_AUDIO_RECORDING_FORMAT : DEFAULT_AUDIO_PLAYBACK_FORMAT ;
1811+ const int minimum_channels = device -> recording ? DEFAULT_AUDIO_RECORDING_CHANNELS : DEFAULT_AUDIO_PLAYBACK_CHANNELS ;
1812+ const int minimum_freq = device -> recording ? DEFAULT_AUDIO_RECORDING_FREQUENCY : DEFAULT_AUDIO_PLAYBACK_FREQUENCY ;
1813+ device -> spec .format = (SDL_AUDIO_BITSIZE (minimum_format ) >= SDL_AUDIO_BITSIZE (spec .format )) ? minimum_format : spec .format ;
1814+ device -> spec .channels = SDL_max (minimum_channels , spec .channels );
1815+ device -> spec .freq = SDL_max (minimum_freq , spec .freq );
1816+ }
1817+
18151818 device -> sample_frames = SDL_GetDefaultSampleFramesFromFreq (device -> spec .freq );
18161819 SDL_UpdatedAudioDeviceFormat (device ); // start this off sane.
18171820
0 commit comments