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

Manages a collection of ambient geographic sound channels.

DtProceduralSoundscapeManager is a per-DtDe singleton that drives looping, non-3D DtSoundComponent instances whose volume is controlled each tick by how close the current observer is to polygons in an osgEarth FeatureSource layer.

Each channel is described by a DtProceduralSoundscapeChannel:

The same addAmbientChannel() method handles all sound types (water, forest, city, etc.) - there are no type-specific registration methods.

Follows the DtSoundComponentSystem pattern:

See Also
DtProceduralSoundscapesSettingsManager
Warning
DtProceduralSoundscapeManager discriminates between procedural channels and Sound-schema model-definition channels by checking whether soundFile starts with makVrv::kProceduralSoundPrefix ("ProceduralSound:") or with "ModelDefinition:". Raw file paths are no longer accepted.
Inheritance diagram for makVrv::DtProceduralSoundscapeManager:
Inheritance graph
[legend]

Classes

struct  ChannelState
 

Public Member Functions

virtual ~DtProceduralSoundscapeManager ()
 
 DtProceduralSoundscapeManager (const DtProceduralSoundscapeManager &)=delete
 
 DtProceduralSoundscapeManager (DtProceduralSoundscapeManager &&)=delete
 
DtProceduralSoundscapeManager & operator= (const DtProceduralSoundscapeManager &)=delete
 
DtProceduralSoundscapeManager & operator= (DtProceduralSoundscapeManager &&)=delete
 
virtual void addAmbientChannel (const DtProceduralSoundscapeChannel &channel)
 
virtual void removeAmbientChannel (const std::string &name)
 
virtual void clearAllAmbientChannels ()
 
virtual void startPreview (const DtProceduralSoundscapeChannel &channel)
 
virtual void stopPreview ()
 
virtual bool isPreviewActive () const
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Member Functions

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

Protected Member Functions

 DtProceduralSoundscapeManager (DtDe &de)
 
virtual void slot_mapNodeFound (DtTerrainPatchObject &tpo)
 
virtual void slot_postTick ()
 
virtual void handleDelayedSoundCreation ()
 
virtual void slot_audioEnabledChanged (bool enabled)
 
virtual void createChannelSound (std::size_t channelIndex)
 
virtual void slot_initImGui ()
 
virtual void slot_renderImGui ()
 
virtual DtUniqueID generateLocalUniqueId ()
 
virtual void slot_audioListenerObserverChanged (DtObserver *observer)
 
virtual void slot_currentObserverModeChanged (int observerMode)
 
virtual void slot_postInitializeObserver ()
 
virtual void slot_soundsChanged (const std::vector< DtProceduralSoundConfig > &sounds)
 

Protected Attributes

DtDe & myDe
 
std::vector< ChannelState > myChannels
 
std::vector< std::unique_ptr
< DtProceduralSoundPlayer > > 
myProceduralPlayers
 
std::unique_ptr
< DtProceduralSoundscapeQuery > 
myQuery
 
DtSignalConnectionManager myConnections
 
DtSignalConnectionManager myCurrentObserverConnection
 
DtObserver * myCurrentObserver = nullptr
 
DtModelSetId myCurrentModelSet = DtModelSetId::Models3D
 
double myLastSimTime = -1.0
 
std::unique_ptr< DtSoundComponent > myPreviewWavSound
 
std::unique_ptr
< DtProceduralSoundPlayer > 
myPreviewProceduralPlayer
 

Constructor & Destructor Documentation

virtual makVrv::DtProceduralSoundscapeManager::~DtProceduralSoundscapeManager ( )
virtual
makVrv::DtProceduralSoundscapeManager::DtProceduralSoundscapeManager ( const DtProceduralSoundscapeManager &  )
delete
makVrv::DtProceduralSoundscapeManager::DtProceduralSoundscapeManager ( DtProceduralSoundscapeManager &&  )
delete
makVrv::DtProceduralSoundscapeManager::DtProceduralSoundscapeManager ( DtDe &  de)
explicitprotected

Protected constructor - use instance(DtDe&).

Member Function Documentation

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

Get or create the DtProceduralSoundscapeManager singleton for de. Use DtProceduralSoundscapeManager::registerInstance() to substitute a subclass.

static void makVrv::DtProceduralSoundscapeManager::registerInstance ( DtDe &  de,
DtProceduralSoundscapeManager *  mgr 
)
static

Register a custom instance (must be called before the first instance() call).

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

Get the name used to register this class with DtDe.

DtProceduralSoundscapeManager& makVrv::DtProceduralSoundscapeManager::operator= ( const DtProceduralSoundscapeManager &  )
delete
DtProceduralSoundscapeManager& makVrv::DtProceduralSoundscapeManager::operator= ( DtProceduralSoundscapeManager &&  )
delete
virtual void makVrv::DtProceduralSoundscapeManager::addAmbientChannel ( const DtProceduralSoundscapeChannel &  channel)
virtual

Register an ambient sound channel.

If the audio playback device is already initialized and the MapNode is available, the underlying DtSoundComponent is created immediately. Otherwise creation is deferred until both are ready.

Channels with the same name replace any existing channel with that name.

Parameters
channelChannel configuration including sound file and feature layer query.
virtual void makVrv::DtProceduralSoundscapeManager::removeAmbientChannel ( const std::string &  name)
virtual

Remove the channel with the given name and stop its sound. No-op if no channel with that name exists.

virtual void makVrv::DtProceduralSoundscapeManager::clearAllAmbientChannels ( )
virtual

Remove all registered channels and stop all sounds.

