From ac9eb30bd69a836291b4a62436fe724f97a17ff1 Mon Sep 17 00:00:00 2001 From: Micah Johnston Date: Sun, 5 Nov 2023 09:07:52 -0600 Subject: [PATCH] update for CLAP 1.1.9 --- src/ext/draft/ambisonic.rs | 36 +++++++++++++++-------- src/ext/draft/audio_ports_activation.rs | 3 +- src/ext/draft/configurable_audio_ports.rs | 13 ++++---- src/ext/draft/surround.rs | 5 ++-- src/version.rs | 2 +- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/ext/draft/ambisonic.rs b/src/ext/draft/ambisonic.rs index 2eaa225..00cf5d2 100644 --- a/src/ext/draft/ambisonic.rs +++ b/src/ext/draft/ambisonic.rs @@ -2,35 +2,45 @@ use crate::{cstr, host::*, plugin::*}; use std::ffi::CStr; -pub const CLAP_EXT_AMBISONIC: &CStr = cstr!("clap.ambisonic.draft/2"); +pub const CLAP_EXT_AMBISONIC: &CStr = cstr!("clap.ambisonic.draft/3"); pub const CLAP_PORT_AMBISONIC: &CStr = cstr!("ambisonic"); -pub const CLAP_AMBISONIC_FUMA: u32 = 0; -pub const CLAP_AMBISONIC_ACN: u32 = 1; +pub const CLAP_AMBISONIC_ORDERING_FUMA: clap_ambisonic_ordering = 0; +pub const CLAP_AMBISONIC_ORDERING_ACN: clap_ambisonic_ordering = 1; -pub const CLAP_AMBISONIC_NORMALIZATION_MAXN: u32 = 0; -pub const CLAP_AMBISONIC_NORMALIZATION_SN3D: u32 = 1; -pub const CLAP_AMBISONIC_NORMALIZATION_N3D: u32 = 2; -pub const CLAP_AMBISONIC_NORMALIZATION_SN2D: u32 = 3; -pub const CLAP_AMBISONIC_NORMALIZATION_N2D: u32 = 4; +pub type clap_ambisonic_ordering = u32; + +pub const CLAP_AMBISONIC_NORMALIZATION_MAXN: clap_ambisonic_normalization = 0; +pub const CLAP_AMBISONIC_NORMALIZATION_SN3D: clap_ambisonic_normalization = 1; +pub const CLAP_AMBISONIC_NORMALIZATION_N3D: clap_ambisonic_normalization = 2; +pub const CLAP_AMBISONIC_NORMALIZATION_SN2D: clap_ambisonic_normalization = 3; +pub const CLAP_AMBISONIC_NORMALIZATION_N2D: clap_ambisonic_normalization = 4; + +pub type clap_ambisonic_normalization = u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct clap_ambisonic_info { - pub ordering: u32, - pub normalization: u32, +pub struct clap_ambisonic_config { + pub ordering: clap_ambisonic_ordering, + pub normalization: clap_ambisonic_normalization, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct clap_plugin_ambisonic { - pub get_info: Option< + pub is_config_supported: Option< + unsafe extern "C" fn( + plugin: *const clap_plugin, + config: *const clap_ambisonic_config, + ) -> bool, + >, + pub get_config: Option< unsafe extern "C" fn( plugin: *const clap_plugin, is_input: bool, port_index: u32, - info: *mut clap_ambisonic_info, + info: *mut clap_ambisonic_config, ) -> bool, >, } diff --git a/src/ext/draft/audio_ports_activation.rs b/src/ext/draft/audio_ports_activation.rs index 99ee944..e090333 100644 --- a/src/ext/draft/audio_ports_activation.rs +++ b/src/ext/draft/audio_ports_activation.rs @@ -2,7 +2,7 @@ use crate::{cstr, plugin::*}; use std::ffi::CStr; -pub const CLAP_EXT_AUDIO_PORTS_ACTIVATION: &CStr = cstr!("clap.audio-ports-activation/draft-1"); +pub const CLAP_EXT_AUDIO_PORTS_ACTIVATION: &CStr = cstr!("clap.audio-ports-activation/draft-2"); #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -15,6 +15,7 @@ pub struct clap_plugin_audio_ports_activation { is_input: bool, port_index: u32, is_active: bool, + sample_size: u32, ) -> bool, >, } diff --git a/src/ext/draft/configurable_audio_ports.rs b/src/ext/draft/configurable_audio_ports.rs index d9425ac..49c6006 100644 --- a/src/ext/draft/configurable_audio_ports.rs +++ b/src/ext/draft/configurable_audio_ports.rs @@ -2,12 +2,11 @@ use crate::{cstr, plugin::*}; use std::ffi::{c_char, c_void, CStr}; -pub const CLAP_EXT_CONFIGURABLE_AUDIO_PORTS: &CStr = cstr!("clap.configurable-audio-ports.draft0"); +pub const CLAP_EXT_CONFIGURABLE_AUDIO_PORTS: &CStr = cstr!("clap.configurable-audio-ports.draft1"); #[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, @@ -21,10 +20,14 @@ 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 can_apply_configuration: Option< + unsafe extern "C" fn( + plugin: *const clap_plugin, + requests: *const clap_audio_port_configuration_request, + request_count: u32, + ) -> bool, >, - pub request_configuration: Option< + pub apply_configuration: Option< unsafe extern "C" fn( plugin: *const clap_plugin, requests: *const clap_audio_port_configuration_request, diff --git a/src/ext/draft/surround.rs b/src/ext/draft/surround.rs index bd840b2..804a841 100644 --- a/src/ext/draft/surround.rs +++ b/src/ext/draft/surround.rs @@ -2,7 +2,7 @@ use crate::{cstr, host::*, plugin::*}; use std::ffi::CStr; -pub const CLAP_EXT_SURROUND: &CStr = cstr!("clap.surround.draft/3"); +pub const CLAP_EXT_SURROUND: &CStr = cstr!("clap.surround.draft/4"); pub const CLAP_PORT_SURROUND: &CStr = cstr!("surround"); @@ -28,6 +28,8 @@ pub const CLAP_SURROUND_TBR: u32 = 17; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct clap_plugin_surround { + pub is_channel_mask_supported: + Option bool>, pub get_channel_map: Option< unsafe extern "C" fn( plugin: *const clap_plugin, @@ -37,7 +39,6 @@ pub struct clap_plugin_surround { channel_map_capacity: u32, ) -> u32, >, - pub changed: Option, } #[repr(C)] diff --git a/src/version.rs b/src/version.rs index 5e9603e..ba8898f 100644 --- a/src/version.rs +++ b/src/version.rs @@ -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 = 8; +pub const CLAP_VERSION_REVISION: u32 = 9; pub const CLAP_VERSION: clap_version = clap_version { major: CLAP_VERSION_MAJOR,