1
0
Fork 0

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.
This commit is contained in:
Robbert van der Helm 2022-05-07 13:24:17 +02:00
parent f05e31d9e3
commit ffe4642aa5
2 changed files with 18 additions and 4 deletions

View file

@ -13,7 +13,8 @@ use super::wrapper::Wrapper;
use crate::plugin::Vst3Plugin; use crate::plugin::Vst3Plugin;
use crate::wrapper::util::strlcpy; 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"; const VST3_SDK_VERSION: &str = "VST 3.6.14";
#[doc(hidden)] #[doc(hidden)]

View file

@ -4,15 +4,16 @@ use std::mem::{self, MaybeUninit};
use std::ptr; use std::ptr;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::Arc;
use vst3_com::vst::IProcessContextRequirementsFlags;
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}; use vst3_sys::base::{IBStream, IPluginBase};
use vst3_sys::utils::SharedVstPtr; use vst3_sys::utils::SharedVstPtr;
use vst3_sys::vst::{ use vst3_sys::vst::{
kNoParamId, kNoParentUnitId, kNoProgramListId, kRootUnitId, Event, EventTypes, IAudioProcessor, kNoParamId, kNoParentUnitId, kNoProgramListId, kRootUnitId, Event, EventTypes, IAudioProcessor,
IComponent, IEditController, IEventList, IMidiMapping, INoteExpressionController, IComponent, IEditController, IEventList, IMidiMapping, INoteExpressionController,
IParamValueQueue, IParameterChanges, IUnitInfo, LegacyMidiCCOutEvent, NoteExpressionTypeInfo, IParamValueQueue, IParameterChanges, IProcessContextRequirements, IUnitInfo,
NoteExpressionValueDescription, NoteOffEvent, NoteOnEvent, ParameterFlags, PolyPressureEvent, LegacyMidiCCOutEvent, NoteExpressionTypeInfo, NoteExpressionValueDescription, NoteOffEvent,
ProgramListInfo, TChar, UnitInfo, NoteOnEvent, ParameterFlags, PolyPressureEvent, ProgramListInfo, TChar, UnitInfo,
}; };
use vst3_sys::VST3; use vst3_sys::VST3;
use widestring::U16CStr; use widestring::U16CStr;
@ -42,6 +43,7 @@ use vst3_sys as vst3_com;
IAudioProcessor, IAudioProcessor,
IMidiMapping, IMidiMapping,
INoteExpressionController, INoteExpressionController,
IProcessContextRequirements,
IUnitInfo IUnitInfo
))] ))]
pub(crate) struct Wrapper<P: Vst3Plugin> { pub(crate) struct Wrapper<P: Vst3Plugin> {
@ -1406,6 +1408,17 @@ impl<P: Vst3Plugin> INoteExpressionController for Wrapper<P> {
} }
} }
impl<P: Vst3Plugin> IProcessContextRequirements for Wrapper<P> {
unsafe fn get_process_context_requirements(&self) -> u32 {
IProcessContextRequirementsFlags::kNeedProjectTimeMusic
| IProcessContextRequirementsFlags::kNeedBarPositionMusic
| IProcessContextRequirementsFlags::kNeedCycleMusic
| IProcessContextRequirementsFlags::kNeedTimeSignature
| IProcessContextRequirementsFlags::kNeedTempo
| IProcessContextRequirementsFlags::kNeedTransportState
}
}
impl<P: Vst3Plugin> IUnitInfo for Wrapper<P> { impl<P: Vst3Plugin> IUnitInfo for Wrapper<P> {
unsafe fn get_unit_count(&self) -> i32 { unsafe fn get_unit_count(&self) -> i32 {
self.inner.param_units.len() as i32 self.inner.param_units.len() as i32