diff --git a/src/wrapper/vst3.rs b/src/wrapper/vst3.rs
index ee3aa03f..3cf0aae5 100644
--- a/src/wrapper/vst3.rs
+++ b/src/wrapper/vst3.rs
@@ -14,12 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-// The VST3 macro generates an `allocate()` function for initializing the struct, so Clippy will
-// complain as soon as a struct has more than 8 fields
-#![allow(clippy::too_many_arguments)]
-
-use crossbeam::atomic::AtomicCell;
-use lazy_static::lazy_static;
use parking_lot::{RwLock, RwLockWriteGuard};
use raw_window_handle::RawWindowHandle;
use std::any::Any;
@@ -29,24 +23,26 @@ use std::ffi::{c_void, CStr};
use std::marker::PhantomData;
use std::mem::{self, MaybeUninit};
use std::ptr;
-use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
+use std::sync::atomic::Ordering;
use std::sync::Arc;
use vst3_sys::base::{kInvalidArgument, kNoInterface, kResultFalse, kResultOk, tresult, TBool};
use vst3_sys::base::{IBStream, IPluginBase, IPluginFactory, IPluginFactory2, IPluginFactory3};
use vst3_sys::gui::IPlugView;
use vst3_sys::utils::SharedVstPtr;
use vst3_sys::vst::{
- IAudioProcessor, IComponent, IComponentHandler, IEditController, IEventList, IParamValueQueue,
- IParameterChanges, TChar,
+ IAudioProcessor, IComponent, IEditController, IEventList, IParamValueQueue, IParameterChanges,
+ TChar,
};
use vst3_sys::VST3;
use widestring::U16CStr;
+mod inner;
#[macro_use]
mod util;
-use crate::buffer::Buffer;
-use crate::context::{EventLoop, GuiContext, MainThreadExecutor, OsEventLoop, ProcessContext};
+use self::inner::WrapperInner;
+use self::util::{VstPtr, BYPASS_PARAM_HASH};
+use crate::context::{EventLoop, ProcessContext};
use crate::param::internals::ParamPtr;
use crate::param::range::Range;
use crate::param::Param;
@@ -54,7 +50,7 @@ use crate::plugin::{
BufferConfig, BusConfig, Editor, NoteEvent, Plugin, ProcessStatus, Vst3Plugin,
};
use crate::wrapper::state::{ParamValue, State};
-use crate::wrapper::util::{hash_param_id, process_wrapper, strlcpy, u16strlcpy};
+use crate::wrapper::util::{process_wrapper, strlcpy, u16strlcpy};
use crate::ParentWindowHandle;
// Alias needed for the VST3 attribute macro
@@ -78,84 +74,8 @@ const VST3_PLATFORM_UIVIEW: &str = "UIView";
#[allow(unused)]
const VST3_PLATFORM_X11_WINDOW: &str = "X11EmbedWindowID";
-/// Right now the wrapper adds its own bypass parameter.
-///
-/// TODO: Actually use this parameter.
-const BYPASS_PARAM_ID: &str = "bypass";
-lazy_static! {
- static ref BYPASS_PARAM_HASH: u32 = hash_param_id(BYPASS_PARAM_ID);
-}
-
-/// The actual wrapper bits. We need this as an `Arc` so we can safely use our event loop API.
-/// Since we can't combine that with VST3's interior reference counting this just has to be moved to
-/// its own struct.
-struct WrapperInner {
- /// The wrapped plugin instance.
- plugin: RwLock
,
- /// The plugin's editor, if it has one. This object does not do anything on its own, but we need
- /// to instantiate this in advance so we don't need to lock the entire [Plugin] object when
- /// creating an editor.
- editor: Option>,
-
- /// The host's `IComponentHandler` instance, if passed through
- /// `IEditController::set_component_handler`.
- component_handler: RwLock