Sound Pool (manager)

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
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Sound Pool (manager)

Post by AlexYeCu »

Does anyone know a lib or a method for love 2d to organize sound pool?
For example, we need to play one sound several times. And next playing should start before this sound ends.
So, after checking playing status, we can start stopped sound again or, if it still playing, create a copy of it's source and start to play the copy. The quantity of copies is limited, so if we are out of limit, the stop last sound in a pool and start it from initial position.
User avatar
Nikki
Citizen
Posts: 84
Joined: Wed Jan 25, 2017 5:42 pm

Re: Sound Pool (manager)

Post by Nikki »

Not a pool implementation, but are you aware you can use clone() on the Source ?
that way you can play the same sound many times

https://love2d.org/wiki/Source:clone
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Sound Pool (manager)

Post by AlexYeCu »

Well, as I understand, I should then manually remove all clones?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Sound Pool (manager)

Post by zorg »

You could put all clones in a table with the original one, and you can check which of them finished in a loop, and if you found one, call play on that, otherwise clone another one; you could make a tiny lib to do this too if you wanted to; alternatively there are a few libs that support these but i dont use them myself.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Sound Pool (manager)

Post by AlexYeCu »

zorg, you've described how the SoundPool should work. I know this, but I do not want to do it myself if someone did it before.

>alternatively there are a few libs

What libs? I've found noone.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Sound Pool (manager)

Post by zorg »

https://github.com/drhayes/TESound - Apparently this creates new Source objects each time you call it... not the best implementation and i never recommend it, but i will mention it at the very least.
https://github.com/Ulydev/wave - A decent lib, but very specific; it does support instances but the implementation's a bit complicated.

I'd go with https://github.com/tesselode/ripple since it has a very neatly designed API, and also supports tons of features, instancing and tagging as well. (not to mention that this one does implement pooling how i explained it previously :3)

However if you just want pooling, and not the other stuff, it's faster to just implement it yourself. :P
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests