JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
JPL::DirectPathService Class Reference

#include <JPLSpatial/Services/DirectPathService.h>

Public Types

template<class Key , class T >
using FlatMapType = FlatMapWithAllocator<Key, T, std::pmr::polymorphic_allocator>
 

Public Member Functions

 DirectPathService ()=default
 
 DirectPathService (const DirectPathService &)=delete
 
DirectPathServiceoperator= (const DirectPathService &)=delete
 
JPL_INLINE DirectEffectHandle InitializeDirrectEffect (const DirectEffectInitParameters &initParameters)
 
JPL_INLINE bool ReleaseEffectData (DirectEffectHandle source)
 
JPL_INLINE AttenuationCurveRef AssignAttenuationCurve (DirectEffectHandle source, AttenuationCurveRef attenuationFunction)
 
JPL_INLINE bool EvaluateDistance (DirectEffectHandle source, float distance)
 
JPL_INLINE bool EvaluateDirection (DirectEffectHandle source, float directionDot)
 
JPL_INLINE float GetDistanceAttenuation (DirectEffectHandle source, const AttenuationCurveRef &curve) const
 
JPL_INLINE float GetDirectionAttenuation (DirectEffectHandle source) const
 

Static Public Member Functions

template<CVec3 Vec3Type>
static JPL_INLINE DirectPathResult< Vec3Type > ProcessDirectPath (const Position< Vec3Type > &source, const Position< Vec3Type > &listener)
 
template<CVec3 Vec3Type>
static JPL_INLINE float ProcessAngleAttenuation (const Vec3Type &position, const Position< Vec3Type > &referencePoint, AttenuationCone cone)
 
static JPL_INLINE float ProcessAngleAttenuation (float azimuth, AttenuationCone cone)
 
static JPL_INLINE float EvaluateDistance (float distance, const AttenuationCurveRef &attenuationCurve)
 

Member Typedef Documentation

◆ FlatMapType

template<class Key , class T >
using JPL::DirectPathService::FlatMapType = FlatMapWithAllocator<Key, T, std::pmr::polymorphic_allocator>

Constructor & Destructor Documentation

◆ DirectPathService() [1/2]

JPL::DirectPathService::DirectPathService ( )
default

◆ DirectPathService() [2/2]

JPL::DirectPathService::DirectPathService ( const DirectPathService & )
delete

Member Function Documentation

◆ AssignAttenuationCurve()

JPL_INLINE AttenuationCurveRef JPL::DirectPathService::AssignAttenuationCurve ( DirectEffectHandle source,
AttenuationCurveRef attenuationFunction )

Assign attenuation curve to source. The curve should not be owned by the user. attenuationFunction must be constructed with make_pmr_shared

◆ EvaluateDirection()

JPL_INLINE bool JPL::DirectPathService::EvaluateDirection ( DirectEffectHandle source,
float directionDot )

Evaluate direction angle using cone attenuation parameters assigned to the source. The value is cached internally and can be retrieved by calling GetDirectionAttenuation function.

Parameters
sourcesource to evaluate the curves for
directionDotdirection dot product relative to forward axis to evaluate
Returns
'true' if the source is valid, 'false' otherwise

◆ EvaluateDistance() [1/2]

JPL_INLINE bool JPL::DirectPathService::EvaluateDistance ( DirectEffectHandle source,
float distance )

Evaluate distance with all the curves associated with the source. The values are cached internally and can be retrieved by calling GetDistanceAttenuation function.

Parameters
sourcesource to evaluate the curves for
distancedistance to evaluate
Returns
'true' if the source is valid, 'false' otherwise

◆ EvaluateDistance() [2/2]

JPL_INLINE float JPL::DirectPathService::EvaluateDistance ( float distance,
const AttenuationCurveRef & attenuationCurve )
static

◆ GetDirectionAttenuation()

JPL_INLINE float JPL::DirectPathService::GetDirectionAttenuation ( DirectEffectHandle source) const

Get cone attenuation value for source relative to listener view. If the soruce is not found in the cache, 1.0f is returned

Parameters
sourcesource to get the value for
Returns
last value evaluated for the source, or 1.0f if value is has not been evaluated yet

◆ GetDistanceAttenuation()

JPL_INLINE float JPL::DirectPathService::GetDistanceAttenuation ( DirectEffectHandle source,
const AttenuationCurveRef & curve ) const

Get distance attenuation value for source evaluated from the curve. If either the soruce or the curve is not found in the cache, 1.0f is returned

Parameters
sourcesource to get the value for
curvecurve created by calling CreateAttenuationCurve function
Returns
last value evaluated from the curve for the source, or 1.0f if value is has not been evaluated yet

◆ InitializeDirrectEffect()

JPL_INLINE DirectEffectHandle JPL::DirectPathService::InitializeDirrectEffect ( const DirectEffectInitParameters & initParameters)

◆ operator=()

DirectPathService & JPL::DirectPathService::operator= ( const DirectPathService & )
delete

◆ ProcessAngleAttenuation() [1/2]

template<CVec3 Vec3Type>
JPL_INLINE float JPL::DirectPathService::ProcessAngleAttenuation ( const Vec3Type & position,
const Position< Vec3Type > & referencePoint,
AttenuationCone cone )
static

◆ ProcessAngleAttenuation() [2/2]

JPL_INLINE float JPL::DirectPathService::ProcessAngleAttenuation ( float azimuth,
AttenuationCone cone )
static

◆ ProcessDirectPath()

template<CVec3 Vec3Type>
JPL_INLINE DirectPathResult< Vec3Type > JPL::DirectPathService::ProcessDirectPath ( const Position< Vec3Type > & source,
const Position< Vec3Type > & listener )
static

Compute direct path parameters based on the positions of the source and listener. This can be used to compute parameters for position of a source relative to listener, as well as position of the listener relative to a source.

Parameters
sourceSource position and orientation in world space.
listenerListener position and orientation in world space.
Returns
Direct-path parameters of the source relative to the listener.

Assuming Y axis is UP-DOWN

◆ ReleaseEffectData()

JPL_INLINE bool JPL::DirectPathService::ReleaseEffectData ( DirectEffectHandle source)

Release any data associated with the source handle.

Returns
true if anything was cleared, false if no data was associated with the handle

The documentation for this class was generated from the following file: