1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use crate::{events::*, host::*, id::*, plugin::*, string_sizes::*};

use std::os::raw::c_char;

pub const CLAP_EXT_TUNING: *const c_char = b"clap.tuning.draft/2\0".as_ptr() as *const c_char;

#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_event_tuning {
    pub header: clap_event_header,
    pub port_index: i16,
    pub channel: i16,
    pub tunning_id: clap_id,
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_tuning_info {
    pub tuning_id: clap_id,
    pub name: [c_char; CLAP_NAME_SIZE],
    pub is_dynamic: bool,
}

unsafe impl Send for clap_tuning_info {}
unsafe impl Sync for clap_tuning_info {}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_plugin_tuning_t {
    pub changed: unsafe extern "C" fn(plugin: *const clap_plugin),
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct clap_host_tuning {
    pub get_relative: unsafe extern "C" fn(
        host: *const clap_host,
        tuning_id: clap_id,
        channel: i32,
        key: i32,
        sample_offset: u32,
    ) -> f64,
    pub should_play: unsafe extern "C" fn(
        host: *const clap_host,
        tuning_id: clap_id,
        channel: i32,
        key: i32,
    ) -> bool,
    pub get_tuning_count: unsafe extern "C" fn(host: *const clap_host) -> u32,
    pub get_info: unsafe extern "C" fn(
        host: *const clap_host,
        tuning_index: u32,
        info: *mut clap_tuning_info,
    ) -> bool,
}