![]() |
VR-Forces Developer's Guide
|
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().
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 |
|
strong |
| makVrv::DtBallisticSoundStream::DtBallisticSoundStream | ( | ) |
Default constructor. The stream is not usable until init() succeeds.
|
virtual |
Destructor. Stops the underlying stream if it is playing.
|
delete |
|
default |
|
delete |
|
default |
|
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.
| de | Simulation environment (needed by DtProceduralSound). |
| streamId | Unique numeric ID for this stream; used by DtProceduralSound to avoid DtSoundComponent ID collisions. |
| groups | Group definitions to pre-load as layers. |
|
virtual |
Returns true if this slot has no burst assigned.
|
virtual |
Returns true if this slot is assigned to the given burst.
| burstId | Burst ID to test against myAssignedBurstId. |
burstId.
|
virtual |
Returns the current lifecycle state of this slot.
|
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.
| groupName | Layer name to trigger (must match a group loaded in init()). |
| worldPos | World-space position of the CPA (meters). |
| vel | Bullet velocity at CPA (m/s); used for Doppler. |
| decibels | Source SPL forwarded to DtProceduralSound::setDecibel(). |
| linearGain | Linear gain multiplier for this event [0.0, 1.0]. |
| pitchFactor | Pitch multiplier for this event (1.0 = native pitch). |
| burstId | Burst-record ID of the fire burst (DtBallisticBurstRecord::myId). |
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).
| dt | Elapsed simulation time in seconds. |
| simTime | Absolute simulation time in seconds (for drain-timer comparison). |
|
static |
Hold time after the last event before transitioning to Free (seconds).
|
protected |
Underlying stream; null until init() succeeds.
|
protected |
Current lifecycle state.
|
protected |
Burst-record ID of the currently assigned burst; 0 when Free.
|
protected |
Simulation time at which the slot entered the Draining state.