From ffe4642aa5c35cb61801a7bc1d4ee25b84bccd9b Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 7 May 2022 13:24:17 +0200 Subject: [PATCH] Implement IProcessContextRequirements This is needed for VST 3.7. We claim to be a VST 3.6.14 plugin, but implementing this anyways seems like the safe bet. I doubt many hosts would, but under VST 3.7 hosts are allowed to not send any transport information unless this interface is implemented. --- src/wrapper/vst3/factory.rs | 3 ++- src/wrapper/vst3/wrapper.rs | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/wrapper/vst3/factory.rs b/src/wrapper/vst3/factory.rs index 17733808..00cc828f 100644 --- a/src/wrapper/vst3/factory.rs +++ b/src/wrapper/vst3/factory.rs @@ -13,7 +13,8 @@ use super::wrapper::Wrapper; use crate::plugin::Vst3Plugin; use crate::wrapper::util::strlcpy; -/// The VST3 SDK version this is roughtly based on. +/// The VST3 SDK version this is roughtly based on. The bindings include some VST 3.7 things but not +/// everything, so we'll play it safe. const VST3_SDK_VERSION: &str = "VST 3.6.14"; #[doc(hidden)] diff --git a/src/wrapper/vst3/wrapper.rs b/src/wrapper/vst3/wrapper.rs index cb49a89c..2f25963a 100644 --- a/src/wrapper/vst3/wrapper.rs +++ b/src/wrapper/vst3/wrapper.rs @@ -4,15 +4,16 @@ use std::mem::{self, MaybeUninit}; use std::ptr; use std::sync::atomic::Ordering; use std::sync::Arc; +use vst3_com::vst::IProcessContextRequirementsFlags; use vst3_sys::base::{kInvalidArgument, kNoInterface, kResultFalse, kResultOk, tresult, TBool}; use vst3_sys::base::{IBStream, IPluginBase}; use vst3_sys::utils::SharedVstPtr; use vst3_sys::vst::{ kNoParamId, kNoParentUnitId, kNoProgramListId, kRootUnitId, Event, EventTypes, IAudioProcessor, IComponent, IEditController, IEventList, IMidiMapping, INoteExpressionController, - IParamValueQueue, IParameterChanges, IUnitInfo, LegacyMidiCCOutEvent, NoteExpressionTypeInfo, - NoteExpressionValueDescription, NoteOffEvent, NoteOnEvent, ParameterFlags, PolyPressureEvent, - ProgramListInfo, TChar, UnitInfo, + IParamValueQueue, IParameterChanges, IProcessContextRequirements, IUnitInfo, + LegacyMidiCCOutEvent, NoteExpressionTypeInfo, NoteExpressionValueDescription, NoteOffEvent, + NoteOnEvent, ParameterFlags, PolyPressureEvent, ProgramListInfo, TChar, UnitInfo, }; use vst3_sys::VST3; use widestring::U16CStr; @@ -42,6 +43,7 @@ use vst3_sys as vst3_com; IAudioProcessor, IMidiMapping, INoteExpressionController, + IProcessContextRequirements, IUnitInfo ))] pub(crate) struct Wrapper { @@ -1406,6 +1408,17 @@ impl INoteExpressionController for Wrapper

{ } } +impl IProcessContextRequirements for Wrapper

{ + unsafe fn get_process_context_requirements(&self) -> u32 { + IProcessContextRequirementsFlags::kNeedProjectTimeMusic + | IProcessContextRequirementsFlags::kNeedBarPositionMusic + | IProcessContextRequirementsFlags::kNeedCycleMusic + | IProcessContextRequirementsFlags::kNeedTimeSignature + | IProcessContextRequirementsFlags::kNeedTempo + | IProcessContextRequirementsFlags::kNeedTransportState + } +} + impl IUnitInfo for Wrapper

{ unsafe fn get_unit_count(&self) -> i32 { self.inner.param_units.len() as i32