clap_sys/
plugin.rs

1use crate::{process::*, version::*};
2
3use std::ffi::{c_char, c_void};
4
5#[repr(C)]
6#[derive(Debug, Copy, Clone)]
7pub struct clap_plugin_descriptor {
8    pub clap_version: clap_version,
9    pub id: *const c_char,
10    pub name: *const c_char,
11    pub vendor: *const c_char,
12    pub url: *const c_char,
13    pub manual_url: *const c_char,
14    pub support_url: *const c_char,
15    pub version: *const c_char,
16    pub description: *const c_char,
17    pub features: *const *const c_char,
18}
19
20unsafe impl Send for clap_plugin_descriptor {}
21unsafe impl Sync for clap_plugin_descriptor {}
22
23#[repr(C)]
24#[derive(Debug, Copy, Clone)]
25pub struct clap_plugin {
26    pub desc: *const clap_plugin_descriptor,
27    pub plugin_data: *mut c_void,
28    pub init: Option<unsafe extern "C" fn(plugin: *const clap_plugin) -> bool>,
29    pub destroy: Option<unsafe extern "C" fn(plugin: *const clap_plugin)>,
30    pub activate: Option<
31        unsafe extern "C" fn(
32            plugin: *const clap_plugin,
33            sample_rate: f64,
34            min_frames_count: u32,
35            max_frames_count: u32,
36        ) -> bool,
37    >,
38    pub deactivate: Option<unsafe extern "C" fn(plugin: *const clap_plugin)>,
39    pub start_processing: Option<unsafe extern "C" fn(plugin: *const clap_plugin) -> bool>,
40    pub stop_processing: Option<unsafe extern "C" fn(plugin: *const clap_plugin)>,
41    pub reset: Option<unsafe extern "C" fn(plugin: *const clap_plugin)>,
42    pub process: Option<
43        unsafe extern "C" fn(
44            plugin: *const clap_plugin,
45            process: *const clap_process,
46        ) -> clap_process_status,
47    >,
48    pub get_extension: Option<
49        unsafe extern "C" fn(plugin: *const clap_plugin, id: *const c_char) -> *const c_void,
50    >,
51    pub on_main_thread: Option<unsafe extern "C" fn(plugin: *const clap_plugin)>,
52}
53
54unsafe impl Send for clap_plugin {}
55unsafe impl Sync for clap_plugin {}