VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtRainSoundBehavior.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
16 
17 #include <atomic>
18 #include <map>
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 namespace makVrv
24 {
25  class DtProceduralSound;
26  class DtDe;
27 
32  {
33  public:
38  DtProceduralSoundBehavior* create(DtDe& de,
39  const std::map<std::string, std::string>& params) override;
40  };
41 
62  {
63  public:
66  explicit DtRainSoundBehavior(const DtRainSoundConfig& config);
67 
69  virtual ~DtRainSoundBehavior() = default;
70 
74  void setupSound(DtProceduralSound& sound, DtDe& de) override;
75 
79  void update(DtDe& de) override;
80 
84  bool isActive(const DtProceduralSoundBehaviorContext& ctx) const override;
85 
90  float currentVolumeDb(const DtProceduralSoundBehaviorContext& ctx,
91  float channelBaseVolumeDb) const override;
92 
96  void setLocalPrecipitationOverride(bool raining, float normalizedIntensity) override;
97 
99  void appendImGuiDebugInfo() const override;
100 
101  protected:
104  std::atomic<float> myNormalizedIntensity;
107  std::atomic<bool> myIsRaining;
108 
111  std::atomic<bool> myHasLocalOverride;
113  std::atomic<bool> myLocalRaining;
115  std::atomic<float> myLocalNormIntensity;
116 
117  // Slot behaviors are owned here; their raw pointers are held by the layers.
118  // Declared after the atomics so they are destroyed first (reverse declaration order),
119  // ensuring the references they hold into this object remain valid throughout.
120  std::vector<std::unique_ptr<DtTierSlotBehavior>> mySlots;
122  };
123 
124 } // namespace makVrv
std::atomic< float > myNormalizedIntensity
Normalized precipitationIntensity() written by update(); read by slot behaviors on the audio thread...
Definition: DtRainSoundBehavior.h:104
std::atomic< bool > myLocalRaining
Local weather area raining flag, written by setLocalPrecipitationOverride().
Definition: DtRainSoundBehavior.h:113
Read-only context passed to every DtProceduralSoundBehavior callback.
Definition: DtProceduralSoundBehaviorContext.h:20
std::atomic< bool > myIsRaining
Set to true by update() when precipitation type is Rain and intensity &gt; 0. Read by slot behaviors on ...
Definition: DtRainSoundBehavior.h:107
Abstract factory interface for creating a named DtProceduralSoundBehavior.
Definition: DtProceduralSoundBehaviorCreator.h:92
std::vector< std::unique_ptr< DtTierSlotBehavior > > mySlots
One slot per tier.
Definition: DtRainSoundBehavior.h:120
Composes multiple DtProceduralSoundLayer pools into one streaming ambient sound.
Definition: DtProceduralSound.h:61
DtRainSoundConfig myConfig
Tier configuration (sources and crossfade parameters) retained for setupSound().
Definition: DtRainSoundBehavior.h:121
std::atomic< bool > myHasLocalOverride
True when a local weather area override has been set via setLocalPrecipitationOverride(). Consumed (exchanged to false) at the start of update().
Definition: DtRainSoundBehavior.h:111
DtProceduralSoundBehaviorCreator implementation for the &quot;Rain&quot; behavior. Register under the key &quot;Rain...
Definition: DtRainSoundBehavior.h:31
Contains makVrv::DtProceduralSoundBehaviorCreator abstract base class.
Contains makVrv::DtRainSoundTier and makVrv::DtRainSoundConfig.
std::atomic< float > myLocalNormIntensity
Local weather area normalized intensity, written by setLocalPrecipitationOverride().
Definition: DtRainSoundBehavior.h:115
Optional per-channel behavior hook for DtProceduralSoundPlayer.
Definition: DtProceduralSoundBehavior.h:40
#define DT_DLL_VRVAUDIO
Definition: vrvAudio.h:20
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Full configuration for DtRainSoundBehavior.
Definition: DtRainSoundConfig.h:51
Contains makVrv::DtProceduralSoundBehavior base class.
Adapts rain audio to the current precipitation intensity using a configurable set of named tiers (e...
Definition: DtRainSoundBehavior.h:61
Contains makVrv::DtTierGainCurve and makVrv::DtTierSlotBehavior.

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)