commit 09b7b8dab5cfe63c37960e4688735c065a255adc
parent db1138cb1642e53a03596164c0070441e1740b3c
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date: Mon, 12 Dec 2022 12:18:50 +0100
Merge pull request #219 from abique/channel-info
Work on channel-info to replace track-info
Diffstat:
2 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/include/clap/ext/draft/track-info.h b/include/clap/ext/draft/track-info.h
@@ -4,24 +4,48 @@
#include "../../color.h"
#include "../../string-sizes.h"
+// This extensions let the plugin query info about the track it's in.
+// It is useful when the plugin is created, to initialize some parameters (mix, dry, wet)
+// and pick a suitable configuartion regarding audio port type and channel count.
+
static CLAP_CONSTEXPR const char CLAP_EXT_TRACK_INFO[] = "clap.track-info.draft/0";
#ifdef __cplusplus
extern "C" {
#endif
+enum {
+ CLAP_TRACK_INFO_HAS_TRACK_NAME = (1 << 0),
+ CLAP_TRACK_INFO_HAS_TRACK_COLOR = (1 << 1),
+ CLAP_TRACK_INFO_HAS_AUDIO_CHANNEL = (1 << 2),
+
+ // This plugin is on a return track, initialize with wet 100%
+ CLAP_TRACK_INFO_IS_FOR_RETURN_TRACK = (1 << 3),
+
+ // This plugin is on a bus track, initialize with appropriate settings for bus processing
+ CLAP_TRACK_INFO_IS_FOR_BUS = (1 << 4),
+
+ // This plugin is on the master, initialize with appropriate settings for channel processing
+ CLAP_TRACK_INFO_IS_FOR_MASTER = (1 << 5),
+};
+
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;
+ uint64_t flags; // see the flags above
+
+ // track name, available if flags contain CLAP_TRACK_INFO_HAS_TRACK_NAME
+ char name[CLAP_NAME_SIZE];
+
+ // track color, available if flags contain CLAP_TRACK_INFO_HAS_TRACK_COLOR
clap_color_t color;
- bool is_return_track;
+
+ // availabe if flags contain CLAP_TRACK_INFO_HAS_AUDIO_CHANNEL
+ // see audio-ports.h, struct clap_audio_port_info to learn how to use channel count and port type
+ int32_t audio_channel_count;
+ const char *audio_port_type;
} clap_track_info_t;
typedef struct clap_plugin_track_info {
+ // Called when the info changes.
// [main-thread]
void(CLAP_ABI *changed)(const clap_plugin_t *plugin);
} clap_plugin_track_info_t;
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