-
-
Save AndrejMitrovic/427866da4d3e9cd7dc307925f9eebdfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef unsigned char __u_char; | |
typedef unsigned short int __u_short; | |
typedef unsigned int __u_int; | |
typedef unsigned long int __u_long; | |
typedef signed char __int8_t; | |
typedef unsigned char __uint8_t; | |
typedef signed short int __int16_t; | |
typedef unsigned short int __uint16_t; | |
typedef signed int __int32_t; | |
typedef unsigned int __uint32_t; | |
typedef signed long long __int64_t; | |
typedef unsigned long long __uint64_t; | |
typedef __int8_t __int_least8_t; | |
typedef __uint8_t __uint_least8_t; | |
typedef __int16_t __int_least16_t; | |
typedef __uint16_t __uint_least16_t; | |
typedef __int32_t __int_least32_t; | |
typedef __uint32_t __uint_least32_t; | |
typedef __int64_t __int_least64_t; | |
typedef __uint64_t __uint_least64_t; | |
typedef long int __quad_t; | |
typedef unsigned long int __u_quad_t; | |
typedef long int __intmax_t; | |
typedef unsigned long int __uintmax_t; | |
typedef unsigned long int __dev_t; | |
typedef unsigned int __uid_t; | |
typedef unsigned int __gid_t; | |
typedef unsigned long int __ino_t; | |
typedef unsigned long int __ino64_t; | |
typedef unsigned int __mode_t; | |
typedef unsigned long int __nlink_t; | |
typedef long int __off_t; | |
typedef long int __off64_t; | |
typedef int __pid_t; | |
typedef struct { int __val[2]; } __fsid_t; | |
typedef long int __clock_t; | |
typedef unsigned long int __rlim_t; | |
typedef unsigned long int __rlim64_t; | |
typedef unsigned int __id_t; | |
typedef long int __time_t; | |
typedef unsigned int __useconds_t; | |
typedef long int __suseconds_t; | |
typedef int __daddr_t; | |
typedef int __key_t; | |
typedef int __clockid_t; | |
typedef void * __timer_t; | |
typedef long int __blksize_t; | |
typedef long int __blkcnt_t; | |
typedef long int __blkcnt64_t; | |
typedef unsigned long int __fsblkcnt_t; | |
typedef unsigned long int __fsblkcnt64_t; | |
typedef unsigned long int __fsfilcnt_t; | |
typedef unsigned long int __fsfilcnt64_t; | |
typedef long int __fsword_t; | |
typedef long int __ssize_t; | |
typedef long int __syscall_slong_t; | |
typedef unsigned long int __syscall_ulong_t; | |
typedef __off64_t __loff_t; | |
typedef char *__caddr_t; | |
typedef long int __intptr_t; | |
typedef unsigned int __socklen_t; | |
typedef int __sig_atomic_t; | |
typedef __int8_t int8_t; | |
typedef __int16_t int16_t; | |
typedef __int32_t int32_t; | |
typedef __int64_t int64_t; | |
typedef __uint8_t uint8_t; | |
typedef __uint16_t uint16_t; | |
typedef __uint32_t uint32_t; | |
typedef __uint64_t uint64_t; | |
typedef __int_least8_t int_least8_t; | |
typedef __int_least16_t int_least16_t; | |
typedef __int_least32_t int_least32_t; | |
typedef __int_least64_t int_least64_t; | |
typedef __uint_least8_t uint_least8_t; | |
typedef __uint_least16_t uint_least16_t; | |
typedef __uint_least32_t uint_least32_t; | |
typedef __uint_least64_t uint_least64_t; | |
typedef signed char int_fast8_t; | |
typedef long int int_fast16_t; | |
typedef long int int_fast32_t; | |
typedef long int int_fast64_t; | |
typedef unsigned char uint_fast8_t; | |
typedef unsigned long int uint_fast16_t; | |
typedef unsigned long int uint_fast32_t; | |
typedef unsigned long int uint_fast64_t; | |
typedef long int intptr_t; | |
typedef unsigned long int uintptr_t; | |
typedef __intmax_t intmax_t; | |
typedef __uintmax_t uintmax_t; | |
typedef long int ptrdiff_t; | |
typedef long unsigned int size_t; | |
typedef int wchar_t; | |
typedef struct { | |
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); | |
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); | |
} max_align_t; | |
typedef struct clap_version { | |
uint32_t major; | |
uint32_t minor; | |
uint32_t revision; | |
} clap_version_t; | |
static const clap_version_t CLAP_VERSION = {((uint32_t)1), ((uint32_t)1), ((uint32_t)1)}; | |
static inline _Bool | |
clap_version_is_compatible(const clap_version_t v) { | |
return v.major >= 1; | |
} | |
typedef struct clap_plugin_entry { | |
clap_version_t clap_version; | |
_Bool (*initialize)(const char *plugin_path); | |
void (*deinit)(void); | |
const void *(*get_factory)(const char *factory_id); | |
} clap_plugin_entry_t; | |
__attribute__((visibility("default"))) extern const clap_plugin_entry_t clap_entry; | |
typedef struct clap_host { | |
clap_version_t clap_version; | |
void *host_data; | |
const char *name; | |
const char *vendor; | |
const char *url; | |
const char *_version; | |
const void *(*get_extension)(const struct clap_host *host, const char *extension_id); | |
void (*request_restart)(const struct clap_host *host); | |
void (*request_process)(const struct clap_host *host); | |
void (*request_callback)(const struct clap_host *host); | |
} clap_host_t; | |
static const int64_t CLAP_BEATTIME_FACTOR = 1LL << 31; | |
static const int64_t CLAP_SECTIME_FACTOR = 1LL << 31; | |
typedef int64_t clap_beattime; | |
typedef int64_t clap_sectime; | |
typedef uint32_t clap_id; | |
static const clap_id CLAP_INVALID_ID = (4294967295U); | |
typedef struct clap_event_header { | |
uint32_t size; | |
uint32_t time; | |
uint16_t space_id; | |
uint16_t type; | |
uint32_t flags; | |
} clap_event_header_t; | |
static const uint16_t CLAP_CORE_EVENT_SPACE_ID = 0; | |
enum clap_event_flags { | |
CLAP_EVENT_IS_LIVE = 1 << 0, | |
CLAP_EVENT_DONT_RECORD = 1 << 1, | |
}; | |
enum { | |
CLAP_EVENT_NOTE_ON, | |
CLAP_EVENT_NOTE_OFF, | |
CLAP_EVENT_NOTE_CHOKE, | |
CLAP_EVENT_NOTE_END, | |
CLAP_EVENT_NOTE_EXPRESSION, | |
CLAP_EVENT_PARAM_VALUE, | |
CLAP_EVENT_PARAM_MOD, | |
CLAP_EVENT_PARAM_GESTURE_BEGIN, | |
CLAP_EVENT_PARAM_GESTURE_END, | |
CLAP_EVENT_TRANSPORT, | |
CLAP_EVENT_MIDI, | |
CLAP_EVENT_MIDI_SYSEX, | |
CLAP_EVENT_MIDI2, | |
}; | |
typedef struct clap_event_note { | |
clap_event_header_t header; | |
int32_t note_id; | |
int16_t port_index; | |
int16_t channel; | |
int16_t key; | |
double velocity; | |
} clap_event_note_t; | |
enum { | |
CLAP_NOTE_EXPRESSION_VOLUME, | |
CLAP_NOTE_EXPRESSION_PAN, | |
CLAP_NOTE_EXPRESSION_TUNING, | |
CLAP_NOTE_EXPRESSION_VIBRATO, | |
CLAP_NOTE_EXPRESSION_EXPRESSION, | |
CLAP_NOTE_EXPRESSION_BRIGHTNESS, | |
CLAP_NOTE_EXPRESSION_PRESSURE, | |
}; | |
typedef int32_t clap_note_expression; | |
typedef struct clap_event_note_expression { | |
clap_event_header_t header; | |
clap_note_expression expression_id; | |
int32_t note_id; | |
int16_t port_index; | |
int16_t channel; | |
int16_t key; | |
double value; | |
} clap_event_note_expression_t; | |
typedef struct clap_event_param_value { | |
clap_event_header_t header; | |
clap_id param_id; | |
void *cookie; | |
int32_t note_id; | |
int16_t port_index; | |
int16_t channel; | |
int16_t key; | |
double value; | |
} clap_event_param_value_t; | |
typedef struct clap_event_param_mod { | |
clap_event_header_t header; | |
clap_id param_id; | |
void *cookie; | |
int32_t note_id; | |
int16_t port_index; | |
int16_t channel; | |
int16_t key; | |
double amount; | |
} clap_event_param_mod_t; | |
typedef struct clap_event_param_gesture { | |
clap_event_header_t header; | |
clap_id param_id; | |
} clap_event_param_gesture_t; | |
enum clap_transport_flags { | |
CLAP_TRANSPORT_HAS_TEMPO = 1 << 0, | |
CLAP_TRANSPORT_HAS_BEATS_TIMELINE = 1 << 1, | |
CLAP_TRANSPORT_HAS_SECONDS_TIMELINE = 1 << 2, | |
CLAP_TRANSPORT_HAS_TIME_SIGNATURE = 1 << 3, | |
CLAP_TRANSPORT_IS_PLAYING = 1 << 4, | |
CLAP_TRANSPORT_IS_RECORDING = 1 << 5, | |
CLAP_TRANSPORT_IS_LOOP_ACTIVE = 1 << 6, | |
CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL = 1 << 7, | |
}; | |
typedef struct clap_event_transport { | |
clap_event_header_t header; | |
uint32_t flags; | |
clap_beattime song_pos_beats; | |
clap_sectime song_pos_seconds; | |
double tempo; | |
double tempo_inc; | |
clap_beattime loop_start_beats; | |
clap_beattime loop_end_beats; | |
clap_sectime loop_start_seconds; | |
clap_sectime loop_end_seconds; | |
clap_beattime bar_start; | |
int32_t bar_number; | |
uint16_t tsig_num; | |
uint16_t tsig_denom; | |
} clap_event_transport_t; | |
typedef struct clap_event_midi { | |
clap_event_header_t header; | |
uint16_t port_index; | |
uint8_t data[3]; | |
} clap_event_midi_t; | |
typedef struct clap_event_midi_sysex { | |
clap_event_header_t header; | |
uint16_t port_index; | |
const uint8_t *buffer; | |
uint32_t size; | |
} clap_event_midi_sysex_t; | |
typedef struct clap_event_midi2 { | |
clap_event_header_t header; | |
uint16_t port_index; | |
uint32_t data[4]; | |
} clap_event_midi2_t; | |
typedef struct clap_input_events { | |
void *ctx; | |
uint32_t (*size)(const struct clap_input_events *list); | |
const clap_event_header_t *(*get)(const struct clap_input_events *list, uint32_t index); | |
} clap_input_events_t; | |
typedef struct clap_output_events { | |
void *ctx; | |
_Bool (*try_push)(const struct clap_output_events *list, const clap_event_header_t *event); | |
} clap_output_events_t; | |
typedef struct clap_audio_buffer { | |
float **data32; | |
double **data64; | |
uint32_t channel_count; | |
uint32_t latency; | |
uint64_t constant_mask; | |
} clap_audio_buffer_t; | |
enum { | |
CLAP_PROCESS_ERROR = 0, | |
CLAP_PROCESS_CONTINUE = 1, | |
CLAP_PROCESS_CONTINUE_IF_NOT_QUIET = 2, | |
CLAP_PROCESS_TAIL = 3, | |
CLAP_PROCESS_SLEEP = 4, | |
}; | |
typedef int32_t clap_process_status; | |
typedef struct clap_process { | |
int64_t steady_time; | |
uint32_t frames_count; | |
const clap_event_transport_t *transport; | |
const clap_audio_buffer_t *audio_inputs; | |
clap_audio_buffer_t *audio_outputs; | |
uint32_t audio_inputs_count; | |
uint32_t audio_outputs_count; | |
const clap_input_events_t *in_events; | |
const clap_output_events_t *out_events; | |
} clap_process_t; | |
typedef struct clap_plugin_descriptor { | |
clap_version_t clap_version; | |
const char *id; | |
const char *name; | |
const char *vendor; | |
const char *url; | |
const char *manual_url; | |
const char *support_url; | |
const char *_version; | |
const char *description; | |
const char **features; | |
} clap_plugin_descriptor_t; | |
typedef struct clap_plugin { | |
const clap_plugin_descriptor_t *desc; | |
void *plugin_data; | |
_Bool (*initialize)(const struct clap_plugin *plugin); | |
void (*destroy)(const struct clap_plugin *plugin); | |
_Bool (*activate)(const struct clap_plugin *plugin, | |
double sample_rate, | |
uint32_t min_frames_count, | |
uint32_t max_frames_count); | |
void (*deactivate)(const struct clap_plugin *plugin); | |
_Bool (*start_processing)(const struct clap_plugin *plugin); | |
void (*stop_processing)(const struct clap_plugin *plugin); | |
void (*reset)(const struct clap_plugin *plugin); | |
clap_process_status (*process)(const struct clap_plugin *plugin, const clap_process_t *process); | |
const void *(*get_extension)(const struct clap_plugin *plugin, const char *id); | |
void (*on_main_thread)(const struct clap_plugin *plugin); | |
} clap_plugin_t; | |
static const char CLAP_PLUGIN_FACTORY_ID[] = "clap.plugin-factory"; | |
typedef struct clap_plugin_factory { | |
uint32_t (*get_plugin_count)(const struct clap_plugin_factory *factory); | |
const clap_plugin_descriptor_t *(*get_plugin_descriptor)( | |
const struct clap_plugin_factory *factory, uint32_t index); | |
const clap_plugin_t *(*create_plugin)(const struct clap_plugin_factory *factory, | |
const clap_host_t *host, | |
const char *plugin_id); | |
} clap_plugin_factory_t; | |
typedef struct clap_plugin_invalidation_source { | |
const char *directory; | |
const char *filename_glob; | |
_Bool recursive_scan; | |
} clap_plugin_invalidation_source_t; | |
static const char CLAP_PLUGIN_INVALIDATION_FACTORY_ID[] = | |
"clap.plugin-invalidation-factory/draft0"; | |
typedef struct clap_plugin_invalidation_factory { | |
uint32_t (*count)(const struct clap_plugin_invalidation_factory *factory); | |
const clap_plugin_invalidation_source_t *(*get)( | |
const struct clap_plugin_invalidation_factory *factory, uint32_t index); | |
_Bool (*refresh)(const struct clap_plugin_invalidation_factory *factory); | |
} clap_plugin_invalidation_factory_t; | |
enum { | |
CLAP_NAME_SIZE = 256, | |
CLAP_PATH_SIZE = 1024, | |
}; | |
static const char CLAP_EXT_AUDIO_PORTS_CONFIG[] = "clap.audio-ports-config"; | |
typedef struct clap_audio_ports_config { | |
clap_id id; | |
char name[CLAP_NAME_SIZE]; | |
uint32_t input_port_count; | |
uint32_t output_port_count; | |
_Bool has_main_input; | |
uint32_t main_input_channel_count; | |
const char *main_input_port_type; | |
_Bool has_main_output; | |
uint32_t main_output_channel_count; | |
const char *main_output_port_type; | |
} clap_audio_ports_config_t; | |
typedef struct clap_plugin_audio_ports_config { | |
uint32_t (*count)(const clap_plugin_t *plugin); | |
_Bool (*get)(const clap_plugin_t *plugin, uint32_t index, clap_audio_ports_config_t *config); | |
_Bool (*select)(const clap_plugin_t *plugin, clap_id config_id); | |
} clap_plugin_audio_ports_config_t; | |
typedef struct clap_host_audio_ports_config { | |
void (*rescan)(const clap_host_t *host); | |
} clap_host_audio_ports_config_t; | |
static const char CLAP_EXT_AUDIO_PORTS[] = "clap.audio-ports"; | |
static const char CLAP_PORT_MONO[] = "mono"; | |
static const char CLAP_PORT_STEREO[] = "stereo"; | |
enum { | |
CLAP_AUDIO_PORT_IS_MAIN = 1 << 0, | |
CLAP_AUDIO_PORT_SUPPORTS_64BITS = 1 << 1, | |
CLAP_AUDIO_PORT_PREFERS_64BITS = 1 << 2, | |
CLAP_AUDIO_PORT_REQUIRES_COMMON_SAMPLE_SIZE = 1 << 3, | |
}; | |
typedef struct clap_audio_port_info { | |
clap_id id; | |
char name[CLAP_NAME_SIZE]; | |
uint32_t flags; | |
uint32_t channel_count; | |
const char *port_type; | |
clap_id in_place_pair; | |
} clap_audio_port_info_t; | |
typedef struct clap_plugin_audio_ports { | |
uint32_t (*count)(const clap_plugin_t *plugin, _Bool is_input); | |
_Bool (*get)(const clap_plugin_t *plugin, | |
uint32_t index, | |
_Bool is_input, | |
clap_audio_port_info_t *info); | |
} clap_plugin_audio_ports_t; | |
enum { | |
CLAP_AUDIO_PORTS_RESCAN_NAMES = 1 << 0, | |
CLAP_AUDIO_PORTS_RESCAN_FLAGS = 1 << 1, | |
CLAP_AUDIO_PORTS_RESCAN_CHANNEL_COUNT = 1 << 2, | |
CLAP_AUDIO_PORTS_RESCAN_PORT_TYPE = 1 << 3, | |
CLAP_AUDIO_PORTS_RESCAN_IN_PLACE_PAIR = 1 << 4, | |
CLAP_AUDIO_PORTS_RESCAN_LIST = 1 << 5, | |
}; | |
typedef struct clap_host_audio_ports { | |
_Bool (*is_rescan_flag_supported)(const clap_host_t *host, uint32_t flag); | |
void (*rescan)(const clap_host_t *host, uint32_t flags); | |
} clap_host_audio_ports_t; | |
static const char CLAP_EXT_EVENT_REGISTRY[] = "clap.event-registry"; | |
typedef struct clap_host_event_registry { | |
_Bool (*query)(const clap_host_t *host, const char *space_name, uint16_t *space_id); | |
} clap_host_event_registry_t; | |
static const char CLAP_EXT_GUI[] = "clap.gui"; | |
static const char CLAP_WINDOW_API_WIN32[] = "win32"; | |
static const char CLAP_WINDOW_API_COCOA[] = "cocoa"; | |
static const char CLAP_WINDOW_API_X11[] = "x11"; | |
static const char CLAP_WINDOW_API_WAYLAND[] = "wayland"; | |
typedef void *clap_hwnd; | |
typedef void *clap_nsview; | |
typedef unsigned long clap_xwnd; | |
typedef struct clap_window { | |
const char *api; | |
union { | |
clap_nsview cocoa; | |
clap_xwnd x11; | |
clap_hwnd win32; | |
void *ptr; | |
}; | |
} clap_window_t; | |
typedef struct clap_gui_resize_hints { | |
_Bool can_resize_horizontally; | |
_Bool can_resize_vertically; | |
_Bool preserve_aspect_ratio; | |
uint32_t aspect_ratio_width; | |
uint32_t aspect_ratio_height; | |
} clap_gui_resize_hints_t; | |
typedef struct clap_plugin_gui { | |
_Bool (*is_api_supported)(const clap_plugin_t *plugin, const char *api, _Bool is_floating); | |
_Bool (*get_preferred_api)(const clap_plugin_t *plugin, const char **api, _Bool *is_floating); | |
_Bool (*create)(const clap_plugin_t *plugin, const char *api, _Bool is_floating); | |
void (*destroy)(const clap_plugin_t *plugin); | |
_Bool (*set_scale)(const clap_plugin_t *plugin, double scale); | |
_Bool (*get_size)(const clap_plugin_t *plugin, uint32_t *width, uint32_t *height); | |
_Bool (*can_resize)(const clap_plugin_t *plugin); | |
_Bool (*get_resize_hints)(const clap_plugin_t *plugin, clap_gui_resize_hints_t *hints); | |
_Bool (*adjust_size)(const clap_plugin_t *plugin, uint32_t *width, uint32_t *height); | |
_Bool (*set_size)(const clap_plugin_t *plugin, uint32_t width, uint32_t height); | |
_Bool (*set_parent)(const clap_plugin_t *plugin, const clap_window_t *window); | |
_Bool (*set_transient)(const clap_plugin_t *plugin, const clap_window_t *window); | |
void (*suggest_title)(const clap_plugin_t *plugin, const char *title); | |
_Bool (*show)(const clap_plugin_t *plugin); | |
_Bool (*hide)(const clap_plugin_t *plugin); | |
} clap_plugin_gui_t; | |
typedef struct clap_host_gui { | |
void (*resize_hints_changed)(const clap_host_t *host); | |
_Bool (*request_resize)(const clap_host_t *host, uint32_t width, uint32_t height); | |
_Bool (*request_show)(const clap_host_t *host); | |
_Bool (*request_hide)(const clap_host_t *host); | |
void (*closed)(const clap_host_t *host, _Bool was_destroyed); | |
} clap_host_gui_t; | |
static const char CLAP_EXT_LATENCY[] = "clap.latency"; | |
typedef struct clap_plugin_latency { | |
uint32_t (*get)(const clap_plugin_t *plugin); | |
} clap_plugin_latency_t; | |
typedef struct clap_host_latency { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_latency_t; | |
static const char CLAP_EXT_LOG[] = "clap.log"; | |
enum { | |
CLAP_LOG_DEBUG = 0, | |
CLAP_LOG_INFO = 1, | |
CLAP_LOG_WARNING = 2, | |
CLAP_LOG_ERROR = 3, | |
CLAP_LOG_FATAL = 4, | |
CLAP_LOG_HOST_MISBEHAVING = 5, | |
CLAP_LOG_PLUGIN_MISBEHAVING = 6, | |
}; | |
typedef int32_t clap_log_severity; | |
typedef struct clap_host_log { | |
void (*log)(const clap_host_t *host, clap_log_severity severity, const char *msg); | |
} clap_host_log_t; | |
static const char CLAP_EXT_NOTE_NAME[] = "clap.note-name"; | |
typedef struct clap_note_name { | |
char name[CLAP_NAME_SIZE]; | |
int16_t port; | |
int16_t key; | |
int16_t channel; | |
} clap_note_name_t; | |
typedef struct clap_plugin_note_name { | |
uint32_t (*count)(const clap_plugin_t *plugin); | |
_Bool (*get)(const clap_plugin_t *plugin, uint32_t index, clap_note_name_t *note_name); | |
} clap_plugin_note_name_t; | |
typedef struct clap_host_note_name { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_note_name_t; | |
static const char CLAP_EXT_NOTE_PORTS[] = "clap.note-ports"; | |
enum clap_note_dialect { | |
CLAP_NOTE_DIALECT_CLAP = 1 << 0, | |
CLAP_NOTE_DIALECT_MIDI = 1 << 1, | |
CLAP_NOTE_DIALECT_MIDI_MPE = 1 << 2, | |
CLAP_NOTE_DIALECT_MIDI2 = 1 << 3, | |
}; | |
typedef struct clap_note_port_info { | |
clap_id id; | |
uint32_t supported_dialects; | |
uint32_t preferred_dialect; | |
char name[CLAP_NAME_SIZE]; | |
} clap_note_port_info_t; | |
typedef struct clap_plugin_note_ports { | |
uint32_t (*count)(const clap_plugin_t *plugin, _Bool is_input); | |
_Bool (*get)(const clap_plugin_t *plugin, | |
uint32_t index, | |
_Bool is_input, | |
clap_note_port_info_t *info); | |
} clap_plugin_note_ports_t; | |
enum { | |
CLAP_NOTE_PORTS_RESCAN_ALL = 1 << 0, | |
CLAP_NOTE_PORTS_RESCAN_NAMES = 1 << 1, | |
}; | |
typedef struct clap_host_note_ports { | |
uint32_t (*supported_dialects)(const clap_host_t *host); | |
void (*rescan)(const clap_host_t *host, uint32_t flags); | |
} clap_host_note_ports_t; | |
static const char CLAP_EXT_PARAMS[] = "clap.params"; | |
enum { | |
CLAP_PARAM_IS_STEPPED = 1 << 0, | |
CLAP_PARAM_IS_PERIODIC = 1 << 1, | |
CLAP_PARAM_IS_HIDDEN = 1 << 2, | |
CLAP_PARAM_IS_READONLY = 1 << 3, | |
CLAP_PARAM_IS_BYPASS = 1 << 4, | |
CLAP_PARAM_IS_AUTOMATABLE = 1 << 5, | |
CLAP_PARAM_IS_AUTOMATABLE_PER_NOTE_ID = 1 << 6, | |
CLAP_PARAM_IS_AUTOMATABLE_PER_KEY = 1 << 7, | |
CLAP_PARAM_IS_AUTOMATABLE_PER_CHANNEL = 1 << 8, | |
CLAP_PARAM_IS_AUTOMATABLE_PER_PORT = 1 << 9, | |
CLAP_PARAM_IS_MODULATABLE = 1 << 10, | |
CLAP_PARAM_IS_MODULATABLE_PER_NOTE_ID = 1 << 11, | |
CLAP_PARAM_IS_MODULATABLE_PER_KEY = 1 << 12, | |
CLAP_PARAM_IS_MODULATABLE_PER_CHANNEL = 1 << 13, | |
CLAP_PARAM_IS_MODULATABLE_PER_PORT = 1 << 14, | |
CLAP_PARAM_REQUIRES_PROCESS = 1 << 15, | |
}; | |
typedef uint32_t clap_param_info_flags; | |
typedef struct clap_param_info { | |
clap_id id; | |
clap_param_info_flags flags; | |
void *cookie; | |
char name[CLAP_NAME_SIZE]; | |
char module[CLAP_PATH_SIZE]; | |
double min_value; | |
double max_value; | |
double default_value; | |
} clap_param_info_t; | |
typedef struct clap_plugin_params { | |
uint32_t (*count)(const clap_plugin_t *plugin); | |
_Bool (*get_info)(const clap_plugin_t *plugin, | |
uint32_t param_index, | |
clap_param_info_t *param_info); | |
_Bool (*get_value)(const clap_plugin_t *plugin, clap_id param_id, double *value); | |
_Bool (*value_to_text)( | |
const clap_plugin_t *plugin, clap_id param_id, double value, char *display, uint32_t size); | |
_Bool (*text_to_value)(const clap_plugin_t *plugin, | |
clap_id param_id, | |
const char *display, | |
double *value); | |
void (*flush)(const clap_plugin_t *plugin, | |
const clap_input_events_t *in, | |
const clap_output_events_t *out); | |
} clap_plugin_params_t; | |
enum { | |
CLAP_PARAM_RESCAN_VALUES = 1 << 0, | |
CLAP_PARAM_RESCAN_TEXT = 1 << 1, | |
CLAP_PARAM_RESCAN_INFO = 1 << 2, | |
CLAP_PARAM_RESCAN_ALL = 1 << 3, | |
}; | |
typedef uint32_t clap_param_rescan_flags; | |
enum { | |
CLAP_PARAM_CLEAR_ALL = 1 << 0, | |
CLAP_PARAM_CLEAR_AUTOMATIONS = 1 << 1, | |
CLAP_PARAM_CLEAR_MODULATIONS = 1 << 2, | |
}; | |
typedef uint32_t clap_param_clear_flags; | |
typedef struct clap_host_params { | |
void (*rescan)(const clap_host_t *host, clap_param_rescan_flags flags); | |
void (*clear)(const clap_host_t *host, clap_id param_id, clap_param_clear_flags flags); | |
void (*request_flush)(const clap_host_t *host); | |
} clap_host_params_t; | |
static const char CLAP_EXT_POSIX_FD_SUPPORT[] = "clap.posix-fd-support"; | |
enum { | |
CLAP_POSIX_FD_READ = 1 << 0, | |
CLAP_POSIX_FD_WRITE = 1 << 1, | |
CLAP_POSIX_FD_ERROR = 1 << 2, | |
}; | |
typedef uint32_t clap_posix_fd_flags_t; | |
typedef struct clap_plugin_posix_fd_support { | |
void (*on_fd)(const clap_plugin_t *plugin, int fd, clap_posix_fd_flags_t flags); | |
} clap_plugin_posix_fd_support_t; | |
typedef struct clap_host_posix_fd_support { | |
_Bool (*register_fd)(const clap_host_t *host, int fd, clap_posix_fd_flags_t flags); | |
_Bool (*modify_fd)(const clap_host_t *host, int fd, clap_posix_fd_flags_t flags); | |
_Bool (*unregister_fd)(const clap_host_t *host, int fd); | |
} clap_host_posix_fd_support_t; | |
static const char CLAP_EXT_RENDER[] = "clap.render"; | |
enum { | |
CLAP_RENDER_REALTIME = 0, | |
CLAP_RENDER_OFFLINE = 1, | |
}; | |
typedef int32_t clap_plugin_render_mode; | |
typedef struct clap_plugin_render { | |
_Bool (*has_hard_realtime_requirement)(const clap_plugin_t *plugin); | |
_Bool (*set)(const clap_plugin_t *plugin, clap_plugin_render_mode mode); | |
} clap_plugin_render_t; | |
typedef struct clap_istream { | |
void *ctx; | |
int64_t (*read)(const struct clap_istream *stream, void *buffer, uint64_t size); | |
} clap_istream_t; | |
typedef struct clap_ostream { | |
void *ctx; | |
int64_t (*write)(const struct clap_ostream *stream, const void *buffer, uint64_t size); | |
} clap_ostream_t; | |
static const char CLAP_EXT_STATE[] = "clap.state"; | |
typedef struct clap_plugin_state { | |
_Bool (*save)(const clap_plugin_t *plugin, const clap_ostream_t *stream); | |
_Bool (*load)(const clap_plugin_t *plugin, const clap_istream_t *stream); | |
} clap_plugin_state_t; | |
typedef struct clap_host_state { | |
void (*mark_dirty)(const clap_host_t *host); | |
} clap_host_state_t; | |
static const char CLAP_EXT_TAIL[] = "clap.tail"; | |
typedef struct clap_plugin_tail { | |
uint32_t (*get)(const clap_plugin_t *plugin); | |
} clap_plugin_tail_t; | |
typedef struct clap_host_tail { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_tail_t; | |
static const char CLAP_EXT_THREAD_CHECK[] = "clap.thread-check"; | |
typedef struct clap_host_thread_check { | |
_Bool (*is_main_thread)(const clap_host_t *host); | |
_Bool (*is_audio_thread)(const clap_host_t *host); | |
} clap_host_thread_check_t; | |
static const char CLAP_EXT_THREAD_POOL[] = "clap.thread-pool"; | |
typedef struct clap_plugin_thread_pool { | |
void (*exec)(const clap_plugin_t *plugin, uint32_t task_index); | |
} clap_plugin_thread_pool_t; | |
typedef struct clap_host_thread_pool { | |
_Bool (*request_exec)(const clap_host_t *host, uint32_t num_tasks); | |
} clap_host_thread_pool_t; | |
static const char CLAP_EXT_TIMER_SUPPORT[] = "clap.timer-support"; | |
typedef struct clap_plugin_timer_support { | |
void (*on_timer)(const clap_plugin_t *plugin, clap_id timer_id); | |
} clap_plugin_timer_support_t; | |
typedef struct clap_host_timer_support { | |
_Bool (*register_timer)(const clap_host_t *host, uint32_t period_ms, clap_id *timer_id); | |
_Bool (*unregister_timer)(const clap_host_t *host, clap_id timer_id); | |
} clap_host_timer_support_t; | |
static const char CLAP_EXT_VOICE_INFO[] = "clap.voice-info"; | |
enum { | |
CLAP_VOICE_INFO_SUPPORTS_OVERLAPPING_NOTES = 1 << 0, | |
}; | |
typedef struct clap_voice_info { | |
uint32_t voice_count; | |
uint32_t voice_capacity; | |
uint64_t flags; | |
} clap_voice_info_t; | |
typedef struct clap_plugin_voice_info { | |
_Bool (*get)(const clap_plugin_t *plugin, clap_voice_info_t *info); | |
} clap_plugin_voice_info_t; | |
typedef struct clap_host_voice_info { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_voice_info_t; | |
static const char CLAP_EXT_AMBISONIC[] = "clap.ambisonic.draft/0"; | |
static const char CLAP_PORT_AMBISONIC[] = "ambisonic"; | |
enum { | |
CLAP_AMBISONIC_FUMA = 0, | |
CLAP_AMBISONIC_ACN = 1, | |
}; | |
enum { | |
CLAP_AMBISONIC_NORMALIZATION_MAXN = 0, | |
CLAP_AMBISONIC_NORMALIZATION_SN3D = 1, | |
CLAP_AMBISONIC_NORMALIZATION_N3D = 2, | |
CLAP_AMBISONIC_NORMALIZATION_SN2D = 3, | |
CLAP_AMBISONIC_NORMALIZATION_N2D = 4, | |
}; | |
typedef struct clap_ambisonic_info { | |
uint32_t ordering; | |
uint32_t normalization; | |
} clap_ambisonic_info_t; | |
typedef struct clap_plugin_ambisonic { | |
_Bool (*get_info)(const clap_plugin_t *plugin, | |
_Bool is_input, | |
uint32_t port_index, | |
clap_ambisonic_info_t *info); | |
} clap_plugin_ambisonic_t; | |
typedef struct clap_host_ambisonic { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_ambisonic_t; | |
static const char CLAP_EXT_CV[] = "clap.cv.draft/0"; | |
static const char CLAP_PORT_CV[] = "cv"; | |
enum { | |
CLAP_CV_VALUE = 0, | |
CLAP_CV_GATE = 1, | |
CLAP_CV_PITCH = 2, | |
}; | |
typedef struct clap_plugin_cv { | |
_Bool (*get_channel_type)(const clap_plugin_t *plugin, | |
_Bool is_input, | |
uint32_t port_index, | |
uint32_t channel_index, | |
uint32_t *channel_type); | |
} clap_plugin_cv_t; | |
typedef struct clap_host_cv { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_cv_t; | |
static const char CLAP_EXT_FILE_REFERENCE[] = "clap.file-reference.draft/0"; | |
typedef struct clap_file_reference { | |
clap_id resource_id; | |
_Bool belongs_to_plugin_collection; | |
size_t path_capacity; | |
size_t path_size; | |
char *path; | |
} clap_file_reference_t; | |
typedef struct clap_plugin_file_reference { | |
uint32_t (*count)(const clap_plugin_t *plugin); | |
_Bool (*get)(const clap_plugin_t *plugin, uint32_t index, clap_file_reference_t *file_reference); | |
_Bool (*get_blake3_digest)(const clap_plugin_t *plugin, clap_id resource_id, uint8_t *digest); | |
_Bool (*get_file_size)(const clap_plugin_t *plugin, clap_id resource_id, uint64_t *size); | |
_Bool (*update_path)(const clap_plugin_t *plugin, clap_id resource_id, const char *path); | |
_Bool (*save_resources)(const clap_plugin_t *plugin); | |
} clap_plugin_file_reference_t; | |
typedef struct clap_host_file_reference { | |
void (*changed)(const clap_host_t *host); | |
void (*set_dirty)(const clap_host_t *host, clap_id resource_id); | |
} clap_host_file_reference; | |
static const char CLAP_EXT_MIDI_MAPPINGS[] = "clap.midi-mappings.draft/0"; | |
enum { | |
CLAP_MIDI_MAPPING_CC7, | |
CLAP_MIDI_MAPPING_CC14, | |
CLAP_MIDI_MAPPING_RPN, | |
CLAP_MIDI_MAPPING_NRPN, | |
}; | |
typedef int32_t clap_midi_mapping_type; | |
typedef struct clap_midi_mapping { | |
int32_t channel; | |
int32_t number; | |
clap_id param_id; | |
} clap_midi_mapping_t; | |
typedef struct clap_plugin_midi_mappings { | |
uint32_t (*count)(const clap_plugin_t *plugin); | |
_Bool (*get)(const clap_plugin_t *plugin, uint32_t index, clap_midi_mapping_t *mapping); | |
} clap_plugin_midi_mappings_t; | |
typedef struct clap_host_midi_mappings { | |
void (*changed)(const clap_host_t *host); | |
} clap_host_midi_mappings_t; | |
static const char CLAP_EXT_PRESET_LOAD[] = "clap.preset-load.draft/0"; | |
typedef struct clap_plugin_preset_load { | |
_Bool (*from_file)(const clap_plugin_t *plugin, const char *path); | |
} clap_plugin_preset_load_t; | |
static const char CLAP_EXT_QUICK_CONTROLS[] = "clap.quick-controls.draft/0"; | |
enum { CLAP_QUICK_CONTROLS_COUNT = 8 }; | |
typedef struct clap_quick_controls_page { | |
clap_id id; | |
char name[CLAP_NAME_SIZE]; | |
clap_id param_ids[CLAP_QUICK_CONTROLS_COUNT]; | |
} clap_quick_controls_page_t; | |
typedef struct clap_plugin_quick_controls { | |
uint32_t (*count)(const clap_plugin_t *plugin); | |
_Bool (*get)(const clap_plugin_t *plugin, uint32_t page_index, clap_quick_controls_page_t *page); | |
} clap_plugin_quick_controls_t; | |
typedef struct clap_host_quick_controls { | |
void (*changed)(const clap_host_t *host); | |
void (*suggest_page)(const clap_host_t *host, clap_id page_id); | |
} clap_host_quick_controls_t; | |
static const char CLAP_EXT_STATE_CONTEXT[] = "clap.state-context.draft/1"; | |
enum clap_plugin_state_context_type { | |
CLAP_STATE_CONTEXT_FOR_DUPLICATE = 1, | |
CLAP_STATE_CONTEXT_FOR_PRESET = 2, | |
}; | |
typedef struct clap_plugin_state_context { | |
_Bool (*save)(const clap_plugin_t *plugin, const clap_ostream_t *stream, uint32_t context_type); | |
_Bool (*load)(const clap_plugin_t *plugin, const clap_istream_t *stream, uint32_t context_type); | |
} clap_plugin_state_context_t; | |
static const char CLAP_EXT_SURROUND[] = "clap.surround.draft/1"; | |
static const char CLAP_PORT_SURROUND[] = "surround"; | |
enum { | |
CLAP_SURROUND_FL = 0, | |
CLAP_SURROUND_FR = 1, | |
CLAP_SURROUND_FC = 2, | |
CLAP_SURROUND_LFE = 3, | |
CLAP_SURROUND_BL = 4, | |
CLAP_SURROUND_BR = 5, | |
CLAP_SURROUND_FLC = 6, | |
CLAP_SURROUND_FRC = 7, | |
CLAP_SURROUND_BC = 8, | |
CLAP_SURROUND_SL = 9, | |
CLAP_SURROUND_SR = 10, | |
CLAP_SURROUND_TC = 11, | |
CLAP_SURROUND_TFL = 12, | |
CLAP_SURROUND_TFC = 13, | |
CLAP_SURROUND_TFR = 14, | |
CLAP_SURROUND_TBL = 15, | |
CLAP_SURROUND_TBC = 16, | |
CLAP_SURROUND_TBR = 17, | |
}; | |
typedef struct clap_plugin_surround { | |
uint32_t (*get_channel_map)(const clap_plugin_t *plugin, | |
_Bool is_input, | |
uint32_t port_index, | |
uint8_t *channel_map, | |
uint32_t channel_map_capacity); | |
void (*changed)(const clap_plugin_t *plugin); | |
} clap_plugin_surround_t; | |
typedef struct clap_host_surround { | |
void (*changed)(const clap_host_t *host); | |
void (*get_preferred_channel_map)(const clap_host_t *host, | |
uint8_t *channel_map, | |
uint32_t channel_map_capacity, | |
uint32_t *channel_count); | |
} clap_host_surround_t; | |
typedef struct clap_color { | |
uint8_t alpha; | |
uint8_t red; | |
uint8_t green; | |
uint8_t blue; | |
} clap_color_t; | |
static const char CLAP_EXT_TRACK_INFO[] = "clap.track-info.draft/0"; | |
typedef struct clap_track_info { | |
clap_id id; | |
int32_t index; | |
char name[CLAP_NAME_SIZE]; | |
char path[CLAP_PATH_SIZE]; | |
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 { | |
void (*changed)(const clap_plugin_t *plugin); | |
} clap_plugin_track_info_t; | |
typedef struct clap_host_track_info { | |
_Bool (*get)(const clap_host_t *host, clap_track_info_t *info); | |
} clap_host_track_info_t; | |
static const char CLAP_EXT_TUNING[] = "clap.tuning.draft/2"; | |
typedef struct clap_event_tuning { | |
clap_event_header_t header; | |
int16_t port_index; | |
int16_t channel; | |
clap_id tunning_id; | |
} clap_event_tuning_t; | |
typedef struct clap_tuning_info { | |
clap_id tuning_id; | |
char name[CLAP_NAME_SIZE]; | |
_Bool is_dynamic; | |
} clap_tuning_info_t; | |
typedef struct clap_plugin_tuning { | |
void (*changed)(const clap_plugin_t *plugin); | |
} clap_plugin_tuning_t; | |
typedef struct clap_host_tuning { | |
double (*get_relative)(const clap_host_t *host, | |
clap_id tuning_id, | |
int32_t channel, | |
int32_t key, | |
uint32_t sample_offset); | |
_Bool (*should_play)(const clap_host_t *host, clap_id tuning_id, int32_t channel, int32_t key); | |
uint32_t (*get_tuning_count)(const clap_host_t *host); | |
_Bool (*get_info)(const clap_host_t *host, uint32_t tuning_index, clap_tuning_info_t *info); | |
} clap_host_tuning_t; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment