[SOLVED] Question about love.audio

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
User avatar
ChicoGameDev
Citizen
Posts: 70
Joined: Thu Feb 14, 2019 6:02 pm
Location: Switzerland
Contact:

[SOLVED] Question about love.audio

Post by ChicoGameDev »

Hi everybody,

I'm actually experimenting with sound effects... It's the first time of my whole gamedev journey that I'm actually adding sound to a game.

I was probably naive to think that if I create a "loot" sound effect and play it every time my player loot an item, that it will play exactly the number of time that it was requested...

So I've done that and when my player run across multiple items the sound effects play once for 5 looted items. I mean, the sound have to be completely played to be played again.

Does someone have a idea to overlap sound effects or something similar that is more reactive ?

Thanks in advance.


Regards,
Last edited by ChicoGameDev on Wed Mar 18, 2020 11:36 am, edited 1 time in total.
Lionel Leeser

Luven : https://github.com/chicogamedev/Luven

--

Always keep Game Dev as a passion.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Question about love.audio

Post by zorg »

As you said, one Source object can only play one instance of a sound at once; you can either rewind and start the source again, or you can use Source:clone to clone a Source, and play that when another instance of the same sound needs to be played while another's still playing. It might also be a good idea to save these into a table or something so you don't create too much garbage.
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.
User avatar
ChicoGameDev
Citizen
Posts: 70
Joined: Thu Feb 14, 2019 6:02 pm
Location: Switzerland
Contact:

Re: Question about love.audio

Post by ChicoGameDev »

I understood that shortly after posting this question.

Thanks for the clone idea tho !

I made me a little function that check if the sound is already playing if it is the case it stop it to play it again, it's perfect.


Regards,
Lionel Leeser

Luven : https://github.com/chicogamedev/Luven

--

Always keep Game Dev as a passion.
Post Reply

Who is online

Users browsing this forum: No registered users and 228 guests