Re: Units for position?
Chris Robinson <[email protected]> Sat, 29 Dec 2012 18:16:13 -0800
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
On 12/29/2012 04:12 PM, [email protected] wrote: > Hey all! > > I hope you are in the midst of having a great holiday season! Hi! :) > I've been working on a demo, and it occurs to me that I have no idea what > units are used in the position coordinates, nor how to set or change them > if I need to use something different. In practical terms, unextended OpenAL uses scale-invariant units. That is to say, it doesn't matter whether you're using meters, feet, centimeters, inches, etc... as long as /all/ distance values use the same scale, you'll get the same output. A common pitfall, however, is to ignore or set an improper value for AL_REFERENCE_DISTANCE on sources. This is essentially the distance from the sound that the audio was originally recorded at, or more basically, the in-game distance where the source should not be attenuated. So for example, if you had this set to 1 when using a scale of 1 unit = 1 meter, you'd want to set it to 100 if using 1 unit = 1 centimeter to keep the scale correct. When using EFX, there is a setting to specify the unit scale. This setting applies to certain effects, like the air absorption effect which defines high-frequency attenuation in meters rather than units. This scale can be set using the listener's AL_METERS_PER_UNIT property, and it defaults to 1. > So what surprised me is that these distances seem to be "too far away" - > the volume attenuation basically shuts the sounds off. If I use arbitrary > but small numbers FC=(0, 0, 1) BC=(0,0,3), LT=(-1,0,2), RT=(1,0,2) it > seems to work OK. Then you'll want to increase the source's AL_REFERENCE_DISTANCE until you get good attenuation levels. Every doubling of the distance from the reference distance halves the gain, so at a distance of 10 with a ref distance of 1, you'll basically have an attenuation of 1/10, or 0.1. Increase the ref distance to 5 and you'll get an attenuation of 5/10, or 0.5, at the same distance. _______________________________________________ Openal mailing list [email protected] http://opensource.creative.com/mailman/listinfo/openal