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 | Public Attributes | Protected Attributes | Private Member Functions
makVrv::DtBallisticSoundProxy Class Reference

Pure data and signal container that decouples DtOsgBallisticManager from the audio subsystem.

DtOsgBallisticManager owns one instance of this proxy as a member. vrvAudio obtains the proxy via DtOsgBallisticManager::soundProxy(), attaches a resolver, connects to signal_soundTriggers, and pushes query settings. The proxy itself has no knowledge of DtBallisticComputeComponent beyond what is needed to drain sound triggers from it.

See Also
DtOsgBallisticManager, DtBallisticSoundTrigger

Public Types

using SoundIndexResolver = std::function< int32_t(const std::string &)>
 

Public Member Functions

 DtBallisticSoundProxy ()
 
virtual ~DtBallisticSoundProxy ()=default
 
virtual void setSoundIndexResolver (const SoundIndexResolver &resolver)
 
virtual void setSoundQueryEnabled (bool enabled)
 
virtual void setSoundQueryRadius (float radius)
 
virtual void setSoundQueryMaxResults (int n)
 
virtual bool soundQueryEnabled () const
 
virtual float soundQueryRadius () const
 
virtual int soundQueryMaxResults () const
 
virtual void notifyBulletSpawned (uint32_t bulletSlot, uint64_t burstId)
 
virtual void notifyBulletRetired (uint32_t bulletSlot)
 
virtual void notifyBurstFired (uint64_t burstId, const Vector3_64 &muzzleWorldPos)
 
virtual void notifyBurstRetired (uint64_t burstId)
 
virtual void drainAndFire (DtBallisticComputeComponent &compute)
 
virtual int32_t resolveGroupIndex (const std::string &groupName) const
 

Public Attributes

boost::signalslib::signal
< void(const std::vector
< DtBallisticSoundTrigger > &)> 
signal_soundTriggers
 

Protected Attributes

SoundIndexResolver mySoundIndexResolver
 
bool mySoundQueryEnabled
 
float mySoundQueryRadius
 
int mySoundQueryMaxResults
 
std::map< uint32_t,
DtBallisticSoundTrigger > 
myPendingRangeTriggers
 
std::set< uint32_t > myFiredWithinZoneIds
 
std::set< uint32_t > myFiredFlybySoundIds
 
std::unordered_map< uint32_t,
uint64_t > 
mySlotToFireRequestId
 
std::unordered_map< uint64_t,
Vector3_64 > 
myBurstIdToMuzzlePos
 

Private Member Functions

 DtBallisticSoundProxy (const DtBallisticSoundProxy &)=delete
 
DtBallisticSoundProxy & operator= (const DtBallisticSoundProxy &)=delete
 

Member Typedef Documentation

using makVrv::DtBallisticSoundProxy::SoundIndexResolver = std::function<int32_t(const std::string&)>

Callable that maps a sound group name to a stable 0-based GPU index.

Registered by vrvAudio so that DtOsgBallisticManager::spawnOneRound() can resolve a group name to an index without depending on vrvAudio at compile time. Returns -1 when no group can be resolved.

Constructor & Destructor Documentation

makVrv::DtBallisticSoundProxy::DtBallisticSoundProxy ( )

Constructs the proxy with sound query disabled and default settings.

virtual makVrv::DtBallisticSoundProxy::~DtBallisticSoundProxy ( )
virtualdefault

Virtual destructor.

makVrv::DtBallisticSoundProxy::DtBallisticSoundProxy ( const DtBallisticSoundProxy &  )
privatedelete

Member Function Documentation

virtual void makVrv::DtBallisticSoundProxy::setSoundIndexResolver ( const SoundIndexResolver &  resolver)
virtual

Registers the callable that resolves group names to GPU indices.

Parameters
resolverCallable; the proxy stores a copy.
virtual void makVrv::DtBallisticSoundProxy::setSoundQueryEnabled ( bool  enabled)
virtual

Enables or disables the proximity sound query on the GPU.

Parameters
enabledTrue to enable; false to disable.
virtual void makVrv::DtBallisticSoundProxy::setSoundQueryRadius ( float  radius)
virtual

Sets the detection radius for the proximity sound query.

Parameters
radiusDetection radius in meters.
virtual void makVrv::DtBallisticSoundProxy::setSoundQueryMaxResults ( int  n)
virtual

Sets the maximum number of query results per frame.

The value is cached here; the caller is responsible for forwarding it to DtBallisticComputeComponent via DtOsgBallisticManager::setSoundQueryMaxResults() when the compute component is live.

Parameters
nMaximum number of results.
virtual bool makVrv::DtBallisticSoundProxy::soundQueryEnabled ( ) const
virtual

Returns true when the proximity sound query is enabled.

virtual float makVrv::DtBallisticSoundProxy::soundQueryRadius ( ) const
virtual

Returns the detection radius in meters.

virtual int makVrv::DtBallisticSoundProxy::soundQueryMaxResults ( ) const
virtual

Returns the maximum number of query results per frame.

virtual void makVrv::DtBallisticSoundProxy::notifyBulletSpawned ( uint32_t  bulletSlot,
uint64_t  burstId 
)
virtual

Records that a bullet has been spawned from a fire burst.

