|
JPL Spatial
Sound spatialization and propagation library
|
Look-up table containing channel gains for each direction. More...
#include <JPLSpatial/Panning/VBAPLUT2D.h>
Classes | |
| struct | LUTStats |
Public Types | |
| template<class T > | |
| using | Array = std::pmr::vector< T > |
Static Public Member Functions | |
| static void | BuildDiamondToUniformIndexLUT (Array< uint32 > &outCorrectionLUT, uint32 N_uniform, uint32 M_corr=1024) |
| static void | BuildDiamondToAngleNormLUT (Array< float > &outCorrectionLUT, uint32 M_corr=1024) |
Friends | |
| template<auto GetSpeakerAngleFunction> | |
| class | LUTBuilder2D |
Look-up table containing channel gains for each direction.
| using JPL::VBAP::LUT2D::Array = std::pmr::vector<T> |
|
default |
| JPL_INLINE int JPL::VBAP::LUT2D::AngleNormalizedToLUTPosition | ( | float | angleNormalised | ) | const |
Get LUT position from direction angle, where 0.0 is forward
| angleNormalized | angle in radians in [0, 2Pi] |
| JPL_INLINE int JPL::VBAP::LUT2D::AngleToLUTPosition | ( | float | angleInRadians | ) | const |
Get LUT position from direction angle, where 0.0 is forward
| angleInRadians | in radians in [-Pi, Pi] |
|
inlinestatic |
Build p -> normalized angle in [0,1) M_corr: power-of-two size
|
inlinestatic |
Build a table of size M_corr that maps diamond-parameter bins to 'uniform-angle' indices in [0, N_uniform).
| JPL_INLINE simd_mask JPL::VBAP::LUT2D::CartesianToLUTPosition | ( | const simd & | x, |
| const simd & | y | ||
| ) | const |
Get LUT position from direction vector.
For diamond encoding we need to normalize Vec2(x, y) direction
| JPL_INLINE int JPL::VBAP::LUT2D::CartesianToLUTPosition | ( | float | x, |
| float | y | ||
| ) | const |
Get LUT position from direction vector.
|
inlinenoexcept |
Resolution of the LUT.
|
inlinenoexcept |
|
inline |
Get gain value at LUT position. Channel stride should be handled by the caller.
E.g. to get gain value for channel 3, knowing LUT position (e.g. retrieved by calling AngleToLUTPosition), positionInLUT parameter should be: AngleToLUTPosition * NumberOfChannels + 3.
Channel gain values for each angle are laid out continuously in the LUT. So to get all the target channel gains for a specific angle, simply get the beginning of the gain data, e.g.: GetLUTValue(AngleToLUTPosition * NumberOfChannels) ..and copy the contiguous gains from that position (LFE is inlude if present in the channel map, though the gain for LFE is always 0.0).
| JPL_INLINE void JPL::VBAP::LUT2D::GetSpeakerGains | ( | const simd & | dirX, |
| const simd & | dirY, | ||
| std::span< simd > | outGains | ||
| ) | const |
Get preprocessed speaker gains from LUT based on direction vector.
| JPL_INLINE void JPL::VBAP::LUT2D::GetSpeakerGains | ( | const Vec2 & | direction, |
| std::span< float > | outGains | ||
| ) | const |
Get preprocessed speaker gains from LUT based on direction vector.
| JPL_INLINE void JPL::VBAP::LUT2D::GetSpeakerGains | ( | int | lutPosition, |
| std::span< float > | outGains | ||
| ) | const |
Get preprocessed speaker gains at specific LUT posotion.
|
inlinenoexcept |
| JPL_INLINE auto JPL::VBAP::LUT2D::LUTPositionToAngle | ( | int | pos | ) | const |
|
inline |
|
inline |
|
friend |