Skip to main content

clap_sys/ext/
note_ports.rs

1use crate::{cstr, host::*, id::*, plugin::*, string_sizes::*};
2
3use std::ffi::{c_char, CStr};
4
5pub const CLAP_EXT_NOTE_PORTS: &CStr = cstr!("clap.note-ports");
6
7pub const CLAP_NOTE_DIALECT_CLAP: clap_note_dialect = 1 << 0;
8pub const CLAP_NOTE_DIALECT_MIDI: clap_note_dialect = 1 << 1;
9pub const CLAP_NOTE_DIALECT_MIDI_MPE: clap_note_dialect = 1 << 2;
10pub const CLAP_NOTE_DIALECT_MIDI2: clap_note_dialect = 1 << 3;
11
12pub type clap_note_dialect = u32;
13
14#[repr(C)]
15#[derive(Debug, Copy, Clone)]
16pub struct clap_note_port_info {
17    pub id: clap_id,
18    pub supported_dialects: clap_note_dialect,
19    pub preferred_dialect: clap_note_dialect,
20    pub name: [c_char; CLAP_NAME_SIZE],
21}
22
23#[repr(C)]
24#[derive(Debug, Copy, Clone)]
25pub struct clap_plugin_note_ports {
26    pub count: Option<unsafe extern "C" fn(plugin: *const clap_plugin, is_input: bool) -> u32>,
27    pub get: Option<
28        unsafe extern "C" fn(
29            plugin: *const clap_plugin,
30            index: u32,
31            is_input: bool,
32            info: *mut clap_note_port_info,
33        ) -> bool,
34    >,
35}
36
37pub const CLAP_NOTE_PORTS_RESCAN_ALL: u32 = 1 << 0;
38pub const CLAP_NOTE_PORTS_RESCAN_NAMES: u32 = 1 << 1;
39
40#[repr(C)]
41#[derive(Debug, Copy, Clone)]
42pub struct clap_host_note_ports {
43    pub supported_dialects:
44        Option<unsafe extern "C" fn(host: *const clap_host) -> clap_note_dialect>,
45    pub rescan: Option<unsafe extern "C" fn(host: *const clap_host, flags: u32)>,
46}