Skip to content

Commit

Permalink
Remove is_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
exa04 committed Jan 14, 2025
1 parent 7421974 commit b8217f6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/bus/into_bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion src/bus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ where
&self,
dispatcher: F,
) -> Arc<dyn for<'a> Fn(Self::O<'a>) + Send + Sync>;
fn is_empty(&self) -> bool;

fn subscribe(self: &Arc<Self>, cx: &mut Context) {
let bus = self.clone();
Expand Down
4 changes: 0 additions & 4 deletions src/bus/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ impl Bus<f32> for MonoBus {
.for_each(|d| d(samples.iter()));
}

fn is_empty(&self) -> bool {
self.channel.1.is_empty()
}

fn register_dispatcher<F: for<'a> Fn(Self::I<'a>) + Sync + Send + 'static>(
&self,
dispatcher: F,
Expand Down
10 changes: 3 additions & 7 deletions src/bus/multichannel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ impl<const C: usize> Bus<[f32; C]> for MultiChannelBus<C> {
}

fn update(&self) {
if self.channel.1.is_empty() {
let samples = self.channel.1.try_iter().collect::<Vec<_>>();

if samples.is_empty() {
return;
}

let samples = self.channel.1.try_iter().collect::<Vec<_>>();

self.dispatchers
.read()
.unwrap()
Expand All @@ -126,10 +126,6 @@ impl<const C: usize> Bus<[f32; C]> for MultiChannelBus<C> {
.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);
Expand Down

0 comments on commit b8217f6

Please sign in to comment.