From 373dcfb60fc75a114474d2c61b267ea4c3949733 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Fri, 19 Jan 2024 12:35:56 +0100 Subject: [PATCH] Bugfixes (that could potentially segfault) in PortAudio backend. --- cpp_src/device/portaudio/lasp_portaudiodaq.cpp | 8 +++++++- third_party/portaudio | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cpp_src/device/portaudio/lasp_portaudiodaq.cpp b/cpp_src/device/portaudio/lasp_portaudiodaq.cpp index 4715828..da0cc9d 100644 --- a/cpp_src/device/portaudio/lasp_portaudiodaq.cpp +++ b/cpp_src/device/portaudio/lasp_portaudiodaq.cpp @@ -69,6 +69,8 @@ void fillPortAudioDeviceInfo(DeviceInfoList &devinfolist) { } OurPaDeviceInfo d; d._paDevInfo = *deviceInfo; + // We store the name in d.device_name + d._paDevInfo.name = nullptr; d.api = portaudioApi; d.device_name = deviceInfo->name; @@ -87,6 +89,9 @@ void fillPortAudioDeviceInfo(DeviceInfoList &devinfolist) { d.prefFramesPerBlockIndex = 2; d.availableInputRanges = {1.0}; + // d.prefInputRangeIndex = 0; // Constructor-defined + d.availableOutputRanges = {1.0}; + // d.prefOutputRangeIndex = 0; // Constructor-defined d.ninchannels = deviceInfo->maxInputChannels; d.noutchannels = deviceInfo->maxOutputChannels; @@ -194,12 +199,13 @@ PortAudioDaq::PortAudioDaq(const OurPaDeviceInfo &devinfo_gen, // the index, as this is required in the PaStreamParameters struct int devindex = -1; for (int i = 0; i < Pa_GetDeviceCount(); i++) { + // DEBUGTRACE_PRINT(i); bool ok = true; const PaDeviceInfo *info = Pa_GetDeviceInfo(i); if (!info) { throw rte("No device structure returned from PortAudio"); } - ok &= string(info->name) == devinfo_gen._paDevInfo.name; + ok &= string(info->name) == devinfo_gen.device_name; ok &= info->hostApi == devinfo_gen._paDevInfo.hostApi; ok &= info->maxInputChannels == devinfo_gen._paDevInfo.maxInputChannels; ok &= info->maxOutputChannels == devinfo_gen._paDevInfo.maxOutputChannels; diff --git a/third_party/portaudio b/third_party/portaudio index cb8d3dc..daaf637 160000 --- a/third_party/portaudio +++ b/third_party/portaudio @@ -1 +1 @@ -Subproject commit cb8d3dcbc6fa74c67f3e236be89b12d5630da141 +Subproject commit daaf637f6f9fce670031221abfd7dfde92e5cce3