12#ifndef __AUDACITY_VST_WRAPPER__
13#define __AUDACITY_VST_WRAPPER__
22#include <unordered_map>
50class wxDynamicLibrary;
67 virtual intptr_t
callDispatcher(
int opcode,
int index, intptr_t value,
void *ptr,
float opt) = 0;
88 std::unordered_map<wxString, std::optional<double> >
mParamsMap;
94 virtual void NeedIdle();
95 virtual void SizeWindow(
int w,
int h);
96 virtual void Automate(
int index,
float value);
119 , mMainThreadId{
std::this_thread::get_id() }
127 intptr_t callDispatcher(
int opcode,
int index,
128 intptr_t value,
void* ptr,
float opt)
override;
130 intptr_t constCallDispatcher(
int opcode,
int index,
131 intptr_t value,
void* ptr,
float opt)
const;
135 float callGetParameter(
int index)
const;
137 void callSetChunk(
bool isPgm,
int len,
void* buf);
138 void callSetChunk(
bool isPgm,
int len,
void* buf,
VstPatchChunkInfo* info)
const;
141 int GetString(wxString& outstr,
int opcode,
int index = 0)
const;
142 wxString GetString(
int opcode,
int index = 0)
const;
156 bool FetchSettings(
VSTSettings& vst3Settings,
bool doFetch=
true)
const;
158 bool StoreSettings(
const VSTSettings& vst3settings)
const;
175 bool LoadXML(
const wxFileName&
fn);
176 bool HandleXMLTag(
const std::string_view& tag,
const AttributesList& attrs)
override;
177 void HandleXMLEndTag(
const std::string_view& tag)
override;
178 void HandleXMLContent(
const std::string_view& content)
override;
179 XMLTagHandler* HandleXMLChild(
const std::string_view& tag)
override;
181 void SetString(
int opcode,
const wxString&
str,
int index = 0);
185 void callSetParameter(
int index,
float value)
const;
187 void SaveXML(
const wxFileName&
fn)
const;
190 bool LoadFXB(
const wxFileName&
fn);
191 bool LoadFXP(
const wxFileName&
fn);
192 bool LoadFXProgram(
unsigned char** bptr, ssize_t& len,
int index,
bool dryrun);
193 void callSetProgram(
int index);
195 void SaveFXB(
const wxFileName&
fn)
const;
196 void SaveFXP(
const wxFileName&
fn)
const;
197 void SaveFXProgram(wxMemoryBuffer& buf,
int index)
const;
200 intptr_t mCurrentEffectID {};
206#if defined(__WXMSW__)
209 struct ModuleDeleter {
210 void operator() (
void*)
const;
212 using ModuleHandle = std::unique_ptr < char, ModuleDeleter >;
219 bool mInteractive{
false };
220 unsigned mAudioIns{ 0 };
221 unsigned mAudioOuts{ 0 };
228 void ResetModuleAndHandle();
230#if defined(__WXMAC__)
240 : mpHandle{ pHandle }, mNum{ num }
244 if (
this != &other) {
247 other.mpHandle =
nullptr;
263 float GetSampleRate();
266 int mBufferDelay{ 0 };
268 int GetProcessLevel();
269 int mProcessLevel{ 1 };
273 static intptr_t AudioMaster(
AEffect *effect,
285 virtual void SetBufferDelay(
int samples);
290 std::unique_ptr<EffectInstance::Message>
319 std::unique_ptr<Message>
Clone()
const override;
Wrap resource pointers from Apple Core SDK for RAII.
EffectDistortionSettings params
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
static Settings & settings()
void(* processFn)(AEffect *effect, float **inputs, float **outputs, int sampleframes)
void(* setParameterFn)(AEffect *effect, int index, float parameter)
float(* getParameterFn)(AEffect *effect, int index)
intptr_t(* dispatcherFn)(AEffect *effect, int opCode, int index, intptr_t value, void *ptr, float opt)
struct __CFBundle * CFBundleRef
std::vector< Attribute > AttributesList
intptr_t(* audioMasterCallback)(AEffect *, int32_t, int32_t, intptr_t, void *, float)
VST Effects class, conforming to VST layout.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Type of messages to send from main thread to processing.
virtual intptr_t callDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt)=0
This class is an interface which should be implemented by classes which wish to be able to load and s...
THEME_RESOURCES_API void Load()
TranslatableString Message(unsigned trackCount)
Externalized state of a plug-in.
VSTMessage(int id, double value, size_t numParams)
std::vector< std::optional< double > > ParamVector
std::unique_ptr< Message > Clone() const override
void Merge(Message &&src) override
VSTMessage(std::vector< char > chunk, ParamVector params)
void Assign(Message &&src) override
std::vector< char > mChunk
std::vector< char > mChunk
std::unordered_map< wxString, std::optional< double > > mParamsMap
ResourceHandle & operator=(ResourceHandle &&other)
ResourceHandle(CFBundleRef pHandle=nullptr, CFBundleRefNum num=0)
static VSTSettings & GetSettings(EffectSettings &settings)
std::unique_ptr< wxDynamicLibrary > ModuleHandle
CF_ptr< CFBundleRef > BundleHandle
std::recursive_mutex mDispatcherLock
VstPatchChunkInfo mXMLInfo
std::thread::id mMainThreadId
VSTWrapper(const PluginPath &path)
std::function< bool(const ParameterInfo &pi) > ParameterVisitor
static const VSTSettings & GetSettings(const EffectSettings &settings)