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

Static utility helpers shared by procedural sound behavior implementations.

Behavior authors load audio clips from a prefixed source reference that names either a procedural-sound registry key or a Sound-schema model definition entry. Centralizing the classification and lookup logic here keeps every behavior consistent and lets new source kinds be added in one place.

Source string formats
The helper accepts three forms for a source string:
  • "ProceduralSound:Ocean" – prefixed registry key; the prefix is stripped by extractKey() before the factory is queried.
  • "ModelDefinition:myEntry" – prefixed Sound-schema model-definition entry name; resolved via DtModelDefinitionManager. When the entry specifies a procedural_sound_name the load dispatches through the ProceduralSound branch; otherwise a single-clip layer is installed from the entry's sound_filepath / sound_decibels.
  • "Ocean" – legacy bare registry key (no prefix); recognized identically to the prefixed ProceduralSound form.

Any other string – empty, containing a path separator, or ending in ".wav" / ".meaf" – is classified as DtSourceKind::Invalid and produces a warning.

Usage pattern 1 – inside DtProceduralSoundBehavior::setupSound()
void DtMyBehavior::setupSound(DtProceduralSound& sound, DtDe& de) override
{
auto& layer = sound.addLayer("myLayer");
layer.setBehavior(this);
layer, mySource, de);
if (!result.myLoaded)
{
layer.setGainRange(0.8f, 1.0f);
layer.setPitchRange(0.98f, 1.02f);
}
}
Usage pattern 2 – inside DtProceduralSoundBehaviorCreator::create()
DtProceduralSoundBehavior* DtMyCreator::create(
DtDe& /*de*/, const std::map<std::string, std::string>& params) override
{
std::string src = "ProceduralSound:Ocean"; // default registry key
auto it = params.find("source");
if (it != params.end()) src = it->second;
return new DtMyBehavior(src);
}

Classes

struct  ClipLoadResult
 

Static Public Member Functions

static DtSourceKind classifySource (const std::string &src)
 
static std::string extractKey (const std::string &src)
 
static ClipLoadResult loadClipsIntoLayer (DtProceduralSoundLayer &layer, const std::string &source, DtDe &de)
 
static void resolveSource (std::string &source, const DtDePathConfiguration &pathCfg)
 

Private Member Functions

 DtProceduralSoundBehaviorHelper ()=delete
 

Constructor & Destructor Documentation

makVrv::DtProceduralSoundBehaviorHelper::DtProceduralSoundBehaviorHelper ( )
privatedelete

Member Function Documentation

static DtSourceKind makVrv::DtProceduralSoundBehaviorHelper::classifySource ( const std::string &  src)
static

Classify a source reference string used by procedural-soundscape channels and tiers.

Rules (checked in order):

  • empty -> Invalid
  • starts with "ProceduralSound:" -> ProceduralSound
  • starts with "ModelDefinition:" -> ModelDefinition
  • contains '/' or '\', or ends (case-insensitive) in ".wav" or ".meaf" -> Invalid
  • otherwise (bare non-empty word) -> ProceduralSound (legacy)
Parameters
[in]srcSource reference string (from a channel or tier).
Returns
Classification.
static std::string makVrv::DtProceduralSoundBehaviorHelper::extractKey ( const std::string &  src)
inlinestatic

Strip the optional "ProceduralSound:" or "ModelDefinition:" prefix and return the bare key / entry name.

If src begins with either prefix (both are 16 characters) the prefix is removed and the remainder is returned. Otherwise src is returned unchanged.

Parameters
[in]srcSource string, with or without a recognized prefix.
Returns
The bare key / entry name with any prefix stripped; or src unchanged if no recognized prefix is present.
Note
Bare keys (no prefix) are returned unchanged and are valid procedural registry keys under the legacy classification rule; this function does not validate that the key exists.
static ClipLoadResult makVrv::DtProceduralSoundBehaviorHelper::loadClipsIntoLayer ( DtProceduralSoundLayer &  layer,
const std::string &  source,
DtDe &  de 
)
static

Load clips into layer from source, dispatching on classifySource(source).

DtSourceKind::ProceduralSound – the factory is queried with extractKey(source); on success clips are transferred via addClipsFrom() and the returned ClipLoadResult carries the factory layer's scheduling / gain / pitch settings with myLoaded == true.

DtSourceKind::ModelDefinition – the Sound-schema model definition entry named by extractKey(source) is looked up via DtModelDefinitionManager. When the entry specifies a non-empty procedural_sound_name the load re-dispatches through the ProceduralSound branch with that key. Otherwise a single clip is installed from the entry's sound_filepath and sound_decibels.

DtSourceKind::Invalid – a warning is emitted and the returned ClipLoadResult has myLoaded == false with defaults unchanged.

Parameters
layerTarget layer to receive clips.
source"ProceduralSound:<key>", "ModelDefinition:<entryName>", or legacy bare-word procedural key.
deDisplay engine; used to reach the DtProceduralSoundFactory and the DtModelDefinitionManager.
Returns
Populated ClipLoadResult.
static void makVrv::DtProceduralSoundBehaviorHelper::resolveSource ( std::string &  source,
const DtDePathConfiguration &  pathCfg 
)
static

No-op for recognized source references; warns when source is classified as DtSourceKind::Invalid.

Retained for source compatibility with existing behavior-creator call sites. Path-token expansion is no longer performed here because raw file paths are not a valid source form.

Parameters
sourceIn/out source string (unchanged by this call).
pathCfgPath configuration (unused; retained for API stability).

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)