[openal] distance model questions
dtvictorious at gmail.com
Thu May 28 05:50:18 EDT 2015
That worked like a charm, thanks.
If the gain is set to 0, it is completely muted. Is the source still considered playing?
On a related question, what is the maximum number of sounds that can be played on windows 8.1?
From: openal [mailto:openal-bounces at openal.org] On Behalf Of Chris Robinson
Sent: Wednesday, May 27, 2015 9:33 AM
To: openal mailing list
Subject: Re: [openal] distance model questions
On 05/26/2015 11:40 AM, Victorious wrote:
> let actual distance = 5, max distance = 4 and scale = 2. So source
> should be silent at distance of 6. gain = max(1.0 - (5 - 4)*2, 0.0)
> which evaluates to 0.0; the sound is silenced at a distance of 5, not
Right, that should be / instead of *. My bad.
On 05/26/2015 12:35 PM, Victorious wrote:
> Hm, just thought of this: could the following be better?
> The inverse rolloff clamped model is used when distance(source, > listener) <= threshold% of sound's hearing range. Otherwise, a custom > formula or an alternative distance model is used.
That's basically what my latter suggestion does. It uses inverse distance up to max_distance, and then becomes linear.
> I plugged some numbers into the linear models, and it looks like gain > doesn't hit 0 when sound is at max_distance (not sure why I thought > it did).
> // with a rolloff factor of 1,
> gain = (1 - (distance - referenceDistance) / (maxDistance - > referenceDistance)); > > Looks like the only way to have 0 gain is if refDistance = distance > and/or maxDistance = referenceDistance.
Nope, you're missing the '1 -' part. When distance = maxDistance, you get:
gain = (1 - (distance-refDistance) / (maxDistance-refDistance)); gain = (1 - dist_from_ref / dist_from_ref); gain = (1 - 1); gain = 0; _______________________________________________
openal mailing list
openal at openal.org
More information about the openal