diff --git a/examples/basic.rs b/examples/basic.rs index baa80ce..662eb36 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -15,7 +15,9 @@ fn main() { thread::sleep(Duration::from_millis(1500)); let file = std::fs::File::open("examples/beep2.wav").unwrap(); - rodio::play_once(&endpoint, BufReader::new(file)).unwrap().detach(); + rodio::play_once(&endpoint, BufReader::new(file)) + .unwrap() + .detach(); println!("Started beep2"); thread::sleep(Duration::from_millis(1500)); diff --git a/src/buffer.rs b/src/buffer.rs index 7a3c0a8..b5b2643 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -3,7 +3,7 @@ //! The `SamplesBuffer` struct can be used to treat a list of values as a `Source`. //! //! # Example -//! +//! //! ``` //! use rodio::buffer::SamplesBuffer; //! let _ = SamplesBuffer::new(1, 44100, vec![1i16, 2, 3, 4, 5, 6]); @@ -25,7 +25,9 @@ pub struct SamplesBuffer { duration: Duration, } -impl SamplesBuffer where S: Sample { +impl SamplesBuffer + where S: Sample +{ /// Builds a new `SamplesBuffer`. /// /// # Panic @@ -42,8 +44,10 @@ impl SamplesBuffer where S: Sample { assert!(samples_rate != 0); let data = data.into(); - let duration_ns = 1_000_000_000u64.checked_mul(data.len() as u64).unwrap() / samples_rate as u64 / channels as u64; - let duration = Duration::new(duration_ns / 1_000_000_000, (duration_ns % 1_000_000_000) as u32); + let duration_ns = 1_000_000_000u64.checked_mul(data.len() as u64).unwrap() / + samples_rate as u64 / channels as u64; + let duration = Duration::new(duration_ns / 1_000_000_000, + (duration_ns % 1_000_000_000) as u32); SamplesBuffer { data: data.into_iter(), @@ -54,7 +58,9 @@ impl SamplesBuffer where S: Sample { } } -impl Source for SamplesBuffer where S: Sample { +impl Source for SamplesBuffer + where S: Sample +{ #[inline] fn current_frame_len(&self) -> Option { None @@ -76,7 +82,9 @@ impl Source for SamplesBuffer where S: Sample { } } -impl Iterator for SamplesBuffer where S: Sample { +impl Iterator for SamplesBuffer + where S: Sample +{ type Item = S; #[inline] diff --git a/src/conversions/channels.rs b/src/conversions/channels.rs index e4d156f..ca1b79e 100644 --- a/src/conversions/channels.rs +++ b/src/conversions/channels.rs @@ -84,8 +84,9 @@ impl Iterator for ChannelsCountConverter let min = (min / self.from as usize) * self.to as usize + self.next_output_sample_pos as usize; let max = max.map(|max| { - (max / self.from as usize) * self.to as usize + self.next_output_sample_pos as usize - }); + (max / self.from as usize) * self.to as usize + + self.next_output_sample_pos as usize + }); (min, max) } diff --git a/src/conversions/samples_rate.rs b/src/conversions/samples_rate.rs index 5aa4562..1e937f8 100644 --- a/src/conversions/samples_rate.rs +++ b/src/conversions/samples_rate.rs @@ -64,8 +64,14 @@ impl SamplesRateConverter debug_assert_eq!(from, gcd); (Vec::new(), Vec::new()) } else { - let first = input.by_ref().take(num_channels as usize).collect::>(); - let next = input.by_ref().take(num_channels as usize).collect::>(); + let first = input + .by_ref() + .take(num_channels as usize) + .collect::>(); + let next = input + .by_ref() + .take(num_channels as usize) + .collect::>(); (first, next) }; @@ -153,7 +159,10 @@ impl Iterator for SamplesRateConverter let mut result = None; let numerator = (self.from * self.next_output_frame_pos_in_chunk) % self.to; for (off, (cur, next)) in - self.current_frame.iter().zip(self.next_frame.iter()).enumerate() { + self.current_frame + .iter() + .zip(self.next_frame.iter()) + .enumerate() { let sample = Sample::lerp(cur.clone(), next.clone(), numerator, self.to); if off == 0 { @@ -197,10 +206,11 @@ impl Iterator for SamplesRateConverter samples_after_chunk }; // removing the samples of the current chunk that have not yet been read - let samples_after_chunk = samples_after_chunk.saturating_sub( - self.from.saturating_sub(self.current_frame_pos_in_chunk + 2) as usize * - self.current_frame.capacity() - ); + let samples_after_chunk = samples_after_chunk + .saturating_sub(self.from + .saturating_sub(self.current_frame_pos_in_chunk + 2) as + usize * + self.current_frame.capacity()); // calculating the number of samples after the transformation // TODO: this is wrong here \|/ let samples_after_chunk = samples_after_chunk * self.to as usize / self.from as usize; diff --git a/src/decoder/flac.rs b/src/decoder/flac.rs index 1a06e33..daabff0 100644 --- a/src/decoder/flac.rs +++ b/src/decoder/flac.rs @@ -32,15 +32,15 @@ impl FlacDecoder let spec = reader.streaminfo(); Ok(FlacDecoder { - reader: reader, - current_block: Vec::with_capacity(spec.max_block_size as usize * - spec.channels as usize), - current_block_channel_len: 1, - current_block_off: 0, - bits_per_sample: spec.bits_per_sample, - samples_rate: spec.sample_rate, - channels: spec.channels as u16, - }) + reader: reader, + current_block: Vec::with_capacity(spec.max_block_size as usize * + spec.channels as usize), + current_block_channel_len: 1, + current_block_off: 0, + bits_per_sample: spec.bits_per_sample, + samples_rate: spec.sample_rate, + channels: spec.channels as u16, + }) } } @@ -78,7 +78,9 @@ impl Iterator for FlacDecoder loop { if self.current_block_off < self.current_block.len() { // Read from current block. - let real_offset = (self.current_block_off % self.channels as usize) * self.current_block_channel_len + self.current_block_off / self.channels as usize; + let real_offset = (self.current_block_off % self.channels as usize) * + self.current_block_channel_len + + self.current_block_off / self.channels as usize; let raw_val = self.current_block[real_offset]; self.current_block_off += 1; let real_val = if self.bits_per_sample == 16 { @@ -98,7 +100,7 @@ impl Iterator for FlacDecoder Ok(Some(block)) => { self.current_block_channel_len = (block.len() / block.channels()) as usize; self.current_block = block.into_buffer(); - }, + } _ => return None, } } diff --git a/src/decoder/vorbis.rs b/src/decoder/vorbis.rs index 41287da..b46bc43 100644 --- a/src/decoder/vorbis.rs +++ b/src/decoder/vorbis.rs @@ -37,9 +37,9 @@ impl VorbisDecoder }; Ok(VorbisDecoder { - stream_reader: stream_reader, - current_data: data.into_iter(), - }) + stream_reader: stream_reader, + current_data: data.into_iter(), + }) } } @@ -76,13 +76,19 @@ impl Iterator for VorbisDecoder fn next(&mut self) -> Option { if let Some(sample) = self.current_data.next() { if self.current_data.len() == 0 { - if let Some(data) = self.stream_reader.read_dec_packet_itl().ok().and_then(|v| v) { + if let Some(data) = self.stream_reader + .read_dec_packet_itl() + .ok() + .and_then(|v| v) { self.current_data = data.into_iter(); } } return Some(sample); } else { - if let Some(data) = self.stream_reader.read_dec_packet_itl().ok().and_then(|v| v) { + if let Some(data) = self.stream_reader + .read_dec_packet_itl() + .ok() + .and_then(|v| v) { self.current_data = data.into_iter(); } return self.current_data.next(); diff --git a/src/decoder/wav.rs b/src/decoder/wav.rs index 24933b3..e7509fd 100644 --- a/src/decoder/wav.rs +++ b/src/decoder/wav.rs @@ -31,10 +31,10 @@ impl WavDecoder }; Ok(WavDecoder { - reader: reader, - samples_rate: spec.sample_rate, - channels: spec.channels, - }) + reader: reader, + samples_rate: spec.sample_rate, + channels: spec.channels, + }) } } diff --git a/src/dynamic_mixer.rs b/src/dynamic_mixer.rs index 7eb43d5..df9d4ed 100644 --- a/src/dynamic_mixer.rs +++ b/src/dynamic_mixer.rs @@ -17,15 +17,17 @@ use Sample; /// added to the mixer will be converted to these values. /// /// After creating a mixer, you can add new sounds with the controller. -pub fn mixer(channels: u16, samples_rate: u32) -> (Arc>, DynamicMixer) +pub fn mixer(channels: u16, + samples_rate: u32) + -> (Arc>, DynamicMixer) where S: Sample + Send + 'static { let input = Arc::new(DynamicMixerController { - has_pending: AtomicBool::new(false), - pending_sources: Mutex::new(Vec::new()), - channels: channels, - samples_rate: samples_rate, - }); + has_pending: AtomicBool::new(false), + pending_sources: Mutex::new(Vec::new()), + channels: channels, + samples_rate: samples_rate, + }); let output = DynamicMixer { current_sources: Vec::with_capacity(16), @@ -43,15 +45,20 @@ pub struct DynamicMixerController { samples_rate: u32, } -impl DynamicMixerController where S: Sample + Send + 'static { +impl DynamicMixerController + where S: Sample + Send + 'static +{ /// Adds a new source to mix to the existing ones. #[inline] pub fn add(&self, source: T) where T: Source + Send + 'static { let uniform_source = UniformSourceIterator::new(source, self.channels, self.samples_rate); - self.pending_sources.lock().unwrap().push(Box::new(uniform_source) as Box<_>); - self.has_pending.store(true, Ordering::SeqCst); // TODO: can we relax this ordering? + self.pending_sources + .lock() + .unwrap() + .push(Box::new(uniform_source) as Box<_>); + self.has_pending.store(true, Ordering::SeqCst); // TODO: can we relax this ordering? } } @@ -64,7 +71,9 @@ pub struct DynamicMixer { input: Arc>, } -impl Source for DynamicMixer where S: Sample + Send + 'static { +impl Source for DynamicMixer + where S: Sample + Send + 'static +{ #[inline] fn current_frame_len(&self) -> Option { None @@ -86,15 +95,18 @@ impl Source for DynamicMixer where S: Sample + Send + 'static { } } -impl Iterator for DynamicMixer where S: Sample + Send + 'static { +impl Iterator for DynamicMixer + where S: Sample + Send + 'static +{ type Item = S; #[inline] fn next(&mut self) -> Option { - if self.input.has_pending.load(Ordering::SeqCst) { // TODO: relax ordering? + if self.input.has_pending.load(Ordering::SeqCst) { + // TODO: relax ordering? let mut pending = self.input.pending_sources.lock().unwrap(); self.current_sources.extend(pending.drain(..)); - self.input.has_pending.store(false, Ordering::SeqCst); // TODO: relax ordering? + self.input.has_pending.store(false, Ordering::SeqCst); // TODO: relax ordering? } if self.current_sources.is_empty() { diff --git a/src/engine.rs b/src/engine.rs index 4debe31..83b2bec 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -77,7 +77,7 @@ impl Engine { e.insert(Arc::downgrade(&mixer)); voice_to_start = Some(voice); mixer - }, + } Entry::Occupied(mut e) => { if let Some(m) = e.get().upgrade() { m.clone() @@ -87,7 +87,7 @@ impl Engine { voice_to_start = Some(voice); mixer } - }, + } } }; @@ -100,10 +100,12 @@ impl Engine { } // TODO: handle possible errors here -fn new_voice(endpoint: &Endpoint, events_loop: &Arc) +fn new_voice(endpoint: &Endpoint, + events_loop: &Arc) -> (Arc>, Voice) { // Determine the format to use for the new voice. - let format = endpoint.get_supported_formats_list() + let format = endpoint + .get_supported_formats_list() .unwrap() .fold(None, |f1, f2| { if f1.is_none() { @@ -113,8 +115,7 @@ fn new_voice(endpoint: &Endpoint, events_loop: &Arc) let f1 = f1.unwrap(); // We privilege f32 formats to avoid a conversion. - if f2.data_type == cpal::SampleFormat::F32 && - f1.data_type != cpal::SampleFormat::F32 { + if f2.data_type == cpal::SampleFormat::F32 && f1.data_type != cpal::SampleFormat::F32 { return Some(f2); } @@ -132,8 +133,7 @@ fn new_voice(endpoint: &Endpoint, events_loop: &Arc) }) .expect("The endpoint doesn't support any format!?"); - let (voice, stream) = Voice::new(&endpoint, &format, events_loop) - .unwrap(); + let (voice, stream) = Voice::new(&endpoint, &format, events_loop).unwrap(); let (mixer_tx, mut mixer_rx) = { dynamic_mixer::mixer::(format.channels.len() as u16, format.samples_rate.0) diff --git a/src/queue.rs b/src/queue.rs index 2a322cb..bb3db94 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -26,14 +26,13 @@ use Sample; /// a new sound. /// - If you pass `false`, then the queue will report that it has finished playing. /// -pub fn queue(keep_alive_if_empty: bool) - -> (Arc>, SourcesQueueOutput) +pub fn queue(keep_alive_if_empty: bool) -> (Arc>, SourcesQueueOutput) where S: Sample + Send + 'static { let input = Arc::new(SourcesQueueInput { - next_sounds: Mutex::new(Vec::new()), - keep_alive_if_empty: AtomicBool::new(keep_alive_if_empty), - }); + next_sounds: Mutex::new(Vec::new()), + keep_alive_if_empty: AtomicBool::new(keep_alive_if_empty), + }); let output = SourcesQueueOutput { current: Box::new(Empty::::new()) as Box<_>, @@ -54,13 +53,18 @@ pub struct SourcesQueueInput { keep_alive_if_empty: AtomicBool, } -impl SourcesQueueInput where S: Sample + Send + 'static { +impl SourcesQueueInput + where S: Sample + Send + 'static +{ /// Adds a new source to the end of the queue. #[inline] pub fn append(&self, source: T) where T: Source + Send + 'static { - self.next_sounds.lock().unwrap().push((Box::new(source) as Box<_>, None)); + self.next_sounds + .lock() + .unwrap() + .push((Box::new(source) as Box<_>, None)); } /// Adds a new source to the end of the queue. @@ -71,7 +75,10 @@ impl SourcesQueueInput where S: Sample + Send + 'static { where T: Source + Send + 'static { let (tx, rx) = mpsc::channel(); - self.next_sounds.lock().unwrap().push((Box::new(source) as Box<_>, Some(tx))); + self.next_sounds + .lock() + .unwrap() + .push((Box::new(source) as Box<_>, Some(tx))); rx } @@ -79,7 +86,8 @@ impl SourcesQueueInput where S: Sample + Send + 'static { /// /// See also the constructor. pub fn set_keep_alive_if_empty(&self, keep_alive_if_empty: bool) { - self.keep_alive_if_empty.store(keep_alive_if_empty, Ordering::Release); + self.keep_alive_if_empty + .store(keep_alive_if_empty, Ordering::Release); } } @@ -95,7 +103,9 @@ pub struct SourcesQueueOutput { input: Arc>, } -impl Source for SourcesQueueOutput where S: Sample + Send + 'static { +impl Source for SourcesQueueOutput + where S: Sample + Send + 'static +{ #[inline] fn current_frame_len(&self) -> Option { // This function is non-trivial because the boundary between two sounds in the queue should @@ -144,7 +154,9 @@ impl Source for SourcesQueueOutput where S: Sample + Send + 'static { } } -impl Iterator for SourcesQueueOutput where S: Sample + Send + 'static { +impl Iterator for SourcesQueueOutput + where S: Sample + Send + 'static +{ type Item = S; #[inline] @@ -169,7 +181,9 @@ impl Iterator for SourcesQueueOutput where S: Sample + Send + 'static { } } -impl SourcesQueueOutput where S: Sample + Send + 'static { +impl SourcesQueueOutput + where S: Sample + Send + 'static +{ // Called when `current` is empty and we must jump to the next element. // Returns `Ok` if the sound should continue playing, or an error if it should stop. // @@ -185,7 +199,7 @@ impl SourcesQueueOutput where S: Sample + Send + 'static { if next.len() == 0 { if self.input.keep_alive_if_empty.load(Ordering::Acquire) { // Play a short silence in order to avoid spinlocking. - let silence = Zero::::new(1, 44000); // TODO: meh + let silence = Zero::::new(1, 44000); // TODO: meh (Box::new(silence.take_duration(Duration::from_millis(10))) as Box<_>, None) } else { return Err(()); @@ -208,7 +222,7 @@ mod tests { use source::Source; #[test] - #[ignore] // FIXME: samples rate and channel not updated immediately after transition + #[ignore] // FIXME: samples rate and channel not updated immediately after transition fn basic() { let (tx, mut rx) = queue::queue(false); @@ -252,7 +266,7 @@ mod tests { } #[test] - #[ignore] // TODO: not yet implemented + #[ignore] // TODO: not yet implemented fn no_delay_when_added() { let (tx, mut rx) = queue::queue(true); diff --git a/src/sink.rs b/src/sink.rs index d1997fc..8214d8a 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -58,14 +58,15 @@ impl Sink { .pausable(false) .amplify(1.0) .stoppable() - .periodic_access(Duration::from_millis(5), move |src| { - if stopped.load(Ordering::SeqCst) { - src.stop(); - } else { - src.inner_mut().set_factor(*volume.lock().unwrap()); - src.inner_mut().inner_mut().set_paused(pause.load(Ordering::SeqCst)); - } - }) + .periodic_access(Duration::from_millis(5), + move |src| if stopped.load(Ordering::SeqCst) { + src.stop(); + } else { + src.inner_mut().set_factor(*volume.lock().unwrap()); + src.inner_mut() + .inner_mut() + .set_paused(pause.load(Ordering::SeqCst)); + }) .convert_samples(); *self.sleep_until_end.lock().unwrap() = Some(self.queue_tx.append_with_signal(source)); diff --git a/src/source/amplify.rs b/src/source/amplify.rs index 268771c..fad7ba7 100644 --- a/src/source/amplify.rs +++ b/src/source/amplify.rs @@ -55,7 +55,9 @@ impl Iterator for Amplify #[inline] fn next(&mut self) -> Option { - self.input.next().map(|value| value.amplify(self.factor)) + self.input + .next() + .map(|value| value.amplify(self.factor)) } #[inline] diff --git a/src/source/buffered.rs b/src/source/buffered.rs index c3767c2..7cf0599 100644 --- a/src/source/buffered.rs +++ b/src/source/buffered.rs @@ -75,14 +75,17 @@ fn extract(mut input: I) -> Arc> let channels = input.channels(); let rate = input.samples_rate(); - let data = input.by_ref().take(cmp::min(frame_len.unwrap_or(32768), 32768)).collect(); + let data = input + .by_ref() + .take(cmp::min(frame_len.unwrap_or(32768), 32768)) + .collect(); Arc::new(Frame::Data(FrameData { - data: data, - channels: channels, - rate: rate, - next: Mutex::new(Arc::new(Frame::Input(Mutex::new(Some(input))))), - })) + data: data, + channels: channels, + rate: rate, + next: Mutex::new(Arc::new(Frame::Input(Mutex::new(Some(input))))), + })) } impl Buffered diff --git a/src/source/delay.rs b/src/source/delay.rs index 8f22357..33543b9 100644 --- a/src/source/delay.rs +++ b/src/source/delay.rs @@ -9,8 +9,7 @@ pub fn delay(input: I, duration: Duration) -> Delay I::Item: Sample { let duration_ns = duration.as_secs() * 1000000000 + duration.subsec_nanos() as u64; - let samples = duration_ns * input.samples_rate() as u64 * input.channels() as u64 / - 1000000000; + let samples = duration_ns * input.samples_rate() as u64 * input.channels() as u64 / 1000000000; Delay { input: input, @@ -60,7 +59,9 @@ impl Source for Delay { #[inline] fn current_frame_len(&self) -> Option { - self.input.current_frame_len().map(|val| val + self.remaining_samples) + self.input + .current_frame_len() + .map(|val| val + self.remaining_samples) } #[inline] @@ -75,6 +76,8 @@ impl Source for Delay #[inline] fn total_duration(&self) -> Option { - self.input.total_duration().map(|val| val + self.requested_duration) + self.input + .total_duration() + .map(|val| val + self.requested_duration) } } diff --git a/src/source/empty.rs b/src/source/empty.rs index 31ba27c..5bd86fc 100644 --- a/src/source/empty.rs +++ b/src/source/empty.rs @@ -23,7 +23,9 @@ impl Iterator for Empty { } } -impl Source for Empty where S: Sample { +impl Source for Empty + where S: Sample +{ #[inline] fn current_frame_len(&self) -> Option { None diff --git a/src/source/from_factory.rs b/src/source/from_factory.rs index b0a0a1b..04c74ea 100644 --- a/src/source/from_factory.rs +++ b/src/source/from_factory.rs @@ -11,9 +11,7 @@ use source::FromIter; pub fn from_factory(factory: F) -> FromIter> where F: FnMut() -> Option { - from_iter(FromFactoryIter { - factory: factory, - }) + from_iter(FromFactoryIter { factory: factory }) } /// Internal type used by `from_factory`. diff --git a/src/source/from_iter.rs b/src/source/from_iter.rs index e21dcdd..fb5924b 100644 --- a/src/source/from_iter.rs +++ b/src/source/from_iter.rs @@ -24,7 +24,9 @@ pub fn from_iter(iterator: I) -> FromIter /// A source that chains sources provided by an iterator. #[derive(Clone)] -pub struct FromIter where I: Iterator { +pub struct FromIter + where I: Iterator +{ // The iterator that provides sources. iterator: I, // Is only ever `None` if the first element of the iterator is `None`. @@ -140,15 +142,14 @@ mod tests { #[test] fn basic() { - let mut rx = from_iter((0..2).map(|n| { - if n == 0 { - SamplesBuffer::new(1, 48000, vec![10i16, -10, 10, -10]) - } else if n == 1 { + let mut rx = + from_iter((0..2).map(|n| if n == 0 { + SamplesBuffer::new(1, 48000, vec![10i16, -10, 10, -10]) + } else if n == 1 { SamplesBuffer::new(2, 96000, vec![5i16, 5, 5, 5]) } else { unreachable!() - } - })); + })); assert_eq!(rx.channels(), 1); assert_eq!(rx.samples_rate(), 48000); @@ -157,7 +158,8 @@ mod tests { assert_eq!(rx.next(), Some(10)); assert_eq!(rx.next(), Some(-10)); /*assert_eq!(rx.channels(), 2); - assert_eq!(rx.samples_rate(), 96000);*/ // FIXME: not working + assert_eq!(rx.samples_rate(), 96000);*/ + // FIXME: not working assert_eq!(rx.next(), Some(5)); assert_eq!(rx.next(), Some(5)); assert_eq!(rx.next(), Some(5)); diff --git a/src/source/mod.rs b/src/source/mod.rs index d727d0d..4a2d9d0 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -235,7 +235,8 @@ pub trait Source: Iterator /// Converts the samples of this source to another type. #[inline] fn convert_samples(self) -> SamplesConverter - where Self: Sized, D: Sample + where Self: Sized, + D: Sample { SamplesConverter::new(self) } @@ -259,7 +260,9 @@ pub trait Source: Iterator } } -impl Source for Box> where S: Sample { +impl Source for Box> + where S: Sample +{ #[inline] fn current_frame_len(&self) -> Option { (**self).current_frame_len() @@ -281,7 +284,9 @@ impl Source for Box> where S: Sample { } } -impl Source for Box + Send> where S: Sample { +impl Source for Box + Send> + where S: Sample +{ #[inline] fn current_frame_len(&self) -> Option { (**self).current_frame_len() @@ -303,7 +308,9 @@ impl Source for Box + Send> where S: Sample { } } -impl Source for Box + Send + Sync> where S: Sample { +impl Source for Box + Send + Sync> + where S: Sample +{ #[inline] fn current_frame_len(&self) -> Option { (**self).current_frame_len() diff --git a/src/source/periodic.rs b/src/source/periodic.rs index 2258a95..72ea0ee 100644 --- a/src/source/periodic.rs +++ b/src/source/periodic.rs @@ -6,7 +6,7 @@ use Source; /// Internal function that builds a `PeriodicAccess` object. pub fn periodic(source: I, period: Duration, modifier: F) -> PeriodicAccess where I: Source, - I::Item: Sample, + I::Item: Sample { // TODO: handle the fact that the samples rate can change // TODO: generally, just wrong diff --git a/src/source/uniform.rs b/src/source/uniform.rs index 6fae6a9..9e1d1cc 100644 --- a/src/source/uniform.rs +++ b/src/source/uniform.rs @@ -86,7 +86,14 @@ impl Iterator for UniformSourceIterator return Some(value); } - let input = self.inner.take().unwrap().into_inner().into_inner().into_inner().iter; + let input = self.inner + .take() + .unwrap() + .into_inner() + .into_inner() + .into_inner() + .iter; + let mut input = UniformSourceIterator::bootstrap(input, self.target_channels, self.target_samples_rate); diff --git a/src/source/zero.rs b/src/source/zero.rs index 2662ec3..c7b984a 100644 --- a/src/source/zero.rs +++ b/src/source/zero.rs @@ -22,7 +22,9 @@ impl Zero { } } -impl Iterator for Zero where S: Sample { +impl Iterator for Zero + where S: Sample +{ type Item = S; #[inline] @@ -31,7 +33,9 @@ impl Iterator for Zero where S: Sample { } } -impl Source for Zero where S: Sample { +impl Source for Zero + where S: Sample +{ #[inline] fn current_frame_len(&self) -> Option { None