VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Static Public Member Functions | Static Public Attributes | Private Member Functions
makVrv::DtAudioLevel Class Reference

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 Public Member Functions

static float linearGainFromDbfs (float dbfs)
 
static float clampToVoiceCeiling (float dbfs)
 
static float clampToDynamicRange (float dbfs)
 
static bool isEffectivelySilent (float dbfs)
 
static const char * displayedSuffix ()
 
static float displayedRangeMinDb ()
 
static float displayedRangeMaxDb ()
 
static float displayedDefaultDb ()
 
static void applyAttenuation (makAudio::DtSound &sound, float minDistM, float maxDistM)
 
static float computeRolloffFactor (float referenceDistM, float maxDistM)
 
static float attenuationGainAtDistance (float minDistM, float maxDistM, float distM)
 
static
makAudio::DtAbstractAudio::Priority 
priorityFromString (const std::string &priorityString)
 

Static Public Attributes

static constexpr float kFullScaleDbfs = 0.0f
 
static constexpr float kVoiceBoostCeilingDbfs = +12.0f
 
static constexpr float kSilentDbfs = -96.0f
 
static constexpr float kFadeZoneDepthDbfs = -60.0f
 
static constexpr float kSoftStartFloorDbfs = -60.0f
 
static constexpr float kDbfsWidgetMin = -100.0f
 
static constexpr float kDbfsWidgetMax = kVoiceBoostCeilingDbfs
 
static constexpr float kDbfsWidgetDefault = -6.0f
 
static constexpr float kUseDefaultDistance = -1.0f
 
static constexpr float kDefaultSourceSplDb = 90.0f
 
static constexpr float kMaxDistanceGainTarget = 0.001f
 

Private Member Functions

 DtAudioLevel ()=delete
 
 DtAudioLevel (const DtAudioLevel &)=delete
 
 DtAudioLevel (DtAudioLevel &&)=delete
 
DtAudioLevel & operator= (const DtAudioLevel &)=delete
 
DtAudioLevel & operator= (DtAudioLevel &&)=delete
 
 ~DtAudioLevel ()=delete
 

Constructor & Destructor Documentation

makVrv::DtAudioLevel::DtAudioLevel ( )
privatedelete
makVrv::DtAudioLevel::DtAudioLevel ( const DtAudioLevel &  )
privatedelete
makVrv::DtAudioLevel::DtAudioLevel ( DtAudioLevel &&  )
privatedelete
makVrv::DtAudioLevel::~DtAudioLevel ( )
privatedelete

Member Function Documentation

static float makVrv::DtAudioLevel::linearGainFromDbfs ( float  dbfs)
static

Convert a dBFS value into a linear gain multiplier suitable for multiplying against a sample.

Input is clamped to the useful dynamic range before conversion so callers do not need to guard against inf/nan at the extremes.

Parameters
[in]dbfsLevel in dBFS.
Returns
Linear gain in [0, 1].
static float makVrv::DtAudioLevel::clampToVoiceCeiling ( float  dbfs)
static

Clamp a dBFS level to the authoring voice-boost ceiling (kVoiceBoostCeilingDbfs, +12 dBFS), leaving the low end untouched. Callers use this at the read boundary to defend against corrupt or hand-edited configs that push beyond the ceiling.

Parameters
[in]dbfsLevel in dBFS.
Returns
dBFS level with any excursion above kVoiceBoostCeilingDbfs clipped to the ceiling.
static float makVrv::DtAudioLevel::clampToDynamicRange ( float  dbfs)
static

Clamp a dBFS level to the full useful dynamic range [kSilentDbfs, kVoiceBoostCeilingDbfs].

Parameters
[in]dbfsLevel in dBFS.
Returns
dBFS level within the useful range.
static bool makVrv::DtAudioLevel::isEffectivelySilent ( float  dbfs)
static

Test whether a dBFS level is at or below the noise floor and therefore effectively inaudible.

Parameters
[in]dbfsLevel in dBFS.
Returns
True when the level is at or below kSilentDbfs.
static const char* makVrv::DtAudioLevel::displayedSuffix ( )
static

Human-readable unit suffix for widget spinboxes. The leading space is intentional so QSpinBox::setSuffix() lays out cleanly. VR-Vantage presents a single display scale (dBFS) in every widget, so this always returns " dBFS".

Returns
" dBFS".
static float makVrv::DtAudioLevel::displayedRangeMinDb ( )
static

Minimum spinner value for the widget display scale.

Returns
kDbfsWidgetMin.
static float makVrv::DtAudioLevel::displayedRangeMaxDb ( )
static

Maximum spinner value for the widget display scale.

Returns
kDbfsWidgetMax (= kVoiceBoostCeilingDbfs, +12 dBFS).
static float makVrv::DtAudioLevel::displayedDefaultDb ( )
static

Default spinner value for a freshly authored entry.

