Skip to content

Commit

Permalink
add more doc around Empty
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineGod committed Apr 15, 2023
1 parent 5f5a84f commit 0f059bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/channel_volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ 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 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 chan_vol = ChannelVolume::new(input, vec![0.01, 0.01, 0.0, 0.0, 0.0, 0.0]);
sink.append(chan_vol);

Expand Down
3 changes: 3 additions & 0 deletions src/source/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S>(PhantomData<S>);

Expand Down
3 changes: 1 addition & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0f059bd

Please sign in to comment.