commit 6c158d5a0ccb4713a8dec140269039849c035d80
parent 0183f23dd2d793c50d1dc8828f7278a8a8b31411
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Tue, 21 Dec 2021 11:06:58 +0100
Add a more generic way to understand surround channel mapping
Diffstat:
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/include/clap/chmap.h b/include/clap/chmap.h
@@ -13,9 +13,11 @@ enum {
// left, right
CLAP_CHMAP_STEREO = 2,
- // front left, front right, center, low, surround left, surround right
- // surround back left, surround back right
+ // see clap_plugin_surround to inspect the exact channel layout
CLAP_CHMAP_SURROUND = 3,
+
+ // see clap_plugin_ambisonic to inspect the exact channel layout
+ CLAP_CHMAP_AMBISONIC = 4,
};
typedef int32_t clap_chmap;
diff --git a/include/clap/ext/draft/surround.h b/include/clap/ext/draft/surround.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "../../plugin.h"
+
+static CLAP_CONSTEXPR const char CLAP_EXT_SURROUND[] = "clap.surround.draft/0";
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push, CLAP_ALIGN)
+
+enum {
+ CLAP_SURROUND_FL = 0, // Front Left
+ CLAP_SURROUND_FR = 1, // Front Right
+ CLAP_SURROUND_FC = 2, // Front Center
+ CLAP_SURROUND_LFE = 3, // Low Frequency
+ CLAP_SURROUND_BL = 4, // Back Left
+ CLAP_SURROUND_BR = 5, // Back Right
+ CLAP_SURROUND_FLC = 6, // Front Left of Center
+ CLAP_SURROUND_FRC = 7, // Front Right of Center
+ CLAP_SURROUND_BC = 8, // Back Center
+ CLAP_SURROUND_SL = 9, // Side Left
+ CLAP_SURROUND_SR = 10, // Side Right
+ CLAP_SURROUND_TC = 11, // Top Center
+ CLAP_SURROUND_TFL = 12, // Front Left Height
+ CLAP_SURROUND_TFC = 13, // Front Center Height
+ CLAP_SURROUND_TFR = 14, // Front Right Height
+ CLAP_SURROUND_TBL = 15, // Rear Left Height
+ CLAP_SURROUND_TBC = 16, // Rear Center Height
+ CLAP_SURROUND_TBR = 17, // Rear Right Height
+};
+
+typedef struct clap_plugin_surround {
+ // [main-thread]
+ uint32_t (*get_channel_type)(const clap_plugin_t *plugin,
+ bool is_input,
+ uint32_t port_index,
+ uint32_t channel_index);
+} clap_plugin_surround_t;
+
+typedef struct clap_host_surround {
+ // Informs the host that the channel type have changed.
+ // [main-thread]
+ void (*changed)(const clap_host_t *host);
+} clap_host_surround_t;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+\ No newline at end of file