From 19f4fdadc555ed7c70992a30d9c67b813b8f1eba Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 2 Jun 2022 00:50:36 +0200 Subject: [PATCH] Update for CLAP 0.26 --- Cargo.lock | 4 +-- Cargo.toml | 4 +-- src/wrapper/clap/wrapper.rs | 51 +++++++------------------------------ 3 files changed, 13 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50740e45..52aac0b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -469,8 +469,8 @@ checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919" [[package]] name = "clap-sys" -version = "0.25.0" -source = "git+https://github.com/robbert-vdh/clap-sys.git?branch=feature/clap-0.25#c8e5011a66377aa14d9f719a52255d30a48232ed" +version = "0.26.0" +source = "git+https://github.com/robbert-vdh/clap-sys.git?branch=feature/clap-0.26#c628f71fec1656f4d66c2305f37b84008db50770" [[package]] name = "clipboard-win" diff --git a/Cargo.toml b/Cargo.toml index 2c648108..ecbcda78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,8 +66,8 @@ atomic_float = "0.1" atomic_refcell = "0.1" bitflags = "1.3" cfg-if = "1.0" -# For CLAP 0.25 -clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/clap-0.25" } +# For CLAP 0.26 +clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/clap-0.26" } crossbeam = "0.8" lazy_static = "1.4" log = { version = "0.4", features = ["std", "release_max_level_info"] } diff --git a/src/wrapper/clap/wrapper.rs b/src/wrapper/clap/wrapper.rs index 1bf24b69..e6deb34d 100644 --- a/src/wrapper/clap/wrapper.rs +++ b/src/wrapper/clap/wrapper.rs @@ -7,16 +7,15 @@ use atomic_refcell::{AtomicRefCell, AtomicRefMut}; use clap_sys::events::{ clap_event_header, clap_event_midi, clap_event_note, clap_event_note_expression, clap_event_param_gesture, clap_event_param_mod, clap_event_param_value, clap_event_transport, - clap_event_type, clap_input_events, clap_output_events, CLAP_CORE_EVENT_SPACE_ID, - CLAP_EVENT_IS_LIVE, CLAP_EVENT_MIDI, CLAP_EVENT_NOTE_EXPRESSION, CLAP_EVENT_NOTE_OFF, - CLAP_EVENT_NOTE_ON, CLAP_EVENT_PARAM_GESTURE_BEGIN, CLAP_EVENT_PARAM_GESTURE_END, - CLAP_EVENT_PARAM_MOD, CLAP_EVENT_PARAM_VALUE, CLAP_EVENT_TRANSPORT, - CLAP_NOTE_EXPRESSION_BRIGHTNESS, CLAP_NOTE_EXPRESSION_EXPRESSION, CLAP_NOTE_EXPRESSION_PAN, - CLAP_NOTE_EXPRESSION_PRESSURE, CLAP_NOTE_EXPRESSION_TUNING, CLAP_NOTE_EXPRESSION_VIBRATO, - CLAP_NOTE_EXPRESSION_VOLUME, CLAP_TRANSPORT_HAS_BEATS_TIMELINE, - CLAP_TRANSPORT_HAS_SECONDS_TIMELINE, CLAP_TRANSPORT_HAS_TEMPO, - CLAP_TRANSPORT_HAS_TIME_SIGNATURE, CLAP_TRANSPORT_IS_LOOP_ACTIVE, CLAP_TRANSPORT_IS_PLAYING, - CLAP_TRANSPORT_IS_RECORDING, CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL, + clap_input_events, clap_output_events, CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_IS_LIVE, + CLAP_EVENT_MIDI, CLAP_EVENT_NOTE_EXPRESSION, CLAP_EVENT_NOTE_OFF, CLAP_EVENT_NOTE_ON, + CLAP_EVENT_PARAM_GESTURE_BEGIN, CLAP_EVENT_PARAM_GESTURE_END, CLAP_EVENT_PARAM_MOD, + CLAP_EVENT_PARAM_VALUE, CLAP_EVENT_TRANSPORT, CLAP_NOTE_EXPRESSION_BRIGHTNESS, + CLAP_NOTE_EXPRESSION_EXPRESSION, CLAP_NOTE_EXPRESSION_PAN, CLAP_NOTE_EXPRESSION_PRESSURE, + CLAP_NOTE_EXPRESSION_TUNING, CLAP_NOTE_EXPRESSION_VIBRATO, CLAP_NOTE_EXPRESSION_VOLUME, + CLAP_TRANSPORT_HAS_BEATS_TIMELINE, CLAP_TRANSPORT_HAS_SECONDS_TIMELINE, + CLAP_TRANSPORT_HAS_TEMPO, CLAP_TRANSPORT_HAS_TIME_SIGNATURE, CLAP_TRANSPORT_IS_LOOP_ACTIVE, + CLAP_TRANSPORT_IS_PLAYING, CLAP_TRANSPORT_IS_RECORDING, CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL, }; use clap_sys::ext::audio_ports::{ clap_audio_port_info, clap_plugin_audio_ports, CLAP_AUDIO_PORT_IS_MAIN, CLAP_EXT_AUDIO_PORTS, @@ -25,7 +24,6 @@ use clap_sys::ext::audio_ports::{ use clap_sys::ext::audio_ports_config::{ clap_audio_ports_config, clap_plugin_audio_ports_config, CLAP_EXT_AUDIO_PORTS_CONFIG, }; -use clap_sys::ext::event_filter::{clap_plugin_event_filter, CLAP_EXT_EVENT_FILTER}; use clap_sys::ext::gui::{ clap_gui_resize_hints, clap_host_gui, clap_plugin_gui, clap_window, CLAP_EXT_GUI, CLAP_WINDOW_API_COCOA, CLAP_WINDOW_API_WIN32, CLAP_WINDOW_API_X11, @@ -193,8 +191,6 @@ pub struct Wrapper { clap_plugin_audio_ports: clap_plugin_audio_ports, - clap_plugin_event_filter: clap_plugin_event_filter, - clap_plugin_gui: clap_plugin_gui, host_gui: AtomicRefCell>>, @@ -550,10 +546,6 @@ impl Wrapper

