Non-constructible collection of audio-level constants and helpers.
- Note
- Canonical rule: all audio levels are stored on disk and in code as dBFS (decibels relative to digital full-scale, with 0 dBFS being the loudest sample the audio pipeline can represent and negative values attenuating). VR-Vantage presents a single display scale (dBFS) in every widget and HUD; there is no separate authoring display mode. Every persisted numeric level in a configuration file, procedural-soundscape JSON entry, or widget-independent internal API is dBFS.
-
kFullScaleDbfs (0 dBFS) is the DAC full-scale reference used by the physical audio math (linear-gain conversion, dynamic-range clamping, and so on). It is NOT the authoring ceiling. The authoring ceiling is kVoiceBoostCeilingDbfs (+12 dBFS), which matches Wwise / Unreal Engine / FMOD Studio voice-fader conventions and lets users deliberately push a voice above digital full scale, accepting the DAC hard-clip trade-off in exchange for the extra headroom.
-
Industry parity: distance-attenuation curves controlled through this class mirror the parameters exposed by Unreal Engine's USoundAttenuation (FalloffDistance / MinAttenuationDistance), FMOD's Min/Max Distance, Wwise's Attenuation ShareSet, and OpenAL's AL_REFERENCE_DISTANCE / AL_MAX_DISTANCE. Names in this class deliberately track that shared vocabulary so cross-tool authoring intent is preserved.
| static void makVrv::DtAudioLevel::applyAttenuation |
( |
makAudio::DtSound & |
sound, |
|
|
float |
minDistM, |
|
|
float |
maxDistM |
|
) |
| |
|
static |
Apply per-sound reference distance and a derived rolloff factor to a live sound.
Reaches the underlying makAudio voice via DtSound's public setReferenceDistanceOverride and setRolloffFactorOverride and pins the distance-model anchor and curve steepness directly, bypassing the physical-propagation model derivation. Idempotent; safe to call before or after play(). A minDistM equal to kUseDefaultDistance (or otherwise non-positive) leaves the reference distance at makAudio's physical-model derivation.
When BOTH minDistM and maxDistM are authored, this call also computes a rolloff factor via computeRolloffFactor() and pushes it to the voice via setRolloffFactorOverride(). The authored [min, max] range describes the audible envelope: at min the sound plays at unity, and the rolloff is derived so that the gain at max is kMaxDistanceGainTarget (-60 dBFS by default). Beyond max, gain continues to attenuate naturally rather than being clamped.
maxDistM is pushed to makAudio::DtSound::setMaxFalloffDistanceOverride so the authored max becomes the voice-cull boundary: the sound is audible out to max and culled beyond it. The derived rolloff shapes the falloff curve within [min, max]; kMaxDistanceGainTarget is set low enough (-60 dBFS) that the sound is near-inaudible at max, so the cull is not perceived as a step.
- Parameters
-
| [in,out] | sound | The live 3D sound whose distance model should be overridden. |
| [in] | minDistM | Reference distance in metres, or kUseDefaultDistance to keep the physics-derived value. |
| [in] | maxDistM | Max-audible distance in metres used to derive the rolloff factor, and pushed to setMaxFalloffDistanceOverride as the voice-cull boundary. kUseDefaultDistance skips the rolloff derivation entirely. |
| static float makVrv::DtAudioLevel::computeRolloffFactor |
( |
float |
referenceDistM, |
|
|
float |
maxDistM |
|
) |
| |
|
static |
Compute an OpenAL rolloff factor that fits an authored min / max distance pair.
OpenAL's AL_INVERSE_DISTANCE_CLAMPED distance model uses the formula gain(d) = ref / (ref + rolloff * (clamp(d, ref, max) - ref)) With the default rolloff of 1.0, gain at max = ref / max, which for a wide [ref=1, max=1000] range gives -60 dBFS at the edge and a curve so steep that most of the [ref, max] range is inaudible. This helper solves for the rolloff factor that lands the gain at max distance exactly at kMaxDistanceGainTarget (-60 dBFS by default), spreading the falloff across the whole range so the authored maxDistM behaves as a real "outer audible edge" rather than a distant clamp point.
Requires positive, ordered inputs (0 < ref < max). Returns 1.0 (OpenAL's default) for any degenerate input.
- Parameters
-
| [in] | referenceDistM | Reference distance in metres. Must be > 0. |
| [in] | maxDistM | Max audible distance in metres. Must be > referenceDistM. |
- Returns
- Rolloff factor suitable for makAudio::DtSound::setRolloffFactorOverride.
| static makAudio::DtAbstractAudio::Priority makVrv::DtAudioLevel::priorityFromString |
( |
const std::string & |
priorityString | ) |
|
|
static |
Map a lowercase priority string to a makAudio priority enum.
Recognised values are "background_fx", "secondary_fx", "primary_fx", "music", and "dialog". Any unrecognised or empty string maps to BACKGROUND_FX and emits a one-shot warning naming the offending input.
- Parameters
-
| [in] | priorityString | Lowercase priority name. |
- Returns
- The mapped priority.