From 3b4da925730c62e7533e692ec004fbdee6665ecc Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 25 Oct 2024 13:47:07 +1000 Subject: Should add this test asoundrc, though it's not working yet. --- spread.asoundrc | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 spread.asoundrc diff --git a/spread.asoundrc b/spread.asoundrc new file mode 100644 index 0000000..15d77a8 --- /dev/null +++ b/spread.asoundrc @@ -0,0 +1,88 @@ +# From https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture/Configuration_examples#Loopback_interface_with_dmix_external_interface + +# Use this to output to external +pcm.dmixerout { + type dmix + ipc_key 1024 + ipc_key_add_uid false + slave { + pcm "hw:CARDNAME,0" + channels 2 + period_time 0 + period_size 1024 + buffer_size 4096 + rate 44100 + } + bindings { + 0 0 + 1 1 + } +} + +# Use this to output to loopback +pcm.dmixerloop { + type dmix + ipc_key 2048 + ipc_key_add_uid false + slave { + pcm "hw:Loopback,0,0" + channels 2 + period_time 0 + period_size 1024 + buffer_size 4096 + # If format is absent ALSA gives me slave PCM not usable, but it works w/o it for others + format S32_LE + rate 44100 + } + bindings { + 0 0 + 1 1 + } +} + +# Sends to the two dmix interfaces +pcm.quad { + type multi + # Necessary to have both slaves be dmix; both as hw doesn't give errors, but wouldn't + slaves.a.pcm "dmixerout" + slaves.a.channels 2 + slaves.b.pcm "dmixerloop" + slaves.b.channels 2 + bindings { + 0 { slave a; channel 0; } + 1 { slave a; channel 1; } + 2 { slave b; channel 0; } + 3 { slave b; channel 1; } + } +} + +# Duplicates to quad, use this to output to loopback & external +pcm.stereo2quad { + type route + slave.pcm "quad" + # ttable.A.B G + # where A - input channel + # B - output channel + # G - volume gain (1.0 = original) + ttable.0.0 1 + ttable.1.1 1 + ttable.0.2 1 + ttable.1.3 1 +} + +# Listens to loopback +# trying to play to stereo2quad when something is already listening gives me slave PCM not usable +# but listening when something is already playing on stereo2quad works +# and so does starting to listen, then playing to dmixerloop +pcm.loopin { + type dsnoop + ipc_key 1111 + ipc_key_add_uid false + slave.pcm "hw:Loopback,1" +} + +pcm.!default { + type asym + playback.pcm "plug:stereo2quad" + capture.pcm "plug:loopin" +} -- cgit v1.1