iPlug2 - C++ Audio Plug-in Framework
IPlugVST2.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5 
6  See LICENSE.txt for more info.
7 
8  ==============================================================================
9 */
10 
11 #ifndef _IPLUGAPI_
12 #define _IPLUGAPI_
13 // Only load one API class!
14 
20 #include "aeffectx.h"
21 #include "IPlugAPIBase.h"
22 #include "IPlugProcessor.h"
23 
24 BEGIN_IPLUG_NAMESPACE
25 
27 struct InstanceInfo
28 {
29  audioMasterCallback mVSTHostCallback;
30 };
31 
34 class IPlugVST2 : public IPlugAPIBase
35  , public IPlugProcessor
36 {
37 public:
38  IPlugVST2(const InstanceInfo& info, const Config& config);
39 
40  //IPlugAPIBase
41  void BeginInformHostOfParamChange(int idx) override;
42  void InformHostOfParamChange(int idx, double normalizedValue) override;
43  void EndInformHostOfParamChange(int idx) override;
44  void InformHostOfPresetChange() override;
45  void HostSpecificInit() override;
46  bool EditorResize(int viewWidth, int viewHeight) override;
47 
48  //IPlugProcessor
49  void SetLatency(int samples) override;
50  bool SendMidiMsg(const IMidiMsg& msg) override;
51  bool SendSysEx(const ISysEx& msg) override;
52 
53  //IPlugVST
54  audioMasterCallback& GetHostCallback() { return mHostCallback; }
55  AEffect& GetAEffect() { return mAEffect; }
56  void OutputSysexFromEditor();
57 
58 private:
59  virtual VstIntPtr VSTVendorSpecific(VstInt32 idx, VstIntPtr value, void* ptr, float opt) { return 0; }
60  virtual VstIntPtr VSTCanDo(const char* hostString) { return 0; }
61 
69  template <class SAMPLETYPE>
70  void VSTPreProcess(SAMPLETYPE** inputs, SAMPLETYPE** outputs, VstInt32 nFrames);
71 
72  static VstIntPtr VSTCALLBACK VSTDispatcher(AEffect *pEffect, VstInt32 opCode, VstInt32 idx, VstIntPtr value, void *ptr, float opt);
73  static void VSTCALLBACK VSTProcess(AEffect *pEffect, float **inputs, float **outputs, VstInt32 nFrames); // Deprecated.
74  static void VSTCALLBACK VSTProcessReplacing(AEffect *pEffect, float **inputs, float **outputs, VstInt32 nFrames);
75  static void VSTCALLBACK VSTProcessDoubleReplacing(AEffect *pEffect, double **inputs, double **outputs, VstInt32 nFrames);
76  static float VSTCALLBACK VSTGetParameter(AEffect *pEffect, VstInt32 idx);
77  static void VSTCALLBACK VSTSetParameter(AEffect *pEffect, VstInt32 idx, float value);
78 
79  bool SendVSTEvent(VstEvent& event);
80  bool SendVSTEvents(WDL_TypedBuf<VstEvent>* pEvents);
81 
82  void UpdateEditRect();
83 
84  ERect mEditRect;
85  VstSpeakerArrangement mInputSpkrArr, mOutputSpkrArr;
86 
87  enum { VSTEXT_NONE=0, VSTEXT_COCKOS, VSTEXT_COCOA }; // list of VST extensions supported by host
88  int mHasVSTExtensions;
89 
90  IByteChunk mState; // Persistent storage if the host asks for plugin state.
91  IByteChunk mBankState; // Persistent storage if the host asks for bank state.
92 protected:
93  AEffect mAEffect;
94  audioMasterCallback mHostCallback;
95 };
96 
97 #ifndef REAPER_PLUGIN
98 IPlugVST2* MakePlug(const InstanceInfo& info);
99 #endif
100 
101 END_IPLUG_NAMESPACE
102 
103 #endif
The base class for IPlug Audio Processing.
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
Definition: IPlugAPIBase.h:42
Encapsulates a MIDI message and provides helper functions.
Definition: IPlugMidi.h:30
Manages a block of memory, for plug-in settings store/recall.
Definition: IPlugStructs.h:111
VST2.4 API base class for an IPlug plug-in.
Definition: IPlugVST2.h:34
The base class for IPlug Audio Processing.
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
A struct for dealing with SysEx messages.
Definition: IPlugMidi.h:538