{ get: Self::ext_audio_ports_get, }, - clap_plugin_event_filter: clap_plugin_event_filter { - accepts: Self::ext_event_filter_accepts, - }, - clap_plugin_gui: clap_plugin_gui { is_api_supported: Self::ext_gui_is_api_supported, get_preferred_api: Self::ext_gui_get_preferred_api, @@ -2144,8 +2136,6 @@ impl Wrapper

{ &wrapper.clap_plugin_audio_ports_config as *const _ as *const c_void } else if id == CStr::from_ptr(CLAP_EXT_AUDIO_PORTS) { &wrapper.clap_plugin_audio_ports as *const _ as *const c_void - } else if id == CStr::from_ptr(CLAP_EXT_EVENT_FILTER) { - &wrapper.clap_plugin_event_filter as *const _ as *const c_void } else if id == CStr::from_ptr(CLAP_EXT_GUI) && wrapper.editor.is_some() { // Only report that we support this extension if the plugin has an editor &wrapper.clap_plugin_gui as *const _ as *const c_void @@ -2427,29 +2417,6 @@ impl Wrapper

{ true } - unsafe extern "C" fn ext_event_filter_accepts( - _plugin: *const clap_plugin, - space_id: u16, - event_type: clap_event_type, - ) -> bool { - match (space_id, event_type) { - (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_PARAM_VALUE) - | (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_PARAM_MOD) - | (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_TRANSPORT) => true, - (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_NOTE_ON) - | (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_NOTE_OFF) - | (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_NOTE_EXPRESSION) - if P::MIDI_INPUT >= MidiConfig::Basic => - { - true - } - (CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_MIDI) if P::MIDI_INPUT >= MidiConfig::MidiCCs => { - true - } - _ => false, - } - } - unsafe extern "C" fn ext_gui_is_api_supported( _plugin: *const clap_plugin, api: *const c_char,