codewandler-audio 0.5.0

Simple audio playback and audio capture
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::format::SampleFormat;
use crate::{AudioSink, AudioSource};
use std::fmt::Debug;

pub fn audio_pipe<F: SampleFormat + Debug>(
    mut source: Box<dyn AudioSource<Format = F>>,
    sink: Box<dyn AudioSink<Format = F>>,
) -> anyhow::Result<()> {
    while let Some(d) = source.audio_read() {
        sink.audio_write(d)?;
    }
    Ok(())
}