aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ambidefs.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-21 04:05:49 -0800
committerChris Robinson <[email protected]>2019-02-21 04:05:49 -0800
commita9648905378b8a3321742bb0e498227cfc6ee5f6 (patch)
treee9f3c91b810b1e042d3153ceb512896195bf23d7 /Alc/ambidefs.h
parenta35255291f946c634219da71b287339654eeff3c (diff)
Add helpers to get the channel count from an ambisonic order
Diffstat (limited to 'Alc/ambidefs.h')
-rw-r--r--Alc/ambidefs.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Alc/ambidefs.h b/Alc/ambidefs.h
index 2b04d70b..bdecfae0 100644
--- a/Alc/ambidefs.h
+++ b/Alc/ambidefs.h
@@ -8,7 +8,9 @@
* order has 9, third-order has 16, and fourth-order has 25.
*/
#define MAX_AMBI_ORDER 3
-#define MAX_AMBI_CHANNELS ((MAX_AMBI_ORDER+1) * (MAX_AMBI_ORDER+1))
+constexpr inline size_t AmbiChannelsFromOrder(size_t order) noexcept
+{ return (order+1) * (order+1); }
+#define MAX_AMBI_CHANNELS AmbiChannelsFromOrder(MAX_AMBI_ORDER)
/* 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
@@ -30,7 +32,9 @@
* representation. This is 2 per each order above zero-order, plus 1 for zero-
* order. Or simply, o*2 + 1.
*/
-#define MAX_AMBI2D_CHANNELS (MAX_AMBI_ORDER*2 + 1)
+constexpr inline size_t Ambi2DChannelsFromOrder(size_t order) noexcept
+{ return order*2 + 1; }
+#define MAX_AMBI2D_CHANNELS Ambi2DChannelsFromOrder(MAX_AMBI_CHANNELS)
/* NOTE: These are scale factors as applied to Ambisonics content. Decoder