Slave PCM not usable when using ALSA multi plugin

Viewed 1766

I am trying to use the multi ALSA plugin to copy my desktop audio to the Loopback device created by snd-aloop. However, when I try to use the .asoundrc below, I get this error:

> aplay -vv test.wav
Playing WAVE 'test.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
ALSA lib pcm_params.c:2226:(snd1_pcm_hw_refine_slave) Slave PCM not usable
aplay: set_params:1314: Broken configuration for this PCM: no configurations available

.asoundrc:

pcm.both {
    type multi
    slaves.a.pcm "dmixer" 
    slaves.b.pcm "loop"
    slaves.a.channels 2
    slaves.b.channels 2

    bindings.0 { slave a; channel 0; }
    bindings.1 { slave a; channel 1; }
    bindings.2 { slave b; channel 0; }
    bindings.3 { slave b; channel 1; }
}

pcm.dmixer {
    type dmix
    ipc_key 1231
    ipc_perm 0666
    slave.pcm "hw:PCH,0"
    slave.channels 2
    slave.rate 48000
    slave.format S32_LE
    bindings {
        0 0 
        1 1
    }
}


pcm.loop {
    type dmix
    ipc_key 29637
    slave {
        pcm "hw:Loopback,0"
        rate 48000
        format S32_LE
        channels 2
        period_size 1024
        buffer_size 9182
    }
}

pcm.hubcap {
    type plug
    slave {
        pcm "hw:Loopback,1,0"
        rate 48000
        format S32_LE
    }
}

pcm.!default {
    type asym
    playback.pcm {
        type plug
        slave.pcm "both"
        ttable [
            [ 1 0 1 0 ]
            [ 0 1 0 1 ]
        ]
    } 
    capture.pcm "plug:dsnoop" 
}

defaults.pcm.surround21.card off
defaults.pcm.surround21.device off
defaults.pcm.surround40.card off
defaults.pcm.surround40.device off
defaults.pcm.surround41.card off
defaults.pcm.surround41.device off
defaults.pcm.surround50.card off
defaults.pcm.surround50.device off
defaults.pcm.surround51.card off
defaults.pcm.surround51.device off
defaults.pcm.surround71.card off
defaults.pcm.surround71.device off

Things to note:

When I remove both dmixes, it works fine.

In the multi plugin, when I change both slaves to the same pcm, it works fine for that one pcm.

Ex.

...
type multi
    slaves.a.pcm "dmixer" 
    slaves.b.pcm "dmixer"
...
1 Answers

Try setting slave.period_size 1024 in pcm.dmixer block.

Related