Looping with loopTime doesn't work
-
Hello,
I'm trying to play a file once from the start and then loop it from a fixed point:
var sound:FlxSound = new FlxSound(); sound.loadEmbedded("assets/sounds/tone.wav"); sound.looped = true; sound.loopTime = 500; sound.play();
Any idea why this isn't working? The loop plays twice from 0-length and then stops.
-
After some experimenting:
-
Documentation is wrong.
loopTime
is in seconds, not milliseconds. -
It seems it's
openfl.audio.Sound
that's flawed -- callingplay
with any number of loops works fine, but playing the same sound multiple times results in a cutoff at the end, as well asEvent.SOUND_COMPLETE
not being called.
edit
All this seems to apply only to
next
for whatever reason.
-
-
Documentation is wrong.
loopTime
is in seconds, not milliseconds.I can't reproduce that. Is that on specific target?
I've tested this by adding the following code to Mode's
PlayState#create()
. Tested on Flash and Neko (legacy).FlxG.console.autoPause = false; FlxG.watch.addExpression("FlxG.sound.music.time", "time"); FlxG.watch.addExpression("FlxG.sound.music.length", "length"); // may require dev flixel FlxG.watch.addExpression("FlxG.sound.music.loopTime", "loopTime");
You can then play around with
loopTime
using the debugger console (by runningFlxG.sound.music.loopTime = 2000
) for instance. This seems to work as expected.
-
Update: I can reproduce this with
-Dnext
. Reported to OpenFL: https://github.com/openfl/openfl/issues/1290