ALSA:pcm设备和asoundrc

时间:2017-02-10 09:26:35

标签: alsa

我正在尝试使用alsa snd-aloop录制当前播放的声音 这是我的asound.conf

pcm.multi {
    type route;
    slave.pcm {
        type multi;
        slaves.a.pcm "output";
        slaves.b.pcm "loopin";
        slaves.a.channels 2;
        slaves.b.channels 2;
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
    }

    ttable.0.0 1;
    ttable.1.1 1;
    ttable.0.2 1;
    ttable.1.3 1;
}

pcm.!default {
        type plug
        slave.pcm "multi"
}

pcm.output {
        type hw
        card 0
}

pcm.loopin {
        type plug
        slave.pcm "hw:1,0,0"
}

pcm.loopout {
        type plug
        slave.pcm "hw:1,1,0"
}

现在我正在运行这样的命令:

play sound.mp3

和:

arecord -c 2 -f S16_LE -r 48000 -D loopout test.wav

声音在声卡0上播放并记录为test.wav 现在我的默认PCM路由声音循环输出。

但是当我列出PCM设备时:

aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=Loopback
    Loopback, Loopback PCM
    Default Audio Device
front:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    Front speakers
surround21:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

我没有看到asound.conf中添加的pcm 这是正常的吗? 我的问题是我使用此列表配置了一个不使用我的默认pcm的应用程序。

1 个答案:

答案 0 :(得分:2)

aplay -L只能显示定义此类描述字符串的设备。 (这有点没有证据。)

pcm.multi {
    ...

    hint.description "My Little Device"
}