VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
makVrv::DtSoundComponentSystem Class Reference

DtSoundComponentSystem manages the active sounds in the scene.

This system handles:

Inheritance diagram for makVrv::DtSoundComponentSystem:
Inheritance graph
[legend]

Public Member Functions

virtual ~DtSoundComponentSystem ()
 
 DtSoundComponentSystem (const DtSoundComponentSystem &other)=delete
 
 DtSoundComponentSystem (DtSoundComponentSystem &&other)=delete
 
DtSoundComponentSystem & operator= (const DtSoundComponentSystem &other)=delete
 
DtSoundComponentSystem & operator= (DtSoundComponentSystem &&other)=delete
 
virtual void addSound (DtSoundComponent *sound)
 
virtual void removeSound (DtSoundComponent *sound)
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Member Functions

static DtSoundComponentSystem & instance (DtDe &de)
 
static void registerInstance (DtDe &de, DtSoundComponentSystem *system)
 
static const std::string & theClassName ()
 

Protected Member Functions

 DtSoundComponentSystem (DtDe &de)
 
virtual void slot_postUpdate (double simTime)
 
virtual void slot_sceneObjectToBeDeleted (const DtUniqueID &id)
 
virtual void slot_audioListenerObserverChanged (DtObserver *observer)
 
virtual void slot_currentObserverModeChanged (int observerMode)
 
virtual void handleDelayedSoundCreation ()
 
virtual void createAndInitializeSound (DtSoundComponent *soundComponent)
 
virtual void createProceduralSound (DtSoundComponent *soundComponent, const std::string &behaviorKey=std::string(), const std::map< std::string, std::string > &behaviorParams=std::map< std::string, std::string >(), bool localWeatherAreaEnabled=false)
 
virtual void resolveAndWireSceneObject (DtSoundComponent *soundComponent)
 
virtual void initialize ()
 
virtual void createImGui ()
 
virtual void slot_renderImGui ()
 

Protected Attributes

DtDe & myDe
 
DtSignalConnectionManager mySignalPostUpdateConnection
 
DtSignalConnectionManager myCurrentObserverConnection
 
DtSignalConnectionManager myConnections
 
DtObserver * myCurrentObserver
 
DtModelSetId myCurrentModelSet
 
std::map< DtUniqueID,
std::pair< DtSoundComponent
*, vrvSignalsLib::connection > > 
mySceneObjectDeletedSoundLookupMap
 
std::map< DtModelSetId,
std::set< DtSoundComponent * > > 
myModelSetToSoundComponentLookupMap
 
std::set< DtSoundComponent * > mySoundUpdateOnTickSet
 
std::set< DtSoundComponent * > myNewSoundComponents
 
std::set< DtSoundComponent * > myPendingSoundComponents
 
std::map< DtSoundComponent *, int > myResolveAttempts
 
std::map< const
DtSoundComponent
*, std::unique_ptr
< DtProceduralSound > > 
myProceduralSounds
 
std::set< DtSoundComponent * > myProceduralUpdateSet
 
std::map< const
DtSoundComponent
*, std::unique_ptr
< DtProceduralSoundBehavior > > 
myProceduralBehaviors
 
std::set< const
DtSoundComponent * > 
myLocalWeatherAreaEnabledSet
 
double myLastSimTime = -1.0
 
std::unique_ptr
< DtSoundComponentSystemImGui > 
myImGui
 

Friends

class DtSoundComponent
 
class DtSoundComponentSystemImGui
 

Constructor & Destructor Documentation

virtual makVrv::DtSoundComponentSystem::~DtSoundComponentSystem ( )
virtual

DTOR.

makVrv::DtSoundComponentSystem::DtSoundComponentSystem ( const DtSoundComponentSystem &  other)
delete

Copy Constructor not implemented - Copy not allowed.

makVrv::DtSoundComponentSystem::DtSoundComponentSystem ( DtSoundComponentSystem &&  other)
delete

Move Constructor not implemented - Move not allowed.

makVrv::DtSoundComponentSystem::DtSoundComponentSystem ( DtDe &  de)
protected

Member Function Documentation

static DtSoundComponentSystem& makVrv::DtSoundComponentSystem::instance ( DtDe &  de)
static

Get/Create the DtSoundComponentSystem instance. Use DtSoundComponentSystem::registerInstance(...) to override the class instance.

