diff options
author | Chris Robinson <[email protected]> | 2022-08-18 20:37:19 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-08-18 20:37:19 -0700 |
commit | ed9408e53799cefd527bd3079bf1940d5c35bfc9 (patch) | |
tree | 85e87aa1d5bcc342e043e822e6da50c2fbd3bb3b /core | |
parent | 4f75f9258ca316fdb52db4d61158a8e22b442e46 (diff) |
Inline and precompute some CalcDirectionCoeffs calls
Diffstat (limited to 'core')
-rw-r--r-- | core/mixer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/mixer.h b/core/mixer.h index b819b3c7..8624996f 100644 --- a/core/mixer.h +++ b/core/mixer.h @@ -52,6 +52,18 @@ inline std::array<float,MaxAmbiChannels> CalcDirectionCoeffs(const float (&dir)[ } /** + * CalcDirectionCoeffs + * + * Calculates ambisonic coefficients based on an OpenAL direction vector. The + * vector must be normalized (unit length). + */ +constexpr std::array<float,MaxAmbiChannels> CalcDirectionCoeffs(const float (&dir)[3]) +{ + /* Convert from OpenAL coords to Ambisonics. */ + return CalcAmbiCoeffs(-dir[0], dir[1], -dir[2]); +} + +/** * CalcAngleCoeffs * * Calculates ambisonic coefficients based on azimuth and elevation. The |