Page 1 of 1

Sound attenuation

Posted: Wed May 30, 2012 3:59 pm
by bentusis
Hi all,

I can't make the sound attenuation system work.
This is what I do :

Code: Select all

--Setting global sound options
love.audio.setPosition(400, 300, 0)
love.audio.setDistanceModel("exponent")
[...]

--Loading and playing the sound
self.idle_src = love.audio.newSource("res/tank/idle_loop.ogg", "static")
self.idle_src:setLooping(true)
self.idle_src:setDistance(10,100)
self.idle_src:setVolume(0.5)
self.idle_src:setRolloff(0)
self.idle_src:play()

[...]
--Updating sound source position
self.idle_src:setPosition(self.x, self.y, 0)
When I move my entity the volume remain the same.
Any idea ?

Thanks

Re: Sound attenuation

Posted: Wed May 30, 2012 4:35 pm
by TechnoCat
I used sound attenuation in this demo: viewtopic.php?f=3&t=8769&p=54575#p54575
It is really brief, so check it out.

Re: Sound attenuation

Posted: Wed May 30, 2012 5:01 pm
by Boolsheet
This is a moment where working code would help us to point out the problem. Like the forum rules suggest, do attach a .love next time and all will better. ;)

I'm guessing you are using a stereo source. Only mono sources will be positioned in the 3D space.

Re: Sound attenuation

Posted: Wed May 30, 2012 5:33 pm
by bentusis
I posted the code relative to the sound. I didn't think you would need my whole project.
I found the problem btw, it comes from my sound file.

If I use the one supplied in TechnoCat example, it works flawlessly.
So do the sound file needs something special ?

Edit:
Didn't saw the second part of your message before posting.
Thanks for the help ! I'll try that.
Maybe this should be added to the wiki ?