Skip to content

Commit ac6e228

Browse files
committed
fixes example
1 parent 82514bd commit ac6e228

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

examples/into_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rodio::{output_to_wav, Source};
1+
use rodio::{wav_to_file, Source};
22
use std::error::Error;
33

44
/// Converts mp3 file to a wav file.
@@ -12,7 +12,7 @@ fn main() -> Result<(), Box<dyn Error>> {
1212

1313
let wav_path = "music_mp3_converted.wav";
1414
println!("Storing converted audio into {}", wav_path);
15-
output_to_wav(&mut audio, wav_path)?;
15+
wav_to_file(&mut audio, wav_path)?;
1616

1717
Ok(())
1818
}

src/wav_output.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::common::assert_error_traits;
2-
use crate::Source;
32
use crate::Sample;
3+
use crate::Source;
44
use hound::{SampleFormat, WavSpec};
55
use std::io::{self, Write};
66
use std::path;
@@ -94,10 +94,10 @@ pub fn wav_to_writer(
9494
Ok(())
9595
}
9696

97-
struct WholeFrames<I: Iterator<Item=Sample>> {
97+
struct WholeFrames<I: Iterator<Item = Sample>> {
9898
buffer: Vec<Sample>,
9999
pos: usize,
100-
source: I
100+
source: I,
101101
}
102102

103103
impl<S: Source> WholeFrames<S> {
@@ -120,14 +120,13 @@ impl<I: Iterator<Item = Sample>> Iterator for WholeFrames<I> {
120120
}
121121
self.pos = 0;
122122
}
123-
123+
124124
let to_yield = self.buffer[self.pos];
125125
self.pos += 1;
126126
Some(to_yield)
127127
}
128128
}
129129

130-
131130
#[cfg(test)]
132131
mod test {
133132
use super::wav_to_file;

0 commit comments

Comments
 (0)