From 85dfdda3dcb139c7e1eb47fd5e4723114e4fb86b Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Thu, 15 May 2025 16:23:31 +0200 Subject: [PATCH] Allow SDL to change channel count and log audio driver. --- src/AudioCaptureImpl_SDL.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AudioCaptureImpl_SDL.cpp b/src/AudioCaptureImpl_SDL.cpp index f72d9e8..c028923 100644 --- a/src/AudioCaptureImpl_SDL.cpp +++ b/src/AudioCaptureImpl_SDL.cpp @@ -55,6 +55,8 @@ void AudioCaptureImpl::StartRecording(projectm* projectMHandle, int audioDeviceI _projectMHandle = projectMHandle; _currentAudioDeviceIndex = audioDeviceIndex; + poco_debug_f1(_logger, "Using SDL audio driver \"%s\".", std::string(SDL_GetCurrentAudioDriver())); + if (OpenAudioDevice()) { SDL_PauseAudioDevice(_currentAudioDeviceID, false); @@ -125,7 +127,7 @@ bool AudioCaptureImpl::OpenAudioDevice() // Will be NULL on error, which happens if the requested index is -1. This automatically selects the default device. auto deviceName = SDL_GetAudioDeviceName(_currentAudioDeviceIndex, true); - _currentAudioDeviceID = SDL_OpenAudioDevice(deviceName, true, &requestedSpecs, &actualSpecs, 0); + _currentAudioDeviceID = SDL_OpenAudioDevice(deviceName, true, &requestedSpecs, &actualSpecs, SDL_AUDIO_ALLOW_CHANNELS_CHANGE); if (_currentAudioDeviceID == 0) {