How to detect end of sound? (SOLVED)

Well, it’s in the title :slight_smile:

More detail : I need to play musics that loop, but with an intro that doesn’t loop.
So I have two sound object : one for the intro, and one for the loop. Only the loop has the “Looping” box checked, of course.
My idea is to play the intro, and when it is finished playing, to play the loop.
So I was hoping for a way of detecting that a sound has finished playing (like a message, for example), but I haven’t found anything.

Can you help me ?

1 Like

There’s currently no good way to know when a sound has finished playing.
The only option I currently know is to set a timer manually to get a callback.

1 Like

I was hoping you wouldn’t say that :frowning:

Well there really are a few missing feature in sound playback, the most basic one would be the ability to know if a sound is being played.
Others that come to mind: receiving a message when the sound is finished playing, the ability to get or set the current playback time, etc…

3 Likes

You can use OpenAL extension and get source.time and source.state - state will be set to"stoppped" when the source.is_looping is set to false and the sound ends :wink: Then, to check it, probably use timer or update function as well.

6 Likes

Solved in 1.2.161

3 Likes