clap

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

commit e9bbd307febeb99dfb362f933142456e0cd95603
parent efc3b479df365c924ded5a10fbe9ecfdec1a89eb
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Wed, 20 Apr 2022 14:27:40 +0200

Add a voice info draft extensions

Diffstat:
Minclude/clap/clap.h | 1+
Ainclude/clap/ext/draft/voice-info.h | 46++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/include/clap/clap.h b/include/clap/clap.h @@ -58,6 +58,7 @@ #include "ext/draft/surround.h" #include "ext/draft/cv.h" #include "ext/draft/ambisonic.h" +#include "ext/draft/voice-info.h" #include "converters/vst2-converter.h" #include "converters/vst3-converter.h" diff --git a/include/clap/ext/draft/voice-info.h b/include/clap/ext/draft/voice-info.h @@ -0,0 +1,46 @@ +#pragma once + +#include "../../plugin.h" + +// This extensions indicates the number of voices the synthesizer. +// It is useful for the host when performing polyphonic modulations, +// because the host needs its own voice management and should try to follow +// what the plugin is doing. + +static const char CLAP_EXT_VOICE_INFO[] = "clap.voice-info.draft/0"; + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct clap_voice_info { + // voice_count is the current number of voices that the patch can use + // voice_capacity is the number of voices allocated voices + // voice_count should not be confused with the number of active voices. + // + // 1 <= voice_count <= voice_capacity + // + // For example, a synth can have a capacity of 8 voices, but be configured + // to only use 4 voices: {count: 4, capacity: 8}. + // + // If the voice_count is 1, then the synth is working in mono and the host + // can decide to only use global modulation mapping. + uint32_t voice_count; + uint32_t voice_capacity; +} clap_voice_info_t; + +typedef struct clap_plugin_voice_info { + // gets the voice info, returns true on success + // [main-thread] + bool (*get)(const clap_plugin_t *plugin, clap_voice_info_t *info); +} clap_plugin_voice_info_t; + +typedef struct clap_host_voice_info { + // informs the host that the voice info have changed + // [main-thread] + void (*changed)(const clap_host_t *host); +} clap_host_voice_info_t; + +#ifdef __cplusplus +} +#endif