ALSA multi plugin error when combining two soundcards

未关闭
#273 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
15/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
c, linux

调研方向

The payload names no source files, only user configurations for the multi PCM plugin and the errors alsaloop prints ('Rate 48000Hz not available for capture quad' and 'Sample format not available'). Start by reproducing with the multi config and two hardware cards, then check whether the failing rate and format negotiation happens in the multi plugin's parameter handling. Done means a clear diagnosis of why a multi slave with two cards rejects 48 kHz capture, or a documented config that works, and the issue has been idle for about four years, so confirm it still reproduces on current alsa-lib first.

由索引模型根据 Issue 内容生成。

描述

My goal is to mix the output of two sound cards (RAVENNA from bondagit and hifiberry), then pass it to a DSP pcm plugin. As it's not possible with dmix (dmix only supports output to hw devices) the reasonable next step was multi plugin, but my tries always end up in a failure. Below is a quite standard multi configuration inspired by alsa docs that I'm using:

pcm.quad {
    type multi
    slaves.a.pcm "hw:RAVENNA"
    slaves.a.channels 2
    slaves.b.pcm "hw:sndrpihifiberry"
    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
    master 1
}

pcm.quad2 {
    type plug
    slave.pcm "quad"
}

This is run with alsaloop to be input into an extplug plugin that easily accepts 4 channels of audio - alsadsp:

$ alsaloop -C quad -P alsadsp -c 4
Rate 48000Hz not available for capture quad: Invalid argument
Unable to set parameters for capture quad stream: Invalid argument
Loopback start failure.

This results in a failure, moreover running quad2 also results in the same type of error.

Next step was to try plug pcm:

pcm.quad_plug {                                                                                                                              
    type multi                                                                                                                               
    slaves.a.pcm "plughw:RAVENNA"                                                                                                                
    slaves.a.channels 2                                                                                                                      
    slaves.b.pcm "plughw:sndrpihifiberry"                                                                                                        
    slaves.b.channels 2                                                                                                                      
                                                                                                                                             
    bindings.0.slave a                                                                                                                       
    bindings.0.channel 0                                                                                                                     
    bindings.1.slave a                                                                                                                       
    bindings.1.channel 1                                                                                                                     
    bindings.2.slave a                                                                                                                       
    bindings.2.channel 0                                                                                                                     
    bindings.3.slave a                                                                                                                       
    bindings.3.channel 1                                                                                                                     
}

pcm.quad_plug2 {                                                                                                                             
    type plug                                                                                                                                
    slave.pcm "quad_plug"                                                                                                                         
}  

With quad_plug the same error occurs, with quad_plug2 the error is as below:

$ alsaloop -C quad_plug2 -P alsadsp -c 4
Broken configuration for capture quad_plug2 PCM: no configurations available: Invalid argument
Unable to set parameters for capture quad_plug2 stream: Invalid argument
Loopback start failure.

Then the last thing I tried was to force the 48kHz sampling rate directly on the hardware devices with the help of the following config:

pcm.quad_48k {                    
    type multi                    
    slaves.a {                    
        pcm {                     
            type plug     
            slave.pcm "hw:RAVENNA"
            slave.rate 48000      
        }                         
        channels 2                
    }                             
                                  
    slaves.b {                    
        pcm {                     
            type plug             
            slave.pcm "hw:sndrpihifiberry"
            slave.rate 48000              
        }                                 
        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                  
}

and again it ends up with a failure:

$ alsaloop -C quad_48k -P alsadsp -c 4
Sample format not available for capture quad_48k: Invalid argument
Unable to set parameters for capture quad_48k stream: Invalid argument
Loopback start failure.

I know that both these cards are capable of running 48kHz, I'm doing that all the time. So what could be the cause of this error? alsadsp wants them to be 48kHz and if run separately it all works well, both cards set themselves according to alsadsp requirements. It works even if there's only one card in the multi plugin that occupies all 4 output ports - my conclusion is that it's not a problem of alsadsp.
Are there any other steps that could help solving the issue?

主要语言
C
星标
501
派生
227
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

alsa-project/alsa-lib 的其他 Issue

查看 alsa-project/alsa-lib 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。