Once again, thank you nevon. This shouldn't be too difficult.nevon wrote:Not that I know what that piece of code does, but I suspect it turns off the garbage collector - which certainly wouldn't be a solution.
The reason the game crashed now, I suspect, is because your sound source is being cleaned up by the garbage collector after your function has been run - before it has stopped playing. To fix it, set up a sound queue, add every sound to that, remove the sounds once they've been played. Pretty simple.
Question about love.audio.rewind()
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Question about love.audio.rewind()
Re: Question about love.audio.rewind()
The lua manual is very specific in saying if the metatable field gc is 0, it will immediately force the garbage collector on that object... >_>nevon wrote:Not that I know what that piece of code does, but I suspect it turns off the garbage collector - which certainly wouldn't be a solution.
The reason the game crashed now, I suspect, is because your sound source is being cleaned up by the garbage collector after your function has been run - before it has stopped playing. To fix it, set up a sound queue, add every sound to that, remove the sounds once they've been played. Pretty simple.
Hello, I am not dead.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Question about love.audio.rewind()
Thanks for the information, but how would that help, exactly?zac352 wrote:The lua manual is very specific in saying if the metatable field gc is 0, it will immediately force the garbage collector on that object... >_>
Re: Question about love.audio.rewind()
This thread's gotten a bit off-topic. Bringing it back:
This is a known bug with LÖVE's WAV decoding, unfortunately. The easiest way to avoid that lag is to use a different audio format (may I recommend OGG?) - this will stop the Source as soon as it's done playing, instead of having the annoying delay WAV has. This would remove the need to generate a new Source every time the sound is played, and thus obviate the above argument about garbage collection.ninwa wrote:The problem I ran into at first was that this would only successfully play once every couple of seconds or so.
Nothing, it's the engine's fault - in 0.6.2, love.audio.rewind always rewound every Source, not just the one you specified. That's been fixed in the 0.7.0 beta. (You can still call love.audio.rewind with no arguments to rewind everything.)ninwa wrote:This worked, however it also rewinds my background music and any other audio sources for that matter.
What am I doing wrong?
Re: Question about love.audio.rewind()
Thank you Anjo. I will gladly convert the audio files to ogg (they're smaller anyway, why wouldn't I?) I appreciate the response.anjo wrote:This thread's gotten a bit off-topic. Bringing it back:
This is a known bug with LÖVE's WAV decoding, unfortunately. The easiest way to avoid that lag is to use a different audio format (may I recommend OGG?) - this will stop the Source as soon as it's done playing, instead of having the annoying delay WAV has. This would remove the need to generate a new Source every time the sound is played, and thus obviate the above argument about garbage collection.ninwa wrote:The problem I ran into at first was that this would only successfully play once every couple of seconds or so.
Nothing, it's the engine's fault - in 0.6.2, love.audio.rewind always rewound every Source, not just the one you specified. That's been fixed in the 0.7.0 beta. (You can still call love.audio.rewind with no arguments to rewind everything.)ninwa wrote:This worked, however it also rewinds my background music and any other audio sources for that matter.
What am I doing wrong?
Who is online
Users browsing this forum: Google [Bot] and 50 guests