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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
|
# data file for the Fltk User Interface Designer (fluid)
version 1.0105
header_name {.h}
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
decl {//License: GNU GPL version 2} {}
decl {\#include <stdlib.h>} {public
}
decl {\#include <stdio.h>} {public
}
decl {\#include <string.h>} {public
}
decl {\#include "../globals.h"} {public
}
decl {\#include "WidgetPDial.h"} {public
}
decl {\#include "EnvelopeUI.h"} {public
}
decl {\#include "FilterUI.h"} {public
}
decl {\#include "../Misc/Util.h"} {public
}
decl {\#include "../Params/SUBnoteParameters.h"} {public
}
decl {\#include "PresetsUI.h"} {public
}
class SUBnoteharmonic {: {public Fl_Group}
} {
Function {make_window()} {private
} {
Fl_Window harmonic {
xywh {329 403 90 225} type Double hide
class Fl_Group
} {
Fl_Slider mag {
callback {int x=0;
if (Fl::event_button1()) x=127-(int)o->value();
else o->value(127-x);
pars->Phmag[n]=x;
if (pars->Phmag[n]==0) o->selection_color(0);
else o->selection_color(222);}
tooltip {harmonic's magnitude} xywh {0 15 10 115} type {Vert Knob} box FLAT_BOX selection_color 222 labelcolor 0 maximum 127 step 1 value 127
code0 {o->value(127-pars->Phmag[n]);}
code1 {if (pars->Phmag[n]==0) o->selection_color(0);}
}
Fl_Slider bw {
callback {int x=64;
if (Fl::event_button1()) x=127-(int)o->value();
else o->value(x);
pars->Phrelbw[n]=x;}
tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64
code0 {o->value(127-pars->Phrelbw[n]);}
}
Fl_Box {} {
xywh {10 170 5 5} box FLAT_BOX color 45
code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();}
}
Fl_Box {} {
label 01
xywh {0 210 10 15} labelfont 1 labelsize 9 align 20
code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
}
Fl_Box {} {
label 01
xywh {0 0 10 15} labelfont 1 labelsize 9 align 20
code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
}
}
}
Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
code {n=0;} {}
}
Function {init(SUBnoteParameters *pars_,int n_)} {} {
code {pars=pars_;
n=n_;
make_window();
harmonic->show();
end();} {}
}
Function {refresh()} {} {
code {mag->value(127-pars->Phmag[n]);
if (pars->Phmag[n]==0) mag->selection_color(0);
bw->value(127-pars->Phrelbw[n]);} {selected
}
}
Function {~SUBnoteharmonic()} {} {
code {harmonic->hide();
hide();
//delete(harmonic);} {}
}
decl {SUBnoteParameters *pars;} {}
decl {int n;} {}
}
class SUBnoteUI {: {public PresetsUI_}
} {
Function {make_window()} {} {
Fl_Window SUBparameters {
label {SUBsynth Parameters}
xywh {26 214 735 390} type Double hide
} {
Fl_Scroll {} {
xywh {5 140 435 245} type HORIZONTAL box THIN_UP_BOX
} {
Fl_Pack harmonics {open
xywh {10 145 425 235} type HORIZONTAL
code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);}}
} {}
}
Fl_Button {} {
label Close
callback {SUBparameters->hide();}
xywh {625 365 105 20} box THIN_UP_BOX labelfont 1 labelsize 12
}
Fl_Group {} {
label AMPLITUDE
xywh {5 5 215 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
} {
Fl_Value_Slider vol {
label Vol
callback {pars->PVolume=(int)o->value();}
tooltip Volume xywh {10 25 140 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
code0 {o->value(pars->PVolume);}
}
Fl_Value_Slider vsns {
label {V.Sns}
callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
code0 {o->value(pars->PAmpVelocityScaleFunction);}
}
Fl_Dial pan {
label Pan
callback {pars->PPanning=(int) o->value();}
tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
code0 {o->value(pars->PPanning);}
class WidgetPDial
}
Fl_Group ampenv {
label {SUBsynth - Amplitude Envelope} open
xywh {10 65 205 70} box FLAT_BOX color 51 align 144
code0 {o->init(pars->AmpEnvelope);}
class EnvelopeUI
} {}
}
Fl_Group {} {
xywh {495 325 235 35} box THIN_UP_FRAME
} {
Fl_Counter filterstages {
label {Filter Stages}
callback {pars->Pnumstages=(int) o->value();}
tooltip {How many times the noise is filtered} xywh {515 340 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10
code0 {o->value(pars->Pnumstages);}
}
Fl_Choice magtype {
label {Mag.Type}
callback {pars->Phmagtype=(int) o->value();}
xywh {585 340 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 12
code0 {o->value(pars->Phmagtype);}
} {
menuitem {} {
label Linear
xywh {20 20 100 20} labelfont 1 labelsize 12
}
menuitem {} {
label {-40dB}
xywh {30 30 100 20} labelfont 1 labelsize 12
}
menuitem {} {
label {-60dB}
xywh {40 40 100 20} labelfont 1 labelsize 12
}
menuitem {} {
label {-80dB}
xywh {50 50 100 20} labelfont 1 labelsize 12
}
menuitem {} {
label {-100dB}
xywh {60 60 100 20} labelfont 1 labelsize 12
}
}
Fl_Choice start {
label Start
callback {pars->Pstart=(int) o->value();} open
xywh {670 340 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 12
code0 {o->value(pars->Pstart);}
} {
menuitem {} {
label Zero
xywh {30 30 100 20} labelfont 1 labelsize 12
}
menuitem {} {
label RND
xywh {40 40 100 20} labelfont 1 labelsize 12
}
menuitem {} {
label {Max.}
xywh {50 50 100 20} labelfont 1 labelsize 12
}
}
}
Fl_Group freqsettingsui {
label FREQUENCY
xywh {440 5 290 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
} {
Fl_Group freqenvelopegroup {
label {SUBsynth - Frequency Envelope} open
xywh {445 65 205 70} box FLAT_BOX color 51 align 144
code0 {o->init(pars->FreqEnvelope);}
code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();}
class EnvelopeUI
} {}
Fl_Check_Button freqee {
label Enabled
callback {pars->PFreqEnvelopeEnabled=o->value();
if (o->value()==0) freqenvelopegroup->deactivate();
else freqenvelopegroup->activate();
o->show();
freqsettingsui->redraw();}
xywh {445 68 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
code0 {o->value(pars->PFreqEnvelopeEnabled);}
}
Fl_Counter octave {
label Octave
callback {int k=(int) o->value();
if (k<0) k+=16;
pars->PCoarseDetune = k*1024+
pars->PCoarseDetune%1024;}
tooltip Octave xywh {670 50 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12
code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;}
code2 {o->value(k);}
}
Fl_Counter coarsedet {
label {Coarse Det.}
callback {int k=(int) o->value();
if (k<0) k+=1024;
pars->PCoarseDetune = k+
(pars->PCoarseDetune/1024)*1024;}
tooltip {Coarse Detune} xywh {655 115 60 20} labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 12
code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;}
code2 {o->value(k);}
code3 {o->lstep(10);}
}
Fl_Slider detune {
callback {pars->PDetune=(int)o->value()+8192;
detunevalueoutput->do_callback();}
tooltip {Fine Detune (cents)} xywh {495 25 230 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
code0 {o->value(pars->PDetune-8192);}
}
Fl_Value_Output detunevalueoutput {
label Detune
callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
xywh {448 25 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
}
Fl_Check_Button hz440 {
label 440Hz
callback {int x=(int) o->value();
pars->Pfixedfreq=x;
if (x==0) fixedfreqetdial->deactivate();
else fixedfreqetdial->activate();}
tooltip {set the base frequency to 440Hz} xywh {555 45 50 15} down_box DOWN_BOX labelfont 1 labelsize 11
code0 {o->value(pars->Pfixedfreq);}
}
Fl_Dial fixedfreqetdial {
label {Eq.T.}
callback {pars->PfixedfreqET=(int) o->value();}
tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 45 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
code0 {o->value(pars->PfixedfreqET);}
code1 {if (pars->Pfixedfreq==0) o->deactivate();}
class WidgetPDial
}
Fl_Choice detunetype {
label {Detune Type}
callback {pars->PDetuneType=(int) o->value()+1;
detunevalueoutput->do_callback();} open
xywh {655 85 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
code1 {o->value(pars->PDetuneType-1);}
} {}
}
Fl_Check_Button stereo {
label Stereo
callback {pars->Pstereo=(int) o->value();}
xywh {440 325 55 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 10
code0 {o->value(pars->Pstereo);}
}
Fl_Button {} {
label Clear
callback {for (int i=0;i<MAX_SUB_HARMONICS;i++){
h[i]->mag->value(127);
pars->Phmag[i]=0;
h[i]->bw->value(64);
pars->Phrelbw[i]=64;
};
pars->Phmag[0]=127;
h[0]->mag->value(0);
SUBparameters->redraw();}
tooltip {Clear the harmonics} xywh {445 365 70 20} box THIN_UP_BOX labelfont 1 labelsize 12
}
Fl_Group bandwidthsettingsui {
label BANDWIDTH
xywh {220 5 220 135} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
} {
Fl_Group bandwidthenvelopegroup {
label {SUBsynth - BandWidth Envelope} open
xywh {225 65 205 70} box FLAT_BOX color 51 align 144
code0 {o->init(pars->BandWidthEnvelope);}
code1 {if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();}
class EnvelopeUI
} {}
Fl_Check_Button bwee {
label Enabled
callback {pars->PBandWidthEnvelopeEnabled=o->value();
if (o->value()==0) bandwidthenvelopegroup->deactivate();
else bandwidthenvelopegroup->activate();
o->show();
bandwidthsettingsui->redraw();}
xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
code0 {o->value(pars->PBandWidthEnvelopeEnabled);}
}
Fl_Value_Slider bandwidth {
label {Band Width}
callback {pars->Pbandwidth=(int) o->value();}
xywh {225 40 115 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->value(pars->Pbandwidth);}
}
Fl_Value_Slider bwidthscale {
label {B.Width Scale}
callback {pars->Pbwscale=(int) o->value()+64;}
tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1
code0 {o->value(pars->Pbwscale-64);}
}
}
Fl_Group globalfiltergroup {
label FILTER
xywh {440 140 290 185} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();}
} {
Fl_Group filterenv {
label {SUBsynth - Filter Envelope} open
xywh {445 250 275 70} box FLAT_BOX color 51 align 144
code0 {o->init(pars->GlobalFilterEnvelope);}
class EnvelopeUI
} {}
Fl_Group filterui {
label {SUBsynthl - Filter} open
xywh {445 170 275 75} box FLAT_BOX color 50 align 144
code0 {o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);}
class FilterUI
} {}
}
Fl_Check_Button filtere {
label Enabled
callback {pars->PGlobalFilterEnabled=o->value();
if (o->value()==0) globalfiltergroup->deactivate();
else globalfiltergroup->activate();
o->show();
globalfiltergroup->redraw();}
xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 12
code0 {o->value(pars->PGlobalFilterEnabled);}
}
Fl_Button {} {
label C
callback {presetsui->copy(pars);}
xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
}
Fl_Button {} {
label P
callback {presetsui->paste(pars,this);}
xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
}
}
}
Function {refresh()} {} {
code {for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh();
vol->value(pars->PVolume);
vsns->value(pars->PAmpVelocityScaleFunction);
pan->value(pars->PPanning);
bandwidth->value(pars->Pbandwidth);
bwidthscale->value(pars->Pbwscale-64);
bwee->value(pars->PBandWidthEnvelopeEnabled);
if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate();
else bandwidthenvelopegroup->activate();
bwee->show();
bandwidthsettingsui->redraw();
detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
freqee->value(pars->PFreqEnvelopeEnabled);
if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate();
else freqenvelopegroup->activate();
freqee->show();
freqsettingsui->redraw();
detune->value(pars->PDetune-8192);
hz440->value(pars->Pfixedfreq);
fixedfreqetdial->value(pars->PfixedfreqET);
int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
octave->value(k);
detunetype->value(pars->PDetuneType-1);
k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
coarsedet->value(k);
filtere->value(pars->PGlobalFilterEnabled);
if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate();
else globalfiltergroup->activate();
filtere->show();
globalfiltergroup->redraw();
stereo->value(pars->Pstereo);
filterstages->value(pars->Pnumstages);
magtype->value(pars->Phmagtype);
start->value(pars->Pstart);
ampenv->refresh();
bandwidthenvelopegroup->refresh();
freqenvelopegroup->refresh();
filterui->refresh();
filterenv->refresh();} {}
}
Function {SUBnoteUI(SUBnoteParameters *parameters)} {} {
code {pars=parameters;
make_window();} {}
}
Function {~SUBnoteUI()} {} {
code {//for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]);
SUBparameters->hide();
delete(SUBparameters);} {}
}
decl {SUBnoteParameters *pars;} {}
decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {}
}
|