diff options
author | Chris Robinson <[email protected]> | 2022-04-24 22:53:55 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-04-25 17:32:20 -0700 |
commit | 31d7d62eea535decb968845d6ca7698f1a92997c (patch) | |
tree | 697522394e8b75879dab40739eac7fd5f1fee21c | |
parent | 5038ba4d6ba42a777a2bec8780a53e39db028474 (diff) |
Use a type alias to simplify using a type
-rw-r--r-- | alc/alu.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 50603589..b75735f3 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -325,6 +325,8 @@ void DeviceBase::ProcessBs2b(const size_t SamplesToDo) namespace { +using AmbiRotateMatrix = std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels>; + /* This RNG method was created based on the math found in opusdec. It's quick, * and starting with a seed value of 22222, is suitable for generating * whitenoise. @@ -570,14 +572,13 @@ const auto RotatorCoeffArray = RotatorCoeffs::ConcatArrays(RotatorCoeffs::GenCoe * coefficients, this fills in the coefficients for the higher orders up to and * including the given order. The matrix is in ACN layout. */ -void AmbiRotator(std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> &matrix, - const int order) +void AmbiRotator(AmbiRotateMatrix &matrix, const int order) { /* Don't do anything for < 2nd order. */ if(order < 2) return; auto P = [](const int i, const int l, const int a, const int n, const size_t last_band, - const std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> &R) + const AmbiRotateMatrix &R) { const float ri1{ R[static_cast<uint>(i+2)][ 1+2]}; const float rim1{R[static_cast<uint>(i+2)][-1+2]}; @@ -592,12 +593,12 @@ void AmbiRotator(std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> & }; auto U = [P](const int l, const int m, const int n, const size_t last_band, - const std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> &R) + const AmbiRotateMatrix &R) { return P(0, l, m, n, last_band, R); }; auto V = [P](const int l, const int m, const int n, const size_t last_band, - const std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> &R) + const AmbiRotateMatrix &R) { using namespace al::numbers; if(m > 0) @@ -613,7 +614,7 @@ void AmbiRotator(std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> & return d ? p1*sqrt2_v<float> : (p0 + p1); }; auto W = [P](const int l, const int m, const int n, const size_t last_band, - const std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> &R) + const AmbiRotateMatrix &R) { assert(m != 0); if(m > 0) @@ -860,7 +861,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con * order elements, then construct the rotation for the higher * orders. */ - std::array<std::array<float,MaxAmbiChannels>,MaxAmbiChannels> shrot{}; + AmbiRotateMatrix shrot{}; shrot[0][0] = 1.0f; shrot[1][1] = U[0]; shrot[1][2] = -V[0]; shrot[1][3] = -N[0]; shrot[2][1] = -U[1]; shrot[2][2] = V[1]; shrot[2][3] = N[1]; |