Issue with Sound Delays
- Kjell Granlund
- Prole
- Posts: 33
- Joined: Tue Jan 08, 2013 12:39 am
- Location: Virginia Beach, VA USA
Issue with Sound Delays
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 84 times
Re: Issue with Sound Delays
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:
The second argument to love.audio.newSource for a streaming source is actually "stream":
Also, .love files are renamed .zip files, .rar files won't work.
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)
Code: Select all
bgm1 = love.audio.newSource("BGM1.ogg", "stream")
- Kjell Granlund
- Prole
- Posts: 33
- Joined: Tue Jan 08, 2013 12:39 am
- Location: Virginia Beach, VA USA
Re: Issue with Sound Delays
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
** 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
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests