[Openal] Newbie-ish questions on distance models
ewing2121 at yahoo.com
Wed Sep 24 07:25:24 PDT 2003
Hi, can somebody explain to me how to think about the
distance models? I'm not terribly up on the theory
behind it. I've been starting at the specs and there
are analogies to DS3D, but unfortunately, I don't know
anything about DS3D either.
Staring at the equations for the distance models (and
also playing with the factors in my code), I still
don't have a good intuition about how to think about
the values, particularly AL_REFERENCE_DISTANCE, so I
can pick good ones for my application.
According to the doc, AL_REFERENCE_DISTANCE distance
is "the distance under which the volume for the source
would normally drop by half". However, looking at the
equation for AL_INVERSE_DISTANCE, I don't see this
happening. I see the equation reducing to G_dB =
AL_GAIN. I also see all distance values less than
AL_REFERENCE_DISTANCE being reduced to AL_MAX_GAIN
because AL_GAIN will get very large. Furthermore, when
I try playing it, my volume seems to be at full
magnitude, not half. Is this correct? If so, how do I
think about AL_REFERENCE_DISTANCE so I can pick a
value that works with my application in an intuitive
Also, I'm confused on the value of AL_GAIN. Is this
also AL_MAX_GAIN? And is AL_GAIN constrained between
0.0f and 1.0f I tried changing AL_GAIN directly, but
my results among the Linux and Windows distributions
were inconsistent. In the Linux (Loki) dist, AL_GAIN
seemed to act like a On/Off switch whereas the Windows
version gave me different volume levels between 0 and
1. If I used the AL_GAIN_LINEAR_LOKI define, this one
seemed to behave like Windows.
Finally, when actually playing with some values, I'm
not hearing what I think I should be hearing.
For example, I picked AL_ROLLOFF_FACTOR as 1.0,
AL_REFERENCE_DISTANCE as 200.0, Distance as 300.0. If
I punch in the values in my calculator and presume
AL_GAIN is 1.0, I get -2.5 which doesn't make any
sense to me, so assumed the volume would be 0.
However, when I play it, the sound is not Max_Gain,
but still very strong. By my math, my sound should
have cut out somewhere around distance=220, but in
reality, my sound is still quite audible even at much
higher numbers like 10000.
By the way, I've looked back at the mail archives and
there was discussion about a Linear distance model.
Has any progress been made on this?
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
More information about the Openal