Discussion:
new openal programmer: no attenuation
Christopher Howard
2012-10-13 02:25:40 UTC
Permalink
Hi. Hopefully this is the correct place to ask really basic OpenAL/ALUT
programming questions. I'm using them through Haskell language bindings.
Of course, I don't expect you guys to support foreign language bindings,
but I'm hoping my problem stems from some stupid, obvious mistake or
oversight, rather than a module specific issue.

In short: My app plays sources without any trouble. Also, I can manually
set the gain of individual sources. However, I don't seem to be getting
any distance based attenuation at all. The volume of the source always
sounds the same regardless of the distance between source and listener.
I'm hoping I have made some common newbie configuration oversight or
mistake.

My system:
Gentoo Gnu/Linux amd64
openal-1.13 from strangesoft.net
freealut-1.1.0-r1

Stuff I do in my program:
- initialize ALUT
- load buffers from files with ALUT loader
- set distance model to exponential (I've tried a few others as well)
- create source for object and attach buffer to it
- set source relative to listener
- set reference distance of source to reasonable value (though I've
tried various other large and small values)
- connect source position of source to coordinates of object (this is
updated every step of the event loop) that moves around
- connect listener position to coordinates of a difference object
(updated every step) that moves around
- play source when appropriate
--
frigidcode.com
indicium.us
Chris Robinson
2012-10-13 03:40:27 UTC
Permalink
Post by Christopher Howard
In short: My app plays sources without any trouble. Also, I can manually
set the gain of individual sources. However, I don't seem to be getting
any distance based attenuation at all. The volume of the source always
sounds the same regardless of the distance between source and listener.
I'm hoping I have made some common newbie configuration oversight or
mistake.
Hi.

The first thing to check is to make sure the sound is mono. Stereo
sounds won't attenuate with distance.
Post by Christopher Howard
- set source relative to listener
Also to note, you'll want to set this only when you want the source
position to be relative to the listener, e.g. a source position of
{1,0,1} will always make the source sound like it's to the back-right of
the listener, regardless of where the listener is.

If the source and listener are being given absolute world positions, you
want to leave AL_SOURCE_RELATIVE at AL_FALSE.

Loading...