From 50b6f4030b7037ff961313eb64808d10d00c1e2c Mon Sep 17 00:00:00 2001 From: "Ando \"Thor\" Nando" Date: Sat, 15 Apr 2023 18:32:09 +1000 Subject: [PATCH] add more doc around Empty --- examples/channel_volume.rs | 6 +----- src/source/empty.rs | 3 +++ src/stream.rs | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/channel_volume.rs b/examples/channel_volume.rs index fd0a1f2f..758d8bf8 100644 --- a/examples/channel_volume.rs +++ b/examples/channel_volume.rs @@ -1,14 +1,10 @@ -use std::io::BufReader; - use rodio::source::ChannelVolume; fn main() { let (_stream, handle) = rodio::OutputStream::try_default().unwrap(); let sink = rodio::Sink::try_new(&handle).unwrap(); - let file = std::fs::File::open("assets/music.ogg").unwrap(); - let input = rodio::Decoder::new(BufReader::new(file)).unwrap(); - // let input = rodio::source::SineWave::new(440.0); + let input = rodio::source::SineWave::new(440.0); let chan_vol = ChannelVolume::new(input, vec![0.01, 0.01, 0.0, 0.0, 0.0, 0.0]); sink.append(chan_vol); diff --git a/src/source/empty.rs b/src/source/empty.rs index c3dfce7d..24473c08 100644 --- a/src/source/empty.rs +++ b/src/source/empty.rs @@ -4,6 +4,9 @@ use std::time::Duration; use crate::{Sample, Source}; /// An empty source. +/// +/// The empty source is special in that it will never return any data. +/// It also reports 0 channels, a sample rate of 0, and a Duration of 0. #[derive(Debug, Copy, Clone)] pub struct Empty(PhantomData); diff --git a/src/stream.rs b/src/stream.rs index 9cce7d3e..59a4c917 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -216,8 +216,7 @@ impl CpalDeviceExt for cpal::Device { &format.config(), move |data, _| { data.iter_mut() - .for_each(|d| *d = mixer_rx.next().unwrap_or(0f32)); - dbg!(&data[0..6]); + .for_each(|d| *d = mixer_rx.next().unwrap_or(0f32)) }, error_callback, None,