From ce37ec288e05ded258539f7514141dc8cb5e3e01 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 7 Feb 2022 00:19:05 +0100 Subject: [PATCH] Don't store a GUID in the factory This isn't actually needed. --- src/wrapper/vst3.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/wrapper/vst3.rs b/src/wrapper/vst3.rs index 6c19207d..b246a428 100644 --- a/src/wrapper/vst3.rs +++ b/src/wrapper/vst3.rs @@ -919,21 +919,13 @@ impl IAudioProcessor for Wrapper

{ #[doc(hidden)] #[VST3(implements(IPluginFactory, IPluginFactory2, IPluginFactory3))] pub struct Factory { - /// The exposed plugin's GUID. Instead of generating this, we'll just let the programmer decide - /// on their own. - cid: GUID, /// The type will be used for constructing plugin instances later. _phantom: PhantomData

, } impl Factory

{ pub fn new() -> Box { - Self::allocate( - GUID { - data: P::VST3_CLASS_ID, - }, - PhantomData::default(), - ) + Self::allocate(PhantomData::default()) } } @@ -965,7 +957,7 @@ impl IPluginFactory for Factory

{ *info = mem::zeroed(); let info = &mut *info; - info.cid = self.cid; + info.cid.data = P::VST3_CLASS_ID; info.cardinality = vst3_sys::base::ClassCardinality::kManyInstances as i32; strlcpy(&mut info.category, "Audio Module Class"); strlcpy(&mut info.name, P::NAME); @@ -981,7 +973,7 @@ impl IPluginFactory for Factory

{ ) -> tresult { check_null_ptr!(cid, obj); - if *cid != self.cid { + if (*cid).data != P::VST3_CLASS_ID { return kNoInterface; } @@ -1004,7 +996,7 @@ impl IPluginFactory2 for Factory

{ *info = mem::zeroed(); let info = &mut *info; - info.cid = self.cid; + info.cid.data = P::VST3_CLASS_ID; info.cardinality = vst3_sys::base::ClassCardinality::kManyInstances as i32; strlcpy(&mut info.category, "Audio Module Class"); strlcpy(&mut info.name, P::NAME); @@ -1031,7 +1023,7 @@ impl IPluginFactory3 for Factory

{ *info = mem::zeroed(); let info = &mut *info; - info.cid = self.cid; + info.cid.data = P::VST3_CLASS_ID; info.cardinality = vst3_sys::base::ClassCardinality::kManyInstances as i32; strlcpy(&mut info.category, "Audio Module Class"); u16strlcpy(&mut info.name, P::NAME);