2011-03-07, 07:48
HOW-TO : Configure multiple simultaneous audio outputs in linux (hdmi,spdif,analog)
This is designed around an ION1 board. You may need to change the device names for it to work on your hardware (see bottom of post).
output devices to use:
caveats :
pros :
Backup any existing .asoundrc file
Save the following text as /home/xbmc/.asoundrc.
use alsamixer to unmute outputs and set analog output volumes
How to find replacement device names
using the command
To get device names for your hardware look as the following output.
The first entry is analog output as you can see by its name.
It is card 0, and device 0. This means analog device name is hw:0,0
The second entry is digital output (spdif) again seen by its name.
It is card 0, and device 1. This means spdif device name is hw:0,1
The 3rd entry is HDMI, following the same process we get hw:0,3
Do this on your system and replace the three devices on line 40,42,44 and you should be good to go.
This is designed around an ION1 board. You may need to change the device names for it to work on your hardware (see bottom of post).
output devices to use:
- cloned_output if you want simultaneous hdmi, spdif and analog output
- hdmiout if you want dmix for crossfading support.
caveats :
- no dmixer (which means crossfading will cause 'unable to initialize audio hardware' errors
- cant get 7.1 analog output working on my hardware. possibly i have something missconfigured
- only 2 channel support
- cannot clone passthrough output. AC3/DTS will not be cloned
- UI sounds do not seem to use the output device I set. They output via hdmi only
pros :
- gets multidevice output working without recompiling
- should work with new audioengine with no modifications
Backup any existing .asoundrc file
Save the following text as /home/xbmc/.asoundrc.
use alsamixer to unmute outputs and set analog output volumes
Code:
#----
# .asoundrc file designed to expand 2 channels through device 'clone_output'
# to output 2 channels to multiple devices
#
# caveats : no mixed output (no crossfading, no multiple applications) also
# sync will drift between the devices (rarely do i see mine drift though)
#
# designed around a nvidia ION1 zotac board. You may need to change
# device names.
# Use aplay -l to find device numbers
#
# questions contact Loto_Bak on forums.xbmc.org
#----
pcm.!default {
type plug
slave.pcm "dmixed_hdmi"
}
#-----
# Single channel dmixed. Crossfade works
#-----
pcm.hdmiout {
type plug
slave.pcm "dmixed_hdmi"
}
pcm.dmixed_hdmi {
type dmix
ipc_key 2024
slave {
pcm "hw:0,3" # hdmi
}
}
#-----
# multiple output portion begin (3 devices) dmix not supported.
#-----
pcm.clone_output {
type plug
slave.pcm "6channel_expander"
}
pcm.multi_pcm_device {
type multi;
slaves.a.pcm "hw:0,3"; # hdmi
slaves.a.channels 2;
slaves.b.pcm "hw:0,0"; # analog
slaves.b.channels 2;
slaves.c.pcm "hw:0,1"; # spdif
slaves.c.channels 2;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave b;
bindings.2.channel 0;
bindings.3.slave b;
bindings.3.channel 1;
bindings.4.slave c;
bindings.4.channel 0;
bindings.5.slave c;
bindings.5.channel 1;
}
ctl.multi_pcm_device {
type hw;
card 0;
}
pcm.6channel_expander {
type route;
slave.pcm "multi_pcm_device";
slave.channels 6;
ttable.0.0 1;
ttable.1.1 1;
ttable.0.2 1;
ttable.1.3 1;
ttable.0.4 1;
ttable.1.5 1;
}
ctl.6channel_expander {
type hw;
card 0;
}
How to find replacement device names
using the command
Code:
aplay -l
**** List of PLAYBACK Hardware Devices ****
[b]card 0[/b]: NVidia [HDA NVidia], [b]device 0[/b]: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
To get device names for your hardware look as the following output.
The first entry is analog output as you can see by its name.
It is card 0, and device 0. This means analog device name is hw:0,0
The second entry is digital output (spdif) again seen by its name.
It is card 0, and device 1. This means spdif device name is hw:0,1
The 3rd entry is HDMI, following the same process we get hw:0,3
Do this on your system and replace the three devices on line 40,42,44 and you should be good to go.