From: Matt Brubeck <mbrubeck@cs...> - 2004-12-20 16:22:21
---------- Forwarded message ----------
From: Ulrich Eckhardt <uli@...>
Cc: Ulrich Eckhardt <doomster@...>
Date: Sun, 19 Dec 2004 16:56:12 +0100
Subject: [Audacity-help] portmixer uses wrong mixer with OSS
Reply-To: Ulrich Eckhardt <doomster@...>
(please keep me CCed, thanks!)
I have two sound devices in my computer, and want to run audacity on the
second one. The problem is that the playback-volume slider always uses
'/dev/mixer', no matter what I choose as output device.
Browsing the sources a bit, I find that px_unix_oss.c is the problem. In fact
there are several things that strike me as weird:
1. The index passed to Px_OpenMixer is used to select which mixer-device to
open, but the mapping is pretty weird:
0 = /dev/mixer
1 = /dev/mixer0
2 = /dev/mixer1
3 = /dev/mixer2
On my system, /dev/mixer is a symlink to /dev/mixer0 (or any mixer the admin
wants to be the default mixer), so this is already possibly wrong.
2. The index passed to Px_OpenMixer is always zero. OK, this should select the
first (default-) mixer of the device corresponding to the pa_stream
parameter. However, this parameter is never(!) touched, it is only passed to
Px_GetNumMixers() but there it is also not used.
I think a reasonable approach would be to use past_OutputDeviceID of the
stream and ignore the index parameter alltogether. Another approach would be
to pass in playDeviceNum in HandleDeviceChange(). I'm not failiar enough with
the code to decide which one is right, but the comment in portmixer.h seems
to say that it must look at the stream.
3. Px_GetNumMixers() has a buffer overflow in the unlikely case that someone
has ten mixers.
4. In Px_OpenMixer, there is 'info->index = PxDevice[index];'. I daresay that
this should rather read 'info->index = PxDevices[index];' (PxDevices instead
5. There is a nice utility function Px_GetMixerName() which is totally unused.
Instead, the code to generate the weird index-device mapping is repeated
three times in the code.