Page 1 of 1
Issue with Sound Delays
Posted: Thu Jan 10, 2013 6:35 pm
by Kjell Granlund
First of all, I am new to Love and programming. I started last week with a 'hello world'. I have never programmed before so please consider that. Anyways I have an issue with the sound. When I press a key a sound plays. If I hit the key the sound plays again. But if I hit the key over and over the sound only plays every two seconds. Why is it not playing everytime I hit the key? I will upload my love for the game I am working on. The controls are arrow keys and 'F' key to fire. Hope someone can offer some help. I am stumped on this one.
Re: Issue with Sound Delays
Posted: Fri Jan 11, 2013 12:26 am
by Santos
Welcome!
Playing a Source while it's already playing doesn't do anything, so the sound continues until it stops, and then you can play it again, hence why it can be played only every 2 seconds. So, to replay the Source, you can stop it before playing it:
Code: Select all
love.audio.stop(laser1)
love.audio.play(laser1)
The second argument to love.audio.newSource for a streaming source is actually "stream":
Code: Select all
bgm1 = love.audio.newSource("BGM1.ogg", "stream")
Also, .love files are renamed .zip files, .rar files won't work.
Re: Issue with Sound Delays
Posted: Fri Jan 11, 2013 9:15 pm
by Kjell Granlund
Thanks. I will look into that and test. If I have any other issues I will be sure to let you know. Thanks again
** Indeed that was the issue and I was able to fix it. Also thanks for telling me about the rar bit. Haha I am such a noob. I also managed to pack my first exe version of it. Well back to codding! And yeah I fixed the streaming to stream