FlxTypeText doesn't play sounds frequently enough for HTML5 targets
Poobslag opened this issue · 1 comments
Poobslag commented
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 commented
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