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

Canceling a running (slow) fade operation #1543

Open
suterma opened this issue Dec 28, 2021 · 1 comment
Open

Canceling a running (slow) fade operation #1543

suterma opened this issue Dec 28, 2021 · 1 comment

Comments

@suterma
Copy link

suterma commented Dec 28, 2021

While #363 addresses the situation of a fade-in after a fade-out I still would like to have the possibility to cancel a current fade operation.

My scenario is this: I have a running, slow fade-out, but then, after a user input, I would like to stop the sound altogether.

Now this works, the sound is silent, but the fade operation is still running. When, after a short time, the sound should play again, before the fade operation actually ends, the incoming play operation is then immediately fading with the "old" fade.

There should be a possibility to cancel all pending fade operation, either as separate call or as (optional) part of the existing stop operation.

@suterma
Copy link
Author

suterma commented Dec 29, 2021

I have found out, that starting a new fade operation cancels the previous one, so I can do:

        const currentVolume = this.sound.volume();
        this.sound.fade(currentVolume, 0, 0);

to immediately fade to zero, effectively cancel any previous fade.

This possibility should be better addressed in the docs or even offered as it's own method.

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

No branches or pull requests

1 participant