[openal] distance model questions

Victorious dtvictorious at gmail.com
Mon May 25 03:34:06 EDT 2015


I've just implemented it, and it works very well for simulating axis-aligned planes/lines/solids, except for the fast panning. How do I do the interpolation for this case to prevent it? There are 3 values - x/y/z range, 1 sound radius value for each axis.

-----Original Message-----
From: openal [mailto:openal-bounces at openal.org] On Behalf Of Chris Robinson
Sent: Sunday, May 24, 2015 10:01 PM
To: openal mailing list
Subject: Re: [openal] distance model questions

On 05/24/2015 06:06 AM, Victorious wrote:
> I have a river on the left edge of a 10x10 grid. What I want to have 
> is a single sound source for the river that plays towards the left 
> when you're near the left edge (i.e a line segment of 10 units)

In that case, you can simply place the source at the closest point on the line to the listener. The easiest way to handle a sound that covers a convex area is to do a point-to-line (or plane or volume) test to find the closest point in the source area to the listener, and set the set the source position to that point.

For axis-aligned areas, you should be able to merely take the listener position and clamp the individual X, Y, and Z values to the source's world extents. i.e.

sourceX = clamp(listenerX, x - x_range, x + x_range); sourceY = clamp(listenerY, y - y_range, y + y_range); sourceZ = clamp(listenerZ, z - z_range, z + z_range);

where x, y, z is the center location of the sound, x_range, y_range, z_range is the radius for each axis (which must be >= 0), and sourceX, sourceY, sourceZ is the resulting position to set on the source.
_______________________________________________
openal mailing list
openal at openal.org
http://openal.org/mailman/listinfo/openal



More information about the openal mailing list