Called by DtOsgBallisticManager::spawnOneRound() after a GPU slot is assigned. Stores the mapping from GPU slot index to burst-record ID so that drainAndFire() can enrich outgoing triggers with myFireRequestId.

Parameters
bulletSlotGPU StateBuffer slot index of the new bullet.
burstIdDtBallisticBurstRecord::myId for this burst.
virtual void makVrv::DtBallisticSoundProxy::notifyBulletRetired ( uint32_t  bulletSlot)
virtual

Removes the slot-to-burst mapping for a bullet that has left the pool.

Called by DtOsgBallisticManager when a slot is released back to the GPU pool.

Parameters
bulletSlotGPU StateBuffer slot index being freed.
virtual void makVrv::DtBallisticSoundProxy::notifyBurstFired ( uint64_t  burstId,
const Vector3_64 &  muzzleWorldPos 
)
virtual

Records the world-space muzzle position for a fire burst.

Called once per burst (not per round) by DtOsgBallisticManager::fire(). Enriches outgoing DtBallisticSoundTrigger records with the muzzle position so that DtBallisticSoundManager can suppress flyby triggers whose shooter is within the observer's proximity detection radius.

Parameters
burstIdDtBallisticBurstRecord::myId for this burst.
muzzleWorldPosWorld-space muzzle position in meters at fire time.
virtual void makVrv::DtBallisticSoundProxy::notifyBurstRetired ( uint64_t  burstId)
virtual

Removes the muzzle-position record for a burst that has ended.

Called by DtOsgBallisticManager at every burst-record erase site so the map does not accumulate stale entries.

Parameters
burstIdDtBallisticBurstRecord::myId of the retiring burst.
virtual void makVrv::DtBallisticSoundProxy::drainAndFire ( DtBallisticComputeComponent &  compute)
virtual

Drains pending triggers from compute and fires signal_soundTriggers if the batch is non-empty.

Called from DtOsgBallisticManager::slot_postTick() on the simulation thread.

Parameters
computeThe compute component to drain.
virtual int32_t makVrv::DtBallisticSoundProxy::resolveGroupIndex ( const std::string &  groupName) const
virtual

Delegates group-name-to-index resolution to the registered resolver.

Returns -1 if no resolver has been set or if the group name is empty.

Parameters
groupNameSound group name.
Returns
0-based stable index, or -1 if unresolvable.
DtBallisticSoundProxy& makVrv::DtBallisticSoundProxy::operator= ( const DtBallisticSoundProxy &  )
privatedelete

Member Data Documentation

boost::signalslib::signal<void(const std::vector<DtBallisticSoundTrigger>&)> makVrv::DtBallisticSoundProxy::signal_soundTriggers

Signal fired (from the simulation tick thread) when the compute component has produced one or more flyby sound triggers.

Connected by DtBallisticSoundManager::slot_postInitialize().

SoundIndexResolver makVrv::DtBallisticSoundProxy::mySoundIndexResolver
protected

Callable registered by vrvAudio to map group names to GPU indices.

bool makVrv::DtBallisticSoundProxy::mySoundQueryEnabled
protected

True when the proximity sound query is active.

float makVrv::DtBallisticSoundProxy::mySoundQueryRadius
protected

Detection radius in meters for the proximity sound query.

int makVrv::DtBallisticSoundProxy::mySoundQueryMaxResults
protected

Maximum number of query results per frame.

std::map<uint32_t, DtBallisticSoundTrigger> makVrv::DtBallisticSoundProxy::myPendingRangeTriggers
protected

Per-bullet last-known raw result for bullets currently approaching within range.

Key: StateBuffer slot index (bulletID). Value: most recent raw result for that bullet. A bullet is added when first seen with myCpaT > 1 (approaching, not yet at CPA). Its entry is updated each frame until it either reaches CPA or disappears (near-miss).

See Also
drainAndFire()
std::set<uint32_t> makVrv::DtBallisticSoundProxy::myFiredWithinZoneIds
protected

Bullet IDs that have already fired a within-zone trigger (myCpaT == -1 sentinel). Prevents re-triggering on every frame the bullet remains inside the detection zone. Entries are erased when the bullet leaves the GPU readback result set.

See Also
drainAndFire()
std::set<uint32_t> makVrv::DtBallisticSoundProxy::myFiredFlybySoundIds
protected

Bullet IDs that have already fired a flyby trigger (myCpaT in (0, 1]). Prevents duplicate triggers when myCpaT falls in the active window across consecutive frames. Entries are erased when the bullet leaves the GPU readback result set.

See Also
drainAndFire()
std::unordered_map<uint32_t, uint64_t> makVrv::DtBallisticSoundProxy::mySlotToFireRequestId
protected

Maps GPU StateBuffer slot index to the burst-record ID of the spawning burst.

Populated by notifyBulletSpawned(); cleared per-entry by notifyBulletRetired(). Consulted by drainAndFire() to populate DtBallisticSoundTrigger::myFireRequestId.

std::unordered_map<uint64_t, Vector3_64> makVrv::DtBallisticSoundProxy::myBurstIdToMuzzlePos
protected

Maps burst-record ID to the world-space muzzle position at fire time.

Populated by notifyBurstFired(); cleared per-entry by notifyBurstRetired(). Consulted by drainAndFire() to populate DtBallisticSoundTrigger::myMuzzlePosition.


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)