web-audio-api-rs
web-audio-api-rs copied to clipboard
Wrong behaviour when inserting `LinearRampToValueAtTime` and `ExponentialRampToValueAtTime` events
trafficstars
This check is wrong in some situations:
https://github.com/orottier/web-audio-api-rs/blob/53b1dc0b643d65e1695cff30ce0137e95538990e/src/param.rs#L918
For example if we do something like:
param.linear_ramp_to_value_at_time(1., context.current_time() + 1.);
std::thread::sleep(std::time::Duration::from_secs(4));
// first event has ended thus the timeline is empty and `last_event` is defined
param.linear_ramp_to_value_at_time(2., context.current_time() + 1.);
The check will insert a new set_value event on the second linear_ramp_to_value_at_time call, while it should not because last_event is defined. Therefore, the start_time of the second linear_ramp event will be wrong.
The weird funny fact is that the current behaviour works without clicks, while the specified behaviour should click without a set_value_at_time before the second linear_ramp... :)
Relevant spec links:
- https://webaudio.github.io/web-audio-api/#dom-audioparam-linearramptovalueattime
- https://webaudio.github.io/web-audio-api/#dom-audioparam-exponentialramptovalueattime