Detect end of sound


#1

Get end sound in any way(message or callback)


#2

You could always create a timer with the length of the intro and run in at the same time as the sound.

But maybe there’s a way to get the callback directly from the sound.


#3

Yes i can, but for that i need to know sound lenght


#4

Don’t you?


#5

I actually did this myself when making Operator.

It turned out beautifully, but at the same time, it did require some hacking together to make alarm timings that managed to loop sounds. That is made a bit easier now with an actual built-in alarm (I had made one myself).

I’m told that FMOD is the best, if not the only sound manager asset for Defold. That might have some sort of “get sound length” feature. I might experiment with this.


#6

We will make several improvements to audio playback during 2019. Getting a callback when a sound is finished is among them.


#7

If you use FMOD it’s really easy to tell when a sound is playing or not.

if sound:get_playback_state() == fmod.STUDIO_PLAYBACK_STOPPED …


#8

I look at fmod. But not try it yet. It looks big and complex, for me.


#9

It is pretty easy once you get it. If you have questions ask me and I can help.