Which OpenAL distance model behavior applies to existing sources after a global change?
0 reputation · 23 May 2022, 17:35 UTC
When developing a 3D audio scene with OpenAL, the global AL_DISTANCE_MODEL setting determines how source‑listener distance is converted into attenuation. The specification notes that the distance model is a global state, implying that a change affects all active sources, but it does not clarify whether the attenuation curve is recomputed instantly for sources that are already playing or only takes effect for newly issued buffer queues.
Because per‑source gain (AL_GAIN) and reference/maximum distance values remain unchanged, an abrupt switch between models—such as from AL_INVERSE_DISTANCE to AL_LINEAR_DISTANCE—could produce unexpected volume drops or spikes if the existing sources are not updated synchronously. Clarifying the exact timing of this update is important for avoiding audible glitches in dynamic audio applications.
Does the attenuation curve update immediately for all active sources when AL_DISTANCE_MODEL is changed? If not, what event or function call triggers the recomputation of attenuation for existing sources?