diff options
author | Chris Robinson <[email protected]> | 2019-09-20 13:35:29 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-20 13:35:29 -0700 |
commit | 65eb0987e2f08655575f4d835e178b483901a053 (patch) | |
tree | e162dec1df7757bf35ffa266912a9651273d47aa /alc | |
parent | 79a621ac47e01ad886bc7b4284e514d736650e6d (diff) |
Remove and simplify some functions
Diffstat (limited to 'alc')
-rw-r--r-- | alc/effects/reverb.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 82a80198..4a85f640 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -844,6 +844,8 @@ void ReverbState::updateDelayLine(const ALfloat earlyDelay, const ALfloat lateDe */ alu::Matrix GetTransformFromVector(const ALfloat *vec) { + constexpr float sqrt_3{1.73205080756887719318f}; + /* Normalize the panning vector according to the N3D scale, which has an * extra sqrt(3) term on the directional components. Converting from OpenAL * to B-Format also requires negating X (ACN 1) and Z (ACN 3). Note however @@ -855,9 +857,9 @@ alu::Matrix GetTransformFromVector(const ALfloat *vec) ALfloat mag{std::sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])}; if(mag > 1.0f) { - norm[0] = vec[0] / mag * -al::MathDefs<float>::Sqrt3(); - norm[1] = vec[1] / mag * al::MathDefs<float>::Sqrt3(); - norm[2] = vec[2] / mag * al::MathDefs<float>::Sqrt3(); + norm[0] = vec[0] / mag * -sqrt_3; + norm[1] = vec[1] / mag * sqrt_3; + norm[2] = vec[2] / mag * sqrt_3; mag = 1.0f; } else @@ -866,9 +868,9 @@ alu::Matrix GetTransformFromVector(const ALfloat *vec) * term. There's no need to renormalize the magnitude since it would * just be reapplied in the matrix. */ - norm[0] = vec[0] * -al::MathDefs<float>::Sqrt3(); - norm[1] = vec[1] * al::MathDefs<float>::Sqrt3(); - norm[2] = vec[2] * al::MathDefs<float>::Sqrt3(); + norm[0] = vec[0] * -sqrt_3; + norm[1] = vec[1] * sqrt_3; + norm[2] = vec[2] * sqrt_3; } return alu::Matrix{ |