JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits > Class Template Reference

#include <JPLSpatial/SpatialManager.h>

Public Types

template<class Key , class T >
using FlatMapType = FlatMapWithAllocator< Key, T, std::pmr::polymorphic_allocator >
 
template<class Key >
using SetType = std::pmr::unordered_set< Key, std::hash< Key >, std::equal_to< Key > >
 

Public Member Functions

 SpatialManager ()=default
 
 ~SpatialManager ()=default
 
 SpatialManager (const SpatialManager &)=delete
 
SpatialManageroperator= (const SpatialManager &)=delete
 
JPL_INLINE const DirectPathServiceGetDirectPathService () const
 
JPL_INLINE DirectPathServiceGetDirectPathService ()
 
JPL_INLINE const PanningService< VBAPTraits > & GetPanningService () const
 
JPL_INLINE PanningService< VBAPTraits > & GetPanningService ()
 
JPL_INLINE void AdvanceSimulation ()
 
JPL_INLINE std::span< const SourceIdGetLastUpdatedSource () const
 
JPL_INLINE ListenerId CreateListener ()
 
JPL_INLINE bool DeleteListener (ListenerId listener)
 
JPL_INLINE SourceId CreateSource (const SourceInitParameters &options)
 
JPL_INLINE bool DeleteSource (SourceId source)
 
JPL_INLINE bool SetListener (SourceId source, ListenerId listener)
 
JPL_INLINE ListenerId GetDefaultListener () const
 
JPL_INLINE bool SetListenerPosition (ListenerId listener, const Position< Vec3Type > &newPosition)
 
JPL_INLINE std::optional< Position< Vec3Type > > GetListenerPosition (ListenerId listener) const
 
JPL_INLINE bool SetSourcePosition (SourceId source, const Position< Vec3Type > &newPosition)
 
JPL_INLINE bool SetSourceFocusAndSpread (SourceId source, PanEffectParameters focusAndSpread)
 
JPL_INLINE DirectEffectHandle GetDirectEffectHandle (SourceId source) const
 
JPL_INLINE PanEffectHandle GetPanEffectHandle (SourceId source) const
 
JPL_INLINE float GetDistanceAttenuation (SourceId source, const AttenuationCurveRef &curve) const
 
JPL_INLINE float GetConeAttenuation (SourceId source) const
 
JPL_INLINE std::span< const floatGetChannelGains (SourceId source, ChannelMap targetChannelMap) const
 

Static Public Member Functions

static JPL_INLINE float GetSpreadFromSourceSize (float sourceSize, float distance)
 

Detailed Description

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
class JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >

High level interface to manage spatialized sources. It holds an instance of each spatialization service.

Member Typedef Documentation

◆ FlatMapType

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
template<class Key , class T >
using JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::FlatMapType = FlatMapWithAllocator<Key, T, std::pmr::polymorphic_allocator>

◆ SetType

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
template<class Key >
using JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SetType = std::pmr::unordered_set<Key, std::hash<Key>, std::equal_to<Key> >

Constructor & Destructor Documentation

◆ SpatialManager() [1/2]

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SpatialManager ( )
default

◆ ~SpatialManager()

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::~SpatialManager ( )
default

◆ SpatialManager() [2/2]

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SpatialManager ( const SpatialManager< Vec3Type, VBAPTraits > &  )
delete

Member Function Documentation

◆ AdvanceSimulation()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE void JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::AdvanceSimulation ( )

Process all the parameters of the modified sources. E.g. this can be called at the end of an update frame to process changed positions of all the sources.

TBD

◆ CreateListener()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE ListenerId JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::CreateListener ( )

◆ CreateSource()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE SourceId JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::CreateSource ( const SourceInitParameters options)

◆ DeleteListener()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE bool JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::DeleteListener ( ListenerId  listener)

◆ DeleteSource()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE bool JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::DeleteSource ( SourceId  source)

◆ GetChannelGains()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE std::span< const float > JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetChannelGains ( SourceId  source,
ChannelMap  targetChannelMap 
) const

Get channel gains of the source for the ChannelMap based on the number of values/channels in outGains The returned channel gains are based on the data computed during the last call to AdvanceSimulation()

Returns
span of ChannelGains per source channel, if the 'source' is valid and the targetChannelMap was initialized for that source, empty span otherwise

◆ GetConeAttenuation()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE float JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetConeAttenuation ( SourceId  source) const

◆ GetDefaultListener()

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE ListenerId JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetDefaultListener ( ) const
inline

◆ GetDirectEffectHandle()

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE DirectEffectHandle JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetDirectEffectHandle ( SourceId  source) const
inline

◆ GetDirectPathService() [1/2]

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE DirectPathService & JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetDirectPathService ( )
inline

◆ GetDirectPathService() [2/2]

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE const DirectPathService & JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetDirectPathService ( ) const
inline

◆ GetDistanceAttenuation()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE float JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetDistanceAttenuation ( SourceId  source,
const AttenuationCurveRef curve 
) const
Returns
distance attenuation value evaluated for the 'source' and 'curve' the last time AdvanceSimulation() was called

◆ GetLastUpdatedSource()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE std::span< const SourceId > JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetLastUpdatedSource ( ) const

◆ GetListenerPosition()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE std::optional< Position< Vec3Type > > JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetListenerPosition ( ListenerId  listener) const

◆ GetPanEffectHandle()

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE PanEffectHandle JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetPanEffectHandle ( SourceId  source) const
inline

◆ GetPanningService() [1/2]

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE PanningService< VBAPTraits > & JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetPanningService ( )
inline

◆ GetPanningService() [2/2]

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
JPL_INLINE const PanningService< VBAPTraits > & JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetPanningService ( ) const
inline

◆ GetSpreadFromSourceSize()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE float JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::GetSpreadFromSourceSize ( float  sourceSize,
float  distance 
)
static

◆ operator=()

template<CVec3 Vec3Type, class VBAPTraits = VBAPBaseTraits<Vec3Type>>
SpatialManager & JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::operator= ( const SpatialManager< Vec3Type, VBAPTraits > &  )
delete

◆ SetListener()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE bool JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SetListener ( SourceId  source,
ListenerId  listener 
)

◆ SetListenerPosition()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE bool JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SetListenerPosition ( ListenerId  listener,
const Position< Vec3Type > &  newPosition 
)

Set new position for the listener. This will flag all sources associated with this listener for update if the position is different than the current one.

Returns
'true' if the listener is valid, 'false' otherwise

◆ SetSourceFocusAndSpread()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE bool JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SetSourceFocusAndSpread ( SourceId  source,
PanEffectParameters  focusAndSpread 
)

Set focus and spread parameters for the source.

Returns
'true' if the source is valid and has PanEffect initialized, 'fasle' otherwise

◆ SetSourcePosition()

template<CVec3 Vec3Type, class VBAPTraits >
JPL_INLINE bool JPL::Spatial::SpatialManager< Vec3Type, VBAPTraits >::SetSourcePosition ( SourceId  source,
const Position< Vec3Type > &  newPosition 
)

Updating any data for sources can be done many times, the data is only processed when calling AdvanceSimulation()


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