Sound attenuation

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
bentusis
Prole
Posts: 2
Joined: Wed May 30, 2012 3:50 pm

Sound attenuation

Post 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
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Sound attenuation

Post 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.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Sound attenuation

Post 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.
Shallow indentations.
bentusis
Prole
Posts: 2
Joined: Wed May 30, 2012 3:50 pm

Re: Sound attenuation

Post 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 ?
Post Reply

Who is online

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