VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtBallisticSoundManager.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 
17 
20 
21 #include <atomic>
22 #include <cstdint>
23 #include <memory>
24 #include <random>
25 #include <string>
26 #include <vector>
27 
28 namespace makVrv
29 {
30 
31  class DtDe;
32 
54  {
55  public:
58  static DtBallisticSoundManager& instance(DtDe& de);
59 
63  static void registerInstance(DtDe& de, DtBallisticSoundManager* mgr);
64 
66  static const std::string& theClassName();
67 
69  virtual ~DtBallisticSoundManager() = default;
70 
81  virtual void previewGroup(const std::string& groupName);
82 
83  protected:
89  explicit DtBallisticSoundManager(DtDe& de);
90 
94  virtual void slot_postTick();
95 
99  virtual void slot_postInitialize();
100 
103  virtual void slot_soundTriggers(const std::vector<DtBallisticSoundTrigger>& triggers);
104 
108  virtual void slot_settingsChanged(const DtBallisticSoundSettingsRecord& record);
109 
113  virtual void slot_masterAudioEnabled(bool enabled);
114 
118  virtual void slot_playbackDeviceInitialized();
119 
122  virtual int32_t resolveOrAssignGroupIndex(const std::string& groupName);
123 
126  virtual void initPool();
127 
131  virtual void buildPreviewStream(const std::vector<DtBallisticSoundGroup>& groups);
132 
136  virtual void tickPool(double dt, double simTime);
137 
139  virtual DtBallisticSoundStream* findStreamForRequest(DtUniqueID burstId);
140 
142  virtual DtBallisticSoundStream* findFreeStream();
143 
146  virtual std::string resolveGroupName(int32_t groupIndex) const;
147 
149  virtual float computeDecibels(float distanceMeters) const;
150 
151  protected:
154 
158 
161  std::vector<std::string> myIndexToGroup;
162 
164  std::vector<DtBallisticSoundStream> myPool;
165 
171  std::unique_ptr<DtProceduralSound> myPreviewStream;
172 
175 
180 
182  std::mt19937 myRng;
183 
188  std::atomic<int> myPendingPreviewGroupIdx{-1};
189 
192  };
193 
194 } // namespace makVrv
Manages audio playback for ballistic proximity sounds.
Definition: DtBallisticSoundManager.h:53
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
const DtBallisticSoundSettingsRecord * mySettings
Non-owning pointer to the settings manager&#39;s record; stable for manager lifetime. Set during slot_pos...
Definition: DtBallisticSoundManager.h:157
Contains the DtBallisticSoundStream class declaration.
Plain data struct for cross-thread transfer of a ballistic flyby sound trigger.Written by the render ...
void slot_postInitialize(makVrv::DtDe &de)
Settings record for the ballistic proximity sound system.
Definition: DtBallisticSoundSettingsRecord.h:32
std::vector< std::string > myIndexToGroup
Maps stable 0-based GPU index to group name. Append-only; indices are never reassigned so in-flight b...
Definition: DtBallisticSoundManager.h:161
Contains the DLL export macro for vrvAudio classes.
One slot in the ballistic proximity sound stream pool.
Definition: DtBallisticSoundStream.h:48
Contains makVrv::DtVirtualBaseClass class.
DtDe & myDe
Reference to the simulation environment.
Definition: DtBallisticSoundManager.h:153
bool myMasterAudioEnabled
Mirrors DtAudioSettingsManager::audioEnabled(); updated by slot_masterAudioEnabled(). Gates the GPU sound query and slot_soundTriggers so that no compute work or playback calls are made while audio is globally off.
Definition: DtBallisticSoundManager.h:179
std::unique_ptr< DtProceduralSound > myPreviewStream
Non-3D procedural sound used exclusively for settings-page preview.
Definition: DtBallisticSoundManager.h:171
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
Contains the DtBallisticSoundSettingsRecord struct declaration.
Base class to provide boost signal/slot management.
#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
DtSignalConnectionManager myConnections
Manages signal/slot lifetime connections.
Definition: DtBallisticSoundManager.h:191
double myLastSimTime
Absolute simulation time recorded at the start of each tick.
Definition: DtBallisticSoundManager.h:174
std::vector< DtBallisticSoundStream > myPool
Stream pool; one slot per allowed concurrent burst.
Definition: DtBallisticSoundManager.h:164
std::mt19937 myRng
Random number generator for per-event pitch and gain variance.
Definition: DtBallisticSoundManager.h:182

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)