orottier / web-audio-api-rs

A Rust implementation of the Web Audio API, for use in non-browser contexts
https://docs.rs/web-audio-api/
MIT License
300 stars 16 forks source link

Rethrow panics in nodes during user tests #523

Closed orottier closed 2 months ago

orottier commented 2 months ago

Fixes #522

orottier commented 2 months ago

@b-ma maybe you are more familiar with the inner workings of the WaveShaperNode? The issue in the tests is

---- node::waveshaper::tests::test_user_defined_options stdout ----
thread 'node::waveshaper::tests::test_user_defined_options' panicked at src/node/waveshaper.rs:328:46:
assertion `left == right` failed
  left: 128 --->  the channel length
 right: 256 ---->  processor.input_frames_next()

in self.upsampler_x2.process(channels):

   6: web_audio_api::node::waveshaper::Resampler::process
             at ./src/node/waveshaper.rs:328:9
   7: <web_audio_api::node::waveshaper::WaveShaperRenderer as web_audio_api::render::processor::AudioProcessor>::process
             at ./src/node/waveshaper.rs:429:21

I don't see why the upsampler x2 should have 256 as input size...

impl ResamplerConfig {
    fn upsample_x2(channels: usize, sample_rate: usize) -> Self {
        let chunk_size_in = RENDER_QUANTUM_SIZE * 2;

Could you shed some light?

b-ma commented 2 months ago

Hum I don't know actually, looks like either it has always been there and the underlying lib has been fixed somehow, or I introduced that by mistake in some refactoring... I can have a look

orottier commented 2 months ago

Okay thanks. Let me know how it goes, if it takes more time I can release a fix for the buffer loop separately

b-ma commented 2 months ago

cf #526

orottier commented 2 months ago

Thanks. I will release tonight. V-1.0.0 probably, why not? :)