BUG in MixerToolBar with two soundcards?


i got two sound cards (internal hw:0,0 and pci hw:1,0)
when i select hw:1,0 as playback (toolbar) and use the playback volume slider (toolbar), nothing happens.
i disabled pulseaudio, so just using ALSA.

with alsamixer i can see the PCM volume of hw:0,0 (internal onboard) is used instead, no matter what i select as output

playback does work, just the volume slider controls only the first card.

(using Audacity 2.2.0)

What are the two devices?
Why have you disabled PulseAudio?
Which version of Audacity?
Which version of Debian?

HDA Intel: ALC662 rev1 Analog (hw:0,0)
Sound Fusion CS46xx: - (hw:1,0)

Ubuntu 16.04.3 LTS

Audacity 2.1.2
Audacity 2.2.0 (compiled by myself)

Enabling/Disabling PA doesn’t make a difference: in pavucontrol the same happens, MixerToolBar slider just changes volume of first card.
when loading the snd_cs46xx first and snd_hda_intel second, MTB slider uses snd_cs46xx
and i don’t have a /etc/asound.conf (tried to set defaults there too, no change)

Sounds like the two sound cards are conflicting with each other, Why not remove / disable one and just use whichever is the better of the two?

Too easy :wink:
I’m, reading Audacity source code right now…

I wonder if anyone else has two soundcards and MixerToolBar is working?
Then it would be my setup, and not a bug…

It’s neither a bug or your set up. The playback level slider doesn’t really do anything - it’s just an alias for the primary sound card main output level control. It’s a convenience for many users that either have just one sound card, or only use the primary device. It’s no substitute for a full featured audio device mixer, but then most operating systems provide one of those anyway (for example, pavucontrol)

Ok, i thought it would control the volume of the selected device.
So let’s take this as a feature request then :slight_smile:

That could be pretty tough to achieve reliably and cross-platform.

How would you deal (for example) with Jack Audio System? I don’t think that Jack tells the application what device it is connected to.
What about PulseAudio? In this case the selected device as far as Audacity is concerned is PulseAudio, but if Audacity uses the “virtual” sound card output level provided by Pulse, and the volume is turned down on the “real” sound card, then there is no way that Audacity can turn up the level on the real (physical) device.

Personally, if I were writing Audacity from scratch, I’d not bother having either the of the device toolbar sliders, because computer sound systems have become so much more complex over the past 18 years that having just one slider for input and one for output will hardly ever be enough, 18 years ago when the first version of Audacity was written, sound systems were generally very much simpler things.

I don’t know Jack, or other platforms, they could stay as they are :wink:

I found out it was a Portaudio bug that is fixed in stable.
PaAlsa_GetStreamOutputCard() did always set card=0

File: audacity-minsrc-2.2.0/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c
I just copied the functions PaAlsa_GetStreamInputCard and PaAlsa_GetStreamOutputCard from stable.

Now the MixerToolBar uses the PCM of the selected card.

Fancy that :open_mouth: I assumed it was supposed to be like that :mrgreen:

Can you post a link to where you discovered that? I’m aware that one of the Audacity developers is intending to fix some issues with Pulse, so this could be highly relevant.

I started from audacity-minsrc-2.2.0/src/toolbars/MixerToolBar.cpp and went backwards in the code to portmixer, which uses portaudio functions
so i landed here audacity-minsrc-2.2.0/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c
I put some code together to test pulsemixer/pulseaudio from the examples and found out that it is fixed in stable PortAudio
And because the latest PortAudio doesn’t work with Audacity i compared it with stable portaudio and found the difference…