Opening a stream with the default input config is unsupported

Aperta
#657 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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(())
}
Lingua principale
Rust
Stelle
4k
Fork
554
Merge medio
1g 3h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RustAudio/cpal

Tutte le issue di RustAudio/cpal

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.