clap

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

commit 66dfd75cea1a7f120e707b039ba5df68a69a666a
parent 38f20230e01e82e2cc3e8f51ae3d4fec5a8e35aa
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Mon, 28 Nov 2022 19:44:00 +0100

Work on channel-info to replace track-info

Diffstat:
Minclude/clap/clap.h | 2+-
Ainclude/clap/ext/draft/channel-info.h | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dinclude/clap/ext/draft/track-info.h | 37-------------------------------------
Minclude/clap/string-sizes.h | 3+++
4 files changed, 65 insertions(+), 38 deletions(-)

diff --git a/include/clap/clap.h b/include/clap/clap.h @@ -59,6 +59,6 @@ #include "ext/draft/remote-controls.h" #include "ext/draft/state-context.h" #include "ext/draft/surround.h" -#include "ext/draft/track-info.h" +#include "ext/draft/channel-info.h" #include "ext/draft/tuning.h" #include "ext/draft/param-indication.h" diff --git a/include/clap/ext/draft/channel-info.h b/include/clap/ext/draft/channel-info.h @@ -0,0 +1,61 @@ +#pragma once + +#include "../../plugin.h" +#include "../../color.h" +#include "../../string-sizes.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_CHANNEL_INFO[] = "clap.channel-info.draft/0"; + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + CLAP_CHANNEL_INFO_HAS_TRACK_NAME = (1 << 0), + CLAP_CHANNEL_INFO_HAS_TRACK_COLOR = (1 << 1), + CLAP_CHANNEL_INFO_HAS_TRACK_ID = (1 << 1), + CLAP_CHANNEL_INFO_HAS_TRACK_PATH = (1 << 1), + CLAP_CHANNEL_INFO_HAS_CHANNEL_NAME = (1 << 2), + CLAP_CHANNEL_INFO_HAS_CHANNEL_COLOR = (1 << 3), + CLAP_CHANNEL_INFO_HAS_CHANNEL_ID = (1 << 4), + CLAP_CHANNEL_INFO_HAS_CHANNEL_PATH = (1 << 4), + CLAP_CHANNEL_INFO_HAS_AUDIO_CHANNEL_COUNT = (1 << 5), + CLAP_CHANNEL_INFO_HAS_AUDIO_PORT_TYPE = (1 << 6), +}; + +typedef struct clap_channel_info { + uint32_t flags; // see the flags above + + // info relatives to the track to which the current channel belong + char track_id[CLAP_CUSTOM_ID_SIZE]; + char track_name[CLAP_NAME_SIZE]; + char track_path[CLAP_PATH_SIZE]; + clap_color_t track_color; + bool is_return_track; + + // info relatives to the channel owning the plugin instance + // path can be like: "/group1/group2/track7/drum-machine/drum-pad-13" + char channel_id[CLAP_CUSTOM_ID_SIZE]; + char channel_name[CLAP_NAME_SIZE]; + char channel_path[CLAP_PATH_SIZE]; + clap_color_t channel_color; + bool is_return_channel; + + int32_t audio_channel_count; + const char *audio_port_type; +} clap_channel_info_t; + +typedef struct clap_plugin_channel_info { + // [main-thread] + void(CLAP_ABI *changed)(const clap_plugin_t *plugin); +} clap_plugin_channel_info_t; + +typedef struct clap_host_channel_info { + // Get info about the track the plugin belongs to. + // [main-thread] + bool(CLAP_ABI *get)(const clap_host_t *host, clap_channel_info_t *info); +} clap_host_channel_info_t; + +#ifdef __cplusplus +} +#endif diff --git a/include/clap/ext/draft/track-info.h b/include/clap/ext/draft/track-info.h @@ -1,37 +0,0 @@ -#pragma once - -#include "../../plugin.h" -#include "../../color.h" -#include "../../string-sizes.h" - -static CLAP_CONSTEXPR const char CLAP_EXT_TRACK_INFO[] = "clap.track-info.draft/0"; - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct clap_track_info { - clap_id id; - int32_t index; - char name[CLAP_NAME_SIZE]; - char path[CLAP_PATH_SIZE]; // Like "/group1/group2/drum-machine/drum-pad-13" - int32_t channel_count; - const char *audio_port_type; - clap_color_t color; - bool is_return_track; -} clap_track_info_t; - -typedef struct clap_plugin_track_info { - // [main-thread] - void(CLAP_ABI *changed)(const clap_plugin_t *plugin); -} clap_plugin_track_info_t; - -typedef struct clap_host_track_info { - // Get info about the track the plugin belongs to. - // [main-thread] - bool(CLAP_ABI *get)(const clap_host_t *host, clap_track_info_t *info); -} clap_host_track_info_t; - -#ifdef __cplusplus -} -#endif diff --git a/include/clap/string-sizes.h b/include/clap/string-sizes.h @@ -14,6 +14,9 @@ enum { // This is not suited for describing a file path on the disk, as NTFS allows up to 32K long // paths. CLAP_PATH_SIZE = 1024, + + // String capacity for storing custom identifiers, it could be a uuid for example. + CLAP_CUSTOM_ID_SIZE = 256, }; #ifdef __cplusplus