I'm playing with a console sound visualiser which wants its own ALSA device to listen on. I'm editing ~/.asoundrc. I know I'll need the multi plugin to split the sound data onto separate devices. However, my soundcard has no hardware mixing, so I'll also need a dmix plugin in there somewhere, for software mixing.
If I try to add a multi as a slave of the dmix, I get this error (line-wrapped):
ALSA lib pcm_direct.c:1525:(_snd_pcm_direct_get_slave_ipc_offset) Invalid type 'multi' for slave PCM I tried creating a "dummy middleman" plug with the multi as a slave, and pointing the dmix to that, but still get the same error. Looks like dmix wants the whole chain of stuff to be plug or hw…
If I try to add a dmix module as a slave of a multi instead, I get
Device or resource busy As you'd expect when software mixing isn't the first step in the pipeline, but multiple programs try to grab the sound card.
Both of these things (dmixing, and multi-ing to a loopback device) work well separately.
Why do dmix and multi not work together? How can I make this work?
Here's my ~/.asoundrc, with options that give Invalid type 'multi' for slave PCM:
# thx # http://wiki.ubuntuusers.de/.asoundrc # http://alsa.opensrc.org/Dmix # http://forums.linuxmint.com/viewtopic.php?f=196&t=94877 pcm.snd_card { type hw card 1 device 0 } # allows multiple programs to output sound simultanously ("software mixing") pcm.dmixer { type dmix ipc_key 1024 ipc_perm 0666 # allow other users slave.pcm "out" slave { period_time 0 period_size 1024 buffer_size 4096 ### if having problems # rate 44100 ### some sound cards need the exact data format # format S32_LE ### Available formats: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE ### U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE ### FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE ### IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW ### A_LAW IMA_ADPCM MPEG GSM channels 2 # must match bindings } bindings { 0 0 1 1 } } # allows multiple programs to capture simultaneously pcm.dsnooper { type dsnoop ipc_key 2048 ipc_perm 0666 slave.pcm "snd_card" slave { period_time 0 period_size 1024 buffer_size 4096 channels 2 } bindings { 0 0 1 1 } } pcm.!default { type asym playback.pcm "dmixer" capture.pcm "dsnooper" } pcm.out { type plug slave.pcm { type multi slaves { a { channels 2 pcm "snd_card" } b { channels 2 pcm "hw:Loopback,0,0" } } 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 ] } # In case I ever want to use PulseAudio, for bluetooth speakers or such. #pcm.!default { # type pulse #} #ctl.!default { # type pulse #}