clap_sys/ext/draft/
tuning.rs

1use crate::{cstr, events::*, host::*, id::*, plugin::*, string_sizes::*};
2
3use std::ffi::{c_char, CStr};
4
5pub const CLAP_EXT_TUNING: &CStr = cstr!("clap.tuning/2");
6
7#[repr(C)]
8#[derive(Debug, Copy, Clone)]
9pub struct clap_event_tuning {
10    pub header: clap_event_header,
11    pub port_index: i16,
12    pub channel: i16,
13    pub tunning_id: clap_id,
14}
15
16#[repr(C)]
17#[derive(Debug, Copy, Clone)]
18pub struct clap_tuning_info {
19    pub tuning_id: clap_id,
20    pub name: [c_char; CLAP_NAME_SIZE],
21    pub is_dynamic: bool,
22}
23
24unsafe impl Send for clap_tuning_info {}
25unsafe impl Sync for clap_tuning_info {}
26
27#[repr(C)]
28#[derive(Debug, Copy, Clone)]
29pub struct clap_plugin_tuning_t {
30    pub changed: Option<unsafe extern "C" fn(plugin: *const clap_plugin)>,
31}
32
33#[repr(C)]
34#[derive(Debug, Copy, Clone)]
35pub struct clap_host_tuning {
36    pub get_relative: Option<
37        unsafe extern "C" fn(
38            host: *const clap_host,
39            tuning_id: clap_id,
40            channel: i32,
41            key: i32,
42            sample_offset: u32,
43        ) -> f64,
44    >,
45    pub should_play: Option<
46        unsafe extern "C" fn(
47            host: *const clap_host,
48            tuning_id: clap_id,
49            channel: i32,
50            key: i32,
51        ) -> bool,
52    >,
53    pub get_tuning_count: Option<unsafe extern "C" fn(host: *const clap_host) -> u32>,
54    pub get_info: Option<
55        unsafe extern "C" fn(
56            host: *const clap_host,
57            tuning_index: u32,
58            info: *mut clap_tuning_info,
59        ) -> bool,
60    >,
61}