VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSoundComponentSystem.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>
13 
15 #include <vrvCore/DtUniqueID.h>
18 
19 #include <matrix/vlVector.h>
20 
21 #include <map>
22 #include <memory>
23 #include <set>
24 
25 namespace makAudio
26 {
27  class DtSound;
28 }
29 
30 namespace makVrv
31 {
32  class DtProceduralSound;
33  class DtProceduralSoundBehavior;
34  class DtDe;
35  class DtSoundComponent;
36  class DtSoundComponentSystemImGui;
37  class DtObserver;
38 
50  {
51  friend class DtSoundComponent;
53  public:
56  static DtSoundComponentSystem& instance(DtDe& de);
57 
59  static void registerInstance(DtDe& de, DtSoundComponentSystem* system);
60 
62  static const std::string& theClassName();
63 
64  public:
65 
67  virtual ~DtSoundComponentSystem();
68 
71  const DtSoundComponentSystem& other) = delete;
72 
75  DtSoundComponentSystem&& other) = delete;
76 
78  DtSoundComponentSystem& operator=(
79  const DtSoundComponentSystem& other) = delete;
80 
82  DtSoundComponentSystem& operator=(
83  DtSoundComponentSystem&& other) = delete;
84 
85  public:
91  virtual void addSound(DtSoundComponent* sound);
92 
95  virtual void removeSound(DtSoundComponent* sound);
96 
97  protected:
98 
102 
106  virtual void slot_postUpdate(double simTime);
107 
111  virtual void slot_sceneObjectToBeDeleted(const DtUniqueID& id);
112 
116  virtual void slot_audioListenerObserverChanged(DtObserver* observer);
117 
121  virtual void slot_currentObserverModeChanged(int observerMode);
122 
124  virtual void handleDelayedSoundCreation();
125 
126  virtual void createAndInitializeSound(DtSoundComponent* soundComponent);
127 
140  virtual void createProceduralSound(
141  DtSoundComponent* soundComponent,
142  const std::string& behaviorKey = std::string(),
143  const std::map<std::string, std::string>& behaviorParams =
144  std::map<std::string, std::string>(),
145  bool localWeatherAreaEnabled = false);
146 
155  virtual void resolveAndWireSceneObject(DtSoundComponent* soundComponent);
156 
161  virtual void initialize();
162 
167  virtual void createImGui();
168 
170  virtual void slot_renderImGui();
171 
172  protected:
175 
178 
181 
184 
187 
190 
194  std::map<DtUniqueID, std::pair<DtSoundComponent*, vrvSignalsLib::connection>>
196 
198  std::map<DtModelSetId, std::set<DtSoundComponent*>> myModelSetToSoundComponentLookupMap;
199 
201  std::set<DtSoundComponent*> mySoundUpdateOnTickSet;
202 
208 
210  std::set<DtSoundComponent*> myNewSoundComponents;
211 
213  std::set<DtSoundComponent*> myPendingSoundComponents;
214 
218  std::map<DtSoundComponent*, int> myResolveAttempts;
219 
222  std::map<const DtSoundComponent*, std::unique_ptr<DtProceduralSound>> myProceduralSounds;
223 
225  std::set<DtSoundComponent*> myProceduralUpdateSet;
226 
231  std::map<const DtSoundComponent*, std::unique_ptr<DtProceduralSoundBehavior>> myProceduralBehaviors;
232 
238  std::set<const DtSoundComponent*> myLocalWeatherAreaEnabledSet;
239 
241  double myLastSimTime = -1.0;
242 
244  std::unique_ptr<DtSoundComponentSystemImGui> myImGui;
245  };
246 
247 } // namespace makVrv
DtSignalConnectionManager myConnections
Connection manager for miscellaneous signal connections.
Definition: DtSoundComponentSystem.h:183
std::map< DtSoundComponent *, int > myResolveAttempts
Retry-attempt count for components stuck waiting for a late-registering SceneObjectAgent. Entries only exist for components that have failed at least one resolve; erased on successful resolve or on removeSound.
Definition: DtSoundComponentSystem.h:218
Manages the lifetime of a single audio source attached to an entity or world position.
Definition: DtSoundComponent.h:48
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
std::map< const DtSoundComponent *, std::unique_ptr< DtProceduralSound > > myProceduralSounds
Map from sound component to its procedural sound. DtSoundComponentSystem owns the sounds...
Definition: DtSoundComponentSystem.h:222
std::set< DtSoundComponent * > myPendingSoundComponents
Components that have completed one update interval and can now be created.
Definition: DtSoundComponentSystem.h:213
DtSignalConnectionManager myCurrentObserverConnection
Connection manager for current observer&#39;s signals.
Definition: DtSoundComponentSystem.h:180
std::map< DtModelSetId, std::set< DtSoundComponent * > > myModelSetToSoundComponentLookupMap
Map from model set ID to the set of sound components in that model set.
Definition: DtSoundComponentSystem.h:198
DtSoundComponentSystem manages the active sounds in the scene.
Definition: DtSoundComponentSystem.h:49
Contains the DLL export macro for vrvAudio classes.
DtModelSetId myCurrentModelSet
The current model set ID (determines which sounds are active based on observer mode) ...
Definition: DtSoundComponentSystem.h:189
std::set< DtSoundComponent * > myProceduralUpdateSet
Set of components backed by a procedural sound that need per-frame tick() calls.
Definition: DtSoundComponentSystem.h:225
A facade for a DtObserverObject.
Definition: DtObserver.h:38
Contains makVrv::DtVirtualBaseClass class.
std::set< DtSoundComponent * > myNewSoundComponents
Two-set swap: sounds added this tick land in myNewSoundComponents; at the end of slot_postUpdate the ...
Definition: DtSoundComponentSystem.h:210
DtSignalConnectionManager mySignalPostUpdateConnection
Connection manager for the post-update signal (blocked when no sounds need updates) ...
Definition: DtSoundComponentSystem.h:177
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
std::unique_ptr< DtSoundComponentSystemImGui > myImGui
ImGui debug panel renderer (owned).
Definition: DtSoundComponentSystem.h:244
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
std::map< const DtSoundComponent *, std::unique_ptr< DtProceduralSoundBehavior > > myProceduralBehaviors
Map from sound component to its behavior-backed procedural sound behavior.
Definition: DtSoundComponentSystem.h:231
Base class to provide boost signal/slot management.
std::set< const DtSoundComponent * > myLocalWeatherAreaEnabledSet
Components whose behavior should query local weather areas at model position.
Definition: DtSoundComponentSystem.h:238
std::set< DtSoundComponent * > mySoundUpdateOnTickSet
Set of sound components that need per-frame position updates.
Definition: DtSoundComponentSystem.h:201
Contains makVrv::DtUniqueID type.
#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
std::map< DtUniqueID, std::pair< DtSoundComponent *, vrvSignalsLib::connection > > mySceneObjectDeletedSoundLookupMap
Map from scene object unique ID to (sound component, signal connection) pair for deletion handling...
Definition: DtSoundComponentSystem.h:195
DtModelSetId
Definition: DtModelSetEnums.h:19
DtDe & myDe
Reference to the DtDe (distributed entity) that owns this system.
Definition: DtSoundComponentSystem.h:174
Contains various enum classes relating to model sets.
DtObserver * myCurrentObserver
Pointer to the current observer (used to track observer mode changes)
Definition: DtSoundComponentSystem.h:186
ImGui debug panel renderer for DtSoundComponentSystem.
Definition: DtSoundComponentSystemImGui.h:35

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)