Sound not playing

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Anxiety
Prole
Posts: 49
Joined: Sat Apr 02, 2011 9:36 am
Location: Finland

Re: Sound not playing

Post by Anxiety »

Anyone? I really want for it to work (who doesnt?).
I can't come up with a good signature!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Sound not playing

Post by Robin »

Thanks for the .love. Also, don't worry if no-one replied for a few hours. This is still a forum. Plus, it was around dinner time for most of us.

I looked at it but couldn't find the exact cause. :( Maybe someone else can help.
Help us help you: attach a .love.
User avatar
Anxiety
Prole
Posts: 49
Joined: Sat Apr 02, 2011 9:36 am
Location: Finland

Re: Sound not playing

Post by Anxiety »

Aww D:
I can't come up with a good signature!
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Sound not playing

Post by TechnoCat »

do this instead

Code: Select all

Source:stop()
Source:play()
You might not be able to rewind statics.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Sound not playing

Post by Taehl »

Use TEsound and worry no more.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
EmmanuelOga
Citizen
Posts: 56
Joined: Thu Apr 22, 2010 9:42 pm
Location: Buenos Aires, Argentina
Contact:

Re: Sound not playing

Post by EmmanuelOga »

The easiest is create the source each time you want to play it. Otherwise you need to checkout if the sound is playing, if it is, create a new source for the source file, in order to get the same sound to play more than once, etc...

Code: Select all

function shot_sound()
	love.audio.newSource("sound/glock18.wav", "static"):play()
end

function reload1()
	love.audio.newSource("sound/glock_clipin.wav", "static"):play()
end

function reload2()
	love.audio.newSource("sound/glock_clipout.wav", "static"):play()
end
you can call those methods each time you want to play. Garbage collection should take care of the rest.
shoot.love
shoot!
(51.17 KiB) Downloaded 154 times
--------------------------------------------------------------------------------------------------------
http://EmmanuelOga.com
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests