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

FlxTypeText doesn't play sounds frequently enough for HTML5 targets #389

Open
Poobslag opened this issue May 23, 2023 · 1 comment
Open

Comments

@Poobslag
Copy link

In HTML5 projects, FlxTypeText will play typing sounds very sparsely -- only about half as frequently as other targets such as Flash.

This appears to be caused by a bug in FlxSound, which continues continue playing a sound past the sound's length. Even if a sound is only 25 ms, it will continue playing and the FlxSound.time value will progress to 35, 45, and 55 ms before finally stopping.

This applies to playing .wav files when the finishSounds flag is set, I have not tested the issue with .mp3 or .ogg files.

@Poobslag
Copy link
Author

I have workaround this bug in my game by amending FlxTypeText to include the following code:

-					FlxG.random.getObject(sounds).play(!finishSounds);
+					var sound:FlxSound = FlxG.random.getObject(sounds);
+					#if flash
+					sound.play(!finishSounds);
+					#else
+					sound.play(!finishSounds || (sound.time > sound.length));
+					#end

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