-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix: prevent AudioBufferSourceNode
to restart when loop is set to true
#521
Conversation
…ted by setting loop to true cf. ircam-ismm/node-web-audio-api#135
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, looks good. I will apply some fixes for CI and something around the guard
src/node/audio_buffer_source.rs
Outdated
&& (computed_playback_rate > 0. && buffer_time >= buffer_duration | ||
|| computed_playback_rate < 0. && buffer_time < 0.) | ||
{ | ||
self.ended = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move the send_ended_event()
to here right? So the event is spawned directly and not in the next quantum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure we could I think, I just don't remember why we did it this way in the first place :) do you thing it is better?
I think the before_drop
stuff would just becomes useless in this case...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the before_drop stuff would just becomes useless in this case...
Hum, no there are still some cases where is it needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok done, allowed to remove the additional onended_triggered
flag too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just don't remember why we did it this way in the first place :)
I think it was just inconvenient in the process fn. We had multiple return points so the code would have to be duplicated. That is now different.
Ah I realize you lag behind the |
Damn, sure I'll fix that |
This fixes ircam-ismm/node-web-audio-api#135
and maybe ircam-ismm/node-web-audio-api#134 (TBC)
There are new unrelated clippy issues that I didn't fixed, mostly small doc things but one that concerns
transmute
that I think it is better that you check, let's do that in another PR?