Skip to content

Commit

Permalink
avoid swap arity panic
Browse files Browse the repository at this point in the history
  • Loading branch information
tomara-x committed Aug 13, 2024
1 parent 0bab7da commit 3ac8312
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,18 @@ impl AudioUnit for SwapUnit {

fn tick(&mut self, input: &[f32], output: &mut [f32]) {
if let Ok(net) = self.receiver.try_recv() {
self.x = net;
if self.x.inputs() == net.inputs() && self.x.outputs() == net.outputs() {
self.x = net;
}
}
self.x.tick(input, output);
}

fn process(&mut self, size: usize, input: &BufferRef, output: &mut BufferMut) {
if let Ok(net) = self.receiver.try_recv() {
self.x = net;
if self.x.inputs() == net.inputs() && self.x.outputs() == net.outputs() {
self.x = net;
}
}
self.x.process(size, input, output);
}
Expand Down

0 comments on commit 3ac8312

Please sign in to comment.