I have an alsa config file which I use to map stereo speakers on to my 5.0 speaker setup.
The file looks like this:
pcm.all8 {
type plug
slave {
pcm "hw:0,0"
channels 8
}
hint.description "8 channel analog"
}
pcm.music4 {
type route
slave {
pcm all8
channels 8
}
ttable {
0.0 1
1.1 1
0.2 1 # Copy Front Left to Rear Left
1.3 1 # Copy Front Right to Rear Right
0.4 0.8 # Copy Front Left to Front Centre
1.4 0.8 # Copy Front Right to Front Centre
}
hint.description "2 channels duplicated on front and rear"
}
I currently use the "music4" device to play music from one program but I now need a second program to have access to the device too. I need to use dmix as, currently, the device is locked.
I tried adding this to the config (which I shamelessly copied from https://www.alsa-project.org/main/index.php/Asoundrc#dmix):
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm music4
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
bindings {
0 0
1 1
}
hint.description "Dmixed - 4 speakers"
}
When I try to use this device I get an error message saying "dmix plugin can be only connected to hw plugin" but how can I do that while preserving my mappings?
Managed to work this one out. Solution looks like this:
pcm.dmixer {
type dmix
ipc_key 1024
ipc_key_add_uid true
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
channels 8
}
bindings {
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
}
hint.description "Raw dmixer - 8 channels"
}
pcm.dmix4 {
type plug
slave.pcm dmixer
slave.channels 8
ttable {
0.0 1
1.1 1
0.2 1 # Copy Front Left to Rear Left
1.3 1 # Copy Front Right to Rear Right
0.4 0.8 # Copy Front Left to Front Centre
1.4 0.8 # Copy Front Right to Front Centre
}
hint.description "Dmixed - 2 channels to 5.0"
}