Page 1 of 1

Is there way to add a song to a queue?

Posted: Wed Aug 30, 2023 7:09 pm
by Egg_Spoon
I want to have one song play after another, however I can't find a way to do that. Currently I just have sounds.song1:play() to play the first song, but if I want to add a song2, I can't find a way to time it so it plays after. Is there a way to sort of queue the song, or at least detect when the first one has ended so I can play the second one after?

I'm clearly new to LÖVE, this is very soon after I added audio at all.

Edit: Solved, used Source:isPlaying()

Re: Is there way to add a song to a queue?

Posted: Wed Aug 30, 2023 8:16 pm
by dusoft

Re: Is there way to add a song to a queue?

Posted: Wed Aug 30, 2023 8:22 pm
by darkfrei
Make the function to check it:
viewtopic.php?p=168187#p168187

Re: Is there way to add a song to a queue?

Posted: Wed Aug 30, 2023 8:25 pm
by pgimeno
As darkfrei implies, for this purpose I'd suggest to use Source:isPlaying() in love.update and play the next when the current one stops playing, because you can certainly afford a one frame delay between songs, rather than going into the complications of queueable sources.

Re: Is there way to add a song to a queue?

Posted: Wed Aug 30, 2023 9:34 pm
by Egg_Spoon
alright I got it working, tysm :>