static void makVrv::DtSoundComponentSystem::registerInstance ( DtDe &  de,
DtSoundComponentSystem *  system 
)
static

Register the provided instance of a DtSoundComponentSystem.

static const std::string& makVrv::DtSoundComponentSystem::theClassName ( )
static

Get the name used to register this class.

DtSoundComponentSystem& makVrv::DtSoundComponentSystem::operator= ( const DtSoundComponentSystem &  other)
delete

Assignment Operator not implemented - Assignment not allowed.

DtSoundComponentSystem& makVrv::DtSoundComponentSystem::operator= ( DtSoundComponentSystem &&  other)
delete

Move Assignment Operator not implemented - Move Assignment not allowed.

virtual void makVrv::DtSoundComponentSystem::addSound ( DtSoundComponent *  sound)
virtual

Add a sound component to the system.

Audio creation for a 3D scene-object-attached component is deferred until the scene object has completed an update. Other components are created immediately.

Parameters
soundThe sound component to add
virtual void makVrv::DtSoundComponentSystem::removeSound ( DtSoundComponent *  sound)
virtual

Remove a sound component from the system and clean up resources.

Parameters
soundThe sound component to remove
virtual void makVrv::DtSoundComponentSystem::slot_postUpdate ( double  simTime)
protectedvirtual

Slot connected to DtRenderer::signal_postUpdate Updates sound positions each frame for sounds attached to scene objects.

Parameters
simTimeThe current simulation time
virtual void makVrv::DtSoundComponentSystem::slot_sceneObjectToBeDeleted ( const DtUniqueID &  id)
protectedvirtual

Slot connected to DtSceneObject::signal_sceneObjectToBeDeleted Handles cleanup when a scene object with attached sounds is being deleted.

Parameters
idThe unique ID of the scene object being deleted
virtual void makVrv::DtSoundComponentSystem::slot_audioListenerObserverChanged ( DtObserver *  observer)
protectedvirtual

Slot connected to DtAudioManager::signal_audioListenerObserverChanged Handles switching to a new observer and its associated observer mode.

Parameters
observerThe new current observer (may be nullptr)
virtual void makVrv::DtSoundComponentSystem::slot_currentObserverModeChanged ( int  observerMode)
protectedvirtual

Slot connected to DtObserver::signal_observerModeChanged Pauses sounds in the old model set and resumes sounds in the new model set.

Parameters
observerModeThe new observer mode
virtual void makVrv::DtSoundComponentSystem::handleDelayedSoundCreation ( )
protectedvirtual

Handle creation of sounds that were deferred due to audio device not being ready.

virtual void makVrv::DtSoundComponentSystem::createAndInitializeSound ( DtSoundComponent *  soundComponent)
protectedvirtual
virtual void makVrv::DtSoundComponentSystem::createProceduralSound ( DtSoundComponent *  soundComponent,
const std::string &  behaviorKey = std::string(),
const std::map< std::string, std::string > &  behaviorParams = std::map< std::string, std::string >(),
bool  localWeatherAreaEnabled = false 
)
protectedvirtual

Create and start a procedural sound for the given component.

When behaviorKey is non-empty, creates a behavior-backed procedural sound via DtProceduralSoundBehaviorFactory instead of looking up the key from the filename prefix. When behaviorKey is empty, falls back to the existing filename-based DtProceduralSoundFactory lookup.

Parameters
soundComponentComponent to attach the procedural sound to.
behaviorKeyOptional behavior factory key.
behaviorParamsKey-value params forwarded to the behavior creator.
localWeatherAreaEnabledWhen true, local weather area queries are performed before each behavior update.
virtual void makVrv::DtSoundComponentSystem::resolveAndWireSceneObject ( DtSoundComponent *  soundComponent)
protectedvirtual

Resolve mySceneObjectId to a mySceneObject pointer on the component and connect its scene-object deletion signal.

Idempotent: safe to call more than once. A no-op if the pointer is already resolved. Called during initial wiring and again from the per-tick update loop when a late-registering agent finally becomes resolvable.

Parameters
soundComponentThe component to resolve and wire.
virtual void makVrv::DtSoundComponentSystem::initialize ( )
protectedvirtual

Two-phase initialization called by instance() after construction.

Connects signal slots and calls createImGui(). Subclasses that override this must call the base-class implementation.

virtual void makVrv::DtSoundComponentSystem::createImGui ( )
protectedvirtual

