[pulseaudio-discuss] Mute and unmute individual sinks in a module-combine

Timothy J Massey tmassey at obscorp.com
Tue Jun 30 22:14:13 PDT 2009


Colin Guthrie <gmane at colin.guthr.ie> wrote on 06/28/2009 06:03:36 PM:

> 'Twas brillig, and Timothy J Massey at 28/06/09 22:09 did gyre and 
gimble:
> > Hello!
> > 
> > Still working on my multi-zone setup.  The goal is to have multiple 
> > instances of MPD playing, and being able to be routed to 0 or more 
zones 
> > simultaneously.  Each player is connected to a unique sink created 
with 
> > module-combine, with each of these combined sinks including *all* of 
the 
> > physical sinks.  Something like this:
> > 
> > #Physical sinks for actual hardware
> > load-module module-alsa-sink device=hw:1,0 sink_name=zone1
> > load-module module-alsa-sink device=hw:2,0 sink_name=zone2 
> > load-module module-alsa-sink device=hw:3,0 sink_name=zone3 
> > #Module-combine sinks for handling each MPD
> > load-module module-combine sink_name=mpdplayer1 
slaves=zone1,zone2,zone3
> > load-module module-combine sink_name=mpdplayer2 
slaves=zone1,zone2,zone3
> > load-module module-combine sink_name=mpdplayer3 
slaves=zone1,zone2,zone3
> > 
> > For now, I have a single instance of MPD playing through sink 
mpdplayer1. 
> > When I start up MPD and play something, I get audio out of all three 
> > sinks.  So far, so good.
> > 
> > Now, though, I would like to mute the sound in all but one of the 
zones. I 
> > can't simply do something like:
> > 
> > set-sink-mute zone2
> > set-sink-mute zone3
> > 
> > Because that would mute the outputs for those zones, and they might be 

> > (and likely are) playing music from one of the other MPD sessions. 
What I 
> > want to do is tell the module-combined sink (mpdplayer1) to only send 
> > audio to one of the sinks and to mute the output to the other two 
sinks.
> > 
> > Is this possible?  I cant seem to find a way to interact with the 
> > individual channels within a module-combine...
> 
> The only way I can think of to do this right now is to create nine 
> remapped sinks of the real alsa sinks. one for each player instance in 
> each zone.

Actually, there is a much easier way of managing this.  The individual 
components of the module-combine are each shown as a separate sink-input, 
connected to the physical sound card sink.  All you have to do is use 
set-sink-input-mute to mute the proper sink-inputs.

Now while did I bother to write that entire e-mail if it were that easy? 
Simple:  when you do a list-sink-inputs from pacmd, it does not show you 
any sink-inputs that are not active.  Therefore, without a MPD server 
playing, you won't see the module-combine generated sink-inputs.

The fun part, though, is this:  I *did* have a MPD server playing 
music--loudly through all three of my sound cards!  Yet, there was no 
evidence of this that I could see from pacmd, or from pavucontrol, for 
that matter.  I'm going to follow up with a different e-mail to find out 
what's going wrong with this.

But, for all of those of us out there trying to manage to create a 
multi-zone setup, here's a little more detail.  Again, credit for this 
idea goes to Matthew Patterson <matt at v8zman.com>.  I'm just slowly redoing 
the work he's already done.

1) Add X sound cards to your system and make sure that PulseAudio works 
with them.  That should be the easy part!  :)

2) Start pacmd and type:  "list-sinks".  From the data, find the lines 
that look like "name: <alsa_output.pci_8086_2445_sound_card_0>".  That 
will give you the name of each sound card.

3) Use module-combine to create a sink that will play audio to all 
available zones.  The command will look something like this (this is mine 
with 3 sound cards):  "load-module module-combine sink_name=mpdplayer1 
slaves=alsa_output.pci_8086_2445_sound_card_0,alsa_output.usb_device_41e_3010_noserial_if0_sound_card_0,alsa_output.usb_device_d8c_103_noserial_if0_sound_card_0". 
 You will want to eventually add this line to the end of 
/etc/pulse/default.pa.  (Later, you may want to use system mode, but I 
haven't gotten that far yet.)

4) Notice how the sink_name in the command above is "mpdplayer1"? 
Duplicate the above line for each of the number of MPD servers you want. 
If you have three people in the house, you might want to have three 
different MPD servers, and therefore, three module-combine lines.

5) Now we come to the part I'm still working through.  When you play 
something through one of your MPD's, it will play through *all* *three* 
zones.  You probably don't want that, at least not immediately.  To change 
this, you will use the command "set-sink-input-mute XX 1", where XX is the 
index number of the sink-source generated for the module-combine of the 
MPD player you're interested in.  I can't yet be more specific about this, 
because I'm having problems with getting the sink-sources to show up 
properly.

However, when properly working, you should be able to get a list of 
sink-inputs with the command "list-sink-inputs".  With all (e.g.) three 
MPD's running, and (e.g.) three physical sound cards, you will see the 9 
sink-inputs created for each of the three components of each of the three 
module-combines (plus others).

Tim Massey




More information about the pulseaudio-discuss mailing list