Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioParam: Running only one event per tick leads to off-by-one event_start_time #301

Open
collares opened this issue Aug 21, 2019 · 2 comments
Labels
bug Something isn't working webaudio

Comments

@collares
Copy link
Contributor

collares commented Aug 21, 2019

Consider the following line, from WPT (the-audioparam-interface/audioparam-method-chaining.html):

envelope.gain
    .setValueAtTime(0.0, 0.0)
    .linearRampToValueAtTime(1.0, 1.0);

If I understand correctly, setValueAtTime runs at tick 0. We only process one event per tick, so linearRampToValueAtTime waits until tick 1 to run, at which point event_start_time gets set:

self.event_start_time = current_tick;
The linearRamp line then starts at this point (value 0 at tick 1), when it should have started at tick 0.

@Manishearth
Copy link
Member

Oh, hmm. I fixed one off by one but I vaguely recall seeing similar stuff afterwards. Thanks for investigating!

@Manishearth
Copy link
Member

The two ifs here should probably have their own tryrecv loops

https://github.com/servo/media/blob/master/audio/render_thread.rs#L296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working webaudio
Projects
None yet
Development

No branches or pull requests

3 participants