Page 1 of 1

A little problem regarding audio.

Posted: Mon Oct 03, 2011 12:48 am
by thegenius
I have this laser shooting spaceship, and a sound is supposed to play when the laser is fired. However, when there is only one source it only plays every few seconds. Making a new source every time in order to play it works, but it takes up a lot of memory. If anyone can provide a solution, I would be glad to hear it.

Re: A little problem regarding audio.

Posted: Mon Oct 03, 2011 2:14 am
by TechnoCat
thegenius wrote:I have this laser shooting spaceship, and a sound is supposed to play when the laser is fired. However, when there is only one source it only plays every few seconds. Making a new source every time in order to play it works, but it takes up a lot of memory. If anyone can provide a solution, I would be glad to hear it.
You can recycle old ones done playing right? http://love2d.org/wiki/TEsound

Re: A little problem regarding audio.

Posted: Mon Oct 03, 2011 3:10 am
by thegenius
TechnoCat wrote:
thegenius wrote:I have this laser shooting spaceship, and a sound is supposed to play when the laser is fired. However, when there is only one source it only plays every few seconds. Making a new source every time in order to play it works, but it takes up a lot of memory. If anyone can provide a solution, I would be glad to hear it.
You can recycle old ones done playing right? http://love2d.org/wiki/TEsound
I'm not sure I'd like to use an entire script to fix what seems to be a small problem. Is there any other way?

Re: A little problem regarding audio.

Posted: Mon Oct 03, 2011 3:52 am
by Ensayia
It's inherently the way the audio system works in LOVE. LOVE does not like to quickly start and stop audio sources, there is always a huge delay. The best way to do it is to create a new source every sound effect and have a way of clearing them all out when they are done playing, which frees up resources.

Taehl and I created TEsound to do just that. The current sound system is not very user friendly and the devs really have no intention of fixing it or writing a proper tutorial anytime soon.

EDIT: Retracting that statement.

Re: A little problem regarding audio.

Posted: Mon Oct 03, 2011 5:14 am
by slime
There are a few filetype-specific issues with sounds in LÖVE 0.7.2. One of them is that .wav files have a few seconds of silence at the end of them. You can call

Code: Select all

source:stop()
source:play()
to manually restart the sound.

Ogg files are the best-supported currently AFAIK. Most of the sound issues can be avoided by using ogg files.

The real problem here is the lack of documentation on the love.audio portion of the wiki, someone should fix that. :P

Re: A little problem regarding audio.

Posted: Mon Oct 03, 2011 6:00 am
by thegenius
slime wrote:There are a few filetype-specific issues with sounds in LÖVE 0.7.2. One of them is that .wav files have a few seconds of silence at the end of them. You can call

Code: Select all

source:stop()
source:play()
to manually restart the sound.

Ogg files are the best-supported currently AFAIK. Most of the sound issues can be avoided by using ogg files.

The real problem here is the lack of documentation on the love.audio portion of the wiki, someone should fix that. :P
Thanks, using .ogg files now, they work much better.