![]() |
VR-Forces Developer's Guide
|
Adapts rain audio to the current precipitation intensity using a configurable set of named tiers (e.g. Moderate, Heavy, Extreme). Adjacent tiers share an equal-power crossfade zone (sin/cos pair) so their combined RMS power stays constant throughout the transition – no dip or boost.
update() reads DtEnvironment::precipitationType() and precipitationIntensity(). precipitationIntensity() returns a value normalized to [0, 1] where 1.0 equals DtSkyObject::theMaximumPrecipitationRate (200 mm/hr).
Tier boundaries, crossfade width, and onset ramp are all read from the behavior params map supplied to the constructor (keys: tierN.source, tierN.peakFrom, tierN.peakTo, crossfadeWidthMmhr, onsetRampMmhr).
WAV loop seams are masked by two staggered copies per layer (0% / 50% offset).

Public Member Functions | |
| DtRainSoundBehavior (const DtRainSoundConfig &config) | |
| virtual | ~DtRainSoundBehavior ()=default |
| void | setupSound (DtProceduralSound &sound, DtDe &de) override |
| void | update (DtDe &de) override |
| bool | isActive (const DtProceduralSoundBehaviorContext &ctx) const override |
| float | currentVolumeDb (const DtProceduralSoundBehaviorContext &ctx, float channelBaseVolumeDb) const override |
| void | setLocalPrecipitationOverride (bool raining, float normalizedIntensity) override |
| void | appendImGuiDebugInfo () const override |
Public Member Functions inherited from makVrv::DtProceduralSoundBehavior | |
| virtual | ~DtProceduralSoundBehavior ()=default |
| virtual void | setLocalWindSpeedOverride (bool audible, float speedMs) |
| virtual void | setLocalVisibilityOverride (bool hazy, float visibilityMeters) |
| virtual void | setProximityDistance (double distanceMeters) |
| virtual float | proximityDistMeters () const |
| virtual bool | isInRange () const |
| virtual bool | usingLocalOverride () const |
| virtual float | nextIntervalSeconds (const DtProceduralSoundBehaviorContext &ctx, float builtInInterval) const |
| virtual int | selectClip (const DtProceduralSoundBehaviorContext &ctx, const std::vector< float > &weights) const |
| virtual float | selectGain (const DtProceduralSoundBehaviorContext &ctx, float minGain, float maxGain) const |
| virtual float | selectPitch (const DtProceduralSoundBehaviorContext &ctx, float minPitch, float maxPitch) const |
| virtual bool | wantRestart () const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Protected Attributes | |
| std::atomic< float > | myNormalizedIntensity |
| std::atomic< bool > | myIsRaining |
| std::atomic< bool > | myHasLocalOverride |
| std::atomic< bool > | myLocalRaining |
| std::atomic< float > | myLocalNormIntensity |
| std::vector< std::unique_ptr < DtTierSlotBehavior > > | mySlots |
| DtRainSoundConfig | myConfig |
Protected Attributes inherited from makVrv::DtProceduralSoundBehavior | |
| std::atomic< float > | myProximityDistMeters {0.0f} |
|
explicit |
Constructor. Builds slot behaviors from config.
| config | Rain sound configuration loaded from JSON (or built-in default). |
|
virtualdefault |
Virtual destructor.
|
overridevirtual |
Create one sound layer per configured tier, each with its own slot behavior.
| sound | The procedural sound to configure. |
| de | Display engine context; used by the clip loader for path token resolution. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Store current precipitation type and intensity into the shared atomics read by the slot behaviors on the audio thread.
| de | Display engine context. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Returns true when the precipitation type is Rain and intensity > 0.
| ctx | Current channel context (unused). |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Pass-through; per-layer volume is controlled by each slot behavior.
| ctx | Current channel context (unused). |
| channelBaseVolumeDb | Channel's configured base volume in dB. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Store a local weather area precipitation override for the next update().
| raining | True when inside a rain local weather area. |
| normalizedIntensity | Blended normalized precipitation intensity [0,1]. |
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
overridevirtual |
Emit ImGui text showing current rain intensity and raining/override flags.
Reimplemented from makVrv::DtProceduralSoundBehavior.
|
protected |
Normalized precipitationIntensity() written by update(); read by slot behaviors on the audio thread. Value is in [0, 1] where 1.0 = 200 mm/hr.
|
protected |
Set to true by update() when precipitation type is Rain and intensity > 0. Read by slot behaviors on the audio thread to gate isActive().
|
protected |
True when a local weather area override has been set via setLocalPrecipitationOverride(). Consumed (exchanged to false) at the start of update().
|
protected |
Local weather area raining flag, written by setLocalPrecipitationOverride().
|
protected |
Local weather area normalized intensity, written by setLocalPrecipitationOverride().
|
protected |
One slot per tier.
|
protected |
Tier configuration (sources and crossfade parameters) retained for setupSound().