rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Callback/signal when sink finishes playback of a sound

Open glalonde opened this issue 4 years ago • 5 comments

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?

glalonde avatar Mar 24 '20 19:03 glalonde

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.)

doylep avatar Jun 27 '20 20:06 doylep

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.

mxnemu avatar Dec 21 '23 00:12 mxnemu