Skip to content

Commit

Permalink
Update for CLAP 1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
robbert-vdh committed Mar 13, 2023
1 parent fbdf772 commit 04779b5
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 25 deletions.
5 changes: 2 additions & 3 deletions src/ext/draft/ambisonic.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{host::*, id::*, plugin::*};
use crate::{host::*, plugin::*};

use std::ffi::CStr;

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

pub const CLAP_PORT_AMBISONIC: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"ambisonic\0") };
Expand All @@ -30,7 +30,6 @@ 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
35 changes: 35 additions & 0 deletions src/ext/draft/configurable_audio_ports.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::plugin::*;

use std::ffi::{c_char, CStr};

pub const CLAP_EXT_CONFIGURABLE_AUDIO_PORTS: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.configurable-audio-ports.draft0\0") };

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_audio_port_configuration_request {
pub is_best_effort: bool,
pub is_input: bool,
pub port_index: u32,
pub channel_count: u32,
pub port_type: *const c_char,
pub port_details: *const c_char,
}

unsafe impl Send for clap_audio_port_configuration_request {}
unsafe impl Sync for clap_audio_port_configuration_request {}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_configurable_audio_ports {
pub is_port_configurable: Option<
unsafe extern "C" fn(plugin: *const clap_plugin, is_input: bool, port_index: u32) -> bool,
>,
pub request_configuration: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
requests: *const clap_audio_port_configuration_request,
request_count: u32,
) -> bool,
>,
}
27 changes: 27 additions & 0 deletions src/ext/draft/extensible_audio_ports.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use crate::plugin::*;

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

pub const CLAP_EXT_EXTENSIBLE_AUDIO_PORTS: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.extensible-audio-ports.draft0\0") };

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_extensible_audio_ports {
pub add_port: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
is_input: bool,
channel_count: u32,
port_type: *const c_char,
port_details: *const c_void,
) -> bool,
>,
pub remove_port: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
is_input: bool,
channel_count: u32,
) -> bool,
>,
}
2 changes: 2 additions & 0 deletions src/ext/draft/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
pub mod ambisonic;
pub mod audio_ports_activation;
pub mod check_for_update;
pub mod configurable_audio_ports;
pub mod context_menu;
pub mod cv;
pub mod extensible_audio_ports;
pub mod midi_mappings;
pub mod param_indication;
pub mod preset_load;
Expand Down
19 changes: 14 additions & 5 deletions src/ext/draft/preset_load.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
use crate::factory::draft::preset_discovery::*;
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/1\0") };
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.preset-load.draft/2\0") };

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_plugin_preset_load {
pub from_uri: Option<
pub from_location: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
uri: *const c_char,
location_kind: clap_preset_discovery_location_kind,
location: *const c_char,
load_key: *const c_char,
) -> bool,
>,
Expand All @@ -24,12 +26,19 @@ pub struct clap_host_preset_load {
pub on_error: Option<
unsafe extern "C" fn(
host: *const clap_host,
uri: *const c_char,
location_kind: clap_preset_discovery_location_kind,
location: *const c_char,
load_key: *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),
unsafe extern "C" fn(
host: *const clap_host,
location_kind: clap_preset_discovery_location_kind,
location: *const c_char,
load_key: *const c_char,
),
>,
}
13 changes: 2 additions & 11 deletions src/ext/draft/surround.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{host::*, id::*, plugin::*};
use crate::{host::*, plugin::*};

use std::ffi::CStr;

pub const CLAP_EXT_SURROUND: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.surround.draft/2\0") };
unsafe { CStr::from_bytes_with_nul_unchecked(b"clap.surround.draft/3\0") };

pub const CLAP_PORT_SURROUND: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"surround\0") };

Expand Down Expand Up @@ -32,7 +32,6 @@ pub struct clap_plugin_surround {
pub get_channel_map: Option<
unsafe extern "C" fn(
plugin: *const clap_plugin,
config_id: clap_id,
is_input: bool,
port_index: u32,
channel_map: *mut u8,
Expand All @@ -46,12 +45,4 @@ pub struct clap_plugin_surround {
#[derive(Debug, Copy, Clone)]
pub struct clap_host_surround {
pub changed: Option<unsafe extern "C" fn(host: *const clap_host)>,
pub get_preferred_channel_map: Option<
unsafe extern "C" fn(
plugin: *const clap_host,
channel_map: *mut u8,
channel_map_capacity: u32,
channel_count: *mut u32,
),
>,
}
17 changes: 12 additions & 5 deletions src/factory/draft/preset_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ use std::ffi::{c_void, CStr};
use std::os::raw::c_char;

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

pub const CLAP_PRESET_DISCOVERY_LOCATION_FILE: clap_preset_discovery_location_kind = 0;
pub const CLAP_PRESET_DISCOVERY_LOCATION_PLUGIN: clap_preset_discovery_location_kind = 1;

pub type clap_preset_discovery_location_kind = u32;

pub const CLAP_PRESET_DISCOVERY_IS_FACTORY_CONTENT: u32 = 1 << 0;
pub const CLAP_PRESET_DISCOVERY_IS_USER_CONTENT: u32 = 1 << 1;
Expand Down Expand Up @@ -111,7 +116,8 @@ unsafe impl Sync for clap_preset_discovery_filetype {}
pub struct clap_preset_discovery_location {
pub flags: u32,
pub name: *const c_char,
pub uri: *const c_char,
pub kind: clap_preset_discovery_location_kind,
pub location: *const c_char,
}

unsafe impl Send for clap_preset_discovery_location {}
Expand All @@ -120,13 +126,13 @@ unsafe impl Sync for clap_preset_discovery_location {}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct clap_preset_discovery_soundpack {
pub flags: u64,
pub flags: u32,
pub id: *const c_char,
pub name: *const c_char,
pub description: *const c_char,
pub homepage_url: *const c_char,
pub vendor: *const c_char,
pub image_uri: *const c_char,
pub image_path: *const c_char,
pub release_timestamp: clap_timestamp,
}

Expand Down Expand Up @@ -155,7 +161,8 @@ pub struct clap_preset_discovery_provider {
pub get_metadata: Option<
unsafe extern "C" fn(
provider: *const clap_preset_discovery_provider,
uri: *const c_char,
location_kind: clap_preset_discovery_location_kind,
location: *const c_char,
metadata_receiver: *const clap_preset_discovery_metadata_receiver,
) -> bool,
>,
Expand Down
4 changes: 4 additions & 0 deletions src/plugin_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ pub const CLAP_PLUGIN_FEATURE_TRANSIENT_SHAPER: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"transient-shaper\0") };
pub const CLAP_PLUGIN_FEATURE_COMPRESSOR: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"compressor\0") };
pub const CLAP_PLUGIN_FEATURE_EXPANDER: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"expander\0") };
pub const CLAP_PLUGIN_FEATURE_GATE: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"gate\0") };
pub const CLAP_PLUGIN_FEATURE_LIMITER: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"limiter\0") };

Expand Down
2 changes: 1 addition & 1 deletion src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct clap_version {

pub const CLAP_VERSION_MAJOR: u32 = 1;
pub const CLAP_VERSION_MINOR: u32 = 1;
pub const CLAP_VERSION_REVISION: u32 = 7;
pub const CLAP_VERSION_REVISION: u32 = 8;

pub const CLAP_VERSION: clap_version = clap_version {
major: CLAP_VERSION_MAJOR,
Expand Down

0 comments on commit 04779b5

Please sign in to comment.