It looks like you're new here. If you want to get involved, click one of these buttons!
function Sound:playWithLoopCount(startTime, nbLoops) nbLoops = nbLoops or 1 local soundLength = self:getLength() local channel = self:play(startTime, true) -- loop infinitely -- set looping as false after (loops - 0.5) count Timer.delayedCall((nbLoops - 0.5) * soundLength, function() channel:setLooping(false) end) return channel end |
Comments
Timer.stopAll() would be useful, but I need to stop a specific timer in this case as you guessed.
@ar2rsawseen
Thanks.
1. Do you think this is something that should be modified at the level of the implementation in GiderosCodingEasy?
I feel the ability to cancel the call is important.
Ex : my sound is looping. I change scene and want to stop the sound, remove it from the scene, nil it, cancel the call.
It would be really convenient to have it as a property of sound.
Or maybe return it with the channel?
return channel, timer
2. Edit : solved, I had misunderstood your example.
Hod did you solve it?
I was referring to my (2) only.
What do you think about modifying the implementation in GiderosCodingEasy to :