Skip to content

Commit f7879c2

Browse files
committed
IIRFilterNode: port construct of biquad for handling silent input
otherwise the `zip` will skip over the other channels
1 parent 12fa04c commit f7879c2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/node/iir_filter.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,13 @@ impl AudioProcessor for IirFilterRenderer {
353353
}
354354

355355
// apply filter
356-
for (channel_number, (input_channel, output_channel)) in input
357-
.channels()
358-
.iter()
359-
.zip(output.channels_mut())
360-
.enumerate()
361-
{
356+
for (channel_number, output_channel) in output.channels_mut().iter_mut().enumerate() {
357+
let input_channel = if input.is_silent() {
358+
input.channel_data(0)
359+
} else {
360+
input.channel_data(channel_number)
361+
};
362+
362363
for (&i, o) in input_channel.iter().zip(output_channel.iter_mut()) {
363364
let input = f64::from(i);
364365
let b0 = self.norm_coeffs[0].0;

0 commit comments

Comments
 (0)