From 0c24398234b7ac70644a42664b6a5139f4dbb2eb Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 30 Jan 2022 01:16:27 +0100 Subject: [PATCH] Target vst3-sys fork with better pointer semantics --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- src/wrapper/vst3.rs | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62678752..522d533d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,7 +122,7 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "vst3-com" version = "0.1.0" -source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9" +source = "git+https://github.com/robbert-vdh/vst3-sys.git?branch=feature/pointer-rewrite#5307e7763ed3fb37e67cd5ba9627d33b9bbb9426" dependencies = [ "vst3-com-macros", ] @@ -130,7 +130,7 @@ dependencies = [ [[package]] name = "vst3-com-macros" version = "0.2.0" -source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9" +source = "git+https://github.com/robbert-vdh/vst3-sys.git?branch=feature/pointer-rewrite#5307e7763ed3fb37e67cd5ba9627d33b9bbb9426" dependencies = [ "proc-macro2", "quote", @@ -141,7 +141,7 @@ dependencies = [ [[package]] name = "vst3-com-macros-support" version = "0.2.0" -source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9" +source = "git+https://github.com/robbert-vdh/vst3-sys.git?branch=feature/pointer-rewrite#5307e7763ed3fb37e67cd5ba9627d33b9bbb9426" dependencies = [ "proc-macro2", "quote", @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "vst3-sys" version = "0.1.0" -source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9" +source = "git+https://github.com/robbert-vdh/vst3-sys.git?branch=feature/pointer-rewrite#5307e7763ed3fb37e67cd5ba9627d33b9bbb9426" dependencies = [ "vst3-com", ] diff --git a/Cargo.toml b/Cargo.toml index 8662cf4c..26400503 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ nih_plug_derive = { path = "nih_plug_derive" } lazy_static = "1.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -vst3-sys = { git = "https://github.com/RustAudio/vst3-sys.git" } +vst3-sys = { git = "https://github.com/robbert-vdh/vst3-sys.git", branch = "feature/pointer-rewrite" } widestring = "1.0.0-beta.1" diff --git a/src/wrapper/vst3.rs b/src/wrapper/vst3.rs index c13cc2fb..f80f8010 100644 --- a/src/wrapper/vst3.rs +++ b/src/wrapper/vst3.rs @@ -29,7 +29,7 @@ use std::ptr; use std::sync::atomic::{AtomicBool, Ordering}; use vst3_sys::base::{kInvalidArgument, kNoInterface, kResultFalse, kResultOk, tresult, TBool}; use vst3_sys::base::{IBStream, IPluginBase, IPluginFactory, IPluginFactory2, IPluginFactory3}; -use vst3_sys::utils::VstPtr; +use vst3_sys::utils::SharedVstPtr; use vst3_sys::vst::{ IAudioProcessor, IComponent, IEditController, IParamValueQueue, IParameterChanges, TChar, }; @@ -296,7 +296,7 @@ impl IComponent for Wrapper<'_, P> { kResultOk } - unsafe fn set_state(&self, state: VstPtr) -> tresult { + unsafe fn set_state(&self, state: SharedVstPtr) -> tresult { check_null_ptr!(state); let state = state.upgrade().unwrap(); @@ -370,7 +370,7 @@ impl IComponent for Wrapper<'_, P> { kResultOk } - unsafe fn get_state(&self, state: VstPtr) -> tresult { + unsafe fn get_state(&self, state: SharedVstPtr) -> tresult { check_null_ptr!(state); let state = state.upgrade().unwrap(); @@ -412,12 +412,12 @@ impl IComponent for Wrapper<'_, P> { } impl IEditController for Wrapper<'_, P> { - unsafe fn set_component_state(&self, _state: VstPtr) -> tresult { + unsafe fn set_component_state(&self, _state: SharedVstPtr) -> tresult { // We have a single file component, so we don't need to do anything here kResultOk } - unsafe fn set_state(&self, state: VstPtr) -> tresult { + unsafe fn set_state(&self, state: SharedVstPtr) -> tresult { // We have a single file component, so there's only one `set_state()` function. Unlike C++, // Rust allows you to have multiple methods with the same name when they're provided by // different treats, but because of the Rust implementation the host may call either of @@ -425,7 +425,7 @@ impl IEditController for Wrapper<'_, P> { IComponent::set_state(self, state) } - unsafe fn get_state(&self, state: VstPtr) -> tresult { + unsafe fn get_state(&self, state: SharedVstPtr) -> tresult { // Same for this function IComponent::get_state(self, state) } @@ -592,7 +592,7 @@ impl IEditController for Wrapper<'_, P> { unsafe fn set_component_handler( &self, - _handler: VstPtr, + _handler: SharedVstPtr, ) -> tresult { // TODO: Use this when we add GUI support kResultOk