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

Audio AudioNode stop with delay #29375

Closed
tatsmaki opened this issue Sep 9, 2024 · 0 comments · Fixed by #29376
Closed

Audio AudioNode stop with delay #29375

tatsmaki opened this issue Sep 9, 2024 · 0 comments · Fixed by #29376
Milestone

Comments

@tatsmaki
Copy link
Contributor

tatsmaki commented Sep 9, 2024

Description

Some features of WebAudio API are missing.
E.g. https://developer.mozilla.org/en-US/docs/Web/API/AudioScheduledSourceNode/stop
This is important for the use cases like fading audio.

To do this using Three.js Audio API I have to duplicate underlying Audio.stop()

three.js/src/audio/Audio.js

Lines 172 to 179 in bac758d

if ( this.source !== null ) {
this.source.stop();
this.source.onended = null;
}
this.isPlaying = false;

 const { currentTime } = listener.context;
 
 if (audio.source) {
    audio.source.stop(currentTime + 1);
    audio.source.onended = null;
    audio.isPlaying = false;
 }

Solution

I would like to achieve the same result using

audio.stop(1);

as if it was using AudioScheduledSourceNode interface

Alternatives

None

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants