Skip to content

Commit

Permalink
Merge pull request #25 from robbert-vdh/update/clap-1.1.7
Browse files Browse the repository at this point in the history
Update for CLAP 1.1.7
  • Loading branch information
glowcoil committed Mar 14, 2023
2 parents 40f8880 + fbdf772 commit f1e9adf
Show file tree
Hide file tree
Showing 22 changed files with 638 additions and 105 deletions.
18 changes: 18 additions & 0 deletions src/ext/audio_ports_config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use crate::ext::audio_ports::*;
use crate::{host::*, id::*, plugin::*, string_sizes::*};

use std::ffi::CStr;
use std::os::raw::c_char;

pub const CLAP_EXT_AUDIO_PORTS_CONFIG: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.audio-ports-config\0") };
pub const CLAP_EXT_AUDIO_PORTS_CONFIG_INFO: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.audio-ports-config-info/draft-0\0") };

#[repr(C)]
#[derive(Debug, Copy, Clone)]
Expand Down Expand Up @@ -42,6 +45,21 @@ pub struct clap_plugin_audio_ports_config {
Option<unsafe extern "C" fn(plugin: *const clap_plugin, config_id: clap_id) -> bool>,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_audio_ports_config_info {
pub current_config: Option<unsafe extern "C" fn(plugin: *const clap_plugin) -> clap_id>,
pub get: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
config_id: clap_id,
port_index: u32,
is_input: bool,
config: *mut clap_audio_port_info,
) -> bool,
>,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_host_audio_ports_config {
Expand Down
5 changes: 3 additions & 2 deletions src/ext/draft/ambisonic.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{host::*, plugin::*};
use crate::{host::*, id::*, plugin::*};

use std::ffi::CStr;

pub const CLAP_EXT_AMBISONIC: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.ambisonic.draft/0\0") };
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.ambisonic.draft/1\0") };

pub const CLAP_PORT_AMBISONIC: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"ambisonic\0") };
Expand All @@ -30,6 +30,7 @@ pub struct clap_plugin_ambisonic {
pub get_info: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
config_id: clap_id,
is_input: bool,
port_index: u32,
info: *mut clap_ambisonic_info,
Expand Down
21 changes: 21 additions & 0 deletions src/ext/draft/audio_ports_activation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::plugin::*;

use std::ffi::CStr;

pub const CLAP_EXT_AUDIO_PORTS_ACTIVATION: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.audio-ports-activation/draft-1\0") };

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_audio_ports_activation {
pub can_activate_while_processing:
Option<unsafe extern "C" fn(plugin: *const clap_plugin) -> bool>,
pub set_active: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
is_input: bool,
port_index: u32,
is_active: bool,
) -> bool,
>,
}
138 changes: 138 additions & 0 deletions src/ext/draft/context_menu.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
use crate::{host::*, id::*, plugin::*};

use std::ffi::{c_void, CStr};
use std::os::raw::c_char;

pub const CLAP_EXT_CONTEXT_MENU: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.context-menu.draft/0\0") };

pub const CLAP_CONTEXT_MENU_TARGET_KIND_GLOBAL: u32 = 0;
pub const CLAP_CONTEXT_MENU_TARGET_KIND_PARAM: u32 = 1;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_context_menu_target {
pub kind: u32,
pub id: clap_id,
}

pub const CLAP_CONTEXT_MENU_ITEM_ENTRY: clap_context_menu_item_kind = 0;
pub const CLAP_CONTEXT_MENU_ITEM_CHECK_ENTRY: clap_context_menu_item_kind = 1;
pub const CLAP_CONTEXT_MENU_ITEM_SEPARATOR: clap_context_menu_item_kind = 2;
pub const CLAP_CONTEXT_MENU_ITEM_BEGIN_SUBMENU: clap_context_menu_item_kind = 3;
pub const CLAP_CONTEXT_MENU_ITEM_END_SUBMENU: clap_context_menu_item_kind = 4;
pub const CLAP_CONTEXT_MENU_ITEM_TITLE: clap_context_menu_item_kind = 5;
pub type clap_context_menu_item_kind = u32;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_context_menu_entry {
pub label: *const c_char,
pub is_enabled: bool,
pub action_id: clap_id,
}

unsafe impl Send for clap_context_menu_entry {}
unsafe impl Sync for clap_context_menu_entry {}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_context_menu_check_entry {
pub label: *const c_char,
pub is_enabled: bool,
pub is_checked: bool,
pub action_id: clap_id,
}

unsafe impl Send for clap_context_menu_check_entry {}
unsafe impl Sync for clap_context_menu_check_entry {}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_context_menu_item_title {
pub title: *const c_char,
pub is_enabled: bool,
}

