VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtProceduralSoundscapeManager.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>
15 
18 
20 #include <vrvCore/DtUniqueID.h>
21 
22 #include <makAudio/abstractAudio.h>
23 
24 #include <cfloat>
25 #include <memory>
26 #include <string>
27 #include <vector>
28 
29 namespace makVrv
30 {
31  class DtDe;
32  class DtObserver;
33  class DtTerrainPatchObject;
34  class DtSoundComponent;
35  class DtProceduralSoundscapeQuery;
36  class DtProceduralSoundPlayer;
37 
69  {
70  public:
73  static DtProceduralSoundscapeManager& instance(DtDe& de);
74 
76  static void registerInstance(DtDe& de, DtProceduralSoundscapeManager* mgr);
77 
79  static const std::string& theClassName();
80 
81  public:
83 
88 
89  public:
98  virtual void addAmbientChannel(const DtProceduralSoundscapeChannel& channel);
99 
102  virtual void removeAmbientChannel(const std::string& name);
103 
105  virtual void clearAllAmbientChannels();
106 
112  virtual void startPreview(const DtProceduralSoundscapeChannel& channel);
113 
115  virtual void stopPreview();
116 
118  virtual bool isPreviewActive() const;
119 
120  protected:
122  explicit DtProceduralSoundscapeManager(DtDe& de);
123 
126  virtual void slot_mapNodeFound(DtTerrainPatchObject& tpo);
127 
130  virtual void slot_postTick();
131 
135  virtual void handleDelayedSoundCreation();
136 
144  virtual void slot_audioEnabledChanged(bool enabled);
145 
148  virtual void createChannelSound(std::size_t channelIndex);
149 
152  virtual void slot_initImGui();
153 
156  virtual void slot_renderImGui();
157 
165  virtual DtUniqueID generateLocalUniqueId();
166 
169  virtual void slot_audioListenerObserverChanged(DtObserver* observer);
170 
172  virtual void slot_currentObserverModeChanged(int observerMode);
173 
175  virtual void slot_postInitializeObserver();
176 
179  virtual void slot_soundsChanged(const std::vector<DtProceduralSoundConfig>& sounds);
180 
181  protected:
184  {
186  std::unique_ptr<DtSoundComponent> sound;
187  bool soundPlaying = false;
188 
194 
202  float resolvedSoundDecibels = 0.0f;
203 
210  makAudio::DtAbstractAudio::Priority resolvedSoundPriority =
211  makAudio::DtAbstractAudio::BACKGROUND_FX;
212 
213  // Per-tick debug state (written by slot_postTick, read by slot_renderImGui).
214  double lastSignedDistanceMeters = DBL_MAX;
215  float lastDecibels = 0.0f;
216 
222  float softStartRemainingSec = 0.0f;
223  };
224 
226 
228  std::vector<ChannelState> myChannels;
229 
231  std::vector<std::unique_ptr<DtProceduralSoundPlayer>> myProceduralPlayers;
232 
234  std::unique_ptr<DtProceduralSoundscapeQuery> myQuery;
235 
238 
241 
243  DtObserver* myCurrentObserver = nullptr;
244 
248 
250  double myLastSimTime = -1.0;
251 
253  std::unique_ptr<DtSoundComponent> myPreviewWavSound;
254  std::unique_ptr<DtProceduralSoundPlayer> myPreviewProceduralPlayer;
255  };
256 
257 } // namespace makVrv
std::vector< std::unique_ptr< DtProceduralSoundPlayer > > myProceduralPlayers
All registered procedural channels. Indexed in parallel with removal by name.
Definition: DtProceduralSoundscapeManager.h:231
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
DtDe & myDe
Definition: DtProceduralSoundscapeManager.h:225
std::unique_ptr< DtProceduralSoundPlayer > myPreviewProceduralPlayer
Definition: DtProceduralSoundscapeManager.h:254
std::unique_ptr< DtSoundComponent > sound
nullptr until device + map are ready
Definition: DtProceduralSoundscapeManager.h:186
DtSignalConnectionManager myCurrentObserverConnection
Signal connections scoped to the current observer&#39;s lifetime.
Definition: DtProceduralSoundscapeManager.h:240
DtSignalConnectionManager myConnections
Signal connections (DtDe::signal_postTick, terrain signaler, audio device).
Definition: DtProceduralSoundscapeManager.h:237
DtProceduralSoundscapeChannel config
Full channel configuration as provided to addAmbientChannel().
Definition: DtProceduralSoundscapeManager.h:185
Contains the DLL export macro for vrvAudio classes.
std::vector< ChannelState > myChannels
All registered looping-file channels with their active sound components.
Definition: DtProceduralSoundscapeManager.h:228
std::unique_ptr< DtProceduralSoundscapeQuery > myQuery
The osgEarth query helper. Null until signal_osgEarthMapNodeFound fires.
Definition: DtProceduralSoundscapeManager.h:234
A DtTerrainPatchObject contains the methods for loading a file as a terrain. When loading a file as a...
Definition: DtTerrainPatchObject.h:35
Contains makVrv::DtProceduralClipConfig, DtProceduralLayerConfig, and DtProceduralSoundConfig structs...
Internal state for one registered channel.
Definition: DtProceduralSoundscapeManager.h:183
Contains the declarations for the makVrv ambient sound channel types.
A facade for a DtObserverObject.
Definition: DtObserver.h:38
Contains makVrv::DtVirtualBaseClass class.
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
std::string resolvedSoundFilePath
Filesystem path installed on the OpenAL voice, resolved from the ModelDefinition entry&#39;s sound_filepa...
Definition: DtProceduralSoundscapeManager.h:193
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
Base class to provide boost signal/slot management.
Configuration for one ambient sound channel.
Definition: DtProceduralSoundscapeChannel.h:114
Contains makVrv::DtUniqueID type.
#define DT_DLL_VRVAUDIO
Definition: vrvAudio.h:20
Manages a collection of ambient geographic sound channels.
Definition: DtProceduralSoundscapeManager.h:68
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
DtModelSetId
Definition: DtModelSetEnums.h:19
Contains various enum classes relating to model sets.
std::unique_ptr< DtSoundComponent > myPreviewWavSound
Preview state - at most one of these is non-null at any time.
Definition: DtProceduralSoundscapeManager.h:253

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)