diff options
Diffstat (limited to 'spread.asoundrc')
| -rw-r--r-- | spread.asoundrc | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/spread.asoundrc b/spread.asoundrc new file mode 100644 index 0000000..15d77a8 --- /dev/null +++ b/spread.asoundrc | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | # From https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture/Configuration_examples#Loopback_interface_with_dmix_external_interface | ||
| 2 | |||
| 3 | # Use this to output to external | ||
| 4 | pcm.dmixerout { | ||
| 5 | type dmix | ||
| 6 | ipc_key 1024 | ||
| 7 | ipc_key_add_uid false | ||
| 8 | slave { | ||
| 9 | pcm "hw:CARDNAME,0" | ||
| 10 | channels 2 | ||
| 11 | period_time 0 | ||
| 12 | period_size 1024 | ||
| 13 | buffer_size 4096 | ||
| 14 | rate 44100 | ||
| 15 | } | ||
| 16 | bindings { | ||
| 17 | 0 0 | ||
| 18 | 1 1 | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | # Use this to output to loopback | ||
| 23 | pcm.dmixerloop { | ||
| 24 | type dmix | ||
| 25 | ipc_key 2048 | ||
| 26 | ipc_key_add_uid false | ||
| 27 | slave { | ||
| 28 | pcm "hw:Loopback,0,0" | ||
| 29 | channels 2 | ||
| 30 | period_time 0 | ||
| 31 | period_size 1024 | ||
| 32 | buffer_size 4096 | ||
| 33 | # If format is absent ALSA gives me slave PCM not usable, but it works w/o it for others | ||
| 34 | format S32_LE | ||
| 35 | rate 44100 | ||
| 36 | } | ||
| 37 | bindings { | ||
| 38 | 0 0 | ||
| 39 | 1 1 | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | # Sends to the two dmix interfaces | ||
| 44 | pcm.quad { | ||
| 45 | type multi | ||
| 46 | # Necessary to have both slaves be dmix; both as hw doesn't give errors, but wouldn't | ||
| 47 | slaves.a.pcm "dmixerout" | ||
| 48 | slaves.a.channels 2 | ||
| 49 | slaves.b.pcm "dmixerloop" | ||
| 50 | slaves.b.channels 2 | ||
| 51 | bindings { | ||
| 52 | 0 { slave a; channel 0; } | ||
| 53 | 1 { slave a; channel 1; } | ||
| 54 | 2 { slave b; channel 0; } | ||
| 55 | 3 { slave b; channel 1; } | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | # Duplicates to quad, use this to output to loopback & external | ||
| 60 | pcm.stereo2quad { | ||
| 61 | type route | ||
| 62 | slave.pcm "quad" | ||
| 63 | # ttable.A.B G | ||
| 64 | # where A - input channel | ||
| 65 | # B - output channel | ||
| 66 | # G - volume gain (1.0 = original) | ||
| 67 | ttable.0.0 1 | ||
| 68 | ttable.1.1 1 | ||
| 69 | ttable.0.2 1 | ||
| 70 | ttable.1.3 1 | ||
| 71 | } | ||
| 72 | |||
| 73 | # Listens to loopback | ||
| 74 | # trying to play to stereo2quad when something is already listening gives me slave PCM not usable | ||
| 75 | # but listening when something is already playing on stereo2quad works | ||
| 76 | # and so does starting to listen, then playing to dmixerloop | ||
| 77 | pcm.loopin { | ||
| 78 | type dsnoop | ||
| 79 | ipc_key 1111 | ||
| 80 | ipc_key_add_uid false | ||
| 81 | slave.pcm "hw:Loopback,1" | ||
| 82 | } | ||
| 83 | |||
| 84 | pcm.!default { | ||
| 85 | type asym | ||
| 86 | playback.pcm "plug:stereo2quad" | ||
| 87 | capture.pcm "plug:loopin" | ||
| 88 | } | ||