unsafe impl Send for clap_context_menu_item_title {}
unsafe impl Sync for clap_context_menu_item_title {}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_context_menu_submenu {
pub label: *const c_char,
pub is_enabled: bool,
}

unsafe impl Send for clap_context_menu_submenu {}
unsafe impl Sync for clap_context_menu_submenu {}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_context_menu_builder {
pub ctx: *mut c_void,
pub add_item: Option<
unsafe extern "C" fn(
builder: *const clap_context_menu_builder,
item_kind: clap_context_menu_item_kind,
item_data: *const c_void,
) -> bool,
>,
pub supports: Option<
unsafe extern "C" fn(
builder: *const clap_context_menu_builder,
item_kind: clap_context_menu_item_kind,
) -> bool,
>,
}

unsafe impl Send for clap_context_menu_builder {}
unsafe impl Sync for clap_context_menu_builder {}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_context_menu {
pub populate: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
target: *const clap_context_menu_target,
builder: *const clap_context_menu_builder,
) -> bool,
>,
pub perform: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
target: *const clap_context_menu_target,
action_id: clap_id,
) -> bool,
>,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_host_context_menu {
pub populate: Option<
unsafe extern "C" fn(
host: *const clap_host,
target: *const clap_context_menu_target,
builder: *const clap_context_menu_builder,
) -> bool,
>,
pub perform: Option<
unsafe extern "C" fn(
host: *const clap_host,
target: *const clap_context_menu_target,
action_id: clap_id,
) -> bool,
>,
pub can_popup: Option<unsafe extern "C" fn(host: *const clap_host) -> bool>,
pub popup: Option<
unsafe extern "C" fn(
host: *const clap_host,
target: *const clap_context_menu_target,
screen_index: i32,
x: i32,
y: i32,
) -> bool,
>,
}
62 changes: 0 additions & 62 deletions src/ext/draft/file_reference.rs

This file was deleted.

8 changes: 6 additions & 2 deletions src/ext/draft/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
pub mod ambisonic;
pub mod audio_ports_activation;
pub mod check_for_update;
pub mod context_menu;
pub mod cv;
pub mod file_reference;
pub mod midi_mappings;
pub mod param_indication;
pub mod preset_load;
pub mod quick_controls;
pub mod remote_controls;
pub mod resource_directory;
pub mod state_context;
pub mod surround;
pub mod track_info;
pub mod transport_control;
pub mod triggers;
pub mod tuning;
36 changes: 36 additions & 0 deletions src/ext/draft/param_indication.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use crate::{color::*, id::*, plugin::*};

use std::ffi::CStr;
use std::os::raw::c_char;

pub const CLAP_EXT_PARAM_INDICATION: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.param-indication.draft/4\0") };

pub const CLAP_PARAM_INDICATION_AUTOMATION_NONE: u32 = 0;
pub const CLAP_PARAM_INDICATION_AUTOMATION_PRESENT: u32 = 1;
pub const CLAP_PARAM_INDICATION_AUTOMATION_PLAYING: u32 = 2;
pub const CLAP_PARAM_INDICATION_AUTOMATION_RECORDING: u32 = 3;
pub const CLAP_PARAM_INDICATION_AUTOMATION_OVERRIDING: u32 = 4;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_param_indication {
pub set_mapping: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
param_id: clap_id,
has_mapping: bool,
color: *const clap_color,
label: *const c_char,
description: *const c_char,
),
>,
pub set_automation: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
param_id: clap_id,
automation_state: u32,
color: *const clap_color,
),
>,
}
29 changes: 25 additions & 4 deletions src/ext/draft/preset_load.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
use crate::plugin::*;
use crate::{host::*, plugin::*};

use std::ffi::CStr;
use std::os::raw::c_char;

pub const CLAP_EXT_PRESET_LOAD: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.preset-load.draft/0\0") };
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.preset-load.draft/1\0") };

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_preset_load {
pub from_file:
Option<unsafe extern "C" fn(plugin: *const clap_plugin, path: *const c_char) -> bool>,
pub from_uri: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
uri: *const c_char,
load_key: *const c_char,
) -> bool,
>,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_host_preset_load {
pub on_error: Option<
unsafe extern "C" fn(
host: *const clap_host,
uri: *const c_char,
os_error: i32,
msg: *const c_char,
),
>,
pub loaded: Option<
unsafe extern "C" fn(host: *const clap_host, uri: *const c_char, load_key: *const c_char),
>,
}
Loading

0 comments on commit f1e9adf

Please sign in to comment.