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

View file

@ -13,6 +13,5 @@ nih_plug_derive = { path = "nih_plug_derive" }
lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# Upstream currently does not support structs with generics and comments
vst3-sys = { git = "https://github.com/robbert-vdh/vst3-sys.git", branch = "fix/vst3-macro-generics" }
vst3-sys = { git = "https://github.com/RustAudio/vst3-sys.git" }
widestring = "1.0.0-beta.1"

View file

@ -29,10 +29,11 @@ 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::vst::{
IAudioProcessor, IComponent, IEditController, IParamValueQueue, IParameterChanges, TChar,
};
use vst3_sys::{ComPtr, VST3};
use vst3_sys::VST3;
use widestring::U16CStr;
use crate::params::{Param, ParamPtr};
@ -295,10 +296,10 @@ impl<P: Plugin> IComponent for Wrapper<'_, P> {
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);
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
// 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
}
unsafe fn get_state(&self, state: *mut c_void) -> tresult {
unsafe fn get_state(&self, state: VstPtr<dyn IBStream>) -> tresult {
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.
let params = self
@ -411,12 +412,12 @@ impl<P: Plugin> IComponent 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
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++,
// 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
@ -424,7 +425,7 @@ impl<P: Plugin> IEditController for Wrapper<'_, P> {
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
IComponent::get_state(self, state)
}
@ -589,7 +590,10 @@ impl<P: Plugin> IEditController for Wrapper<'_, P> {
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
kResultOk
}