Returns
kDbfsWidgetDefault (-6 dBFS).
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]soundThe live 3D sound whose distance model should be overridden.
[in]minDistMReference distance in metres, or kUseDefaultDistance to keep the physics-derived value.
[in]maxDistMMax-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]referenceDistMReference distance in metres. Must be > 0.
[in]maxDistMMax audible distance in metres. Must be > referenceDistM.
Returns
Rolloff factor suitable for makAudio::DtSound::setRolloffFactorOverride.
static float makVrv::DtAudioLevel::attenuationGainAtDistance ( float  minDistM,
float  maxDistM,
float  distM 
)
static

Compute the linear attenuation gain a sound would receive at the specified distance under the authored [min, max] envelope.

Mirrors the OpenAL AL_INVERSE_DISTANCE_CLAMPED formula with the rolloff factor derived by computeRolloffFactor(). Intended for HUD / diagnostics rather than the audio hot path – OpenAL is doing the actual math on the voice.

  • When distM is at or below minDistM: returns 1.0.
  • Between min and max: returns the inverse-distance gain using the derived rolloff.
  • Beyond maxDistM: this helper still returns the continuing inverse-distance gain for HUD estimation, but note the runtime voice is culled at maxDistM (applyAttenuation now sets setMaxFalloffDistanceOverride), so the audible result there is silence.
  • When either distance is unauthored (kUseDefaultDistance or non-positive), or ordering is degenerate: returns 1.0 as a safe "no attenuation" fallback.
Parameters
[in]minDistMAuthored inner-radius override.
[in]maxDistMAuthored outer-radius override.
[in]distMListener-to-source distance in metres.
Returns
Linear attenuation gain in (0, 1].
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]priorityStringLowercase priority name.
Returns
The mapped priority.
DtAudioLevel& makVrv::DtAudioLevel::operator= ( const DtAudioLevel &  )
privatedelete
DtAudioLevel& makVrv::DtAudioLevel::operator= ( DtAudioLevel &&  )
privatedelete

Member Data Documentation

constexpr float makVrv::DtAudioLevel::kFullScaleDbfs = 0.0f
static

Digital full scale, in dBFS. DAC reference for physical audio math (linear-gain conversion, dynamic-range clamping); NOT the authoring ceiling. See kVoiceBoostCeilingDbfs.

constexpr float makVrv::DtAudioLevel::kVoiceBoostCeilingDbfs = +12.0f
static

Maximum authorable voice-boost level in dBFS. Values above this (typically from a corrupt or hand-edited config) are clamped to this ceiling at the read boundary via clampToVoiceCeiling(), and a one-shot warning is emitted. +12 dB matches Wwise / Unreal Engine / FMOD Studio voice-fader conventions. Note that dBFS > 0 does not exist in the strict signal-processing sense – the DAC hard-clips at 0 dBFS; a boosted voice produces samples above digital full scale that will clip. Users author boost intentionally, accepting the clipping trade-off.

constexpr float makVrv::DtAudioLevel::kSilentDbfs = -96.0f
static

Noise floor for the dBFS presentation scale.

constexpr float makVrv::DtAudioLevel::kFadeZoneDepthDbfs = -60.0f
static

Depth (in dB) of the crossfade zone at the low end of the useful widget range.

constexpr float makVrv::DtAudioLevel::kSoftStartFloorDbfs = -60.0f
static

Level at which soft-start ramp-ups begin from silence.

constexpr float makVrv::DtAudioLevel::kDbfsWidgetMin = -100.0f
static

Minimum spinner value when the widget is in dBFS mode. -60 dBFS is deep in the audibility floor; -100 dBFS is well below it. Keeping -100 as the lower bound gives customers headroom to express "effectively silent but not literally zero" values.

constexpr float makVrv::DtAudioLevel::kDbfsWidgetMax = kVoiceBoostCeilingDbfs
static

Maximum spinner value when the widget is in dBFS mode. Matches kVoiceBoostCeilingDbfs so the spinner allows users to author positive boost levels up to the industry-standard +12 dB ceiling used by Wwise / Unreal / FMOD Studio.

constexpr float makVrv::DtAudioLevel::kDbfsWidgetDefault = -6.0f
static

Default level for a fresh authored entry, in dBFS. -6 dBFS = half linear amplitude, which is the "comfortable moderate" starting point most audio tools use for a new voice.

constexpr float makVrv::DtAudioLevel::kUseDefaultDistance = -1.0f
static

Sentinel value meaning "leave this distance at the underlying audio engine's default". Callers pass this to applyAttenuation() when they want the engine's fall-off to remain untouched.

constexpr float makVrv::DtAudioLevel::kDefaultSourceSplDb = 90.0f
static

Default sound pressure level for a newly authored source, in dB SPL at 1 m.

Referenced by makVrv::DtSoundComponent::DtSoundComponentData::DtSoundComponentData().

constexpr float makVrv::DtAudioLevel::kMaxDistanceGainTarget = 0.001f
static

Target linear gain at max audible distance used by computeRolloffFactor() when deriving the OpenAL rolloff factor from a caller's authored min / max distance pair. 0.001 = -60 dBFS, placing the sound at the near-inaudible edge of hearing at the authored max distance so the voice cull at max (applyAttenuation pushes maxDistM to setMaxFalloffDistanceOverride) is perceptually seamless rather than an audible step down to silence.


The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)