-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaveShaper.h
84 lines (67 loc) · 2.12 KB
/
WaveShaper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include "IPlug_include_in_plug_hdr.h"
#include "Params.h"
#include "IVMeterControl.h"
#include "Interface.h"
#include "Controls.h"
#include "FileLoader.h"
#include "MultiChannelBuffer.h"
#if IPLUG_DSP
#include "DSP.h"
#endif
using namespace iplug;
using namespace igraphics;
class WaveShaper : public Plugin
{
public:
WaveShaper(const InstanceInfo& instanceInfo);
// called from the UI for the Load and Save buttons.
// we need to wrap LoadProgramFromFXP and SaveProgramAsFXP
// to prevent our presets from getting overwritten.
void HandleSave(WDL_String* fileName, WDL_String* directory);
void HandleLoad(WDL_String* fileName, WDL_String* directory);
void HandleAction(BangControl::Action action);
void DumpPresetSrc();
// getters used by UI classes to draw things
float GetNoiseOffset() const;
float GetNoiseRate() const;
float GetShape() const;
float GetShaperSize() const;
float GetShaperMapValue() const;
// #TODO switch everything over to MidiMapper
void BeginMIDILearn(int param1, int param2, int x, int y) {}
struct NoiseSnapshot
{
double AmpMod;
double Rate;
double Range;
double Shape;
};
void UpdateNoiseSnapshot(int idx);
const NoiseSnapshot& GetNoiseSnapshot(int idx) const
{
return mNoiseSnapshots[idx];
}
// converted the requested snapshot to normalized values before returning
NoiseSnapshot GetNoiseSnapshotNormalized(int idx);
private:
FileLoader mFileLoader;
Minim::MultiChannelBuffer mBuffer;
NoiseSnapshot mNoiseSnapshots[kNoiseSnapshotCount];
#if IPLUG_DSP // All DSP methods and member variables should be within an IPLUG_DSP guard, should you want distributed UI
public:
void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override;
void ProcessMidiMsg(const IMidiMsg& msg) override;
void OnReset() override;
void OnParamChange(int paramIdx) override;
void OnIdle() override;
void SetParamBlend(int paramIdx, double begin, double end, double blend);
private:
WaveShaperDSP mDSP {2};
IVMeterControl<1>::Sender mMeterBallistics {kCtrlTagMeter};
#endif
#if IPLUG_EDITOR
private:
Interface mInterface;
#endif
};