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 @@ -1771,9 +1771,14 @@ static bool OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
1771
1771
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.
1772
1772
(or some VoIP library that opens for mono output ruining your surround-sound game because it got there first).
1773
1773
These are just requests! The backend may change any of these values during OpenDevice method! */
1774
- device -> spec .format = (SDL_AUDIO_BITSIZE (device -> default_spec .format ) >= SDL_AUDIO_BITSIZE (spec .format )) ? device -> default_spec .format : spec .format ;
1775
- device -> spec .freq = SDL_max (device -> default_spec .freq , spec .freq );
1776
- device -> spec .channels = SDL_max (device -> default_spec .channels , spec .channels );
1774
+
1775
+ const SDL_AudioFormat minimum_format = device -> recording ? DEFAULT_AUDIO_RECORDING_FORMAT : DEFAULT_AUDIO_PLAYBACK_FORMAT ;
1776
+ const int minimum_channels = device -> recording ? DEFAULT_AUDIO_RECORDING_CHANNELS : DEFAULT_AUDIO_PLAYBACK_CHANNELS ;
1777
+ const int minimum_freq = device -> recording ? DEFAULT_AUDIO_RECORDING_FREQUENCY : DEFAULT_AUDIO_PLAYBACK_FREQUENCY ;
1778
+
1779
+ device -> spec .format = (SDL_AUDIO_BITSIZE (minimum_format ) >= SDL_AUDIO_BITSIZE (spec .format )) ? minimum_format : spec .format ;
1780
+ device -> spec .channels = SDL_max (minimum_channels , spec .channels );
1781
+ device -> spec .freq = SDL_max (minimum_freq , spec .freq );
1777
1782
device -> sample_frames = SDL_GetDefaultSampleFramesFromFreq (device -> spec .freq );
1778
1783
SDL_UpdatedAudioDeviceFormat (device ); // start this off sane.
1779
1784
You can’t perform that action at this time.
0 commit comments