virtual void makVrv::DtProceduralSoundscapeManager::startPreview ( const DtProceduralSoundscapeChannel &  channel)
virtual

Start previewing a channel at full configured volume, bypassing the proximity gate. Any already-active preview is stopped first. For looping-file channels the WAV is played immediately (requires audio device to be initialised). For procedural channels the soundscape is created and ticked each frame via slot_postTick.

virtual void makVrv::DtProceduralSoundscapeManager::stopPreview ( )
virtual

Stop any active preview. No-op if no preview is running.

virtual bool makVrv::DtProceduralSoundscapeManager::isPreviewActive ( ) const
virtual

Return true if a preview is currently running.

virtual void makVrv::DtProceduralSoundscapeManager::slot_mapNodeFound ( DtTerrainPatchObject &  tpo)
protectedvirtual

Slot connected to DtTerrainPatchObjectSignaler::signal_osgEarthMapNodeFound. Stores the MapNode and creates any channels that were registered before the map loaded.

virtual void makVrv::DtProceduralSoundscapeManager::slot_postTick ( )
protectedvirtual

Slot connected to DtDe::signal_postTick. Queries each channel's feature layer and adjusts DtSoundComponent decibel levels.

virtual void makVrv::DtProceduralSoundscapeManager::handleDelayedSoundCreation ( )
protectedvirtual

Slot connected to DtAudioManager::signal_playbackDeviceInitialized. Creates DtSoundComponent instances for channels that were registered before the audio device was ready.

virtual void makVrv::DtProceduralSoundscapeManager::slot_audioEnabledChanged ( bool  enabled)
protectedvirtual

Slot connected to DtAudioSettingsManager::signal_enableAudioChanged.

When enabled is true, resets the soundPlaying flag on all looping-file channels so that slot_postTick restarts them on the next frame. When enabled is false, this function is a no-op.

Parameters
enabledThe new audio-enabled state.
virtual void makVrv::DtProceduralSoundscapeManager::createChannelSound ( std::size_t  channelIndex)
protectedvirtual

Create and start the DtSoundComponent for one channel state entry. Does nothing if the sound has already been created or the device is not ready.

virtual void makVrv::DtProceduralSoundscapeManager::slot_initImGui ( )
protectedvirtual

Slot connected to DtDe::signal_postInitialize. Defers the renderer signal connection until the renderer is ready.

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

Slot connected to DtRenderer::signal_update. Emits the "Procedural Soundscapes Settings" ImGui debug tree node each rendered frame.

virtual DtUniqueID makVrv::DtProceduralSoundscapeManager::generateLocalUniqueId ( )
protectedvirtual

Generate a unique ID for a locally-owned DtSoundComponent or DtProceduralSoundPlayer.

Uses a monotonically increasing atomic counter seeded at 0xAB000000. These IDs are never registered with the distributed object system, so collisions with networked entities are not possible.

Returns
A unique DtUniqueID value.
virtual void makVrv::DtProceduralSoundscapeManager::slot_audioListenerObserverChanged ( DtObserver *  observer)
protectedvirtual

Handle observer switching – re-bind myCurrentObserverConnection. Slot connected to DtAudioManager::signal_audioListenerObserverChanged.

virtual void makVrv::DtProceduralSoundscapeManager::slot_currentObserverModeChanged ( int  observerMode)
protectedvirtual

Handle observer mode change – update myCurrentModelSet.

virtual void makVrv::DtProceduralSoundscapeManager::slot_postInitializeObserver ( )
protectedvirtual

Called once after DtDe::signal_postInitialize to safely connect observer tracking.

virtual void makVrv::DtProceduralSoundscapeManager::slot_soundsChanged ( const std::vector< DtProceduralSoundConfig > &  sounds)
protectedvirtual

Re-create any behavior-backed channels whose tier sources reference a ProceduralSound key that was just updated in DtProceduralSoundsSettingsManager.

Member Data Documentation

DtDe& makVrv::DtProceduralSoundscapeManager::myDe
protected
std::vector<ChannelState> makVrv::DtProceduralSoundscapeManager::myChannels
protected

All registered looping-file channels with their active sound components.

std::vector<std::unique_ptr<DtProceduralSoundPlayer> > makVrv::DtProceduralSoundscapeManager::myProceduralPlayers
protected

All registered procedural channels. Indexed in parallel with removal by name.

std::unique_ptr<DtProceduralSoundscapeQuery> makVrv::DtProceduralSoundscapeManager::myQuery
protected

The osgEarth query helper. Null until signal_osgEarthMapNodeFound fires.

DtSignalConnectionManager makVrv::DtProceduralSoundscapeManager::myConnections
protected

Signal connections (DtDe::signal_postTick, terrain signaler, audio device).

DtSignalConnectionManager makVrv::DtProceduralSoundscapeManager::myCurrentObserverConnection
protected

Signal connections scoped to the current observer's lifetime.

DtObserver* makVrv::DtProceduralSoundscapeManager::myCurrentObserver = nullptr
protected

Observer whose mode determines the active model set.

DtModelSetId makVrv::DtProceduralSoundscapeManager::myCurrentModelSet = DtModelSetId::Models3D
protected

Model set currently active for the observer. Channels disabled for this model set are silenced in slot_postTick.

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

Simulation time at the end of the previous slot_postTick, used to compute dt.

std::unique_ptr<DtSoundComponent> makVrv::DtProceduralSoundscapeManager::myPreviewWavSound
protected

Preview state - at most one of these is non-null at any time.

std::unique_ptr<DtProceduralSoundPlayer> makVrv::DtProceduralSoundscapeManager::myPreviewProceduralPlayer
protected

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)