The examples here helped me:
https://wiki.archlinux.org/index.php/PulseAudio/Examples#Simultaneous_HDMI_and_Analog_Output
I ended up with the following in ~/.config/pulse/default.pa
:
# http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index12h3
# https://wiki.archlinux.org/index.php/PulseAudio/Examples#Simultaneous_HDMI_and_Analog_Output
# remix=no is required, otherwise it will turn 2-channel sound into 4-channel sound and send it to all master channels
load-module module-remap-sink sink_name=headphones remix=no master=alsa_output.pci-0000_00_1b.0.analog-surround-40 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right sink_properties=device.description=Headphones
load-module module-remap-sink sink_name=speakers remix=no master=alsa_output.pci-0000_00_1b.0.analog-surround-40 channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right sink_properties=device.description=Speakers
# sending output to this goes to both
# replacing "0" with "alsa_output.pci-0000_00_1b.0.analog-surround-40" might work, but this also does
update-sink-proplist 0 device.description="Both"
# this renames the virtual streams, which show up in KMix. It's handy, since KMix can't show more than one sink for master volume in the popup
update-sink-input-proplist 0 media.name="Headphones"
update-sink-input-proplist 1 media.name="Speakers"
Replace your device names (the master=...
) as necessary.
NOTE: You must first copy /etc/pulse/default.pa
to ~/.config/pulse/default.pa
and then edit it, because pulseaudio doesn't read from the system-wide file at all if the user's file exists. Henceforth you must merge any changes from the system-wide file into your personal one. Alternatively you could just edit the system-wide file, but then it could be overwritten by updates, which would throw all your work away! (Or maybe dpkg would prompt you to manually merge them, but what if you didn't notice? (Insert recommendation for etckeeper
here.))
There is also an example here:
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index12h3
But it uses the aux channels, which is more confusing. Using remix=no
makes that unnecessary.
Now I have no idea what your definition of a kludge is, but you should be able to use these examples plus the PA Wiki or a bit of googling to get you the rest of the way. For your extra channels, the wiki lists this:
Channel map. A list of comma-separated channel names. The currently defined channel names are: left, right, mono, center, front-left, front-right, front-center, rear-center, rear-left, rear-right, lfe, subwoofer, front-left-of-center, front-right-of-center, side-left, side-right, aux0, aux1 to aux15, top-center, top-front-left, top-front-right, top-front-center, top-rear-left, top-rear-right, top-rear-center, (Default depends on the number of channels and the driver)
By the way, the pacmd
tool takes the exact same commands as the default.pa
file, so you can make changes interactively, then paste the working commands into default.pa
, just without pacmd
in each one. Be advised, you might have to do some things slightly differently, like unloading some modules first, compared to doing it in default.pa
, since pulseaudio is already running. I spent some time hair-pulling over this. (:v)