Opening a stream with the default input config is unsupported

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

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust

调研方向

Start with the attached Rust example and trace how default_input_config() produces a StreamConfig and how build_input_stream() validates it on macOS. Reproduce with the reported Scarlett Solo, macOS 12.3, and CPAL 0.15.3 setup, then inspect the comments for any existing diagnosis. Done means the reported default input configuration can open a stream, or the issue has a clear explanation of the limitation.

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

描述

host - coreaudio platform - macos

I'm trying to open an basic audio input stream, but can't seem to find any config that works, including any of the configurations that the device claims to support. Sample code is attached.

Mac OS 12.3 / CPAL 0.15.3 / Rust 1.60

Output:

Device: Ok("Scarlett Solo USB")
Config: StreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Default }
thread 'main' panicked at 'Invalid stream: StreamConfigNotSupported', src/main.rs:23:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
use cpal::traits::DeviceTrait;
use cpal::traits::HostTrait;

use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let host = cpal::default_host();
    let device = host
        .default_input_device()
        .expect("No default input device");

    println!("Device: {:?}", device.name());

    let config = device
        .default_input_config()
        .expect("No default input config")
        .config();

    println!("Config: {:?}", config);

    let stream = device
        .build_input_stream(&config, |data: &[i16], callback_info| {}, |error| {})
        .expect("Invalid stream");

    Ok(())
}
主要语言
Rust
星标
4k
派生
554
平均合并
1 天 3 小时
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

RustAudio/cpal 的其他 Issue

查看 RustAudio/cpal 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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