Issue with Sound Delays

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Kjell Granlund
Prole
Posts: 33
Joined: Tue Jan 08, 2013 12:39 am
Location: Virginia Beach, VA USA

Issue with Sound Delays

Post 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.
Attachments
Battle System 1.2.love
(859.21 KiB) Downloaded 85 times
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Issue with Sound Delays

Post 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. ;)
User avatar
Kjell Granlund
Prole
Posts: 33
Joined: Tue Jan 08, 2013 12:39 am
Location: Virginia Beach, VA USA

Re: Issue with Sound Delays

Post 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 :oops:
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests