1
0
Fork 0

Update for CLAP 0.26

This commit is contained in:
Robbert van der Helm 2022-06-02 00:50:36 +02:00
parent 37a2d86714
commit 19f4fdadc5
3 changed files with 13 additions and 46 deletions

4
Cargo.lock generated
View file

@ -469,8 +469,8 @@ checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919"
[[package]] [[package]]
name = "clap-sys" name = "clap-sys"
version = "0.25.0" version = "0.26.0"
source = "git+https://github.com/robbert-vdh/clap-sys.git?branch=feature/clap-0.25#c8e5011a66377aa14d9f719a52255d30a48232ed" source = "git+https://github.com/robbert-vdh/clap-sys.git?branch=feature/clap-0.26#c628f71fec1656f4d66c2305f37b84008db50770"
[[package]] [[package]]
name = "clipboard-win" name = "clipboard-win"

View file

@ -66,8 +66,8 @@ atomic_float = "0.1"
atomic_refcell = "0.1" atomic_refcell = "0.1"
bitflags = "1.3" bitflags = "1.3"
cfg-if = "1.0" cfg-if = "1.0"
# For CLAP 0.25 # For CLAP 0.26
clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/clap-0.25" } clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/clap-0.26" }
crossbeam = "0.8" crossbeam = "0.8"
lazy_static = "1.4" lazy_static = "1.4"
log = { version = "0.4", features = ["std", "release_max_level_info"] } log = { version = "0.4", features = ["std", "release_max_level_info"] }

View file

@ -7,16 +7,15 @@ use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use clap_sys::events::{ use clap_sys::events::{
clap_event_header, clap_event_midi, clap_event_note, clap_event_note_expression, 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_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_input_events, clap_output_events, CLAP_CORE_EVENT_SPACE_ID, CLAP_EVENT_IS_LIVE,
CLAP_EVENT_IS_LIVE, CLAP_EVENT_MIDI, CLAP_EVENT_NOTE_EXPRESSION, CLAP_EVENT_NOTE_OFF, CLAP_EVENT_MIDI, CLAP_EVENT_NOTE_EXPRESSION, CLAP_EVENT_NOTE_OFF, CLAP_EVENT_NOTE_ON,
CLAP_EVENT_NOTE_ON, CLAP_EVENT_PARAM_GESTURE_BEGIN, CLAP_EVENT_PARAM_GESTURE_END, CLAP_EVENT_PARAM_GESTURE_BEGIN, CLAP_EVENT_PARAM_GESTURE_END, CLAP_EVENT_PARAM_MOD,
CLAP_EVENT_PARAM_MOD, CLAP_EVENT_PARAM_VALUE, CLAP_EVENT_TRANSPORT, CLAP_EVENT_PARAM_VALUE, CLAP_EVENT_TRANSPORT, CLAP_NOTE_EXPRESSION_BRIGHTNESS,
CLAP_NOTE_EXPRESSION_BRIGHTNESS, CLAP_NOTE_EXPRESSION_EXPRESSION, CLAP_NOTE_EXPRESSION_PAN, CLAP_NOTE_EXPRESSION_EXPRESSION, CLAP_NOTE_EXPRESSION_PAN, CLAP_NOTE_EXPRESSION_PRESSURE,
CLAP_NOTE_EXPRESSION_PRESSURE, CLAP_NOTE_EXPRESSION_TUNING, CLAP_NOTE_EXPRESSION_VIBRATO, CLAP_NOTE_EXPRESSION_TUNING, CLAP_NOTE_EXPRESSION_VIBRATO, CLAP_NOTE_EXPRESSION_VOLUME,
CLAP_NOTE_EXPRESSION_VOLUME, CLAP_TRANSPORT_HAS_BEATS_TIMELINE, CLAP_TRANSPORT_HAS_BEATS_TIMELINE, CLAP_TRANSPORT_HAS_SECONDS_TIMELINE,
CLAP_TRANSPORT_HAS_SECONDS_TIMELINE, CLAP_TRANSPORT_HAS_TEMPO, CLAP_TRANSPORT_HAS_TEMPO, CLAP_TRANSPORT_HAS_TIME_SIGNATURE, CLAP_TRANSPORT_IS_LOOP_ACTIVE,
CLAP_TRANSPORT_HAS_TIME_SIGNATURE, CLAP_TRANSPORT_IS_LOOP_ACTIVE, CLAP_TRANSPORT_IS_PLAYING, CLAP_TRANSPORT_IS_PLAYING, CLAP_TRANSPORT_IS_RECORDING, CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL,
CLAP_TRANSPORT_IS_RECORDING, CLAP_TRANSPORT_IS_WITHIN_PRE_ROLL,
}; };
use clap_sys::ext::audio_ports::{ use clap_sys::ext::audio_ports::{
clap_audio_port_info, clap_plugin_audio_ports, CLAP_AUDIO_PORT_IS_MAIN, CLAP_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::{ use clap_sys::ext::audio_ports_config::{
clap_audio_ports_config, clap_plugin_audio_ports_config, CLAP_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::{ use clap_sys::ext::gui::{
clap_gui_resize_hints, clap_host_gui, clap_plugin_gui, clap_window, CLAP_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, CLAP_WINDOW_API_COCOA, CLAP_WINDOW_API_WIN32, CLAP_WINDOW_API_X11,
@ -193,8 +191,6 @@ pub struct Wrapper<P: ClapPlugin> {
clap_plugin_audio_ports: clap_plugin_audio_ports, clap_plugin_audio_ports: clap_plugin_audio_ports,
clap_plugin_event_filter: clap_plugin_event_filter,
clap_plugin_gui: clap_plugin_gui, clap_plugin_gui: clap_plugin_gui,
host_gui: AtomicRefCell<Option<ClapPtr<clap_host_gui>>>, host_gui: AtomicRefCell<Option<ClapPtr<clap_host_gui>>>,
@ -550,10 +546,6 @@ impl<P: ClapPlugin> Wrapper<P> {
get: Self::ext_audio_ports_get, 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 { clap_plugin_gui: clap_plugin_gui {
is_api_supported: Self::ext_gui_is_api_supported, is_api_supported: Self::ext_gui_is_api_supported,
get_preferred_api: Self::ext_gui_get_preferred_api, get_preferred_api: Self::ext_gui_get_preferred_api,
@ -2144,8 +2136,6 @@ impl<P: ClapPlugin> Wrapper<P> {
&wrapper.clap_plugin_audio_ports_config as *const _ as *const c_void &wrapper.clap_plugin_audio_ports_config as *const _ as *const c_void
} else if id == CStr::from_ptr(CLAP_EXT_AUDIO_PORTS) { } else if id == CStr::from_ptr(CLAP_EXT_AUDIO_PORTS) {
&wrapper.clap_plugin_audio_ports as *const _ as *const c_void &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() { } 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 // Only report that we support this extension if the plugin has an editor
&wrapper.clap_plugin_gui as *const _ as *const c_void &wrapper.clap_plugin_gui as *const _ as *const c_void
@ -2427,29 +2417,6 @@ impl<P: ClapPlugin> Wrapper<P> {
true 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( unsafe extern "C" fn ext_gui_is_api_supported(
_plugin: *const clap_plugin, _plugin: *const clap_plugin,
api: *const c_char, api: *const c_char,