| OpenAL Specification and Reference | ||
|---|---|---|
| <<< Previous | State and State Requests | Next >>> |
Samples usually use the entire dynamic range of the chosen format/encoding, independent of their real world intensity. In other words, a jet engine and a clockwork both will have samples with full amplitude. The application will then have to adjust Source GAIN accordingly to account for relative differences.
Source GAIN is then attenuated by distance. The effective attenuation of a Source depends on many factors, among which distance attenuation and source and Listener GAIN are only some of the contributing factors. Even if the source and Listener GAIN exceed 1.0 (amplification beyond the guaranteed dynamic range), distance and other attenuation might ultimately limit the overall GAIN to a value below 1.0.
AL currently supports three modes of operation with respect to distance attenuation. It supports two distance-dependent attenuation models, one which is similar to the IASIG I3DL2 (and DS3D) model. The application choses one of these two models (or can chose to disable distance-dependent attenuation effects model) on a per-context basis.
void DistanceModel ( enum modelName );
The following formula describes the distance attenutation defined by the Rolloff Attenutation Model, as logarithmic calculation.
G_dB = GAIN - 20*log10(1 + ROLLOFF_FACTOR*(dist-REFERENCE_DISTANCE)/REFERENCE_DISTANCE );
G_dB = min(G_dB,MAX_GAIN);
G_dB = max(G_dB,MIN_GAIN);
This is essentially the Inverse Distance model, extended to guarantee that for distances below REFERENCE_DISTANCE, gain is clamped. This mode is equivalent to the IASIG I3DL2 (and DS3D) distance model.
dist = max(dist,REFERENCE_DISTANCE);
dist = min(dist,MAX_DISTANCE);
G_dB = GAIN - 20*log10(1 + ROLLOFF_FACTOR*(dist-REFERENCE_DISTANCE)/REFERENCE_DISTANCE )
G_dB = min(G_dB,MAX_GAIN);
G_dB = max(G_dB,MIN_GAIN);
| <<< Previous | Home | Next >>> |
| Space and Distance | Up | Evaluation of Gain/Attenuation Related State |