-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHISSToolsGranular.h
149 lines (116 loc) · 2.93 KB
/
HISSToolsGranular.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#pragma once
#include "IPlug_include_in_plug_hdr.h"
#include "source/Granular.h"
#include "source/Waveform.h"
const int kNumPrograms = 1;
enum EParams
{
kActive = 0,
kMode,
kMaxVoices,
kDensity,
kRate,
kRateRand,
kOffset,
kOffsetRand,
kDuration,
kDurationRand,
kPitch,
kPitchRand,
kGliss,
kGlissRand,
kVol,
kVolRand,
kPan,
kPanRand,
kWindowType,
kWindowBias,
kWindowBiasRand,
kDistortionType,
kGain,
kGainRand,
kFilterType,
kFilterFreq,
kFilterFreqRand,
kFilterResonance,
kFilterResonanceRand,
kNumParams
};
enum ELayout
{
kWidth = 945,
kHeight = 645,
kSmallDialXOffset = 100,
kSmallDialYOffset = -10,
kColW = 180,
kCol1X = 30,
kCol2X = kCol1X + kColW,
kCol3X = kCol2X + kColW,
kCol4X = kCol3X + kColW,
kCol5X = kCol4X + kColW,
kRow1Y = 275,
kRow2Y = kRow1Y + 150,
kRow3Y = kRow2Y + 140,
kWaveformX = 30,
kWaveformY = 30,
kWaveformW = 515,
kWaveformH = 70,
kValueW = 100,
kValueH = 25,
kValueWL = 120,
kValueHL = 25,
kActiveW = 160,
kYSGapping = 20,
kYLGapping = 70,
kRateActiveX = kCol4X + 15,
kVoiceColX = kRateActiveX + 200,
kVoiceRow1Y = kWaveformY + 20,
kVoiceRow2Y = kVoiceRow1Y + kYLGapping,
kVoiceRow3Y = kVoiceRow2Y + kYLGapping,
kBeneathWavefromY = kWaveformY + kWaveformH + kWaveformH + kYSGapping,
kRateY = kWaveformY + 30,
kNameW = 405,
kNameH = 45,
kNameX = kWidth - (30 + kNameW),
kNameY = kRow3Y,
kPanel1X = 15,
kPanel1Y = 15,
kPanel1W = kWidth - (15 * 2),
kPanel1H = 220,
kPanel2X = 15,
kPanel2Y = kRow1Y - 30,
kPanel2W = kWidth - (15 * 2),
kPanel2H = 385,
kWaveformOutline = 5,
kPanel3X = kWaveformX,
kPanel3Y = kWaveformY,
kPanel3W = kWaveformW,
kPanel3H = kWaveformH * 2,
};
using namespace iplug;
using namespace igraphics;
class HISSToolsGranular : public Plugin
{
public:
HISSToolsGranular(const InstanceInfo &info);
~HISSToolsGranular();
void OnReset() override;
void OnParamChange(int paramIdx, EParamSource source, int sampleOffset) override;
void OnParamChangeUI(int paramIdx, EParamSource source) override;
void ProcessBlock(double** inputs, double** outputs, int nFrames) override;
bool SerializeState(IByteChunk& chunk) const override;
int UnserializeState(const IByteChunk& chunk, int pos) override;
void SelectFromGUI(double click, double drag);
void SelectFile(const char *file);
private:
void GUIUpdateBuffer();
void GUIUpdateSelection();
void GUIGrayOutControl(int paramIdx, bool gray);
Waveform *GetWaveform(int tag);
void AddDualControl(IGraphics* graphics, double x, double y, int idx, int idxRand, const char *options);
void AddBiPolarDualControl(IGraphics* graphics, double x, double y, int idx, int idxRand, const char *options, const char *mainOptions = "");
IGraphics* CreateGraphics() override;
void LayoutUI(IGraphics* pGraphics) override;
WDL_Mutex mMutex;
Granular mGranular;
};