VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtProceduralSoundPlayer.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 
12 #include <vrvAudio/vrvAudio.h>
14 
15 #include <memory>
16 #include <string>
17 
18 namespace makVrv
19 {
20  class DtDe;
21  class DtProceduralSound;
22  class DtProceduralSoundBehavior;
23 
37  {
38  public:
43  const DtProceduralSoundscapeChannel& channel,
44  DtProceduralSound* sound);
46  virtual ~DtProceduralSoundPlayer();
47 
49  DtProceduralSoundPlayer& operator=(const DtProceduralSoundPlayer&) = delete;
50 
57  virtual void tick(double dt, float relativeDb);
58 
62  virtual void stop();
63 
65  virtual const std::string& channelName() const;
66 
68  virtual const DtProceduralSoundscapeChannel& channel() const;
69 
72  virtual bool hasEverStarted() const;
73 
75  virtual bool isActive() const;
76 
78  virtual float lastRelativeDb() const;
79 
83  virtual double lastSignedDistanceMeters() const;
84 
86  virtual void setLastSignedDistanceMeters(double d);
87 
89  virtual const DtProceduralSound& sound() const;
90 
94  virtual void setBehavior(DtProceduralSoundBehavior* behavior);
95 
97  virtual DtProceduralSoundBehavior* behavior() const;
98 
101  virtual void setLastProximityFactor(float factor);
102 
113  virtual void setChannelDecibels(float dbfs);
114 
116  virtual float channelDecibels() const;
117 
118  protected:
121  float myLastRelativeDb = 0.0f;
122  double myLastSignedDistanceMeters = 1.0e9;
123  bool myHasEverStarted = false;
124 
128  float myChannelDecibelsDbfs = 0.0f;
129 
130  std::unique_ptr<DtProceduralSound> mySound;
131  // myBehavior is declared after mySound (C++ destroys in reverse order, so myBehavior
132  // is destroyed first). The ~DtProceduralSoundPlayer body relies on DtProceduralSound
133  // calling stop() via its own destructor after myBehavior is gone. Layer raw behavior
134  // pointers are non-owning and are never dereferenced by the default layer destructor,
135  // so no dangling-pointer access occurs. This declaration order is intentional.
136  std::unique_ptr<DtProceduralSoundBehavior> myBehavior;
137  float myLastProximityFactor = 0.0f;
138  };
139 
140 } // namespace makVrv
std::unique_ptr< DtProceduralSound > mySound
Definition: DtProceduralSoundPlayer.h:130
std::unique_ptr< DtProceduralSoundBehavior > myBehavior
Definition: DtProceduralSoundPlayer.h:136
DtProceduralSoundscapeChannel myChannel
Definition: DtProceduralSoundPlayer.h:120
Contains the DLL export macro for vrvAudio classes.
Composes multiple DtProceduralSoundLayer pools into one streaming ambient sound.
Definition: DtProceduralSound.h:61
Contains the declarations for the makVrv ambient sound channel types.
Runtime player for one procedural ambient sound channel.
Definition: DtProceduralSoundPlayer.h:36
DtDe & myDe
Definition: DtProceduralSoundPlayer.h:119
Optional per-channel behavior hook for DtProceduralSoundPlayer.
Definition: DtProceduralSoundBehavior.h:40
Configuration for one ambient sound channel.
Definition: DtProceduralSoundscapeChannel.h:114
#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

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)