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

Adding Sound will stop the SoundChannel through the buffer during the close method execution. #2706

Merged
merged 4 commits into from
Jul 8, 2024

Conversation

rainyt
Copy link
Contributor

@rainyt rainyt commented May 11, 2024

Fixed the issue where SoundChannel may cause SoundMixer to close during playback the __soundChannels array will not be removed, ultimately causing the audio to reach its maximum limit and unable to play the audio.

Like this:

var sound:Sound = openfl.Assets.getSound("assets/sound.mp3");
sound.play();
sound.close();
// The audio length is 1, but the correct value should be 0. 
// After the audio is turned off, you will never receive an audio playback completion event.
trace(@privateAccess SoundMixer.__soundChannels.length);

@joshtynjala joshtynjala merged commit 2e10541 into openfl:develop Jul 8, 2024
24 checks passed
EliteMasterEric pushed a commit to FunkinCrew/openfl that referenced this pull request Jul 29, 2024
… close method execution. (openfl#2706)

* When turning off the audio stream, the audio channel should be turned off through a buffer.

* Add __unregisterSoundChannelByBuffer method.

* Use __audioSource.

* SoundMixer: code style

---------

Co-authored-by: Josh Tynjala <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants