1
0
Fork 0

Upgrade vst3-sys dependency

This commit is contained in:
Robbert van der Helm 2022-01-29 20:54:52 +01:00
parent 6fc4d80483
commit 902c3b2bf6
3 changed files with 18 additions and 15 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/robbert-vdh/vst3-sys.git?branch=fix/vst3-macro-generics#5dee36c1eac24e13c039d68f187a1899bc9069e6" source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9"
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/robbert-vdh/vst3-sys.git?branch=fix/vst3-macro-generics#5dee36c1eac24e13c039d68f187a1899bc9069e6" source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9"
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/robbert-vdh/vst3-sys.git?branch=fix/vst3-macro-generics#5dee36c1eac24e13c039d68f187a1899bc9069e6" source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9"
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/robbert-vdh/vst3-sys.git?branch=fix/vst3-macro-generics#5dee36c1eac24e13c039d68f187a1899bc9069e6" source = "git+https://github.com/RustAudio/vst3-sys.git#b65de68a7ad22b67e246948baf888ff08b3f31e9"
dependencies = [ dependencies = [
"vst3-com", "vst3-com",
] ]

View file

@ -13,6 +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"
# Upstream currently does not support structs with generics and comments vst3-sys = { git = "https://github.com/RustAudio/vst3-sys.git" }
vst3-sys = { git = "https://github.com/robbert-vdh/vst3-sys.git", branch = "fix/vst3-macro-generics" }
widestring = "1.0.0-beta.1" widestring = "1.0.0-beta.1"

View file

@ -29,10 +29,11 @@ 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::vst::{ use vst3_sys::vst::{
IAudioProcessor, IComponent, IEditController, IParamValueQueue, IParameterChanges, TChar, IAudioProcessor, IComponent, IEditController, IParamValueQueue, IParameterChanges, TChar,
}; };
use vst3_sys::{ComPtr, VST3}; use vst3_sys::VST3;
use widestring::U16CStr; use widestring::U16CStr;
use crate::params::{Param, ParamPtr}; use crate::params::{Param, ParamPtr};
@ -295,10 +296,10 @@ impl<P: Plugin> IComponent for Wrapper<'_, P> {
kResultOk kResultOk
} }
unsafe fn set_state(&self, state: *mut c_void) -> tresult { unsafe fn set_state(&self, state: VstPtr<dyn IBStream>) -> tresult {
check_null_ptr!(state); check_null_ptr!(state);
let state: ComPtr<dyn IBStream> = ComPtr::new(state as *mut _); let state = state.upgrade().unwrap();
// We need to know how large the state is before we can read it. The current position can be // We need to know how large the state is before we can read it. The current position can be
// zero, but it can also be something else. Bitwig prepends the preset header in the stream, // zero, but it can also be something else. Bitwig prepends the preset header in the stream,
@ -369,10 +370,10 @@ impl<P: Plugin> IComponent for Wrapper<'_, P> {
kResultOk kResultOk
} }
unsafe fn get_state(&self, state: *mut c_void) -> tresult { unsafe fn get_state(&self, state: VstPtr<dyn IBStream>) -> tresult {
check_null_ptr!(state); check_null_ptr!(state);
let state: ComPtr<dyn IBStream> = ComPtr::new(state as *mut _); let state = state.upgrade().unwrap();
// We'll serialize parmaeter values as a simple `string_param_id: display_value` map. // We'll serialize parmaeter values as a simple `string_param_id: display_value` map.
let params = self let params = self
@ -411,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: *mut c_void) -> tresult { unsafe fn set_component_state(&self, _state: VstPtr<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: *mut c_void) -> tresult { unsafe fn set_state(&self, state: VstPtr<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
@ -424,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: *mut c_void) -> tresult { unsafe fn get_state(&self, state: VstPtr<dyn IBStream>) -> tresult {
// Same for this function // Same for this function
IComponent::get_state(self, state) IComponent::get_state(self, state)
} }
@ -589,7 +590,10 @@ impl<P: Plugin> IEditController for Wrapper<'_, P> {
self.set_normalized_value_by_hash(id, value) self.set_normalized_value_by_hash(id, value)
} }
unsafe fn set_component_handler(&self, _handler: *mut c_void) -> tresult { unsafe fn set_component_handler(
&self,
_handler: VstPtr<dyn vst3_sys::vst::IComponentHandler>,
) -> tresult {
// TODO: Use this when we add GUI support // TODO: Use this when we add GUI support
kResultOk kResultOk
} }