Make duplicate script compatible with Python 3
[wdl/wdl-ol.git] / IPlugExamples / IPlugMonoSynth / IPlugMonoSynth.h
blobdc6d7acc0167987ccb7eb2d37eb6f596a1ff050f
1 #ifndef __IPLUGMONOSYNTH__
2 #define __IPLUGMONOSYNTH__
4 #include "IPlug_include_in_plug_hdr.h"
5 #include "IMidiQueue.h"
7 // http://www.musicdsp.org/archive.php?classid=3#257
9 class CParamSmooth
11 public:
12 CParamSmooth() { a = 0.99; b = 1. - a; z = 0.; };
13 ~CParamSmooth() {};
14 inline double Process(double in) { z = (in * b) + (z * a); return z; }
15 private:
16 double a, b, z;
19 class IPlugMonoSynth : public IPlug
21 public:
23 IPlugMonoSynth(IPlugInstanceInfo instanceInfo);
24 ~IPlugMonoSynth();
26 void Reset();
27 void OnParamChange(int paramIdx);
29 void ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames);
30 bool HostRequestingAboutBox();
32 int GetNumKeys();
33 bool GetKeyStatus(int key);
34 void ProcessMidiMsg(IMidiMsg* pMsg);
36 private:
37 IBitmapOverlayControl* mAboutBox;
38 IControl* mKeyboard;
39 int mMeterIdx_L, mMeterIdx_R;
41 IMidiQueue mMidiQueue;
43 int mNumKeys; // how many keys are being played (via midi)
44 bool mKeyStatus[128]; // array of on/off for each key
46 int mPhase;
47 int mNote;
48 int mKey;
50 double mGainL, mGainR;
51 double mSampleRate;
52 double mFreq;
53 double mNoteGain;
54 double mPrevL, mPrevR;
56 ITimeInfo mTimeInfo;
58 CParamSmooth mGainLSmoother, mGainRSmoother;
61 enum ELayout
63 kWidth = GUI_WIDTH, // width of plugin window
64 kHeight = GUI_HEIGHT, // height of plugin window
66 kKeybX = 1,
67 kKeybY = 233,
69 kGainX = 100,
70 kGainY = 100,
71 kKnobFrames = 60
74 #endif //__IPLUGMONOSYNTH__