// vst_entry.cpp — the VST3 module class factory. Enumerates the one class this module // offers via the SDK's factory macros. Windows module exports — GetPluginFactory (here, // via BEGIN_FACTORY) and InitDll/ExitDll (SDK's dllmain.cpp) — are how REAPER discovers // and loads a VST3. Verified against vendor/vst3sdk/public.sdk/source/main/: the plug-in // must supply InitModule/DeinitModule (linked here via moduleinit.cpp). classFlags = 0 for // a SingleComponentEffect (non-distributable), matching the AGain example. #include "public.sdk/source/main/pluginfactory.h" #include "pluginterfaces/vst/ivstaudioprocessor.h" // kVstAudioEffectClass, PlugType #include "core/version/app_version.h" // vstPluginName / appVersion — the channel-derived identity #include "ext_keys.h" // kProjExtNamespace — the pairing-surface assertion target #include "shell/instrument/reasampler_processor.h" #include "shell/instrument/reasampler_vst.h" // channel-selected class UID (REASAMPLER_ACTIVE_UID_*) // The instrument's plugin identity (UID + filename + display) and its data identity // (ext_keys.h's kProjExtNamespace(), delegating to app_version::extStateNamespace()) both // fork from the one REASAMPLER_CHANNEL_IS_BETA bit, so a beta VST can only ever talk to // the beta extension. // // The guard below pins the two forks together so a refactor cannot split them: it asserts // the class UID this factory registers matches this binary's channel bit. If the #if in // reasampler_vst.h picked the wrong branch, the instrument's identity would diverge from // the namespace ext_keys reads (a beta-named plugin presenting the stable UID, or vice // versa) — this breaks the build instead of shipping that silent split. #if REASAMPLER_CHANNEL_IS_BETA static_assert(REASAMPLER_ACTIVE_UID_1 == REASAMPLER_PROC_UID_BETA_1 && REASAMPLER_ACTIVE_UID_2 == REASAMPLER_PROC_UID_BETA_2 && REASAMPLER_ACTIVE_UID_3 == REASAMPLER_PROC_UID_BETA_3 && REASAMPLER_ACTIVE_UID_4 == REASAMPLER_PROC_UID_BETA_4, "S18: a beta build must register the BETA class UID that pairs with the beta " "extension's ext-state namespace — the UID selection and the channel bit split"); #else static_assert(REASAMPLER_ACTIVE_UID_1 == REASAMPLER_PROC_UID_1 && REASAMPLER_ACTIVE_UID_2 == REASAMPLER_PROC_UID_2 && REASAMPLER_ACTIVE_UID_3 == REASAMPLER_PROC_UID_3 && REASAMPLER_ACTIVE_UID_4 == REASAMPLER_PROC_UID_4, "S18: a stable build must register the STABLE class UID that pairs with the " "stable ext-state namespace — the UID selection and the channel bit split"); #endif BEGIN_FACTORY(reasampler::vst::kVendorName, reasampler::vst::kVendorUrl, reasampler::vst::kVendorEmail, Steinberg::PFactoryInfo::kNoFlags) // Display name + version are channel-derived from app_version, not literals. DEF_CLASS2 // expands inside GetPluginFactory(); PClassInfo2's constructor copies the char* into its // own buffer at that call, so .c_str() on the accessors' static-storage strings is valid. DEF_CLASS2(INLINE_UID(REASAMPLER_ACTIVE_UID_1, REASAMPLER_ACTIVE_UID_2, REASAMPLER_ACTIVE_UID_3, REASAMPLER_ACTIVE_UID_4), Steinberg::PClassInfo::kManyInstances, // cardinality kVstAudioEffectClass, // component category (fixed) reasampler::version::vstPluginName().c_str(), // plug-in display name (channel-derived) 0, // single-component => 0 Steinberg::Vst::PlugType::kInstrumentSynthSampler, // subcategory reasampler::version::appVersion().c_str(), // plug-in version (channel: -beta render) kVstVersionString, // VST3 SDK version (fixed) reasampler::vst::ReaSamplerProcessor::createInstance) END_FACTORY