File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1747,9 +1747,14 @@ static bool OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
1747
1747
something low quality, like an old game using S8/8000Hz audio, from ruining a music thing playing at CD quality that tries to open later.
1748
1748
(or some VoIP library that opens for mono output ruining your surround-sound game because it got there first).
1749
1749
These are just requests! The backend may change any of these values during OpenDevice method! */
1750
- device -> spec .format = (SDL_AUDIO_BITSIZE (device -> default_spec .format ) >= SDL_AUDIO_BITSIZE (spec .format )) ? device -> default_spec .format : spec .format ;
1751
- device -> spec .freq = SDL_max (device -> default_spec .freq , spec .freq );
1752
- device -> spec .channels = SDL_max (device -> default_spec .channels , spec .channels );
1750
+
1751
+ const SDL_AudioFormat minimum_format = device -> recording ? DEFAULT_AUDIO_RECORDING_FORMAT : DEFAULT_AUDIO_PLAYBACK_FORMAT ;
1752
+ const int minimum_channels = device -> recording ? DEFAULT_AUDIO_RECORDING_CHANNELS : DEFAULT_AUDIO_PLAYBACK_CHANNELS ;
1753
+ const int minimum_freq = device -> recording ? DEFAULT_AUDIO_RECORDING_FREQUENCY : DEFAULT_AUDIO_PLAYBACK_FREQUENCY ;
1754
+
1755
+ device -> spec .format = (SDL_AUDIO_BITSIZE (minimum_format ) >= SDL_AUDIO_BITSIZE (spec .format )) ? minimum_format : spec .format ;
1756
+ device -> spec .channels = SDL_max (minimum_channels , spec .channels );
1757
+ device -> spec .freq = SDL_max (minimum_freq , spec .freq );
1753
1758
device -> sample_frames = SDL_GetDefaultSampleFramesFromFreq (device -> spec .freq );
1754
1759
SDL_UpdatedAudioDeviceFormat (device ); // start this off sane.
1755
1760
You can’t perform that action at this time.
0 commit comments