diff --git a/src/bus/into_bus.rs b/src/bus/into_bus.rs index 1c81529..c42d906 100644 --- a/src/bus/into_bus.rs +++ b/src/bus/into_bus.rs @@ -38,10 +38,6 @@ where self.bus.set_sample_rate(sample_rate) } - fn is_empty(&self) -> bool { - self.bus.is_empty() - } - #[inline] fn sample_rate(&self) -> f32 { self.bus.sample_rate() diff --git a/src/bus/mod.rs b/src/bus/mod.rs index 87190ae..9a679f3 100644 --- a/src/bus/mod.rs +++ b/src/bus/mod.rs @@ -26,7 +26,6 @@ where &self, dispatcher: F, ) -> Arc Fn(Self::O<'a>) + Send + Sync>; - fn is_empty(&self) -> bool; fn subscribe(self: &Arc, cx: &mut Context) { let bus = self.clone(); diff --git a/src/bus/mono.rs b/src/bus/mono.rs index 130fd5f..88e2d62 100644 --- a/src/bus/mono.rs +++ b/src/bus/mono.rs @@ -84,10 +84,6 @@ impl Bus for MonoBus { .for_each(|d| d(samples.iter())); } - fn is_empty(&self) -> bool { - self.channel.1.is_empty() - } - fn register_dispatcher Fn(Self::I<'a>) + Sync + Send + 'static>( &self, dispatcher: F, diff --git a/src/bus/multichannel.rs b/src/bus/multichannel.rs index f00778d..aec3823 100644 --- a/src/bus/multichannel.rs +++ b/src/bus/multichannel.rs @@ -112,12 +112,12 @@ impl Bus<[f32; C]> for MultiChannelBus { } fn update(&self) { - if self.channel.1.is_empty() { + let samples = self.channel.1.try_iter().collect::>(); + + if samples.is_empty() { return; } - let samples = self.channel.1.try_iter().collect::>(); - self.dispatchers .read() .unwrap() @@ -126,10 +126,6 @@ impl Bus<[f32; C]> for MultiChannelBus { .for_each(|d| d(samples.iter())); } - fn is_empty(&self) -> bool { - self.channel.1.is_empty() - } - fn set_sample_rate(&self, sample_rate: f32) { self.sample_rate .store(sample_rate, atomic::Ordering::Relaxed);