Skip to content

Instantly share code, notes, and snippets.

@mittorn
Created August 12, 2018 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mittorn/1982dafe651f26d03cb2480ec82f6d19 to your computer and use it in GitHub Desktop.
Save mittorn/1982dafe651f26d03cb2480ec82f6d19 to your computer and use it in GitHub Desktop.
# default control; alsamixer and such will use this
ctl.!default {
type hw
card 1
}
# analog output (channels swapped, i have speakers swapped)
pcm.dmixer_onboard {
type dmix
ipc_key 1024
ipc_perm 0666
slave.pcm "hw:1,0"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 1 # swap
1 0
}
}
# hdmi output
pcm.dmixer_hdmi {
type dmix
ipc_key 2048
ipc_perm 0666
slave.pcm "hw:0,3"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}
# use loopout to capture desktop (arecord -D loopout)
pcm.loopout {
type plug
slave.pcm "hw:Loopback,1,0"
}
pcm.dmixer_loop {
type dmix
ipc_key 4096
ipc_perm 0666 # allow other users
slave.pcm "hw:Loopback,0,0"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}
# allows multiple programs to capture simultaneously
pcm.dsnooper {
type dsnoop
ipc_key 8192
ipc_perm 0666
slave.pcm "hw:1,0"
slave
{
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}
pcm.!default {
type asym
playback.pcm "out"
capture.pcm "dsnooper"
}
# select output mode here
# ttable will not work correctly without this plug
pcm.out
{
type plug
slave.pcm "rebind_loopback"
slave.channels 2 # force 2 channels on ttable input
}
# speakers+hdmi
pcm.rebind_simple {
type plug
slave.channels 4
slave.pcm {
type multi
slaves {
a { channels 2 pcm "dmixer_hdmi" }
b { channels 2 pcm "dmixer_onboard" }
}
bindings {
0 { slave a channel 0 }
1 { slave a channel 1 }
2 { slave b channel 0 }
3 { slave b channel 1 }
}
}
ttable [
[ 1 0 1 0 ] # left -> a.left, b.left
[ 0 1 0 1 ] # right -> a.right, b.right
]
}
# speakers+hdmi+loopback
pcm.rebind_loopback {
type plug
slave.channels 6
slave.pcm {
type multi
slaves {
a { channels 2 pcm "dmixer_hdmi" }
b { channels 2 pcm "dmixer_onboard" }
c { channels 2 pcm "dmixer_loop" }
}
bindings {
0 { slave a channel 0 }
1 { slave a channel 1 }
2 { slave b channel 0 }
3 { slave b channel 1 }
4 { slave c channel 0 }
5 { slave c channel 1 }
}
}
ttable [
[ 1 0 1 0 1 0 ] # left -> a.left, b.left
[ 0 1 0 1 0 1 ] # right -> a.right, b.right
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment