I am running XBMC on a Debian Testing system on my HTPC. I want to switch between my monitor for browsing and my tv for XBMC. This is no problem.
But the sound only seems to reach my television when ONLY the television is connected. Otherwise my monitor will steal the sound like a seagull stealing bread from ducks.
HTPC:HDMI -> TV:HDMI = Sound on tv
HTPC:DVI -> TV:HDMI = No sound on tv
HTPC:HDMI -> Monitor:HDMI = Sound on monitor
HTPC:DVI -> Monitor:HDMI = No sound on monitor (not a typo, no sound when solo)
HTPC:HDMI -> Monitor:HDMI AND
HTPC:DVI -> TV:HDMI = Sound on monitor (what? On DVI?)
HTPC:HDMI -> TV:HDMI AND
HTPC:DVI -> Monitor:HDMI = Also sound on monitor only
It doesn't even seem to matter which screen I define as primary.
How can I have both connected, yet send the HDMI sound through the HDMI port? I didn't even know the DVI port could transmit sound when HDMI-converter-plug is used.
Preferably I'd have a command line trick to switch the port where the audio is going. This answer has some interesting commands, but I cannot 'port' that to my situation. This HTPC also has DisplayPort, but I don't use that output.
The XBMC part of this question is irrelevant, you can immitate the problem using:
speaker-test -D hdmi -c 2 (both my monitor and my TV have only 2 channels (stereo))