aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ambidefs.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-15 03:30:47 -0800
committerChris Robinson <[email protected]>2018-12-15 03:30:47 -0800
commite0f635b20d989a5083112aa70960cc89e6bc553c (patch)
tree9e8f2ca7b87159ad50342938bbe5ec5719c1abeb /Alc/ambidefs.h
parent0dd13a9dfed47660946fa9d37a1fc35e44b73687 (diff)
Move some ambisonic-related macros to a separate header
Diffstat (limited to 'Alc/ambidefs.h')
-rw-r--r--Alc/ambidefs.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Alc/ambidefs.h b/Alc/ambidefs.h
new file mode 100644
index 00000000..124a0c8e
--- /dev/null
+++ b/Alc/ambidefs.h
@@ -0,0 +1,33 @@
+#ifndef AMBIDEFS_H
+#define AMBIDEFS_H
+
+/* The maximum number of Ambisonics coefficients. 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.
+ */
+#define MAX_AMBI_ORDER 3
+#define MAX_AMBI_COEFFS ((MAX_AMBI_ORDER+1) * (MAX_AMBI_ORDER+1))
+
+/* 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).
+ */
+#define AMBI_0ORDER_MASK 0x00000001
+#define AMBI_1ORDER_MASK 0x0000000f
+#define AMBI_2ORDER_MASK 0x000001ff
+#define AMBI_3ORDER_MASK 0x0000ffff
+#define AMBI_4ORDER_MASK 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.
+ */
+#define AMBI_PERIPHONIC_MASK (0xfe7ce4)
+
+/* The maximum number of Ambisonic coefficients for 2D (non-periphonic)
+ * representation. This is 2 per each order above zero-order, plus 1 for zero-
+ * order. Or simply, o*2 + 1.
+ */
+#define MAX_AMBI2D_COEFFS (MAX_AMBI_ORDER*2 + 1)
+
+#endif /* AMBIDEFS_H */