[Audacity-devel] OSS bug (possibly in portaudio) when ALSA exists too + patch
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Sami L. <sl...@cc...> - 2009-03-20 01:07:16
|
Hi, I think I've discovered and fixed a bug in portaudio (while hunting for another bug) that affects audacity 1.3.7, however I'm not sure if my fix is correct. When I look at Help -> Audio Device Info, I have ALSA devices as devices 0..6, and then a OSS /dev/dsp. However the OSS device's list of supported rates is empty. This also causes record and play to fail with "Error while opening sound device. Please check the output device settings and the project sample rate." I believe the bug is in pa_unix_oss.c, function IsFormatSupported(), lines 665 and 671. The problem is that inputParameters->device or outputParameters->device as passed by the caller in pa_front.c is already in the host API device index space (i.e. 0 = first OSS device, not first device portaudio knows of), but the code calls PaUtil_DeviceIndexToHostApiDeviceIndex() for it. This causes the call to fail or return a wrong index if OSS is not the first host API known by portaudio. Here's a minimal patch to fix the problem. It fixes it for me, but I don't understand the code well enough to be sure it's correct. It possibly would be prudent to also check that inputParameters->device and outputParemeters->device are in the correct range. The patch is against 1.3.7, but judging from cvs, it should apply cleanly to HEAD. diff -Nurb audacity-1.3.7.orig/lib-src/portaudio-v19/src/hostapi/oss/pa_unix_oss.c audacity-1.3.7/lib-src/portaudio-v19/src/hostapi/oss/pa_unix_oss.c --- audacity-1.3.7.orig/lib-src/portaudio-v19/src/hostapi/oss/pa_unix_oss.c 2009-01-27 22:51:40.000000000 +0200 +++ audacity-1.3.7/lib-src/portaudio-v19/src/hostapi/oss/pa_unix_oss.c 2009-03-19 20:31:29.000000000 +0200 @@ -662,13 +662,13 @@ if( inputChannelCount > 0 ) { - result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, inputParameters->device, hostApi); + result = inputParameters->device; if (result != paNoError) return result; } else { - result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, outputParameters->device, hostApi); + result = outputParameters->device; if (result != paNoError) return result; } Sami |