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

One slot in the ballistic proximity sound stream pool.

Wraps a single DtProceduralSound (one streaming OpenAL voice) and manages a three-state lifecycle:

All groups from DtBallisticSoundSettingsRecord are pre-loaded as named DtProceduralSoundLayer layers at initialization time. At trigger time the manager looks up the layer by group name and calls triggerGroup().

See Also
DtBallisticSoundManager, DtProceduralSound, DtBallisticSoundGroup

Public Types

enum  State { State::Free, State::Playing, State::Draining }
 

Public Member Functions

 DtBallisticSoundStream ()
 
virtual ~DtBallisticSoundStream ()
 
 DtBallisticSoundStream (const DtBallisticSoundStream &)=delete
 
DtBallisticSoundStream & operator= (const DtBallisticSoundStream &)=delete
 
 DtBallisticSoundStream (DtBallisticSoundStream &&)=default
 
DtBallisticSoundStream & operator= (DtBallisticSoundStream &&)=default
 
virtual bool init (DtDe &de, DtUniqueID streamId, const std::vector< DtBallisticSoundGroup > &groups)
 
virtual bool isFree () const
 
virtual bool ownsRequest (DtUniqueID burstId) const
 
virtual State state () const
 
virtual void triggerGroup (const std::string &groupName, const DtVector &worldPos, const DtVector &vel, float decibels, float linearGain, float pitchFactor, DtUniqueID burstId)
 
virtual void tick (double dt, double simTime)
 

Static Public Attributes

static constexpr float theDrainSecs = 0.5f
 

Protected Attributes

std::unique_ptr
< DtProceduralSound > 
myStream
 
State myState
 
DtUniqueID myAssignedBurstId
 
double myDrainStart
 

Member Enumeration Documentation

Lifecycle states of the stream slot.

Enumerator
Free 

Available for a new burst.

Playing 

Burst in progress; at least one layer event is active.

Draining 

All events finished; waiting for kDrainSecs before becoming Free.

Constructor & Destructor Documentation

makVrv::DtBallisticSoundStream::DtBallisticSoundStream ( )

Default constructor. The stream is not usable until init() succeeds.

virtual makVrv::DtBallisticSoundStream::~DtBallisticSoundStream ( )
virtual

Destructor. Stops the underlying stream if it is playing.

makVrv::DtBallisticSoundStream::DtBallisticSoundStream ( const DtBallisticSoundStream &  )
delete
makVrv::DtBallisticSoundStream::DtBallisticSoundStream ( DtBallisticSoundStream &&  )
default

Member Function Documentation

DtBallisticSoundStream& makVrv::DtBallisticSoundStream::operator= ( const DtBallisticSoundStream &  )
delete
DtBallisticSoundStream& makVrv::DtBallisticSoundStream::operator= ( DtBallisticSoundStream &&  )
default
virtual bool makVrv::DtBallisticSoundStream::init ( DtDe &  de,
DtUniqueID  streamId,
const std::vector< DtBallisticSoundGroup > &  groups 
)
virtual

Create the underlying DtProceduralSound, load all group layers, and start streaming.

Each group in groups is added as a named DtProceduralSoundLayer with density=0 (manual trigger-only mode). Clips are loaded from disk using the path-configuration resolver in de.

Parameters
deSimulation environment (needed by DtProceduralSound).
streamIdUnique numeric ID for this stream; used by DtProceduralSound to avoid DtSoundComponent ID collisions.
groupsGroup definitions to pre-load as layers.
Returns
true on success.
virtual bool makVrv::DtBallisticSoundStream::isFree ( ) const
virtual

Returns true if this slot has no burst assigned.

Returns
true when State::Free.
virtual bool makVrv::DtBallisticSoundStream::ownsRequest ( DtUniqueID  burstId) const
virtual

Returns true if this slot is assigned to the given burst.

Parameters
burstIdBurst ID to test against myAssignedBurstId.
Returns
true when myAssignedBurstId equals burstId.
virtual State makVrv::DtBallisticSoundStream::state ( ) const
virtual

Returns the current lifecycle state of this slot.

Returns
The current State value.
virtual void makVrv::DtBallisticSoundStream::triggerGroup ( const std::string &  groupName,
const DtVector &  worldPos,
const DtVector &  vel,
float  decibels,
float  linearGain,
float  pitchFactor,
DtUniqueID  burstId 
)
virtual

Fire one event on the named group layer.

Positions the 3D source at worldPos, sets velocity and decibels, then calls triggerEvent() on the layer matching groupName.

If the slot is Free or Draining-for-the-same-burst, it transitions to Playing and is assigned burstId. If the named layer does not exist (unknown group name), no event is queued and a warning is emitted once.

Parameters
groupNameLayer name to trigger (must match a group loaded in init()).
worldPosWorld-space position of the CPA (meters).
velBullet velocity at CPA (m/s); used for Doppler.
decibelsSource SPL forwarded to DtProceduralSound::setDecibel().
linearGainLinear gain multiplier for this event [0.0, 1.0].
pitchFactorPitch multiplier for this event (1.0 = native pitch).
burstIdBurst-record ID of the fire burst (DtBallisticBurstRecord::myId).
virtual void makVrv::DtBallisticSoundStream::tick ( double  dt,
double  simTime 
)
virtual

Advance the state machine and tick the underlying stream.

Must be called every frame even when state is Free so the OpenAL buffer queue remains pre-filled with silence (avoids start latency on next trigger).

Parameters
dtElapsed simulation time in seconds.
simTimeAbsolute simulation time in seconds (for drain-timer comparison).

Member Data Documentation

constexpr float makVrv::DtBallisticSoundStream::theDrainSecs = 0.5f
static

Hold time after the last event before transitioning to Free (seconds).

std::unique_ptr<DtProceduralSound> makVrv::DtBallisticSoundStream::myStream
protected

Underlying stream; null until init() succeeds.

State makVrv::DtBallisticSoundStream::myState
protected

Current lifecycle state.

DtUniqueID makVrv::DtBallisticSoundStream::myAssignedBurstId
protected

Burst-record ID of the currently assigned burst; 0 when Free.

double makVrv::DtBallisticSoundStream::myDrainStart
protected

Simulation time at which the slot entered the Draining state.


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)