clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 41f97b7a62d4d749cf7cf2b5d34621f433c5ecef
parent 065d685d4e9657f0344f350eef748be2b4d8e318
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Sun, 29 Jan 2023 11:39:40 +0100

Propose new extensions to make the port configuration more powerful

Diffstat:
Minclude/clap/clap.h | 2++
Ainclude/clap/ext/draft/configurable-audio-ports.h | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Ainclude/clap/ext/draft/extensible-audio-ports.h | 32++++++++++++++++++++++++++++++++
3 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/include/clap/clap.h b/include/clap/clap.h @@ -67,3 +67,5 @@ #include "ext/draft/track-info.h" #include "ext/draft/triggers.h" #include "ext/draft/tuning.h" +#include "ext/draft/configurable-audio-ports.h" +#include "ext/draft/extensible-audio-ports.h" diff --git a/include/clap/ext/draft/configurable-audio-ports.h b/include/clap/ext/draft/configurable-audio-ports.h @@ -0,0 +1,48 @@ +#pragma once + +#include "../audio-ports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// This extension lets the host configure the plugin's input and output audio ports +static CLAP_CONSTEXPR const char CLAP_EXT_CONFIGURABLE_AUDIO_PORTS[] = + "clap.configurable-audio-ports.draft0"; + +typedef struct clap_audio_port_configuration_request { + uint32_t port_index; + bool is_input; + uint32_t channel_count; + + // cast port_details according to port_type: + // - CLAP_PORT_MONO: (discard) + // - CLAP_PORT_STEREO: (discard) + // - CLAP_PORT_SURROUND: const uint8_t *channel_map + // - CLAP_PORT_AMBISONIC: const clap_ambisonic_info_t *info + const char *port_type; + const void *port_details; +} clap_audio_port_configuration_request_t; + +typedef struct clap_plugin_configurable_audio_ports { + // Some ports may not be configurable, or simply the result of another port configuration. + // For example if you have a simple delay plugin, and the output port must have the exact + // same type as the input port, then the output port configuration is a function (identity) + // of the input port configuration. + // [main-thread && !active] + bool(CLAP_ABI *is_port_configurable)(const clap_plugin_t *plugin, + bool is_input, + uint32_t port_index); + + // Submit a bunch of configuration requests which will atomically be applied together, + // or discarded together. + // [main-thread && !active] + bool(CLAP_ABI *request_configuration)( + const clap_plugin_t *plugin, + const struct clap_audio_port_configuration_request *requests, + uint32_t request_count); +} clap_plugin_configurable_audio_ports_t; + +#ifdef __cplusplus +} +#endif +\ No newline at end of file diff --git a/include/clap/ext/draft/extensible-audio-ports.h b/include/clap/ext/draft/extensible-audio-ports.h @@ -0,0 +1,31 @@ +#pragma once + +#include "../audio-ports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// This extension lets the host add and remove audio ports +static CLAP_CONSTEXPR const char CLAP_EXT_EXTENSIBLE_AUDIO_PORTS[] = + "clap.extensible-audio-ports.draft0"; + +typedef struct clap_plugin_extensible_audio_ports { + // Asks the plugin to add a new port (at the end of the list), with the following settings. + // Returns true on success. + // [main-thread && !is_active] + bool(CLAP_ABI *add_port)(const clap_plugin_t *plugin, + bool is_input, + const char *port_type, + const void *port_details, + uint32_t channel_count); + + // Asks the plugin to remove a port. + // Returns true on success. + // [main-thread && !is_active] + bool(CLAP_ABI *remove_port)(const clap_plugin_t *plugin, bool is_input, uint32_t index); +} clap_plugin_extensible_audio_ports_t; + +#ifdef __cplusplus +} +#endif +\ No newline at end of file