commit a936a400036e74bb2ae95b77d0ce5fc2f02d1025
parent 38f20230e01e82e2cc3e8f51ae3d4fec5a8e35aa
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date: Tue, 29 Nov 2022 09:46:49 +0100
Add audio ports activation extension
Diffstat:
1 file changed, 42 insertions(+), 0 deletions(-)
diff --git a/include/clap/ext/draft/audio-ports-activation.h b/include/clap/ext/draft/audio-ports-activation.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "../../string-sizes.h"
+#include "../../plugin.h"
+
+/// @page Audio Ports Activation
+///
+/// This extension provides a way for the host to activate and de-activate audio ports.
+/// Deactivating a port provides the following benefits:
+/// - the plugin knows ahead of time that a given input is not present and can choose
+/// an optimized computation path
+/// - the plugin knows that an output is not consumed by the host, and doesn't need to
+/// compute it
+///
+/// Audio ports can be activated and deactivated at any time, even while processing.
+///
+/// Audio buffers must still be provided if the audio port is deactivated.
+/// In such case, they shall be filled with 0 (or whatever is the neutral value in your context)
+/// and the constant_mask shall be set.
+///
+/// Audio ports are initially in the active state.
+/// Audio ports state should not be saved in the plugin state, so the host must restore the
+/// audio ports state after creating the plugin instance.
+///
+/// Audio ports state is invalidated by clap_plugin_audio_ports_config.select() and
+/// clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_LIST).
+
+static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_ACTIVATION[] = "clap.audio-ports-activation";
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct clap_plugin_audio_ports_activation {
+ // activate the given port
+ // [main-thread]
+ uint32_t(CLAP_ABI *set_active)(const clap_plugin_t *plugin, bool is_input, uint32_t port_index, bool is_active);
+} clap_plugin_audio_ports_activation_t;
+
+#ifdef __cplusplus
+}
+#endif