Is there way to add a song to a queue?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Egg_Spoon
Prole
Posts: 2
Joined: Wed Aug 30, 2023 5:57 pm

Is there way to add a song to a queue?

Post 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()
Last edited by Egg_Spoon on Wed Aug 30, 2023 9:35 pm, edited 1 time in total.
User avatar
dusoft
Party member
Posts: 655
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

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

Post by dusoft »

User avatar
darkfrei
Party member
Posts: 1204
Joined: Sat Feb 08, 2020 11:09 pm

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

Post by darkfrei »

Make the function to check it:
viewtopic.php?p=168187#p168187
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
Egg_Spoon
Prole
Posts: 2
Joined: Wed Aug 30, 2023 5:57 pm

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

Post by Egg_Spoon »

alright I got it working, tysm :>
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], steVeRoll and 7 guests