forked from dliganov/Chaotic-DAW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAwful_paramedit.h
291 lines (254 loc) · 7.21 KB
/
Awful_paramedit.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#ifndef PARAMEDIT_H
#define PARAMEDIT_H
#include "awful.h"
#include "awful_elements.h"
#include "awful_audio.h"
#include "awful_controls.h"
#include "Awful_objects.h"
class PEdit : public Object
{
public:
PEdit* prev;
PEdit* next;
char hint[255];
int go;
Element* element;
Pattern* pt;
bool active;
bool bypass;
bool highlighted;
bool highlightable;
bool visible;
bool donotactivate;
int x;
int y;
int xs;
int ys;
int edx;
int edy;
float scale;
ParamType type;
int value;
float fvalue;
Parameter* param;
Panel* panel;
Instrument* instr;
DrawArea* drawarea;
PEdit();
~PEdit();
virtual PEdit* Clone(Element* el) { return NULL; }
bool IsPointed(int mx, int my);
virtual void ProcessKey(unsigned int key, unsigned int flags) {}
virtual void ProcessChar(char character) {}
virtual void PlaceCursor() {}
virtual void UpdateValFromString() {}
virtual void toRight() {}
virtual void toLeft() {}
virtual void Activate();
virtual void Activate(int x, int y, int w, int h, int x1r, int y1r, int x2r, int y2r);
void Deactivate();
virtual void Leave();
void AddParam(Parameter* param, float* ptrval);
virtual void UpdateFromParam();
virtual void UpdateStringFromVal();
virtual void Reinit();
virtual void Hide() {}
virtual void Show() {}
virtual void Click(int mouse_x, int mouse_y, bool dbclick, unsigned flags) {}
virtual void SetHint(char *hint) { strcpy(this->hint, hint); };
};
class Envelope : public PEdit
{
public:
CmdType ctype;
EnvPnt* p_first;
EnvPnt* p_last;
EnvPnt* susPoint;
int hgt; // in pixels
float len; // in ticks
float scale;
float ticks;
long frame_length;
float last_value;
float prev_value;
int aaCount;
float aaBaseValue;
float cf1;
float cf2;
bool folded;
Toggle* fold;
bool timebased;
Toggle* timetg;
bool sustainable;
bool newbuff; // flag indicating freshness of the buffer (to avoid double use)
long last_buffframe;
long last_buffframe_end;
float buff[MAX_BUFF_SIZE];
float buffoutval[MAX_BUFF_SIZE];
// Dedicated list clamps for various instruments' and FX params
Envelope* group_prev;
Envelope* group_next;
Envelope(CmdType ct);
~Envelope();
Envelope* Clone(Element* el);
Envelope* Clone();
EnvPnt* LocatePoint(EnvPnt* p);
void RelocatePoint(EnvPnt* p);
EnvPnt* AddPoint(float x, float y_norm, bool big = true);
void RemovePoint(EnvPnt* p);
void DeletePoint(EnvPnt* p);
void Clean();
void CalcTime();
virtual bool ProcessBuffer1(long curr_frame, long buffframe, long num_frames, int step, long start_frame, Trigger* tgenv = NULL, Trigger* tgi = NULL);
void StopBuffer();
void UpdateLastValue();
float GetValue(tframe frame);
float GetValue(float tick);
virtual float GetScale(Loc loc);
void DeleteRange(float x_curr, float x_start, bool start_except);
void Drag(int mouse_x, int mouse_y, unsigned flags);
bool IsMouseInside(int mouse_x, int mouse_y);
void Check(int mouse_x, int mouse_y);
void Click(int mouse_x, int mouse_y, unsigned flags);
void SetSustainable(bool sust);
void SetSustainPoint(EnvPnt* pnt);
bool IsOutOfBounds(long frame_phase);
long GetFramesRemaining(long frame_phase);
void InitAAEnv(bool offenv);
void Scale(float s);
void SetLength(float newlen);
void Simplify();
XmlElement* Save(char* name);
void Load(XmlElement* xmlEnvNode);
};
class Percent : public PEdit
{
public:
char digits[5];
int digit_width;
int curPos;
int maxPos;
Percent(int val, int cpos, Element* ow, ParamType pt);
void ProcessChar(char character);
void ProcessKey(unsigned int key, unsigned int flags);
void toLeft();
void toRight();
void PlaceCursor();
void UpdateStringFromVal();
void UpdateValFromString();
void PackZeros();
void SetVal(int value);
void AdjustValue(int delta);
};
class Digits : public PEdit
{
public:
char digits[3];
int num_digits;
int digit_width;
int curPos;
Digits(int val, int cpos, Element* ow);
void ProcessChar(char character);
void ProcessKey(unsigned int key, unsigned int flags);
void PlaceCursor();
void UpdateStringFromVal();
void UpdateValFromString();
void toLeft();
void toRight();
};
class DigitStr : public PEdit
{
public:
char digits[3];
int num_digits;
int digit_width;
int curPos;
int oldval;
bool bright;
Send* send;
Trk* trk;
bool queued;
Mixcell* mcell;
MixChannel* mchanout;
MixChannel* mchanowner;
Image* bground;
DigitStr* mix_prev;
DigitStr* mix_next;
DigitStr(const char* str);
void SetString(const char* str);
void DoUpdate();
void ProcessChar(char character);
void ProcessKey(unsigned int key, unsigned int flags);
void PlaceCursor();
void toLeft();
void toRight();
void Activate();
void Activate(int x, int y, int w, int h, int x1r, int y1r, int x2r, int y2r);
void Leave();
void Click(int mouse_x, int mouse_y, bool dbclick, unsigned flags);
};
class Semitones : public PEdit
{
public:
char str[4];
Semitones(int kolichestvo, Element* owna);
void ProcessKey(unsigned int key, unsigned int flags);
void UpdateStringFromVal();
void SetValue(int val);
};
/*
class FVal : public PEdit
{
public:
char str[4];
FVal(float fval, Element* owna);
void ProcessKey(unsigned int key, unsigned int flags);
void UpdateStringFromVal();
};
class Hz : public PEdit
{
public:
Hz(float hzval, Element* owna);
};
*/
class Note : public PEdit
{
public:
int pixwidth;
bool relative;
char lastchar;
float freq;
Note(short val, Element* ow);
void ProcessKey(unsigned int key, unsigned int flags);
void ProcessChar(char character);
void Kreview(int key);
void PlaceCursor();
void SetValue(int newvalue);
void SetRelative(bool rel);
void Show();
void Hide();
};
class TString : public PEdit
{
public:
char string[MAX_NAME_STRING];
int curPos;
int maxPos;
int cposx;
int maxlen;
bool space_allowed;
TString(char* name, bool spc_allowed, Element* ow);
TString(char* name, bool spc_allowed, Panel* pn);
TString(char* name, bool spc_allowed, Instrument* inst);
TString(char* name, bool spc_allowed);
~TString();
void ProcessChar(char character);
void ProcessKey(unsigned int key, unsigned int flags);
void toLeft();
void toRight();
void PlaceCursor();
void PackZeros();
void SetString(char* name);
void CapFirst();
};
#endif