1
0
Fork 0

Target vst3-sys fork with better pointer semantics

This commit is contained in:
Robbert van der Helm 2022-01-30 01:16:27 +01:00
parent 29d110aee7
commit 0c24398234
3 changed files with 12 additions and 12 deletions

8
Cargo.lock generated
View file

@ -122,7 +122,7 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]] [[package]]
name = "vst3-com" name = "vst3-com"
version = "0.1.0" 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 = [ dependencies = [
"vst3-com-macros", "vst3-com-macros",
] ]
@ -130,7 +130,7 @@ dependencies = [
[[package]] [[package]]
name = "vst3-com-macros" name = "vst3-com-macros"
version = "0.2.0" 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 = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -141,7 +141,7 @@ dependencies = [
[[package]] [[package]]
name = "vst3-com-macros-support" name = "vst3-com-macros-support"
version = "0.2.0" 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 = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -151,7 +151,7 @@ dependencies = [
[[package]] [[package]]
name = "vst3-sys" name = "vst3-sys"
version = "0.1.0" 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 = [ dependencies = [
"vst3-com", "vst3-com",
] ]

View file

@ -13,5 +13,5 @@ nih_plug_derive = { path = "nih_plug_derive" }
lazy_static = "1.4" lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" 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" widestring = "1.0.0-beta.1"

View file

@ -29,7 +29,7 @@ use std::ptr;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use vst3_sys::base::{kInvalidArgument, kNoInterface, kResultFalse, kResultOk, tresult, TBool}; use vst3_sys::base::{kInvalidArgument, kNoInterface, kResultFalse, kResultOk, tresult, TBool};
use vst3_sys::base::{IBStream, IPluginBase, IPluginFactory, IPluginFactory2, IPluginFactory3}; use vst3_sys::base::{IBStream, IPluginBase, IPluginFactory, IPluginFactory2, IPluginFactory3};
use vst3_sys::utils::VstPtr; use vst3_sys::utils::SharedVstPtr;
use vst3_sys::vst::{ use vst3_sys::vst::{
IAudioProcessor, IComponent, IEditController, IParamValueQueue, IParameterChanges, TChar, IAudioProcessor, IComponent, IEditController, IParamValueQueue, IParameterChanges, TChar,
}; };
@ -296,7 +296,7 @@ impl<P: Plugin> IComponent for Wrapper<'_, P> {
kResultOk kResultOk
} }
unsafe fn set_state(&self, state: VstPtr<dyn IBStream>) -> tresult { unsafe fn set_state(&self, state: SharedVstPtr<dyn IBStream>) -> tresult {
check_null_ptr!(state); check_null_ptr!(state);
let state = state.upgrade().unwrap(); let state = state.upgrade().unwrap();
@ -370,7 +370,7 @@ impl<P: Plugin> IComponent for Wrapper<'_, P> {
kResultOk kResultOk
} }
unsafe fn get_state(&self, state: VstPtr<dyn IBStream>) -> tresult { unsafe fn get_state(&self, state: SharedVstPtr<dyn IBStream>) -> tresult {
check_null_ptr!(state); check_null_ptr!(state);
let state = state.upgrade().unwrap(); let state = state.upgrade().unwrap();
@ -412,12 +412,12 @@ impl<P: Plugin> IComponent for Wrapper<'_, P> {
} }
impl<P: Plugin> IEditController for Wrapper<'_, P> { impl<P: Plugin> IEditController for Wrapper<'_, P> {
unsafe fn set_component_state(&self, _state: VstPtr<dyn IBStream>) -> tresult { unsafe fn set_component_state(&self, _state: SharedVstPtr<dyn IBStream>) -> tresult {
// We have a single file component, so we don't need to do anything here // We have a single file component, so we don't need to do anything here
kResultOk kResultOk
} }
unsafe fn set_state(&self, state: VstPtr<dyn IBStream>) -> tresult { unsafe fn set_state(&self, state: SharedVstPtr<dyn IBStream>) -> tresult {
// We have a single file component, so there's only one `set_state()` function. Unlike C++, // 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 // 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 // different treats, but because of the Rust implementation the host may call either of
@ -425,7 +425,7 @@ impl<P: Plugin> IEditController for Wrapper<'_, P> {
IComponent::set_state(self, state) IComponent::set_state(self, state)
} }
unsafe fn get_state(&self, state: VstPtr<dyn IBStream>) -> tresult { unsafe fn get_state(&self, state: SharedVstPtr<dyn IBStream>) -> tresult {
// Same for this function // Same for this function
IComponent::get_state(self, state) IComponent::get_state(self, state)
} }
@ -592,7 +592,7 @@ impl<P: Plugin> IEditController for Wrapper<'_, P> {
unsafe fn set_component_handler( unsafe fn set_component_handler(
&self, &self,
_handler: VstPtr<dyn vst3_sys::vst::IComponentHandler>, _handler: SharedVstPtr<dyn vst3_sys::vst::IComponentHandler>,
) -> tresult { ) -> tresult {
// TODO: Use this when we add GUI support // TODO: Use this when we add GUI support
kResultOk kResultOk