Factory method for the ImGui debug panel.

Override in a subclass to supply a custom DtSoundComponentSystemImGui derivative with extended diagnostics.

virtual void makVrv::DtSoundComponentSystem::slot_renderImGui ( )
protectedvirtual

Per-frame ImGui draw call rendering the Sound Component diagnostics tree.

Friends And Related Function Documentation

friend class DtSoundComponent
friend
friend class DtSoundComponentSystemImGui
friend

Member Data Documentation

DtDe& makVrv::DtSoundComponentSystem::myDe
protected

Reference to the DtDe (distributed entity) that owns this system.

DtSignalConnectionManager makVrv::DtSoundComponentSystem::mySignalPostUpdateConnection
protected

Connection manager for the post-update signal (blocked when no sounds need updates)

DtSignalConnectionManager makVrv::DtSoundComponentSystem::myCurrentObserverConnection
protected

Connection manager for current observer's signals.

DtSignalConnectionManager makVrv::DtSoundComponentSystem::myConnections
protected

Connection manager for miscellaneous signal connections.

DtObserver* makVrv::DtSoundComponentSystem::myCurrentObserver
protected

Pointer to the current observer (used to track observer mode changes)

DtModelSetId makVrv::DtSoundComponentSystem::myCurrentModelSet
protected

The current model set ID (determines which sounds are active based on observer mode)

std::map<DtUniqueID, std::pair<DtSoundComponent*, vrvSignalsLib::connection> > makVrv::DtSoundComponentSystem::mySceneObjectDeletedSoundLookupMap
protected

Map from scene object unique ID to (sound component, signal connection) pair for deletion handling. The stored connection handle allows safe disconnect without acquiring the signal's internal mutex.

std::map<DtModelSetId, std::set<DtSoundComponent*> > makVrv::DtSoundComponentSystem::myModelSetToSoundComponentLookupMap
protected

Map from model set ID to the set of sound components in that model set.

std::set<DtSoundComponent*> makVrv::DtSoundComponentSystem::mySoundUpdateOnTickSet
protected

Set of sound components that need per-frame position updates.

std::set<DtSoundComponent*> makVrv::DtSoundComponentSystem::myNewSoundComponents
protected

Two-set swap: sounds added this tick land in myNewSoundComponents; at the end of slot_postUpdate the two sets are swapped so an entry becomes creation-ready in myPendingSoundComponents on the NEXT post-update. This guarantees the attached SceneObject has received at least one update before the underlying makAudio::DtSound is constructed.

3D scene-object-attached components added since the previous post-update.

std::set<DtSoundComponent*> makVrv::DtSoundComponentSystem::myPendingSoundComponents
protected

Components that have completed one update interval and can now be created.

std::map<DtSoundComponent*, int> makVrv::DtSoundComponentSystem::myResolveAttempts
protected

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.

std::map<const DtSoundComponent*, std::unique_ptr<DtProceduralSound> > makVrv::DtSoundComponentSystem::myProceduralSounds
protected

Map from sound component to its procedural sound. DtSoundComponentSystem owns the sounds.

std::set<DtSoundComponent*> makVrv::DtSoundComponentSystem::myProceduralUpdateSet
protected

Set of components backed by a procedural sound that need per-frame tick() calls.

std::map<const DtSoundComponent*, std::unique_ptr<DtProceduralSoundBehavior> > makVrv::DtSoundComponentSystem::myProceduralBehaviors
protected

Map from sound component to its behavior-backed procedural sound behavior.

Entries are created by createProceduralSound() when a non-empty behaviorKey is provided and removed by removeSound(). Owned by the system.

std::set<const DtSoundComponent*> makVrv::DtSoundComponentSystem::myLocalWeatherAreaEnabledSet
protected

Components whose behavior should query local weather areas at model position.

Populated when DtSoundComponentData::myLocalWeatherAreaEnabled is true and myBehaviorKey is non-empty. The system performs a weather-area containment query at the model's world position before each behavior update for these components.

double makVrv::DtSoundComponentSystem::myLastSimTime = -1.0
protected

Last simulation time used to compute elapsed dt for procedural sound ticks.

std::unique_ptr<DtSoundComponentSystemImGui> makVrv::DtSoundComponentSystem::myImGui
protected

ImGui debug panel renderer (owned).


The documentation for this class was generated from the following file:

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)