New SoundListener event, soundEnded()


23-12-2013 02:00:57

I would like to propose a new event to be added to OgreOggISound::SoundListener, soundEnded(). This would be called when the sound has finished playing by reaching the end of the file (would never be triggered if it's looping). I currently need this event because, as far as I can tell, it's impossible otherwise to tell when a sound has played to the end of the file. I tried to use soundStopped() by checking that the current position is at the end of the file, but I noticed the position is always being reset to zero before calling it so that doesn't work. It's also not a very reliable way of checking since, even though it's nearly impossible, it's possible for the user to just happen to stop the sound right at the value being checked for. I also tried making the sound loop and just stopping it once soundLooping() is called but it doesn't stop cleanly. You can hear the first part of the song for a brief moment before it stops.

If there's some other existing method for being notified when a sound has reached the end that I should be using instead then please let me know. IHere's a patch including the proposed changes.


06-01-2014 17:22:29

Agreed, this would be useful and is now added.