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 | Protected Attributes
makVrv::DtProceduralSoundPlayer Class Reference

Runtime player for one procedural ambient sound channel.

Owned by DtProceduralSoundscapeManager. One DtProceduralSoundPlayer is created per DtProceduralSoundscapeChannel whose soundFile begins with "ProceduralSound:".

Responsibilities:

Public Member Functions

 DtProceduralSoundPlayer (DtDe &de, const DtProceduralSoundscapeChannel &channel, DtProceduralSound *sound)
 
virtual ~DtProceduralSoundPlayer ()
 
 DtProceduralSoundPlayer (const DtProceduralSoundPlayer &)=delete
 
DtProceduralSoundPlayer & operator= (const DtProceduralSoundPlayer &)=delete
 
virtual void tick (double dt, float relativeDb)
 
virtual void stop ()
 
virtual const std::string & channelName () const
 
virtual const
DtProceduralSoundscapeChannel & 
channel () const
 
virtual bool hasEverStarted () const
 
virtual bool isActive () const
 
virtual float lastRelativeDb () const
 
virtual double lastSignedDistanceMeters () const
 
virtual void setLastSignedDistanceMeters (double d)
 
virtual const DtProceduralSound & sound () const
 
virtual void setBehavior (DtProceduralSoundBehavior *behavior)
 
virtual DtProceduralSoundBehavior * behavior () const
 
virtual void setLastProximityFactor (float factor)
 
virtual void setChannelDecibels (float dbfs)
 
virtual float channelDecibels () const
 

Protected Attributes

DtDe & myDe
 
DtProceduralSoundscapeChannel myChannel
 
float myLastRelativeDb = 0.0f
 
double myLastSignedDistanceMeters = 1.0e9
 
bool myHasEverStarted = false
 
float myChannelDecibelsDbfs = 0.0f
 
std::unique_ptr
< DtProceduralSound > 
mySound
 
std::unique_ptr
< DtProceduralSoundBehavior > 
myBehavior
 
float myLastProximityFactor = 0.0f
 

Constructor & Destructor Documentation

makVrv::DtProceduralSoundPlayer::DtProceduralSoundPlayer ( DtDe &  de,
const DtProceduralSoundscapeChannel &  channel,
DtProceduralSound *  sound 
)
Parameters
deDisplay engine context.
channelChannel configuration (name, densityScale, etc.).
soundHeap-allocated procedural sound; this player takes ownership.
virtual makVrv::DtProceduralSoundPlayer::~DtProceduralSoundPlayer ( )
virtual

Destructor. Stops the sound before releasing it.

makVrv::DtProceduralSoundPlayer::DtProceduralSoundPlayer ( const DtProceduralSoundPlayer &  )
delete

Not copyable.

Member Function Documentation

DtProceduralSoundPlayer& makVrv::DtProceduralSoundPlayer::operator= ( const DtProceduralSoundPlayer &  )
delete

Not assignable.

virtual void makVrv::DtProceduralSoundPlayer::tick ( double  dt,
float  relativeDb 
)
virtual

Drive one frame of audio mixing and volume update.

Parameters
dtElapsed simulation time in seconds since last tick.
relativeDbVolume in relative dB (0 = full, negative = attenuated) pre-computed by DtProceduralSoundscapeManager::slot_postTick() from the signed-distance gate.
virtual void makVrv::DtProceduralSoundPlayer::stop ( )
virtual

Stop the sound and silence the stream.

Note
Safe to call every frame; forwards to the underlying sound only when it is currently playing.
virtual const std::string& makVrv::DtProceduralSoundPlayer::channelName ( ) const
virtual

Channel name used for lookup in removeAmbientChannel().

virtual const DtProceduralSoundscapeChannel& makVrv::DtProceduralSoundPlayer::channel ( ) const
virtual

Full channel configuration (needed by slot_postTick for gate queries).

virtual bool makVrv::DtProceduralSoundPlayer::hasEverStarted ( ) const
virtual

True once play() has succeeded at least once (audio device was ready). Lets ImGui distinguish "Pending" (never started) from "Out of range" (stopped).

virtual bool makVrv::DtProceduralSoundPlayer::isActive ( ) const
virtual

True while the underlying sound is currently playing.

virtual float makVrv::DtProceduralSoundPlayer::lastRelativeDb ( ) const
virtual

Last relative-dB value passed to tick() - useful for ImGui diagnostics.

virtual double makVrv::DtProceduralSoundPlayer::lastSignedDistanceMeters ( ) const
virtual

Last signed-distance value (metres) from the zone-gate query. Negative = inside the polygon, positive = outside. Updated every frame by DtProceduralSoundscapeManager::slot_postTick() via setLastSignedDistance().

virtual void makVrv::DtProceduralSoundPlayer::setLastSignedDistanceMeters ( double  d)
virtual

Store the most-recent gate query result for ImGui diagnostics.

virtual const DtProceduralSound& makVrv::DtProceduralSoundPlayer::sound ( ) const
virtual

Read-only access to the underlying procedural sound for diagnostics.

virtual void makVrv::DtProceduralSoundPlayer::setBehavior ( DtProceduralSoundBehavior *  behavior)
virtual

Set the behavior for this player, taking ownership. Also propagates the non-owning pointer to all layers in the underlying sound. Call after the sound has been configured (setupSound has run).

virtual DtProceduralSoundBehavior* makVrv::DtProceduralSoundPlayer::behavior ( ) const
virtual

Non-owning access to the current behavior, or nullptr if none.

virtual void makVrv::DtProceduralSoundPlayer::setLastProximityFactor ( float  factor)
virtual

Push the current proximity factor into all layers so audio-thread callbacks can access it via DtProceduralSoundBehaviorContext::myProximityFactor.

virtual void makVrv::DtProceduralSoundPlayer::setChannelDecibels ( float  dbfs)
virtual

Set the channel-level dBFS attenuation resolved from the Sound-schema sound_decibels parameter.

Additive with the per-tick fade dB computed by DtProceduralSoundscapeManager::slot_postTick(); the composite is clamped to unity inside tick() before it reaches the voice. Defaults to 0.0f (no channel-level attenuation).

Parameters
dbfsChannel-level dBFS offset (0.0f = no attenuation, negative = attenuate).
virtual float makVrv::DtProceduralSoundPlayer::channelDecibels ( ) const
virtual

Current channel-level dBFS offset (see setChannelDecibels).

Member Data Documentation

DtDe& makVrv::DtProceduralSoundPlayer::myDe
protected
DtProceduralSoundscapeChannel makVrv::DtProceduralSoundPlayer::myChannel
protected
float makVrv::DtProceduralSoundPlayer::myLastRelativeDb = 0.0f
protected
double makVrv::DtProceduralSoundPlayer::myLastSignedDistanceMeters = 1.0e9
protected

large = out of range

bool makVrv::DtProceduralSoundPlayer::myHasEverStarted = false
protected
float makVrv::DtProceduralSoundPlayer::myChannelDecibelsDbfs = 0.0f
protected

Channel-level dBFS attenuation from the Sound-schema sound_decibels parameter. Applied additively in tick() and clamped to unity together with the caller-supplied relative dB.

std::unique_ptr<DtProceduralSound> makVrv::DtProceduralSoundPlayer::mySound
protected
std::unique_ptr<DtProceduralSoundBehavior> makVrv::DtProceduralSoundPlayer::myBehavior
protected
float makVrv::DtProceduralSoundPlayer::myLastProximityFactor = 0.0f
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)