1#![allow(non_camel_case_types)]
4#![allow(non_upper_case_globals)]
5
6use std::ffi::{CStr, c_char, c_int, c_uint, c_ulong, c_void};
7
8pub const CLAP_VERSION_MAJOR: u32 = 1;
9pub const CLAP_VERSION_MINOR: u32 = 2;
10pub const CLAP_VERSION_REVISION: u32 = 5;
11
12#[repr(C)]
13#[derive(Debug, Copy, Clone)]
14pub struct clap_version {
15 pub major: u32,
16 pub minor: u32,
17 pub revision: u32,
18}
19
20pub const CLAP_VERSION: clap_version = clap_version {
21 major: CLAP_VERSION_MAJOR,
22 minor: CLAP_VERSION_MINOR,
23 revision: CLAP_VERSION_REVISION,
24};
25
26pub const CLAP_PLUGIN_FEATURE_INSTRUMENT: &CStr = c"instrument";
27pub const CLAP_PLUGIN_FEATURE_AUDIO_EFFECT: &CStr = c"audio-effect";
28pub const CLAP_PLUGIN_FEATURE_NOTE_EFFECT: &CStr = c"note-effect";
29pub const CLAP_PLUGIN_FEATURE_NOTE_DETECTOR: &CStr = c"note-detector";
30pub const CLAP_PLUGIN_FEATURE_ANALYZER: &CStr = c"analyzer";
31pub const CLAP_PLUGIN_FEATURE_SYNTHESIZER: &CStr = c"synthesizer";
32pub const CLAP_PLUGIN_FEATURE_SAMPLER: &CStr = c"sampler";
33pub const CLAP_PLUGIN_FEATURE_DRUM: &CStr = c"drum";
34pub const CLAP_PLUGIN_FEATURE_DRUM_MACHINE: &CStr = c"drum-machine";
35pub const CLAP_PLUGIN_FEATURE_FILTER: &CStr = c"filter";
36pub const CLAP_PLUGIN_FEATURE_PHASER: &CStr = c"phaser";
37pub const CLAP_PLUGIN_FEATURE_EQUALIZER: &CStr = c"equalizer";
38pub const CLAP_PLUGIN_FEATURE_DEESSER: &CStr = c"de-esser";
39pub const CLAP_PLUGIN_FEATURE_PHASE_VOCODER: &CStr = c"phase-vocoder";
40pub const CLAP_PLUGIN_FEATURE_GRANULAR: &CStr = c"granular";
41pub const CLAP_PLUGIN_FEATURE_FREQUENCY_SHIFTER: &CStr = c"frequency-shifter";
42pub const CLAP_PLUGIN_FEATURE_PITCH_SHIFTER: &CStr = c"pitch-shifter";
43pub const CLAP_PLUGIN_FEATURE_DISTORTION: &CStr = c"distortion";
44pub const CLAP_PLUGIN_FEATURE_TRANSIENT_SHAPER: &CStr = c"transient-shaper";
45pub const CLAP_PLUGIN_FEATURE_COMPRESSOR: &CStr = c"compressor";
46pub const CLAP_PLUGIN_FEATURE_EXPANDER: &CStr = c"expander";
47pub const CLAP_PLUGIN_FEATURE_GATE: &CStr = c"gate";
48pub const CLAP_PLUGIN_FEATURE_LIMITER: &CStr = c"limiter";
49pub const CLAP_PLUGIN_FEATURE_FLANGER: &CStr = c"flanger";
50pub const CLAP_PLUGIN_FEATURE_CHORUS: &CStr = c"chorus";
51pub const CLAP_PLUGIN_FEATURE_DELAY: &CStr = c"delay";
52pub const CLAP_PLUGIN_FEATURE_REVERB: &CStr = c"reverb";
53pub const CLAP_PLUGIN_FEATURE_TREMOLO: &CStr = c"tremolo";
54pub const CLAP_PLUGIN_FEATURE_GLITCH: &CStr = c"glitch";
55pub const CLAP_PLUGIN_FEATURE_UTILITY: &CStr = c"utility";
56pub const CLAP_PLUGIN_FEATURE_PITCH_CORRECTION: &CStr = c"pitch-correction";
57pub const CLAP_PLUGIN_FEATURE_RESTORATION: &CStr = c"restoration";
58pub const CLAP_PLUGIN_FEATURE_MULTI_EFFECTS: &CStr = c"multi-effects";
59pub const CLAP_PLUGIN_FEATURE_MIXING: &CStr = c"mixing";
60pub const CLAP_PLUGIN_FEATURE_MASTERING: &CStr = c"mastering";
61pub const CLAP_PLUGIN_FEATURE_MONO: &CStr = c"mono";
62pub const CLAP_PLUGIN_FEATURE_STEREO: &CStr = c"stereo";
63pub const CLAP_PLUGIN_FEATURE_SURROUND: &CStr = c"surround";
64pub const CLAP_PLUGIN_FEATURE_AMBISONIC: &CStr = c"ambisonic";
65
66#[repr(C)]
67#[derive(Debug, Copy, Clone)]
68pub struct clap_plugin_entry {
69 pub clap_version: clap_version,
70 pub init: Option<unsafe extern "C-unwind" fn(plugin_path: *const c_char) -> bool>,
71 pub deinit: Option<unsafe extern "C-unwind" fn()>,
72 pub get_factory:
73 Option<unsafe extern "C-unwind" fn(factory_id: *const c_char) -> *const c_void>,
74}
75
76#[repr(C)]
77#[derive(Debug, Copy, Clone)]
78pub struct clap_host {
79 pub clap_version: clap_version,
80 pub host_data: *mut c_void,
81 pub name: *const c_char,
82 pub vendor: *const c_char,
83 pub url: *const c_char,
84 pub version: *const c_char,
85 pub get_extension: Option<
86 unsafe extern "C-unwind" fn(
87 host: *const clap_host,
88 extension_id: *const c_char,
89 ) -> *const c_void,
90 >,
91 pub request_restart: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
92 pub request_process: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
93 pub request_callback: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
94}
95
96#[doc = " We use fixed point representation of beat time and seconds time\n Usage:\n double x = ...; // in beats\n clap_beattime y = round(CLAP_BEATTIME_FACTOR * x);"]
97pub const CLAP_BEATTIME_FACTOR: i64 = 2147483648; pub const CLAP_SECTIME_FACTOR: i64 = 2147483648;
99pub type clap_beattime = i64;
100pub type clap_sectime = i64;
101pub type clap_id = u32;
102pub const CLAP_INVALID_ID: clap_id = u32::MAX;
103
104#[repr(C)]
105#[derive(Debug, Copy, Clone, PartialEq)]
106pub struct clap_event_header {
107 pub size: u32,
108 pub time: u32,
109 pub space_id: u16,
110 pub r#type: u16,
111 pub flags: u32,
112}
113
114pub const CLAP_CORE_EVENT_SPACE_ID: u16 = 0;
115
116pub const CLAP_EVENT_IS_LIVE: clap_event_flags = 1;
117pub const CLAP_EVENT_DONT_RECORD: clap_event_flags = 2;
118pub type clap_event_flags = c_uint;
119
120pub const CLAP_EVENT_NOTE_ON: c_uint = 0;
121pub const CLAP_EVENT_NOTE_OFF: c_uint = 1;
122pub const CLAP_EVENT_NOTE_CHOKE: c_uint = 2;
123pub const CLAP_EVENT_NOTE_END: c_uint = 3;
124pub const CLAP_EVENT_NOTE_EXPRESSION: c_uint = 4;
125pub const CLAP_EVENT_PARAM_VALUE: c_uint = 5;
126pub const CLAP_EVENT_PARAM_MOD: c_uint = 6;
127pub const CLAP_EVENT_PARAM_GESTURE_BEGIN: c_uint = 7;
128pub const CLAP_EVENT_PARAM_GESTURE_END: c_uint = 8;
129pub const CLAP_EVENT_TRANSPORT: c_uint = 9;
130pub const CLAP_EVENT_MIDI: c_uint = 10;
131pub const CLAP_EVENT_MIDI_SYSEX: c_uint = 11;
132pub const CLAP_EVENT_MIDI2: c_uint = 12;
133
134#[repr(C)]
135#[derive(Debug, Copy, Clone, PartialEq)]
136pub struct clap_event_note {
137 pub header: clap_event_header,
138 pub note_id: i32,
139 pub port_index: i16,
140 pub channel: i16,
141 pub key: i16,
142 pub velocity: f64,
143}
144
145pub type clap_note_expression = i32;
146pub const CLAP_NOTE_EXPRESSION_VOLUME: clap_note_expression = 0;
147pub const CLAP_NOTE_EXPRESSION_PAN: clap_note_expression = 1;
148pub const CLAP_NOTE_EXPRESSION_TUNING: clap_note_expression = 2;
149pub const CLAP_NOTE_EXPRESSION_VIBRATO: clap_note_expression = 3;
150pub const CLAP_NOTE_EXPRESSION_EXPRESSION: clap_note_expression = 4;
151pub const CLAP_NOTE_EXPRESSION_BRIGHTNESS: clap_note_expression = 5;
152pub const CLAP_NOTE_EXPRESSION_PRESSURE: clap_note_expression = 6;
153
154#[repr(C)]
155#[derive(Debug, Copy, Clone, PartialEq)]
156pub struct clap_event_note_expression {
157 pub header: clap_event_header,
158 pub expression_id: clap_note_expression,
159 pub note_id: i32,
160 pub port_index: i16,
161 pub channel: i16,
162 pub key: i16,
163 pub value: f64,
164}
165
166#[repr(C)]
167#[derive(Debug, Copy, Clone, PartialEq)]
168pub struct clap_event_param_value {
169 pub header: clap_event_header,
170 pub param_id: clap_id,
171 pub cookie: *mut c_void,
172 pub note_id: i32,
173 pub port_index: i16,
174 pub channel: i16,
175 pub key: i16,
176 pub value: f64,
177}
178
179#[repr(C)]
180#[derive(Debug, Copy, Clone, PartialEq)]
181pub struct clap_event_param_mod {
182 pub header: clap_event_header,
183 pub param_id: clap_id,
184 pub cookie: *mut c_void,
185 pub note_id: i32,
186 pub port_index: i16,
187 pub channel: i16,
188 pub key: i16,
189 pub amount: f64,
190}
191
192#[repr(C)]
193#[derive(Debug, Copy, Clone, PartialEq)]
194pub struct clap_event_param_gesture {
195 pub header: clap_event_header,
196 pub param_id: clap_id,
197}
198
199pub const CLAP_TRANSPORT_HAS_TEMPO: clap_transport_flags = 1;
200pub const CLAP_TRANSPORT_HAS_BEATS_TIMELINE: clap_transport_flags = 2;
201pub const CLAP_TRANSPORT_HAS_SECONDS_TIMELINE: clap_transport_flags = 4;
202pub const CLAP_TRANSPORT_HAS_TIME_SIGNATURE: clap_transport_flags = 8;
203pub const CLAP_TRANSPORT_IS_PLAYING: clap_transport_flags = 16;
204pub const CLAP_TRANSPORT_IS_RECORDING: clap_transport_flags = 32;
205pub const CLAP_TRANSPORT_IS_LOOP_ACTIVE: clap_transport_flags = 64;
206pub const CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL: clap_transport_flags = 128;
207pub type clap_transport_flags = c_uint;
208
209#[repr(C)]
210#[derive(Debug, Copy, Clone, PartialEq)]
211pub struct clap_event_transport {
212 pub header: clap_event_header,
213 pub flags: u32,
214 pub song_pos_beats: clap_beattime,
215 pub song_pos_seconds: clap_sectime,
216 pub tempo: f64,
217 pub tempo_inc: f64,
218 pub loop_start_beats: clap_beattime,
219 pub loop_end_beats: clap_beattime,
220 pub loop_start_seconds: clap_sectime,
221 pub loop_end_seconds: clap_sectime,
222 pub bar_start: clap_beattime,
223 pub bar_number: i32,
224 pub tsig_num: u16,
225 pub tsig_denom: u16,
226}
227
228#[repr(C)]
229#[derive(Debug, Copy, Clone, PartialEq)]
230pub struct clap_event_midi {
231 pub header: clap_event_header,
232 pub port_index: u16,
233 pub data: [u8; 3usize],
234}
235
236#[repr(C)]
237#[derive(Debug, Copy, Clone, PartialEq)]
238pub struct clap_event_midi_sysex {
239 pub header: clap_event_header,
240 pub port_index: u16,
241 pub buffer: *const u8,
242 pub size: u32,
243}
244
245#[repr(C)]
246#[derive(Debug, Copy, Clone, PartialEq)]
247pub struct clap_event_midi2 {
248 pub header: clap_event_header,
249 pub port_index: u16,
250 pub data: [u32; 4usize],
251}
252
253#[repr(C)]
254#[derive(Debug, Copy, Clone)]
255pub struct clap_input_events {
256 pub ctx: *mut c_void,
257 pub size: Option<unsafe extern "C-unwind" fn(list: *const clap_input_events) -> u32>,
258 pub get: Option<
259 unsafe extern "C-unwind" fn(
260 list: *const clap_input_events,
261 index: u32,
262 ) -> *const clap_event_header,
263 >,
264}
265
266#[repr(C)]
267#[derive(Debug, Copy, Clone)]
268pub struct clap_output_events {
269 pub ctx: *mut c_void,
270 pub try_push: Option<
271 unsafe extern "C-unwind" fn(
272 list: *const clap_output_events,
273 event: *const clap_event_header,
274 ) -> bool,
275 >,
276}
277
278#[repr(C)]
279#[derive(Debug, Copy, Clone)]
280pub struct clap_audio_buffer {
281 pub data32: *mut *mut f32,
282 pub data64: *mut *mut f64,
283 pub channel_count: u32,
284 pub latency: u32,
285 pub constant_mask: u64,
286}
287
288pub type clap_process_status = i32;
289pub const CLAP_PROCESS_ERROR: clap_process_status = 0;
290pub const CLAP_PROCESS_CONTINUE: clap_process_status = 1;
291pub const CLAP_PROCESS_CONTINUE_IF_NOT_QUIET: clap_process_status = 2;
292pub const CLAP_PROCESS_TAIL: clap_process_status = 3;
293pub const CLAP_PROCESS_SLEEP: clap_process_status = 4;
294
295#[repr(C)]
296#[derive(Debug, Copy, Clone)]
297pub struct clap_process {
298 pub steady_time: i64,
299 pub frames_count: u32,
300 pub transport: *const clap_event_transport,
301 pub audio_inputs: *const clap_audio_buffer,
302 pub audio_outputs: *mut clap_audio_buffer,
303 pub audio_inputs_count: u32,
304 pub audio_outputs_count: u32,
305 pub in_events: *const clap_input_events,
306 pub out_events: *const clap_output_events,
307}
308
309#[repr(C)]
310#[derive(Debug, Copy, Clone)]
311pub struct clap_plugin_descriptor {
312 pub clap_version: clap_version,
313 pub id: *const c_char,
314 pub name: *const c_char,
315 pub vendor: *const c_char,
316 pub url: *const c_char,
317 pub manual_url: *const c_char,
318 pub support_url: *const c_char,
319 pub version: *const c_char,
320 pub description: *const c_char,
321 pub features: *const *const c_char,
322}
323
324#[repr(C)]
325#[derive(Debug, Copy, Clone)]
326pub struct clap_plugin {
327 pub desc: *const clap_plugin_descriptor,
328 pub plugin_data: *mut c_void,
329 pub init: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
330 pub destroy: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
331 pub activate: Option<
332 unsafe extern "C-unwind" fn(
333 plugin: *const clap_plugin,
334 sample_rate: f64,
335 min_frames_count: u32,
336 max_frames_count: u32,
337 ) -> bool,
338 >,
339 pub deactivate: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
340 pub start_processing: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
341 pub stop_processing: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
342 pub reset: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
343 pub process: Option<
344 unsafe extern "C-unwind" fn(
345 plugin: *const clap_plugin,
346 process: *const clap_process,
347 ) -> clap_process_status,
348 >,
349 pub get_extension: Option<
350 unsafe extern "C-unwind" fn(plugin: *const clap_plugin, id: *const c_char) -> *const c_void,
351 >,
352 pub on_main_thread: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
353}
354
355pub const CLAP_PLUGIN_FACTORY_ID: &CStr = c"clap.plugin-factory";
356
357#[repr(C)]
358#[derive(Debug, Copy, Clone)]
359pub struct clap_plugin_factory {
360 pub get_plugin_count:
361 Option<unsafe extern "C-unwind" fn(factory: *const clap_plugin_factory) -> u32>,
362 pub get_plugin_descriptor: Option<
363 unsafe extern "C-unwind" fn(
364 factory: *const clap_plugin_factory,
365 index: u32,
366 ) -> *const clap_plugin_descriptor,
367 >,
368 pub create_plugin: Option<
369 unsafe extern "C-unwind" fn(
370 factory: *const clap_plugin_factory,
371 host: *const clap_host,
372 plugin_id: *const c_char,
373 ) -> *const clap_plugin,
374 >,
375}
376
377pub type clap_timestamp = u64;
378pub const CLAP_TIMESTAMP_UNKNOWN: clap_timestamp = 0;
379
380#[repr(C)]
381#[derive(Debug, Copy, Clone)]
382pub struct clap_universal_plugin_id {
383 pub abi: *const c_char,
384 pub id: *const c_char,
385}
386
387pub const CLAP_PRESET_DISCOVERY_FACTORY_ID: &CStr = c"clap.preset-discovery-factory/2";
388pub const CLAP_PRESET_DISCOVERY_FACTORY_ID_COMPAT: &CStr = c"clap.preset-discovery-factory/draft-2";
389
390pub const CLAP_PRESET_DISCOVERY_LOCATION_FILE: clap_preset_discovery_location_kind = 0;
391pub const CLAP_PRESET_DISCOVERY_LOCATION_PLUGIN: clap_preset_discovery_location_kind = 1;
392pub type clap_preset_discovery_location_kind = c_uint;
393
394pub const CLAP_PRESET_DISCOVERY_IS_FACTORY_CONTENT: clap_preset_discovery_flags = 1;
395pub const CLAP_PRESET_DISCOVERY_IS_USER_CONTENT: clap_preset_discovery_flags = 2;
396pub const CLAP_PRESET_DISCOVERY_IS_DEMO_CONTENT: clap_preset_discovery_flags = 4;
397pub const CLAP_PRESET_DISCOVERY_IS_FAVORITE: clap_preset_discovery_flags = 8;
398pub type clap_preset_discovery_flags = c_uint;
399
400#[repr(C)]
401#[derive(Debug, Copy, Clone)]
402pub struct clap_preset_discovery_metadata_receiver {
403 pub receiver_data: *mut c_void,
404 pub on_error: Option<
405 unsafe extern "C-unwind" fn(
406 receiver: *const clap_preset_discovery_metadata_receiver,
407 os_error: i32,
408 error_message: *const c_char,
409 ),
410 >,
411 pub begin_preset: Option<
412 unsafe extern "C-unwind" fn(
413 receiver: *const clap_preset_discovery_metadata_receiver,
414 name: *const c_char,
415 load_key: *const c_char,
416 ) -> bool,
417 >,
418 pub add_plugin_id: Option<
419 unsafe extern "C-unwind" fn(
420 receiver: *const clap_preset_discovery_metadata_receiver,
421 plugin_id: *const clap_universal_plugin_id,
422 ),
423 >,
424 pub set_soundpack_id: Option<
425 unsafe extern "C-unwind" fn(
426 receiver: *const clap_preset_discovery_metadata_receiver,
427 soundpack_id: *const c_char,
428 ),
429 >,
430 pub set_flags: Option<
431 unsafe extern "C-unwind" fn(
432 receiver: *const clap_preset_discovery_metadata_receiver,
433 flags: u32,
434 ),
435 >,
436 pub add_creator: Option<
437 unsafe extern "C-unwind" fn(
438 receiver: *const clap_preset_discovery_metadata_receiver,
439 creator: *const c_char,
440 ),
441 >,
442 pub set_description: Option<
443 unsafe extern "C-unwind" fn(
444 receiver: *const clap_preset_discovery_metadata_receiver,
445 description: *const c_char,
446 ),
447 >,
448 pub set_timestamps: Option<
449 unsafe extern "C-unwind" fn(
450 receiver: *const clap_preset_discovery_metadata_receiver,
451 creation_time: clap_timestamp,
452 modification_time: clap_timestamp,
453 ),
454 >,
455 pub add_feature: Option<
456 unsafe extern "C-unwind" fn(
457 receiver: *const clap_preset_discovery_metadata_receiver,
458 feature: *const c_char,
459 ),
460 >,
461 pub add_extra_info: Option<
462 unsafe extern "C-unwind" fn(
463 receiver: *const clap_preset_discovery_metadata_receiver,
464 key: *const c_char,
465 value: *const c_char,
466 ),
467 >,
468}
469
470#[repr(C)]
471#[derive(Debug, Copy, Clone)]
472pub struct clap_preset_discovery_filetype {
473 pub name: *const c_char,
474 pub description: *const c_char,
475 pub file_extension: *const c_char,
476}
477
478#[repr(C)]
479#[derive(Debug, Copy, Clone)]
480pub struct clap_preset_discovery_location {
481 pub flags: u32,
482 pub name: *const c_char,
483 pub kind: u32,
484 pub location: *const c_char,
485}
486
487#[repr(C)]
488#[derive(Debug, Copy, Clone)]
489pub struct clap_preset_discovery_soundpack {
490 pub flags: u32,
491 pub id: *const c_char,
492 pub name: *const c_char,
493 pub description: *const c_char,
494 pub homepage_url: *const c_char,
495 pub vendor: *const c_char,
496 pub image_path: *const c_char,
497 pub release_timestamp: clap_timestamp,
498}
499
500#[repr(C)]
501#[derive(Debug, Copy, Clone)]
502pub struct clap_preset_discovery_provider_descriptor {
503 pub clap_version: clap_version,
504 pub id: *const c_char,
505 pub name: *const c_char,
506 pub vendor: *const c_char,
507}
508
509#[repr(C)]
510#[derive(Debug, Copy, Clone)]
511pub struct clap_preset_discovery_provider {
512 pub desc: *const clap_preset_discovery_provider_descriptor,
513 pub provider_data: *mut c_void,
514 pub init: Option<
515 unsafe extern "C-unwind" fn(provider: *const clap_preset_discovery_provider) -> bool,
516 >,
517 pub destroy:
518 Option<unsafe extern "C-unwind" fn(provider: *const clap_preset_discovery_provider)>,
519 pub get_metadata: Option<
520 unsafe extern "C-unwind" fn(
521 provider: *const clap_preset_discovery_provider,
522 location_kind: u32,
523 location: *const c_char,
524 metadata_receiver: *const clap_preset_discovery_metadata_receiver,
525 ) -> bool,
526 >,
527 pub get_extension: Option<
528 unsafe extern "C-unwind" fn(
529 provider: *const clap_preset_discovery_provider,
530 extension_id: *const c_char,
531 ) -> *const c_void,
532 >,
533}
534
535#[repr(C)]
536#[derive(Debug, Copy, Clone)]
537pub struct clap_preset_discovery_indexer {
538 pub clap_version: clap_version,
539 pub name: *const c_char,
540 pub vendor: *const c_char,
541 pub url: *const c_char,
542 pub version: *const c_char,
543 pub indexer_data: *mut c_void,
544 pub declare_filetype: Option<
545 unsafe extern "C-unwind" fn(
546 indexer: *const clap_preset_discovery_indexer,
547 filetype: *const clap_preset_discovery_filetype,
548 ) -> bool,
549 >,
550 pub declare_location: Option<
551 unsafe extern "C-unwind" fn(
552 indexer: *const clap_preset_discovery_indexer,
553 location: *const clap_preset_discovery_location,
554 ) -> bool,
555 >,
556 pub declare_soundpack: Option<
557 unsafe extern "C-unwind" fn(
558 indexer: *const clap_preset_discovery_indexer,
559 soundpack: *const clap_preset_discovery_soundpack,
560 ) -> bool,
561 >,
562 pub get_extension: Option<
563 unsafe extern "C-unwind" fn(
564 indexer: *const clap_preset_discovery_indexer,
565 extension_id: *const c_char,
566 ) -> *const c_void,
567 >,
568}
569
570#[repr(C)]
571#[derive(Debug, Copy, Clone)]
572pub struct clap_preset_discovery_factory {
573 pub count:
574 Option<unsafe extern "C-unwind" fn(factory: *const clap_preset_discovery_factory) -> u32>,
575 pub get_descriptor: Option<
576 unsafe extern "C-unwind" fn(
577 factory: *const clap_preset_discovery_factory,
578 index: u32,
579 ) -> *const clap_preset_discovery_provider_descriptor,
580 >,
581 pub create: Option<
582 unsafe extern "C-unwind" fn(
583 factory: *const clap_preset_discovery_factory,
584 indexer: *const clap_preset_discovery_indexer,
585 provider_id: *const c_char,
586 ) -> *const clap_preset_discovery_provider,
587 >,
588}
589
590pub const CLAP_EXT_AMBISONIC: &CStr = c"clap.ambisonic/3";
591pub const CLAP_EXT_AMBISONIC_COMPAT: &CStr = c"clap.ambisonic.draft/3";
592pub const CLAP_PORT_AMBISONIC: &CStr = c"ambisonic";
593
594pub const CLAP_AMBISONIC_ORDERING_FUMA: clap_ambisonic_ordering = 0;
595pub const CLAP_AMBISONIC_ORDERING_ACN: clap_ambisonic_ordering = 1;
596pub type clap_ambisonic_ordering = c_uint;
597
598pub const CLAP_AMBISONIC_NORMALIZATION_MAXN: clap_ambisonic_normalization = 0;
599pub const CLAP_AMBISONIC_NORMALIZATION_SN3D: clap_ambisonic_normalization = 1;
600pub const CLAP_AMBISONIC_NORMALIZATION_N3D: clap_ambisonic_normalization = 2;
601pub const CLAP_AMBISONIC_NORMALIZATION_SN2D: clap_ambisonic_normalization = 3;
602pub const CLAP_AMBISONIC_NORMALIZATION_N2D: clap_ambisonic_normalization = 4;
603pub type clap_ambisonic_normalization = c_uint;
604
605#[repr(C)]
606#[derive(Debug, Copy, Clone)]
607pub struct clap_ambisonic_config {
608 pub ordering: u32,
609 pub normalization: u32,
610}
611
612#[repr(C)]
613#[derive(Debug, Copy, Clone)]
614pub struct clap_plugin_ambisonic {
615 pub is_config_supported: Option<
616 unsafe extern "C-unwind" fn(
617 plugin: *const clap_plugin,
618 config: *const clap_ambisonic_config,
619 ) -> bool,
620 >,
621 pub get_config: Option<
622 unsafe extern "C-unwind" fn(
623 plugin: *const clap_plugin,
624 is_input: bool,
625 port_index: u32,
626 config: *mut clap_ambisonic_config,
627 ) -> bool,
628 >,
629}
630
631#[repr(C)]
632#[derive(Debug, Copy, Clone)]
633pub struct clap_host_ambisonic {
634 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
635}
636
637#[doc = " @page Audio Ports Activation\n\n This extension provides a way for the host to activate and de-activate audio ports.\n Deactivating a port provides the following benefits:\n - the plugin knows ahead of time that a given input is not present and can choose\n an optimized computation path,\n - the plugin knows that an output is not consumed by the host, and doesn't need to\n compute it.\n\n Audio ports can only be activated or deactivated when the plugin is deactivated, unless\n can_activate_while_processing() returns true.\n\n Audio buffers must still be provided if the audio port is deactivated.\n In such case, they shall be filled with 0 (or whatever is the neutral value in your context)\n and the constant_mask shall be set.\n\n Audio ports are initially in the active state after creating the plugin instance.\n Audio ports state are not saved in the plugin state, so the host must restore the\n audio ports state after creating the plugin instance.\n\n Audio ports state is invalidated by clap_plugin_audio_ports_config.select() and\n clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_LIST)."]
638pub const CLAP_EXT_AUDIO_PORTS_ACTIVATION: &CStr = c"clap.audio-ports-activation/2";
639pub const CLAP_EXT_AUDIO_PORTS_ACTIVATION_COMPAT: &CStr = c"clap.audio-ports-activation/draft-2";
640
641#[repr(C)]
642#[derive(Debug, Copy, Clone)]
643pub struct clap_plugin_audio_ports_activation {
644 pub can_activate_while_processing:
645 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
646 pub set_active: Option<
647 unsafe extern "C-unwind" fn(
648 plugin: *const clap_plugin,
649 is_input: bool,
650 port_index: u32,
651 is_active: bool,
652 sample_size: u32,
653 ) -> bool,
654 >,
655}
656
657pub const CLAP_NAME_SIZE: c_uint = 256;
658pub const CLAP_PATH_SIZE: c_uint = 1024;
659
660#[doc = " @page Audio Ports\n\n This extension provides a way for the plugin to describe its current audio ports.\n\n If the plugin does not implement this extension, it won't have audio ports.\n\n 32 bits support is required for both host and plugins. 64 bits audio is optional.\n\n The plugin is only allowed to change its ports configuration while it is deactivated."]
661pub const CLAP_EXT_AUDIO_PORTS: &CStr = c"clap.audio-ports";
662pub const CLAP_PORT_MONO: &CStr = c"mono";
663pub const CLAP_PORT_STEREO: &CStr = c"stereo";
664pub const CLAP_AUDIO_PORT_IS_MAIN: c_uint = 1;
665pub const CLAP_AUDIO_PORT_SUPPORTS_64BITS: c_uint = 2;
666pub const CLAP_AUDIO_PORT_PREFERS_64BITS: c_uint = 4;
667pub const CLAP_AUDIO_PORT_REQUIRES_COMMON_SAMPLE_SIZE: c_uint = 8;
668
669#[repr(C)]
670#[derive(Debug, Copy, Clone)]
671pub struct clap_audio_port_info {
672 pub id: clap_id,
673 pub name: [c_char; 256usize],
674 pub flags: u32,
675 pub channel_count: u32,
676 pub port_type: *const c_char,
677 pub in_place_pair: clap_id,
678}
679
680#[repr(C)]
681#[derive(Debug, Copy, Clone)]
682pub struct clap_plugin_audio_ports {
683 pub count:
684 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, is_input: bool) -> u32>,
685 pub get: Option<
686 unsafe extern "C-unwind" fn(
687 plugin: *const clap_plugin,
688 index: u32,
689 is_input: bool,
690 info: *mut clap_audio_port_info,
691 ) -> bool,
692 >,
693}
694
695pub const CLAP_AUDIO_PORTS_RESCAN_NAMES: c_uint = 1;
696pub const CLAP_AUDIO_PORTS_RESCAN_FLAGS: c_uint = 2;
697pub const CLAP_AUDIO_PORTS_RESCAN_CHANNEL_COUNT: c_uint = 4;
698pub const CLAP_AUDIO_PORTS_RESCAN_PORT_TYPE: c_uint = 8;
699pub const CLAP_AUDIO_PORTS_RESCAN_IN_PLACE_PAIR: c_uint = 16;
700pub const CLAP_AUDIO_PORTS_RESCAN_LIST: c_uint = 32;
701
702#[repr(C)]
703#[derive(Debug, Copy, Clone)]
704pub struct clap_host_audio_ports {
705 pub is_rescan_flag_supported:
706 Option<unsafe extern "C-unwind" fn(host: *const clap_host, flag: u32) -> bool>,
707 pub rescan: Option<unsafe extern "C-unwind" fn(host: *const clap_host, flags: u32)>,
708}
709
710#[doc = " @page Audio Ports Config\n\n This extension let the plugin provide port configurations presets.\n For example mono, stereo, surround, ambisonic, ...\n\n After the plugin initialization, the host may scan the list of configurations and eventually\n select one that fits the plugin context. The host can only select a configuration if the plugin\n is deactivated.\n\n A configuration is a very simple description of the audio ports:\n - it describes the main input and output ports\n - it has a name that can be displayed to the user\n\n The idea behind the configurations, is to let the user choose one via a menu.\n\n Plugins with very complex configuration possibilities should let the user configure the ports\n from the plugin GUI, and call @ref clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_ALL).\n\n To inquire the exact bus layout, the plugin implements the clap_plugin_audio_ports_config_info_t\n extension where all busses can be retrieved in the same way as in the audio-port extension."]
711pub const CLAP_EXT_AUDIO_PORTS_CONFIG: &CStr = c"clap.audio-ports-config";
712pub const CLAP_EXT_AUDIO_PORTS_CONFIG_INFO: &CStr = c"clap.audio-ports-config-info/1";
713pub const CLAP_EXT_AUDIO_PORTS_CONFIG_INFO_COMPAT: &CStr = c"clap.audio-ports-config-info/draft-0";
714
715#[repr(C)]
716#[derive(Debug, Copy, Clone)]
717pub struct clap_audio_ports_config {
718 pub id: clap_id,
719 pub name: [c_char; 256usize],
720 pub input_port_count: u32,
721 pub output_port_count: u32,
722 pub has_main_input: bool,
723 pub main_input_channel_count: u32,
724 pub main_input_port_type: *const c_char,
725 pub has_main_output: bool,
726 pub main_output_channel_count: u32,
727 pub main_output_port_type: *const c_char,
728}
729
730#[repr(C)]
731#[derive(Debug, Copy, Clone)]
732pub struct clap_plugin_audio_ports_config {
733 pub count: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> u32>,
734 pub get: Option<
735 unsafe extern "C-unwind" fn(
736 plugin: *const clap_plugin,
737 index: u32,
738 config: *mut clap_audio_ports_config,
739 ) -> bool,
740 >,
741 pub select:
742 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, config_id: clap_id) -> bool>,
743}
744
745#[repr(C)]
746#[derive(Debug, Copy, Clone)]
747pub struct clap_plugin_audio_ports_config_info {
748 pub current_config: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> clap_id>,
749 pub get: Option<
750 unsafe extern "C-unwind" fn(
751 plugin: *const clap_plugin,
752 config_id: clap_id,
753 port_index: u32,
754 is_input: bool,
755 info: *mut clap_audio_port_info,
756 ) -> bool,
757 >,
758}
759
760#[repr(C)]
761#[derive(Debug, Copy, Clone)]
762pub struct clap_host_audio_ports_config {
763 pub rescan: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
764}
765
766pub const CLAP_EXT_CONFIGURABLE_AUDIO_PORTS: &CStr = c"clap.configurable-audio-ports/1";
767pub const CLAP_EXT_CONFIGURABLE_AUDIO_PORTS_COMPAT: &CStr = c"clap.configurable-audio-ports.draft1";
768
769#[repr(C)]
770#[derive(Debug, Copy, Clone)]
771pub struct clap_audio_port_configuration_request {
772 pub is_input: bool,
773 pub port_index: u32,
774 pub channel_count: u32,
775 pub port_type: *const c_char,
776 pub port_details: *const c_void,
777}
778
779#[repr(C)]
780#[derive(Debug, Copy, Clone)]
781pub struct clap_plugin_configurable_audio_ports {
782 pub can_apply_configuration: Option<
783 unsafe extern "C-unwind" fn(
784 plugin: *const clap_plugin,
785 requests: *const clap_audio_port_configuration_request,
786 request_count: u32,
787 ) -> bool,
788 >,
789 pub apply_configuration: Option<
790 unsafe extern "C-unwind" fn(
791 plugin: *const clap_plugin,
792 requests: *const clap_audio_port_configuration_request,
793 request_count: u32,
794 ) -> bool,
795 >,
796}
797
798pub const CLAP_EXT_CONTEXT_MENU: &CStr = c"clap.context-menu/1";
799pub const CLAP_EXT_CONTEXT_MENU_COMPAT: &CStr = c"clap.context-menu.draft/0";
800pub const CLAP_CONTEXT_MENU_TARGET_KIND_GLOBAL: c_uint = 0;
801pub const CLAP_CONTEXT_MENU_TARGET_KIND_PARAM: c_uint = 1;
802
803#[repr(C)]
804#[derive(Debug, Copy, Clone)]
805pub struct clap_context_menu_target {
806 pub kind: u32,
807 pub id: clap_id,
808}
809
810pub const CLAP_CONTEXT_MENU_ITEM_ENTRY: c_uint = 0;
811pub const CLAP_CONTEXT_MENU_ITEM_CHECK_ENTRY: c_uint = 1;
812pub const CLAP_CONTEXT_MENU_ITEM_SEPARATOR: c_uint = 2;
813pub const CLAP_CONTEXT_MENU_ITEM_BEGIN_SUBMENU: c_uint = 3;
814pub const CLAP_CONTEXT_MENU_ITEM_END_SUBMENU: c_uint = 4;
815pub const CLAP_CONTEXT_MENU_ITEM_TITLE: c_uint = 5;
816pub type clap_context_menu_item_kind = u32;
817
818#[repr(C)]
819#[derive(Debug, Copy, Clone)]
820pub struct clap_context_menu_entry {
821 pub label: *const c_char,
822 pub is_enabled: bool,
823 pub action_id: clap_id,
824}
825
826#[repr(C)]
827#[derive(Debug, Copy, Clone)]
828pub struct clap_context_menu_check_entry {
829 pub label: *const c_char,
830 pub is_enabled: bool,
831 pub is_checked: bool,
832 pub action_id: clap_id,
833}
834
835#[repr(C)]
836#[derive(Debug, Copy, Clone)]
837pub struct clap_context_menu_item_title {
838 pub title: *const c_char,
839 pub is_enabled: bool,
840}
841
842#[repr(C)]
843#[derive(Debug, Copy, Clone)]
844pub struct clap_context_menu_submenu {
845 pub label: *const c_char,
846 pub is_enabled: bool,
847}
848
849#[repr(C)]
850#[derive(Debug, Copy, Clone)]
851pub struct clap_context_menu_builder {
852 pub ctx: *mut c_void,
853 pub add_item: Option<
854 unsafe extern "C-unwind" fn(
855 builder: *const clap_context_menu_builder,
856 item_kind: clap_context_menu_item_kind,
857 item_data: *const c_void,
858 ) -> bool,
859 >,
860 pub supports: Option<
861 unsafe extern "C-unwind" fn(
862 builder: *const clap_context_menu_builder,
863 item_kind: clap_context_menu_item_kind,
864 ) -> bool,
865 >,
866}
867#[repr(C)]
868#[derive(Debug, Copy, Clone)]
869pub struct clap_plugin_context_menu {
870 pub populate: Option<
871 unsafe extern "C-unwind" fn(
872 plugin: *const clap_plugin,
873 target: *const clap_context_menu_target,
874 builder: *const clap_context_menu_builder,
875 ) -> bool,
876 >,
877 pub perform: Option<
878 unsafe extern "C-unwind" fn(
879 plugin: *const clap_plugin,
880 target: *const clap_context_menu_target,
881 action_id: clap_id,
882 ) -> bool,
883 >,
884}
885
886#[repr(C)]
887#[derive(Debug, Copy, Clone)]
888pub struct clap_host_context_menu {
889 pub populate: Option<
890 unsafe extern "C-unwind" fn(
891 host: *const clap_host,
892 target: *const clap_context_menu_target,
893 builder: *const clap_context_menu_builder,
894 ) -> bool,
895 >,
896 pub perform: Option<
897 unsafe extern "C-unwind" fn(
898 host: *const clap_host,
899 target: *const clap_context_menu_target,
900 action_id: clap_id,
901 ) -> bool,
902 >,
903 pub can_popup: Option<unsafe extern "C-unwind" fn(host: *const clap_host) -> bool>,
904 pub popup: Option<
905 unsafe extern "C-unwind" fn(
906 host: *const clap_host,
907 target: *const clap_context_menu_target,
908 screen_index: i32,
909 x: i32,
910 y: i32,
911 ) -> bool,
912 >,
913}
914
915pub const CLAP_EXT_EVENT_REGISTRY: &CStr = c"clap.event-registry";
916
917#[repr(C)]
918#[derive(Debug, Copy, Clone)]
919pub struct clap_host_event_registry {
920 pub query: Option<
921 unsafe extern "C-unwind" fn(
922 host: *const clap_host,
923 space_name: *const c_char,
924 space_id: *mut u16,
925 ) -> bool,
926 >,
927}
928
929#[doc = " @page GUI\n\n This extension defines how the plugin will present its GUI.\n\n There are two approaches:\n 1. the plugin creates a window and embeds it into the host's window\n 2. the plugin creates a floating window\n\n Embedding the window gives more control to the host, and feels more integrated.\n Floating window are sometimes the only option due to technical limitations.\n\n The Embedding protocol is by far the most common, supported by all hosts to date,\n and a plugin author should support at least that case.\n\n Showing the GUI works as follow:\n 1. clap_plugin_gui->is_api_supported(), check what can work\n 2. clap_plugin_gui->create(), allocates gui resources\n 3. if the plugin window is floating\n 4. -> clap_plugin_gui->set_transient()\n 5. -> clap_plugin_gui->suggest_title()\n 6. else\n 7. -> clap_plugin_gui->set_scale()\n 8. -> clap_plugin_gui->can_resize()\n 9. -> if resizable and has known size from previous session, clap_plugin_gui->set_size()\n 10. -> else clap_plugin_gui->get_size(), gets initial size\n 11. -> clap_plugin_gui->set_parent()\n 12. clap_plugin_gui->show()\n 13. clap_plugin_gui->hide()/show() ...\n 14. clap_plugin_gui->destroy() when done with the gui\n\n Resizing the window (initiated by the plugin, if embedded):\n 1. Plugins calls clap_host_gui->request_resize()\n 2. If the host returns true the new size is accepted,\n the host doesn't have to call clap_plugin_gui->set_size().\n If the host returns false, the new size is rejected.\n\n Resizing the window (drag, if embedded)):\n 1. Only possible if clap_plugin_gui->can_resize() returns true\n 2. Mouse drag -> new_size\n 3. clap_plugin_gui->adjust_size(new_size) -> working_size\n 4. clap_plugin_gui->set_size(working_size)"]
930pub const CLAP_EXT_GUI: &CStr = c"clap.gui";
931pub const CLAP_WINDOW_API_WIN32: &CStr = c"win32";
932pub const CLAP_WINDOW_API_COCOA: &CStr = c"cocoa";
933pub const CLAP_WINDOW_API_X11: &CStr = c"x11";
934pub const CLAP_WINDOW_API_WAYLAND: &CStr = c"wayland";
935
936pub type clap_hwnd = *mut c_void;
937pub type clap_nsview = *mut c_void;
938pub type clap_xwnd = c_ulong;
939
940#[repr(C)]
941#[derive(Copy, Clone)]
942pub struct clap_window {
943 pub api: *const c_char,
944 pub clap_window__: clap_window__,
945}
946
947#[repr(C)]
948#[derive(Copy, Clone)]
949pub union clap_window__ {
950 pub cocoa: clap_nsview,
951 pub x11: clap_xwnd,
952 pub win32: clap_hwnd,
953 pub ptr: *mut c_void,
954}
955
956#[repr(C)]
957#[derive(Debug, Copy, Clone)]
958pub struct clap_gui_resize_hints {
959 pub can_resize_horizontally: bool,
960 pub can_resize_vertically: bool,
961 pub preserve_aspect_ratio: bool,
962 pub aspect_ratio_width: u32,
963 pub aspect_ratio_height: u32,
964}
965
966#[repr(C)]
967#[derive(Debug, Copy, Clone)]
968pub struct clap_plugin_gui {
969 pub is_api_supported: Option<
970 unsafe extern "C-unwind" fn(
971 plugin: *const clap_plugin,
972 api: *const c_char,
973 is_floating: bool,
974 ) -> bool,
975 >,
976 pub get_preferred_api: Option<
977 unsafe extern "C-unwind" fn(
978 plugin: *const clap_plugin,
979 api: *mut *const c_char,
980 is_floating: *mut bool,
981 ) -> bool,
982 >,
983 pub create: Option<
984 unsafe extern "C-unwind" fn(
985 plugin: *const clap_plugin,
986 api: *const c_char,
987 is_floating: bool,
988 ) -> bool,
989 >,
990 pub destroy: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
991 pub set_scale:
992 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, scale: f64) -> bool>,
993 pub get_size: Option<
994 unsafe extern "C-unwind" fn(
995 plugin: *const clap_plugin,
996 width: *mut u32,
997 height: *mut u32,
998 ) -> bool,
999 >,
1000 pub can_resize: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
1001 pub get_resize_hints: Option<
1002 unsafe extern "C-unwind" fn(
1003 plugin: *const clap_plugin,
1004 hints: *mut clap_gui_resize_hints,
1005 ) -> bool,
1006 >,
1007 pub adjust_size: Option<
1008 unsafe extern "C-unwind" fn(
1009 plugin: *const clap_plugin,
1010 width: *mut u32,
1011 height: *mut u32,
1012 ) -> bool,
1013 >,
1014 pub set_size: Option<
1015 unsafe extern "C-unwind" fn(plugin: *const clap_plugin, width: u32, height: u32) -> bool,
1016 >,
1017 pub set_parent: Option<
1018 unsafe extern "C-unwind" fn(plugin: *const clap_plugin, window: *const clap_window) -> bool,
1019 >,
1020 pub set_transient: Option<
1021 unsafe extern "C-unwind" fn(plugin: *const clap_plugin, window: *const clap_window) -> bool,
1022 >,
1023 pub suggest_title:
1024 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, title: *const c_char)>,
1025 pub show: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
1026 pub hide: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
1027}
1028
1029#[repr(C)]
1030#[derive(Debug, Copy, Clone)]
1031pub struct clap_host_gui {
1032 pub resize_hints_changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1033 pub request_resize: Option<
1034 unsafe extern "C-unwind" fn(host: *const clap_host, width: u32, height: u32) -> bool,
1035 >,
1036 pub request_show: Option<unsafe extern "C-unwind" fn(host: *const clap_host) -> bool>,
1037 pub request_hide: Option<unsafe extern "C-unwind" fn(host: *const clap_host) -> bool>,
1038 pub closed: Option<unsafe extern "C-unwind" fn(host: *const clap_host, was_destroyed: bool)>,
1039}
1040
1041pub const CLAP_EXT_LATENCY: &CStr = c"clap.latency";
1042
1043#[repr(C)]
1044#[derive(Debug, Copy, Clone)]
1045pub struct clap_plugin_latency {
1046 pub get: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> u32>,
1047}
1048
1049#[repr(C)]
1050#[derive(Debug, Copy, Clone)]
1051pub struct clap_host_latency {
1052 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1053}
1054
1055pub const CLAP_EXT_LOG: &CStr = c"clap.log";
1056pub const CLAP_LOG_DEBUG: clap_log_severity = 0;
1057pub const CLAP_LOG_INFO: clap_log_severity = 1;
1058pub const CLAP_LOG_WARNING: clap_log_severity = 2;
1059pub const CLAP_LOG_ERROR: clap_log_severity = 3;
1060pub const CLAP_LOG_FATAL: clap_log_severity = 4;
1061pub const CLAP_LOG_HOST_MISBEHAVING: clap_log_severity = 5;
1062pub const CLAP_LOG_PLUGIN_MISBEHAVING: clap_log_severity = 6;
1063pub type clap_log_severity = i32;
1064
1065#[repr(C)]
1066#[derive(Debug, Copy, Clone)]
1067pub struct clap_host_log {
1068 pub log: Option<
1069 unsafe extern "C-unwind" fn(
1070 host: *const clap_host,
1071 severity: clap_log_severity,
1072 msg: *const c_char,
1073 ),
1074 >,
1075}
1076
1077pub const CLAP_EXT_NOTE_NAME: &CStr = c"clap.note-name";
1078#[repr(C)]
1079#[derive(Debug, Copy, Clone)]
1080pub struct clap_note_name {
1081 pub name: [c_char; 256usize],
1082 pub port: i16,
1083 pub key: i16,
1084 pub channel: i16,
1085}
1086
1087#[repr(C)]
1088#[derive(Debug, Copy, Clone)]
1089pub struct clap_plugin_note_name {
1090 pub count: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> u32>,
1091 pub get: Option<
1092 unsafe extern "C-unwind" fn(
1093 plugin: *const clap_plugin,
1094 index: u32,
1095 note_name: *mut clap_note_name,
1096 ) -> bool,
1097 >,
1098}
1099
1100#[repr(C)]
1101#[derive(Debug, Copy, Clone)]
1102pub struct clap_host_note_name {
1103 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1104}
1105
1106#[doc = " @page Note Ports\n\n This extension provides a way for the plugin to describe its current note ports.\n If the plugin does not implement this extension, it won't have note input or output.\n The plugin is only allowed to change its note ports configuration while it is deactivated."]
1107pub const CLAP_EXT_NOTE_PORTS: &CStr = c"clap.note-ports";
1108
1109pub const CLAP_NOTE_DIALECT_CLAP: clap_note_dialect = 1;
1110pub const CLAP_NOTE_DIALECT_MIDI: clap_note_dialect = 2;
1111pub const CLAP_NOTE_DIALECT_MIDI_MPE: clap_note_dialect = 4;
1112pub const CLAP_NOTE_DIALECT_MIDI2: clap_note_dialect = 8;
1113pub type clap_note_dialect = c_uint;
1114
1115#[repr(C)]
1116#[derive(Debug, Copy, Clone)]
1117pub struct clap_note_port_info {
1118 pub id: clap_id,
1119 pub supported_dialects: u32,
1120 pub preferred_dialect: u32,
1121 pub name: [c_char; 256usize],
1122}
1123
1124#[repr(C)]
1125#[derive(Debug, Copy, Clone)]
1126pub struct clap_plugin_note_ports {
1127 pub count:
1128 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, is_input: bool) -> u32>,
1129 pub get: Option<
1130 unsafe extern "C-unwind" fn(
1131 plugin: *const clap_plugin,
1132 index: u32,
1133 is_input: bool,
1134 info: *mut clap_note_port_info,
1135 ) -> bool,
1136 >,
1137}
1138
1139pub const CLAP_NOTE_PORTS_RESCAN_ALL: c_uint = 1;
1140pub const CLAP_NOTE_PORTS_RESCAN_NAMES: c_uint = 2;
1141
1142#[repr(C)]
1143#[derive(Debug, Copy, Clone)]
1144pub struct clap_host_note_ports {
1145 pub supported_dialects: Option<unsafe extern "C-unwind" fn(host: *const clap_host) -> u32>,
1146 pub rescan: Option<unsafe extern "C-unwind" fn(host: *const clap_host, flags: u32)>,
1147}
1148
1149#[doc = " @page Parameters\n @brief parameters management\n\n Main idea:\n\n The host sees the plugin as an atomic entity; and acts as a controller on top of its parameters.\n The plugin is responsible for keeping its audio processor and its GUI in sync.\n\n The host can at any time read parameters' value on the [main-thread] using\n @ref clap_plugin_params.get_value().\n\n There are two options to communicate parameter value changes, and they are not concurrent.\n - send automation points during clap_plugin.process()\n - send automation points during clap_plugin_params.flush(), for parameter changes\n without processing audio\n\n When the plugin changes a parameter value, it must inform the host.\n It will send @ref CLAP_EVENT_PARAM_VALUE event during process() or flush().\n If the user is adjusting the value, don't forget to mark the beginning and end\n of the gesture by sending CLAP_EVENT_PARAM_GESTURE_BEGIN and CLAP_EVENT_PARAM_GESTURE_END\n events.\n\n @note MIDI CCs are tricky because you may not know when the parameter adjustment ends.\n Also if the host records incoming MIDI CC and parameter change automation at the same time,\n there will be a conflict at playback: MIDI CC vs Automation.\n The parameter automation will always target the same parameter because the param_id is stable.\n The MIDI CC may have a different mapping in the future and may result in a different playback.\n\n When a MIDI CC changes a parameter's value, set the flag CLAP_EVENT_DONT_RECORD in\n clap_event_param.header.flags. That way the host may record the MIDI CC automation, but not the\n parameter change and there won't be conflict at playback.\n\n Scenarios:\n\n I. Loading a preset\n - load the preset in a temporary state\n - call @ref clap_host_params.rescan() if anything changed\n - call @ref clap_host_latency.changed() if latency changed\n - invalidate any other info that may be cached by the host\n - if the plugin is activated and the preset will introduce breaking changes\n (latency, audio ports, new parameters, ...) be sure to wait for the host\n to deactivate the plugin to apply those changes.\n If there are no breaking changes, the plugin can apply them them right away.\n The plugin is responsible for updating both its audio processor and its gui.\n\n II. Turning a knob on the DAW interface\n - the host will send an automation event to the plugin via a process() or flush()\n\n III. Turning a knob on the Plugin interface\n - the plugin is responsible for sending the parameter value to its audio processor\n - call clap_host_params->request_flush() or clap_host->request_process().\n - when the host calls either clap_plugin->process() or clap_plugin_params->flush(),\n send an automation event and don't forget to wrap the parameter change(s)\n with CLAP_EVENT_PARAM_GESTURE_BEGIN and CLAP_EVENT_PARAM_GESTURE_END to define the\n beginning and end of the gesture.\n\n IV. Turning a knob via automation\n - host sends an automation point during clap_plugin->process() or clap_plugin_params->flush().\n - the plugin is responsible for updating its GUI\n\n V. Turning a knob via plugin's internal MIDI mapping\n - the plugin sends a CLAP_EVENT_PARAM_VALUE output event, set should_record to false\n - the plugin is responsible for updating its GUI\n\n VI. Adding or removing parameters\n - if the plugin is activated call clap_host->restart()\n - once the plugin isn't active:\n - apply the new state\n - if a parameter is gone or is created with an id that may have been used before,\n call clap_host_params.clear(host, param_id, CLAP_PARAM_CLEAR_ALL)\n - call clap_host_params->rescan(CLAP_PARAM_RESCAN_ALL)\n\n CLAP allows the plugin to change the parameter range, yet the plugin developer\n should be aware that doing so isn't without risk, especially if you made the\n promise to never change the sound. If you want to be 100% certain that the\n sound will not change with all host, then simply never change the range.\n\n There are two approaches to automations, either you automate the plain value,\n or you automate the knob position. The first option will be robust to a range\n increase, while the second won't be.\n\n If the host goes with the second approach (automating the knob position), it means\n that the plugin is hosted in a relaxed environment regarding sound changes (they are\n accepted, and not a concern as long as they are reasonable). Though, stepped parameters\n should be stored as plain value in the document.\n\n If the host goes with the first approach, there will still be situation where the\n sound may inevitably change. For example, if the plugin increase the range, there\n is an automation playing at the max value and on top of that an LFO is applied.\n See the following curve:\n .\n . .\n ..... . .\n before: . . and after: . .\n\n Persisting parameter values:\n\n Plugins are responsible for persisting their parameter's values between\n sessions by implementing the state extension. Otherwise parameter value will\n not be recalled when reloading a project. Hosts should _not_ try to save and\n restore parameter values for plugins that don't implement the state\n extension.\n\n Advice for the host:\n\n - store plain values in the document (automation)\n - store modulation amount in plain value delta, not in percentage\n - when you apply a CC mapping, remember the min/max plain values so you can adjust\n - do not implement a parameter saving fall back for plugins that don't\n implement the state extension\n\n Advice for the plugin:\n\n - think carefully about your parameter range when designing your DSP\n - avoid shrinking parameter ranges, they are very likely to change the sound\n - consider changing the parameter range as a tradeoff: what you improve vs what you break\n - make sure to implement saving and loading the parameter values using the\n state extension\n - if you plan to use adapters for other plugin formats, then you need to pay extra\n attention to the adapter requirements"]
1150pub const CLAP_EXT_PARAMS: &CStr = c"clap.params";
1151
1152pub const CLAP_PARAM_IS_STEPPED: clap_param_info_flags = 1;
1153pub const CLAP_PARAM_IS_PERIODIC: clap_param_info_flags = 2;
1154pub const CLAP_PARAM_IS_HIDDEN: clap_param_info_flags = 4;
1155pub const CLAP_PARAM_IS_READONLY: clap_param_info_flags = 8;
1156pub const CLAP_PARAM_IS_BYPASS: clap_param_info_flags = 16;
1157pub const CLAP_PARAM_IS_AUTOMATABLE: clap_param_info_flags = 32;
1158pub const CLAP_PARAM_IS_AUTOMATABLE_PER_NOTE_ID: clap_param_info_flags = 64;
1159pub const CLAP_PARAM_IS_AUTOMATABLE_PER_KEY: clap_param_info_flags = 128;
1160pub const CLAP_PARAM_IS_AUTOMATABLE_PER_CHANNEL: clap_param_info_flags = 256;
1161pub const CLAP_PARAM_IS_AUTOMATABLE_PER_PORT: clap_param_info_flags = 512;
1162pub const CLAP_PARAM_IS_MODULATABLE: clap_param_info_flags = 1024;
1163pub const CLAP_PARAM_IS_MODULATABLE_PER_NOTE_ID: clap_param_info_flags = 2048;
1164pub const CLAP_PARAM_IS_MODULATABLE_PER_KEY: clap_param_info_flags = 4096;
1165pub const CLAP_PARAM_IS_MODULATABLE_PER_CHANNEL: clap_param_info_flags = 8192;
1166pub const CLAP_PARAM_IS_MODULATABLE_PER_PORT: clap_param_info_flags = 16384;
1167pub const CLAP_PARAM_REQUIRES_PROCESS: clap_param_info_flags = 32768;
1168pub const CLAP_PARAM_IS_ENUM: clap_param_info_flags = 65536;
1169pub type clap_param_info_flags = u32;
1170
1171#[repr(C)]
1172#[derive(Debug, Copy, Clone)]
1173pub struct clap_param_info {
1174 pub id: clap_id,
1175 pub flags: clap_param_info_flags,
1176 pub cookie: *mut c_void,
1177 pub name: [c_char; 256usize],
1178 pub module: [c_char; 1024usize],
1179 pub min_value: f64,
1180 pub max_value: f64,
1181 pub default_value: f64,
1182}
1183
1184#[repr(C)]
1185#[derive(Debug, Copy, Clone)]
1186pub struct clap_plugin_params {
1187 pub count: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> u32>,
1188 pub get_info: Option<
1189 unsafe extern "C-unwind" fn(
1190 plugin: *const clap_plugin,
1191 param_index: u32,
1192 param_info: *mut clap_param_info,
1193 ) -> bool,
1194 >,
1195 pub get_value: Option<
1196 unsafe extern "C-unwind" fn(
1197 plugin: *const clap_plugin,
1198 param_id: clap_id,
1199 out_value: *mut f64,
1200 ) -> bool,
1201 >,
1202 pub value_to_text: Option<
1203 unsafe extern "C-unwind" fn(
1204 plugin: *const clap_plugin,
1205 param_id: clap_id,
1206 value: f64,
1207 out_buffer: *mut c_char,
1208 out_buffer_capacity: u32,
1209 ) -> bool,
1210 >,
1211 pub text_to_value: Option<
1212 unsafe extern "C-unwind" fn(
1213 plugin: *const clap_plugin,
1214 param_id: clap_id,
1215 param_value_text: *const c_char,
1216 out_value: *mut f64,
1217 ) -> bool,
1218 >,
1219 pub flush: Option<
1220 unsafe extern "C-unwind" fn(
1221 plugin: *const clap_plugin,
1222 in_: *const clap_input_events,
1223 out: *const clap_output_events,
1224 ),
1225 >,
1226}
1227
1228pub const CLAP_PARAM_RESCAN_VALUES: clap_param_rescan_flags = 1;
1229pub const CLAP_PARAM_RESCAN_TEXT: clap_param_rescan_flags = 2;
1230pub const CLAP_PARAM_RESCAN_INFO: clap_param_rescan_flags = 4;
1231pub const CLAP_PARAM_RESCAN_ALL: clap_param_rescan_flags = 8;
1232pub type clap_param_rescan_flags = u32;
1233
1234pub const CLAP_PARAM_CLEAR_ALL: clap_param_clear_flags = 1;
1235pub const CLAP_PARAM_CLEAR_AUTOMATIONS: clap_param_clear_flags = 2;
1236pub const CLAP_PARAM_CLEAR_MODULATIONS: clap_param_clear_flags = 4;
1237pub type clap_param_clear_flags = u32;
1238
1239#[repr(C)]
1240#[derive(Debug, Copy, Clone)]
1241pub struct clap_host_params {
1242 pub rescan:
1243 Option<unsafe extern "C-unwind" fn(host: *const clap_host, flags: clap_param_rescan_flags)>,
1244 pub clear: Option<
1245 unsafe extern "C-unwind" fn(
1246 host: *const clap_host,
1247 param_id: clap_id,
1248 flags: clap_param_clear_flags,
1249 ),
1250 >,
1251 pub request_flush: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1252}
1253
1254#[repr(C)]
1255#[derive(Debug, Copy, Clone)]
1256pub struct clap_color {
1257 pub alpha: u8,
1258 pub red: u8,
1259 pub green: u8,
1260 pub blue: u8,
1261}
1262
1263pub const CLAP_COLOR_TRANSPARENT: clap_color = clap_color {
1264 alpha: 0,
1265 red: 0,
1266 green: 0,
1267 blue: 0,
1268};
1269
1270pub const CLAP_EXT_PARAM_INDICATION: &CStr = c"clap.param-indication/4";
1271pub const CLAP_EXT_PARAM_INDICATION_COMPAT: &CStr = c"clap.param-indication.draft/4";
1272
1273pub const CLAP_PARAM_INDICATION_AUTOMATION_NONE: c_uint = 0;
1274pub const CLAP_PARAM_INDICATION_AUTOMATION_PRESENT: c_uint = 1;
1275pub const CLAP_PARAM_INDICATION_AUTOMATION_PLAYING: c_uint = 2;
1276pub const CLAP_PARAM_INDICATION_AUTOMATION_RECORDING: c_uint = 3;
1277pub const CLAP_PARAM_INDICATION_AUTOMATION_OVERRIDING: c_uint = 4;
1278
1279#[repr(C)]
1280#[derive(Debug, Copy, Clone)]
1281pub struct clap_plugin_param_indication {
1282 pub set_mapping: Option<
1283 unsafe extern "C-unwind" fn(
1284 plugin: *const clap_plugin,
1285 param_id: clap_id,
1286 has_mapping: bool,
1287 color: *const clap_color,
1288 label: *const c_char,
1289 description: *const c_char,
1290 ),
1291 >,
1292 pub set_automation: Option<
1293 unsafe extern "C-unwind" fn(
1294 plugin: *const clap_plugin,
1295 param_id: clap_id,
1296 automation_state: u32,
1297 color: *const clap_color,
1298 ),
1299 >,
1300}
1301
1302pub const CLAP_EXT_POSIX_FD_SUPPORT: &CStr = c"clap.posix-fd-support";
1303
1304pub const CLAP_POSIX_FD_READ: clap_posix_fd_flags = 1;
1305pub const CLAP_POSIX_FD_WRITE: clap_posix_fd_flags = 2;
1306pub const CLAP_POSIX_FD_ERROR: clap_posix_fd_flags = 4;
1307pub type clap_posix_fd_flags = u32;
1308
1309#[repr(C)]
1310#[derive(Debug, Copy, Clone)]
1311pub struct clap_plugin_posix_fd_support {
1312 pub on_fd: Option<
1313 unsafe extern "C-unwind" fn(
1314 plugin: *const clap_plugin,
1315 fd: c_int,
1316 flags: clap_posix_fd_flags,
1317 ),
1318 >,
1319}
1320
1321#[repr(C)]
1322#[derive(Debug, Copy, Clone)]
1323pub struct clap_host_posix_fd_support {
1324 pub register_fd: Option<
1325 unsafe extern "C-unwind" fn(
1326 host: *const clap_host,
1327 fd: c_int,
1328 flags: clap_posix_fd_flags,
1329 ) -> bool,
1330 >,
1331 pub modify_fd: Option<
1332 unsafe extern "C-unwind" fn(
1333 host: *const clap_host,
1334 fd: c_int,
1335 flags: clap_posix_fd_flags,
1336 ) -> bool,
1337 >,
1338 pub unregister_fd:
1339 Option<unsafe extern "C-unwind" fn(host: *const clap_host, fd: c_int) -> bool>,
1340}
1341
1342pub const CLAP_EXT_PRESET_LOAD: &CStr = c"clap.preset-load/2";
1343pub const CLAP_EXT_PRESET_LOAD_COMPAT: &CStr = c"clap.preset-load.draft/2";
1344
1345#[repr(C)]
1346#[derive(Debug, Copy, Clone)]
1347pub struct clap_plugin_preset_load {
1348 pub from_location: Option<
1349 unsafe extern "C-unwind" fn(
1350 plugin: *const clap_plugin,
1351 location_kind: u32,
1352 location: *const c_char,
1353 load_key: *const c_char,
1354 ) -> bool,
1355 >,
1356}
1357
1358#[repr(C)]
1359#[derive(Debug, Copy, Clone)]
1360pub struct clap_host_preset_load {
1361 pub on_error: Option<
1362 unsafe extern "C-unwind" fn(
1363 host: *const clap_host,
1364 location_kind: u32,
1365 location: *const c_char,
1366 load_key: *const c_char,
1367 os_error: i32,
1368 msg: *const c_char,
1369 ),
1370 >,
1371 pub loaded: Option<
1372 unsafe extern "C-unwind" fn(
1373 host: *const clap_host,
1374 location_kind: u32,
1375 location: *const c_char,
1376 load_key: *const c_char,
1377 ),
1378 >,
1379}
1380
1381pub const CLAP_EXT_REMOTE_CONTROLS: &CStr = c"clap.remote-controls/2";
1382pub const CLAP_EXT_REMOTE_CONTROLS_COMPAT: &CStr = c"clap.remote-controls.draft/2";
1383
1384pub const CLAP_REMOTE_CONTROLS_COUNT: c_uint = 8;
1385
1386#[repr(C)]
1387#[derive(Debug, Copy, Clone)]
1388pub struct clap_remote_controls_page {
1389 pub section_name: [c_char; 256usize],
1390 pub page_id: clap_id,
1391 pub page_name: [c_char; 256usize],
1392 pub param_ids: [clap_id; 8usize],
1393 pub is_for_preset: bool,
1394}
1395
1396#[repr(C)]
1397#[derive(Debug, Copy, Clone)]
1398pub struct clap_plugin_remote_controls {
1399 pub count: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> u32>,
1400 pub get: Option<
1401 unsafe extern "C-unwind" fn(
1402 plugin: *const clap_plugin,
1403 page_index: u32,
1404 page: *mut clap_remote_controls_page,
1405 ) -> bool,
1406 >,
1407}
1408
1409#[repr(C)]
1410#[derive(Debug, Copy, Clone)]
1411pub struct clap_host_remote_controls {
1412 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1413 pub suggest_page: Option<unsafe extern "C-unwind" fn(host: *const clap_host, page_id: clap_id)>,
1414}
1415
1416pub const CLAP_EXT_RENDER: &CStr = c"clap.render";
1417pub const CLAP_RENDER_REALTIME: clap_plugin_render_mode = 0;
1418pub const CLAP_RENDER_OFFLINE: clap_plugin_render_mode = 1;
1419pub type clap_plugin_render_mode = i32;
1420
1421#[repr(C)]
1422#[derive(Debug, Copy, Clone)]
1423pub struct clap_plugin_render {
1424 pub has_hard_realtime_requirement:
1425 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> bool>,
1426 pub set: Option<
1427 unsafe extern "C-unwind" fn(
1428 plugin: *const clap_plugin,
1429 mode: clap_plugin_render_mode,
1430 ) -> bool,
1431 >,
1432}
1433
1434#[repr(C)]
1435#[derive(Debug, Copy, Clone)]
1436pub struct clap_istream {
1437 pub ctx: *mut c_void,
1438 pub read: Option<
1439 unsafe extern "C-unwind" fn(
1440 stream: *const clap_istream,
1441 buffer: *mut c_void,
1442 size: u64,
1443 ) -> i64,
1444 >,
1445}
1446
1447#[repr(C)]
1448#[derive(Debug, Copy, Clone)]
1449pub struct clap_ostream {
1450 pub ctx: *mut c_void,
1451 pub write: Option<
1452 unsafe extern "C-unwind" fn(
1453 stream: *const clap_ostream,
1454 buffer: *const c_void,
1455 size: u64,
1456 ) -> i64,
1457 >,
1458}
1459
1460pub const CLAP_EXT_STATE_CONTEXT: &CStr = c"clap.state-context/2";
1461
1462pub const CLAP_STATE_CONTEXT_FOR_PRESET: clap_plugin_state_context_type = 1;
1463pub const CLAP_STATE_CONTEXT_FOR_DUPLICATE: clap_plugin_state_context_type = 2;
1464pub const CLAP_STATE_CONTEXT_FOR_PROJECT: clap_plugin_state_context_type = 3;
1465pub type clap_plugin_state_context_type = c_uint;
1466
1467#[repr(C)]
1468#[derive(Debug, Copy, Clone)]
1469pub struct clap_plugin_state_context {
1470 pub save: Option<
1471 unsafe extern "C-unwind" fn(
1472 plugin: *const clap_plugin,
1473 stream: *const clap_ostream,
1474 context_type: u32,
1475 ) -> bool,
1476 >,
1477 pub load: Option<
1478 unsafe extern "C-unwind" fn(
1479 plugin: *const clap_plugin,
1480 stream: *const clap_istream,
1481 context_type: u32,
1482 ) -> bool,
1483 >,
1484}
1485
1486#[doc = " @page State\n @brief state management\n\n Plugins can implement this extension to save and restore both parameter\n values and non-parameter state. This is used to persist a plugin's state\n between project reloads, when duplicating and copying plugin instances, and\n for host-side preset management.\n\n If you need to know if the save/load operation is meant for duplicating a plugin\n instance, for saving/loading a plugin preset or while saving/loading the project\n then consider implementing CLAP_EXT_STATE_CONTEXT in addition to CLAP_EXT_STATE."]
1487pub const CLAP_EXT_STATE: &CStr = c"clap.state";
1488
1489#[repr(C)]
1490#[derive(Debug, Copy, Clone)]
1491pub struct clap_plugin_state {
1492 pub save: Option<
1493 unsafe extern "C-unwind" fn(
1494 plugin: *const clap_plugin,
1495 stream: *const clap_ostream,
1496 ) -> bool,
1497 >,
1498 pub load: Option<
1499 unsafe extern "C-unwind" fn(
1500 plugin: *const clap_plugin,
1501 stream: *const clap_istream,
1502 ) -> bool,
1503 >,
1504}
1505
1506#[repr(C)]
1507#[derive(Debug, Copy, Clone)]
1508pub struct clap_host_state {
1509 pub mark_dirty: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1510}
1511
1512pub const CLAP_EXT_SURROUND: &CStr = c"clap.surround/4";
1513pub const CLAP_EXT_SURROUND_COMPAT: &CStr = c"clap.surround.draft/4";
1514pub const CLAP_PORT_SURROUND: &CStr = c"surround";
1515
1516pub const CLAP_SURROUND_FL: c_uint = 0;
1517pub const CLAP_SURROUND_FR: c_uint = 1;
1518pub const CLAP_SURROUND_FC: c_uint = 2;
1519pub const CLAP_SURROUND_LFE: c_uint = 3;
1520pub const CLAP_SURROUND_BL: c_uint = 4;
1521pub const CLAP_SURROUND_BR: c_uint = 5;
1522pub const CLAP_SURROUND_FLC: c_uint = 6;
1523pub const CLAP_SURROUND_FRC: c_uint = 7;
1524pub const CLAP_SURROUND_BC: c_uint = 8;
1525pub const CLAP_SURROUND_SL: c_uint = 9;
1526pub const CLAP_SURROUND_SR: c_uint = 10;
1527pub const CLAP_SURROUND_TC: c_uint = 11;
1528pub const CLAP_SURROUND_TFL: c_uint = 12;
1529pub const CLAP_SURROUND_TFC: c_uint = 13;
1530pub const CLAP_SURROUND_TFR: c_uint = 14;
1531pub const CLAP_SURROUND_TBL: c_uint = 15;
1532pub const CLAP_SURROUND_TBC: c_uint = 16;
1533pub const CLAP_SURROUND_TBR: c_uint = 17;
1534pub const CLAP_SURROUND_TSL: c_uint = 18;
1535pub const CLAP_SURROUND_TSR: c_uint = 19;
1536
1537#[repr(C)]
1538#[derive(Debug, Copy, Clone)]
1539pub struct clap_plugin_surround {
1540 pub is_channel_mask_supported:
1541 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, channel_mask: u64) -> bool>,
1542 pub get_channel_map: Option<
1543 unsafe extern "C-unwind" fn(
1544 plugin: *const clap_plugin,
1545 is_input: bool,
1546 port_index: u32,
1547 channel_map: *mut u8,
1548 channel_map_capacity: u32,
1549 ) -> u32,
1550 >,
1551}
1552
1553#[repr(C)]
1554#[derive(Debug, Copy, Clone)]
1555pub struct clap_host_surround {
1556 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1557}
1558
1559pub const CLAP_EXT_TAIL: &CStr = c"clap.tail";
1560
1561#[repr(C)]
1562#[derive(Debug, Copy, Clone)]
1563pub struct clap_plugin_tail {
1564 pub get: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin) -> u32>,
1565}
1566
1567#[repr(C)]
1568#[derive(Debug, Copy, Clone)]
1569pub struct clap_host_tail {
1570 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1571}
1572
1573pub const CLAP_EXT_THREAD_CHECK: &CStr = c"clap.thread-check";
1574
1575#[doc = " @page thread-check\n\n CLAP defines two symbolic threads:\n\n main-thread:\n This is the thread in which most of the interaction between the plugin and host happens.\n This will be the same OS thread throughout the lifetime of the plug-in.\n On macOS and Windows, this must be the thread on which gui and timer events are received\n (i.e., the main thread of the program).\n It isn't a realtime thread, yet this thread needs to respond fast enough to allow responsive\n user interaction, so it is strongly recommended plugins run long,and expensive or blocking\n tasks such as preset indexing or asset loading in dedicated background threads started by the\n plugin.\n\n audio-thread:\n This thread can be used for realtime audio processing. Its execution should be as\n deterministic as possible to meet the audio interface's deadline (can be <1ms). There are a\n known set of operations that should be avoided: malloc() and free(), contended locks and\n mutexes, I/O, waiting, and so forth.\n\n The audio-thread is symbolic, there isn't one OS thread that remains the\n audio-thread for the plugin lifetime. A host is may opt to have a\n thread pool and the plugin.process() call may be scheduled on different OS threads over time.\n However, the host must guarantee that single plugin instance will not be two audio-threads\n at the same time.\n\n Functions marked with [audio-thread] **ARE NOT CONCURRENT**. The host may mark any OS thread,\n including the main-thread as the audio-thread, as long as it can guarantee that only one OS\n thread is the audio-thread at a time in a plugin instance. The audio-thread can be seen as a\n concurrency guard for all functions marked with [audio-thread].\n\n The real-time constraint on the [audio-thread] interacts closely with the render extension.\n If a plugin doesn't implement render, then that plugin must have all [audio-thread] functions\n meet the real time standard. If the plugin does implement render, and returns true when\n render mode is set to real-time or if the plugin advertises a hard realtime requirement, it\n must implement realtime constraints. Hosts also provide functions marked [audio-thread].\n These can be safely called by a plugin in the audio thread. Therefore hosts must either (1)\n implement those functions meeting the real-time constraints or (2) not process plugins which\n advertise a hard realtime constraint or don't implement the render extension. Hosts which\n provide [audio-thread] functions outside these conditions may experience inconsistent or\n inaccurate rendering.\n\n Clap also tags some functions as [thread-safe]. Functions tagged as [thread-safe] can be called\n from any thread unless explicitly counter-indicated (for instance [thread-safe, !audio-thread])\n and may be called concurrently. Since a [thread-safe] function may be called from the\n [audio-thread] unless explicitly counter-indicated, it must also meet the realtime constraints\n as describes above."]
1576#[repr(C)]
1577#[derive(Debug, Copy, Clone)]
1578pub struct clap_hosthread_check {
1579 pub is_main_thread: Option<unsafe extern "C-unwind" fn(host: *const clap_host) -> bool>,
1580 pub is_audio_thread: Option<unsafe extern "C-unwind" fn(host: *const clap_host) -> bool>,
1581}
1582
1583#[doc = " @page\n\n This extension lets the plugin use the host's thread pool.\n\n The plugin must provide @ref clap_pluginhread_pool, and the host may provide @ref\n clap_hosthread_pool. If it doesn't, the plugin should process its data by its own means. In\n the worst case, a single threaded for-loop.\n\n Simple example with N voices to process\n\n @code\n void myplug_thread_pool_exec(const clap_plugin *plugin, uint32_t voice_index)\n {\n compute_voice(plugin, voice_index);\n }\n\n void myplug_process(const clap_plugin *plugin, const clap_process *process)\n {\n ...\n bool didComputeVoices = false;\n if (host_thread_pool && host_thread_pool.exec)\n didComputeVoices = host_thread_pool.request_exec(host, plugin, N);\n\n if (!didComputeVoices)\n for (uint32_t i = 0; i < N; ++i)\n myplug_thread_pool_exec(plugin, i);\n ...\n }\n @endcode\n\n Be aware that using a thread pool may break hard real-time rules due to the thread\n synchronization involved.\n\n If the host knows that it is running under hard real-time pressure it may decide to not\n provide this interface."]
1584pub const CLAP_EXT_THREAD_POOL: &CStr = c"clap.thread-pool";
1585
1586#[repr(C)]
1587#[derive(Debug, Copy, Clone)]
1588pub struct clap_pluginhread_pool {
1589 pub exec: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, task_index: u32)>,
1590}
1591
1592#[repr(C)]
1593#[derive(Debug, Copy, Clone)]
1594pub struct clap_hosthread_pool {
1595 pub request_exec:
1596 Option<unsafe extern "C-unwind" fn(host: *const clap_host, num_tasks: u32) -> bool>,
1597}
1598
1599pub const CLAP_EXT_TIMER_SUPPORT: &CStr = c"clap.timer-support";
1600
1601#[repr(C)]
1602#[derive(Debug, Copy, Clone)]
1603pub struct clap_pluginimer_support {
1604 pub on_timer:
1605 Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin, timer_id: clap_id)>,
1606}
1607
1608#[repr(C)]
1609#[derive(Debug, Copy, Clone)]
1610pub struct clap_hostimer_support {
1611 pub register_timer: Option<
1612 unsafe extern "C-unwind" fn(
1613 host: *const clap_host,
1614 period_ms: u32,
1615 timer_id: *mut clap_id,
1616 ) -> bool,
1617 >,
1618 pub unregister_timer:
1619 Option<unsafe extern "C-unwind" fn(host: *const clap_host, timer_id: clap_id) -> bool>,
1620}
1621
1622pub const CLAP_EXT_TRACK_INFO: &CStr = c"clap.track-info/1";
1623pub const CLAP_EXT_TRACK_INFO_COMPAT: &CStr = c"clap.track-info.draft/1";
1624
1625pub const CLAP_TRACK_INFO_HAS_TRACK_NAME: c_uint = 1;
1626pub const CLAP_TRACK_INFO_HAS_TRACK_COLOR: c_uint = 2;
1627pub const CLAP_TRACK_INFO_HAS_AUDIO_CHANNEL: c_uint = 4;
1628pub const CLAP_TRACK_INFO_IS_FOR_RETURN_TRACK: c_uint = 8;
1629pub const CLAP_TRACK_INFO_IS_FOR_BUS: c_uint = 16;
1630pub const CLAP_TRACK_INFO_IS_FOR_MASTER: c_uint = 32;
1631
1632#[repr(C)]
1633#[derive(Debug, Copy, Clone)]
1634pub struct clap_track_info {
1635 pub flags: u64,
1636 pub name: [c_char; 256usize],
1637 pub color: clap_color,
1638 pub audio_channel_count: i32,
1639 pub audio_port_type: *const c_char,
1640}
1641
1642#[repr(C)]
1643#[derive(Debug, Copy, Clone)]
1644pub struct clap_pluginrack_info {
1645 pub changed: Option<unsafe extern "C-unwind" fn(plugin: *const clap_plugin)>,
1646}
1647
1648#[repr(C)]
1649#[derive(Debug, Copy, Clone)]
1650pub struct clap_hostrack_info {
1651 pub get: Option<
1652 unsafe extern "C-unwind" fn(host: *const clap_host, info: *mut clap_track_info) -> bool,
1653 >,
1654}
1655
1656pub const CLAP_EXT_VOICE_INFO: &CStr = c"clap.voice-info";
1657
1658pub const CLAP_VOICE_INFO_SUPPORTS_OVERLAPPING_NOTES: c_uint = 1;
1659
1660#[repr(C)]
1661#[derive(Debug, Copy, Clone)]
1662pub struct clap_voice_info {
1663 pub voice_count: u32,
1664 pub voice_capacity: u32,
1665 pub flags: u64,
1666}
1667
1668#[repr(C)]
1669#[derive(Debug, Copy, Clone)]
1670pub struct clap_plugin_voice_info {
1671 pub get: Option<
1672 unsafe extern "C-unwind" fn(plugin: *const clap_plugin, info: *mut clap_voice_info) -> bool,
1673 >,
1674}
1675
1676#[repr(C)]
1677#[derive(Debug, Copy, Clone)]
1678pub struct clap_host_voice_info {
1679 pub changed: Option<unsafe extern "C-unwind" fn(host: *const clap_host)>,
1680}