rodio
rodio copied to clipboard
Callback/signal when sink finishes playback of a sound
This would be useful for implementing continuous playback type functionality. e.g. always keep a sound queued up and only enqueue when a sound finishes to minimize polling. Looks like this is sort of already done with the inner Queue class, so would it make sense to expose similar functionality at the sink level?
I'm considering implementing a simple loop functionality (using the existing methods in Queue). Would this fit your needs or do you need a callback ability that can not be met by the sleep_until_end() function?
(Not a project contributor. I've only just started working with rodio so perhaps it already has looping functionality I haven't discovered.)
I don't think sleep_until_end will cut it. Unless I'm wrong, you need to hold a reference to the sink while it waits, that means you can't pause/play/append more stuff to the sink in the meantime.
Also from the doc it's not entirely clear if it stops waiting when being stopped/cleared or if one sound is played to the end, or when the entire queue ends.
I would like to have a callback/singal that fires after a source ends playing, so I can load in the next file from a playlist and only keep a few sources in memory.