aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-12-12 10:38:24 -0800
committerChris Robinson <[email protected]>2020-12-12 10:38:24 -0800
commit191fe888b4bf55aac539315c75ed7f6d15f2ea7e (patch)
tree1ab74c1f1c1f56405f7babcdfe58df9ef9002353 /alc
parent1bb7f575f056f33d0957fe864cd62072982fc66e (diff)
Move ambidefs.h to core
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp2
-rw-r--r--alc/alcmain.h2
-rw-r--r--alc/alu.cpp2
-rw-r--r--alc/alu.h2
-rw-r--r--alc/ambdec.h2
-rw-r--r--alc/ambidefs.h135
-rw-r--r--alc/bformatdec.h2
-rw-r--r--alc/effects/chorus.cpp2
-rw-r--r--alc/effects/convolution.cpp2
-rw-r--r--alc/hrtf.h2
-rw-r--r--alc/panning.cpp13
11 files changed, 10 insertions, 156 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 2e416d00..70890186 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -75,10 +75,10 @@
#include "alspan.h"
#include "alstring.h"
#include "alu.h"
-#include "ambidefs.h"
#include "atomic.h"
#include "bformatdec.h"
#include "compat.h"
+#include "core/ambidefs.h"
#include "core/bs2b.h"
#include "core/devformat.h"
#include "core/mastering.h"
diff --git a/alc/alcmain.h b/alc/alcmain.h
index d809f8ee..ef52afc7 100644
--- a/alc/alcmain.h
+++ b/alc/alcmain.h
@@ -21,8 +21,8 @@
#include "almalloc.h"
#include "alnumeric.h"
#include "alspan.h"
-#include "ambidefs.h"
#include "atomic.h"
+#include "core/ambidefs.h"
#include "core/bufferline.h"
#include "core/devformat.h"
#include "core/filters/splitter.h"
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 1824a5a9..5ea54f23 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -55,9 +55,9 @@
#include "alnumeric.h"
#include "alspan.h"
#include "alstring.h"
-#include "ambidefs.h"
#include "atomic.h"
#include "bformatdec.h"
+#include "core/ambidefs.h"
#include "core/bs2b.h"
#include "core/bsinc_tables.h"
#include "core/devformat.h"
diff --git a/alc/alu.h b/alc/alu.h
index fd1d0b37..1393b824 100644
--- a/alc/alu.h
+++ b/alc/alu.h
@@ -7,7 +7,7 @@
#include <type_traits>
#include "alspan.h"
-#include "ambidefs.h"
+#include "core/ambidefs.h"
#include "core/bufferline.h"
#include "core/devformat.h"
diff --git a/alc/ambdec.h b/alc/ambdec.h
index db662a76..c96ded5b 100644
--- a/alc/ambdec.h
+++ b/alc/ambdec.h
@@ -4,7 +4,7 @@
#include <array>
#include <string>
-#include "ambidefs.h"
+#include "core/ambidefs.h"
#include "vector.h"
/* Helpers to read .ambdec configuration files. */
diff --git a/alc/ambidefs.h b/alc/ambidefs.h
deleted file mode 100644
index 339b51f9..00000000
--- a/alc/ambidefs.h
+++ /dev/null
@@ -1,135 +0,0 @@
-#ifndef AMBIDEFS_H
-#define AMBIDEFS_H
-
-#include <array>
-#include <stddef.h>
-#include <stdint.h>
-
-using uint = unsigned int;
-
-/* The maximum number of Ambisonics channels. For a given order (o), the size
- * needed will be (o+1)**2, thus zero-order has 1, first-order has 4, second-
- * order has 9, third-order has 16, and fourth-order has 25.
- */
-constexpr uint8_t MaxAmbiOrder{3};
-constexpr inline size_t AmbiChannelsFromOrder(size_t order) noexcept
-{ return (order+1) * (order+1); }
-constexpr size_t MaxAmbiChannels{AmbiChannelsFromOrder(MaxAmbiOrder)};
-
-/* A bitmask of ambisonic channels for 0 to 4th order. This only specifies up
- * to 4th order, which is the highest order a 32-bit mask value can specify (a
- * 64-bit mask could handle up to 7th order).
- */
-constexpr uint Ambi0OrderMask{0x00000001};
-constexpr uint Ambi1OrderMask{0x0000000f};
-constexpr uint Ambi2OrderMask{0x000001ff};
-constexpr uint Ambi3OrderMask{0x0000ffff};
-constexpr uint Ambi4OrderMask{0x01ffffff};
-
-/* A bitmask of ambisonic channels with height information. If none of these
- * channels are used/needed, there's no height (e.g. with most surround sound
- * speaker setups). This is ACN ordering, with bit 0 being ACN 0, etc.
- */
-constexpr uint AmbiPeriphonicMask{0xfe7ce4};
-
-/* The maximum number of ambisonic channels for 2D (non-periphonic)
- * representation. This is 2 per each order above zero-order, plus 1 for zero-
- * order. Or simply, o*2 + 1.
- */
-constexpr inline size_t Ambi2DChannelsFromOrder(size_t order) noexcept
-{ return order*2 + 1; }
-constexpr size_t MaxAmbi2DChannels{Ambi2DChannelsFromOrder(MaxAmbiOrder)};
-
-
-/* NOTE: These are scale factors as applied to Ambisonics content. Decoder
- * coefficients should be divided by these values to get proper scalings.
- */
-struct AmbiScale {
- static constexpr std::array<float,MaxAmbiChannels> FromN3D{{
- 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
- }};
- static constexpr std::array<float,MaxAmbiChannels> FromSN3D{{
- 1.000000000f, /* ACN 0, sqrt(1) */
- 1.732050808f, /* ACN 1, sqrt(3) */
- 1.732050808f, /* ACN 2, sqrt(3) */
- 1.732050808f, /* ACN 3, sqrt(3) */
- 2.236067978f, /* ACN 4, sqrt(5) */
- 2.236067978f, /* ACN 5, sqrt(5) */
- 2.236067978f, /* ACN 6, sqrt(5) */
- 2.236067978f, /* ACN 7, sqrt(5) */
- 2.236067978f, /* ACN 8, sqrt(5) */
- 2.645751311f, /* ACN 9, sqrt(7) */
- 2.645751311f, /* ACN 10, sqrt(7) */
- 2.645751311f, /* ACN 11, sqrt(7) */
- 2.645751311f, /* ACN 12, sqrt(7) */
- 2.645751311f, /* ACN 13, sqrt(7) */
- 2.645751311f, /* ACN 14, sqrt(7) */
- 2.645751311f, /* ACN 15, sqrt(7) */
- }};
- static constexpr std::array<float,MaxAmbiChannels> FromFuMa{{
- 1.414213562f, /* ACN 0 (W), sqrt(2) */
- 1.732050808f, /* ACN 1 (Y), sqrt(3) */
- 1.732050808f, /* ACN 2 (Z), sqrt(3) */
- 1.732050808f, /* ACN 3 (X), sqrt(3) */
- 1.936491673f, /* ACN 4 (V), sqrt(15)/2 */
- 1.936491673f, /* ACN 5 (T), sqrt(15)/2 */
- 2.236067978f, /* ACN 6 (R), sqrt(5) */
- 1.936491673f, /* ACN 7 (S), sqrt(15)/2 */
- 1.936491673f, /* ACN 8 (U), sqrt(15)/2 */
- 2.091650066f, /* ACN 9 (Q), sqrt(35/8) */
- 1.972026594f, /* ACN 10 (O), sqrt(35)/3 */
- 2.231093404f, /* ACN 11 (M), sqrt(224/45) */
- 2.645751311f, /* ACN 12 (K), sqrt(7) */
- 2.231093404f, /* ACN 13 (L), sqrt(224/45) */
- 1.972026594f, /* ACN 14 (N), sqrt(35)/3 */
- 2.091650066f, /* ACN 15 (P), sqrt(35/8) */
- }};
-};
-
-struct AmbiIndex {
- static constexpr std::array<uint8_t,MaxAmbiChannels> FromFuMa{{
- 0, /* W */
- 3, /* X */
- 1, /* Y */
- 2, /* Z */
- 6, /* R */
- 7, /* S */
- 5, /* T */
- 8, /* U */
- 4, /* V */
- 12, /* K */
- 13, /* L */
- 11, /* M */
- 14, /* N */
- 10, /* O */
- 15, /* P */
- 9, /* Q */
- }};
- static constexpr std::array<uint8_t,MaxAmbi2DChannels> FromFuMa2D{{
- 0, /* W */
- 3, /* X */
- 1, /* Y */
- 8, /* U */
- 4, /* V */
- 15, /* P */
- 9, /* Q */
- }};
-
- static constexpr std::array<uint8_t,MaxAmbiChannels> FromACN{{
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15
- }};
- static constexpr std::array<uint8_t,MaxAmbi2DChannels> From2D{{
- 0, 1,3, 4,8, 9,15
- }};
-
- static constexpr std::array<uint8_t,MaxAmbiChannels> OrderFromChannel{{
- 0, 1,1,1, 2,2,2,2,2, 3,3,3,3,3,3,3,
- }};
- static constexpr std::array<uint8_t,MaxAmbi2DChannels> OrderFrom2DChannel{{
- 0, 1,1, 2,2, 3,3,
- }};
-};
-
-#endif /* AMBIDEFS_H */
diff --git a/alc/bformatdec.h b/alc/bformatdec.h
index d9cddf51..7715d364 100644
--- a/alc/bformatdec.h
+++ b/alc/bformatdec.h
@@ -7,7 +7,7 @@
#include "almalloc.h"
#include "alspan.h"
-#include "ambidefs.h"
+#include "core/ambidefs.h"
#include "core/bufferline.h"
#include "core/devformat.h"
#include "core/filters/splitter.h"
diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp
index 68a79fba..2006b163 100644
--- a/alc/effects/chorus.cpp
+++ b/alc/effects/chorus.cpp
@@ -37,7 +37,7 @@
#include "alnumeric.h"
#include "alspan.h"
#include "alu.h"
-#include "ambidefs.h"
+#include "core/ambidefs.h"
#include "effects/base.h"
#include "math_defs.h"
#include "opthelpers.h"
diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp
index 8914835a..b190e75e 100644
--- a/alc/effects/convolution.cpp
+++ b/alc/effects/convolution.cpp
@@ -13,9 +13,9 @@
#include "alcontext.h"
#include "almalloc.h"
#include "alspan.h"
-#include "ambidefs.h"
#include "bformatdec.h"
#include "buffer_storage.h"
+#include "core/ambidefs.h"
#include "core/filters/splitter.h"
#include "effects/base.h"
#include "effectslot.h"
diff --git a/alc/hrtf.h b/alc/hrtf.h
index 9bb7f65f..025bfa92 100644
--- a/alc/hrtf.h
+++ b/alc/hrtf.h
@@ -8,8 +8,8 @@
#include "almalloc.h"
#include "alspan.h"
-#include "ambidefs.h"
#include "atomic.h"
+#include "core/ambidefs.h"
#include "core/bufferline.h"
#include "core/filters/splitter.h"
#include "intrusive_ptr.h"
diff --git a/alc/panning.cpp b/alc/panning.cpp
index c8db28c2..ad297ef7 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -48,8 +48,8 @@
#include "alstring.h"
#include "alu.h"
#include "ambdec.h"
-#include "ambidefs.h"
#include "bformatdec.h"
+#include "core/ambidefs.h"
#include "core/bs2b.h"
#include "core/devformat.h"
#include "core/uhjfilter.h"
@@ -60,17 +60,6 @@
#include "opthelpers.h"
-constexpr std::array<float,MaxAmbiChannels> AmbiScale::FromN3D;
-constexpr std::array<float,MaxAmbiChannels> AmbiScale::FromSN3D;
-constexpr std::array<float,MaxAmbiChannels> AmbiScale::FromFuMa;
-constexpr std::array<uint8_t,MaxAmbiChannels> AmbiIndex::FromFuMa;
-constexpr std::array<uint8_t,MaxAmbi2DChannels> AmbiIndex::FromFuMa2D;
-constexpr std::array<uint8_t,MaxAmbiChannels> AmbiIndex::FromACN;
-constexpr std::array<uint8_t,MaxAmbi2DChannels> AmbiIndex::From2D;
-constexpr std::array<uint8_t,MaxAmbiChannels> AmbiIndex::OrderFromChannel;
-constexpr std::array<uint8_t,MaxAmbi2DChannels> AmbiIndex::OrderFrom2DChannel;
-
-
namespace {
using namespace std::placeholders;