summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/synti/zynaddsubfx/UI/ADnoteUI.fl
blob: 33e25dfff62aa7dbd1f8b33c75435b57289b3768 (plain)
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
# data file for the Fltk User Interface Designer (fluid)
version 1.0106 
header_name {.h} 
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} 

decl {//License: GNU GPL version 2} {} 

decl {\#include "../Params/ADnoteParameters.h"} {public
} 

decl {\#include "../Misc/Util.h"} {public
} 

decl {\#include "../Misc/Master.h"} {public
} 

decl {\#include "ResonanceUI.h"} {public
} 

decl {\#include <FL/Fl_Box.H>} {public
} 

decl {\#include <FL/Fl_Group.H>} {public
} 

decl {\#include <math.h>} {} 

decl {\#include <stdio.h>} {} 

decl {\#include <stdlib.h>} {} 

decl {\#include <string.h>} {} 

decl {\#include "WidgetPDial.h"} {public
} 

decl {\#include "EnvelopeUI.h"} {public
} 

decl {\#include "LFOUI.h"} {public
} 

decl {\#include "FilterUI.h"} {public
} 

decl {\#include "OscilGenUI.h"} {public
} 

decl {\#include "PresetsUI.h"} {public
} 

class ADvoicelistitem {: {public Fl_Group}
} {
  Function {make_window()} {private
  } {
    Fl_Window ADnoteVoiceListItem {
      private xywh {247 599 615 30} type Double hide
      class Fl_Group
    } {
      Fl_Group voicelistitemgroup {
        private xywh {50 0 570 25} box FLAT_BOX
        code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();}
      } {
        Fl_Value_Slider voicevolume {
          callback {pars->VoicePar[nvoice].PVolume=(int)o->value();}
          tooltip Volume xywh {90 5 115 20} type {Horz Knob} box FLAT_BOX labelsize 8 align 5 maximum 127 step 1
          code0 {o->value(pars->VoicePar[nvoice].PVolume);}
        }
        Fl_Check_Button voiceresonanceenabled {
          callback {pars->VoicePar[nvoice].Presonance=(int)o->value();}
          tooltip {Resonance On/Off} xywh {245 7 15 17} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 12 align 4
          code0 {o->value(pars->VoicePar[nvoice].Presonance);}
        }
        Fl_Value_Slider voicelfofreq {
          callback {pars->VoicePar[nvoice].FreqLfo->Pintensity=(int)o->value();}
          tooltip {Frequency LFO amount} xywh {500 5 115 20} type {Horz Knob} box FLAT_BOX labelsize 8 align 5 maximum 127 step 1
          code0 {o->value(pars->VoicePar[nvoice].FreqLfo->Pintensity);}
        }
        Fl_Dial voicepanning {
          callback {pars->VoicePar[nvoice].PPanning=(int) o->value();}
          tooltip {Panning (leftmost is Random)} xywh {215 5 20 20} box ROUND_UP_BOX labelsize 11 align 4 maximum 127 step 1
          code0 {o->value(pars->VoicePar[nvoice].PPanning);}
          class WidgetPDial
        }
        Fl_Group voiceoscil {open
          xywh {60 5 30 20} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
          code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
          code1 {osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);}
          code2 {if (pars->VoicePar[nvoice].Pextoscil != -1) {osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,master);}}
        } {}
        Fl_Value_Output detunevalueoutput {
          callback {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());}
          xywh {265 5 45 20} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
          code0 {o->value(getdetune(pars->VoicePar[nvoice].PDetuneType,0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());}
        }
        Fl_Slider voicedetune {
          callback {pars->VoicePar[nvoice].PDetune=(int)o->value()+8192;
detunevalueoutput->do_callback();}
          tooltip {Fine Detune (cents)} xywh {315 5 185 20} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
          code0 {o->value(pars->VoicePar[nvoice].PDetune-8192);}
        }
        Fl_Box noiselabel {
          label N
          callback {if (pars->VoicePar[nvoice].Type==0) {
  o->hide();
  voiceresonanceenabled->activate();
  detunevalueoutput->activate();
  voicedetune->activate();
  voicelfofreq->activate();
  voiceoscil->activate();
} else {
  o->show();
  voiceresonanceenabled->deactivate();
  detunevalueoutput->deactivate();
  voicedetune->deactivate();
  voicelfofreq->deactivate();
  voiceoscil->deactivate();
};}
          xywh {65 5 20 20} labelfont 1 labelsize 16 labelcolor 7
          code0 {if (pars->VoicePar[nvoice].Type==0) o->hide();}
        }
      }
      Fl_Check_Button voiceenabled {
        label 01
        callback {pars->VoicePar[nvoice].Enabled=(int)o->value();
if (o->value()==0) voicelistitemgroup->deactivate();
else voicelistitemgroup->activate();
o->redraw();}
        private xywh {30 5 20 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 4
        code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));}
        code1 {o->value(pars->VoicePar[nvoice].Enabled);}
      }
    }
  }
  Function {ADvoicelistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {nvoice=0;
pars=NULL;} {}
  }
  Function {init(ADnoteParameters *parameters,int nvoice_,Master *master_)} {} {
    code {pars=parameters;
nvoice=nvoice_;
master=master_;
make_window();
ADnoteVoiceListItem->show();
end();} {}
  }
  Function {refreshlist()} {} {
    code {voiceenabled->value(pars->VoicePar[nvoice].Enabled);
voiceresonanceenabled->value(pars->VoicePar[nvoice].Presonance);
voicevolume->value(pars->VoicePar[nvoice].PVolume);
voicedetune->value(pars->VoicePar[nvoice].PDetune-8192);
voicepanning->value(pars->VoicePar[nvoice].PPanning);
voicelfofreq->value(pars->VoicePar[nvoice].FreqLfo->Pintensity);
if (pars->VoicePar[nvoice].Pextoscil != -1) {
  osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);
} else 
  osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);
if (pars->VoicePar[nvoice].Enabled==0) voicelistitemgroup->deactivate();
    else voicelistitemgroup->activate();
detunevalueoutput->do_callback();
noiselabel->do_callback();
ADnoteVoiceListItem->redraw();} {}
  }
  Function {~ADvoicelistitem()} {} {
    code {ADnoteVoiceListItem->hide();
//delete(ADnoteVoiceListItem);} {}
  }
  decl {ADnoteParameters *pars;} {}
  decl {int nvoice;} {}
  decl {Oscilloscope *osc;} {}
  decl {Master *master;} {}
} 

class ADvoiceUI {: {public Fl_Group}
} {
  Function {make_window()} {} {
    Fl_Window ADnoteVoiceParameters {
      label Voice
      xywh {231 132 765 525} type Double hide
      class Fl_Group
    } {
      Fl_Group voiceparametersgroup {
        xywh {0 0 765 525} box THIN_UP_BOX color 48
        code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();}
      } {
        Fl_Group voicemodegroup {
          xywh {0 5 760 515}
        } {
          Fl_Group voiceFMparametersgroup {
            label MODULATOR
            xywh {530 5 230 515} box THIN_UP_FRAME color 48 labeltype EMBOSSED_LABEL labelfont 1 labelsize 18 align 17
            code0 {if (pars->VoicePar[nvoice].PFMEnabled==0) o->deactivate();}
          } {
            Fl_Group modfrequency {
              label {Mod.FREQUENCY}
              xywh {535 220 220 145} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
            } {
              Fl_Group voiceFMfreqenvgroup {
                label {ADSynth Modulator - Frequency Envelope}
                xywh {540 290 205 70} box FLAT_BOX color 51 align 144
                code0 {o->init(pars->VoicePar[nvoice].FMFreqEnvelope);}
                code1 {if (pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled==0) o->deactivate();}
                class EnvelopeUI
              } {}
              Fl_Check_Button {} {
                label Enable
                callback {pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled=(int)o->value();
if (o->value()==0) voiceFMfreqenvgroup->deactivate();
else voiceFMfreqenvgroup->activate();
o->redraw();}
                tooltip {Forced Relase} xywh {545 295 50 10} down_box DOWN_BOX labelfont 1 labelsize 10
                code0 {o->value(pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled);}
              }
              Fl_Counter {} {
                label {Coarse Det.}
                callback {int k=(int) o->value();
if (k<0) k+=1024;
pars->VoicePar[nvoice].PFMCoarseDetune = k+
   (pars->VoicePar[nvoice].PFMCoarseDetune/1024)*1024;}
                tooltip {Coarse Detune} xywh {685 270 60 15} labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 12
                code0 {int k=pars->VoicePar[nvoice].PFMCoarseDetune%1024;}
                code1 {if (k>=512) k-=1024;}
                code2 {o->value(k);}
                code3 {o->lstep(10);}
              }
              Fl_Counter {} {
                label Octave
                callback {int k=(int) o->value();
if (k<0) k+=16;
pars->VoicePar[nvoice].PFMCoarseDetune = k*1024+
   pars->VoicePar[nvoice].PFMCoarseDetune%1024;}
                tooltip Octave xywh {625 270 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12
                code0 {int k=pars->VoicePar[nvoice].PFMCoarseDetune/1024;}
                code1 {if (k>=8) k-=16;}
                code2 {o->value(k);}
              }
              Fl_Slider {} {
                callback {pars->VoicePar[nvoice].PFMDetune=(int)o->value()+8192;
fmdetunevalueoutput->do_callback();}
                tooltip {Fine Detune (cents)} xywh {590 245 160 10} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
                code0 {o->value(pars->VoicePar[nvoice].PFMDetune-8192);}
              }
              Fl_Value_Output fmdetunevalueoutput {
                label Detune
                callback {o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune));}
                xywh {540 245 45 13} labelsize 8 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 8
                code0 {o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune));}
                code1 {//o->value(getdetune(pars->VoicePar[nvoice].PFMDetuneType,0,pars->VoicePar[nvoice].PFMDetune));}
              }
              Fl_Choice {} {
                label {Detune Type}
                callback {pars->VoicePar[nvoice].PFMDetuneType=(int) o->value();
fmdetunevalueoutput->do_callback();} open
                xywh {540 270 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
                code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
                code1 {o->value(pars->VoicePar[nvoice].PFMDetuneType);}
              } {}
            }
            Fl_Group {} {
              label {Mod.AMPLITUDE}
              xywh {535 60 220 160} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
            } {
              Fl_Value_Slider {} {
                label Vol
                callback {pars->VoicePar[nvoice].PFMVolume=(int)o->value();}
                tooltip Volume xywh {540 80 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
                code0 {o->value(pars->VoicePar[nvoice].PFMVolume);}
              }
              Fl_Value_Slider {} {
                label {V.Sns}
                callback {pars->VoicePar[nvoice].PFMVelocityScaleFunction=(int) o->value();}
                tooltip {Velocity Sensing Function (rightmost to disable)} xywh {540 100 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
                code0 {o->value(pars->VoicePar[nvoice].PFMVelocityScaleFunction);}
              }
              Fl_Group voiceFMampenvgroup {
                label {ADSynth Modulator - Amplitude Envelope} open
                xywh {540 145 205 70} box FLAT_BOX color 51 align 144
                code0 {o->init(pars->VoicePar[nvoice].FMAmpEnvelope);}
                code1 {if (pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled==0) o->deactivate();}
                class EnvelopeUI
              } {}
              Fl_Check_Button {} {
                label Enable
                callback {pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled=(int)o->value();
if (o->value()==0) voiceFMampenvgroup->deactivate();
else voiceFMampenvgroup->activate();
o->redraw();}
                tooltip {Forced Relase} xywh {545 150 50 10} down_box DOWN_BOX labelfont 1 labelsize 10
                code0 {o->value(pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled);}
              }
              Fl_Value_Slider {} {
                label {F.Damp}
                callback {pars->VoicePar[nvoice].PFMVolumeDamp=(int) o->value()+64;}
                tooltip {Modulator Damp at Higher frequency} xywh {540 120 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 minimum -64 maximum 63 step 1
                code0 {o->value(pars->VoicePar[nvoice].PFMVolumeDamp-64);}
              }
            }
            Fl_Group modoscil {
              xywh {535 365 220 150}
            } {
              Fl_Group fmoscil {open
                xywh {535 405 220 110} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
                code0 {oscFM=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
                code1 {int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;}
                code2 {oscFM->init(pars->VoicePar[nv].FMSmp,0,pars->VoicePar[nvoice].PFMoscilphase,master);}
              } {}
              Fl_Box {} {
                label {Mod.Oscillator}
                xywh {535 365 155 20} labelfont 1 align 20
              }
              Fl_Button changeFMoscilbutton {
                label Change
                callback {if (oscedit!=NULL) delete(oscedit);

int nv=nvoice;
if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;

oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,NULL,NULL,master);} selected
                xywh {700 370 55 15} box THIN_UP_BOX labelfont 1 labelsize 12
                code0 {if (pars->VoicePar[nvoice].PextFMoscil>=0) o->labelcolor(FL_BLUE);}
              }
              Fl_Slider {} {
                label Phase
                callback {pars->VoicePar[nvoice].PFMoscilphase=64-(int)o->value();
oscFM->phase=64-(int) o->value();
fmoscil->redraw();}
                xywh {665 395 65 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1
                code0 {o->value(64-pars->VoicePar[nvoice].PFMoscilphase);}
              }
              Fl_Choice {} {
                label Use
                callback {pars->VoicePar[nvoice].PextFMoscil=(int)o->value()-1;
if ((int) o->value() != 0) {
    oscFM->init(pars->VoicePar[(int) o->value()-1].FMSmp,master);
    changeFMoscilbutton->labelcolor(FL_BLUE);
} else { 
    oscFM->init(pars->VoicePar[nvoice].FMSmp,master);
    changeFMoscilbutton->labelcolor(FL_BLACK);
};
voiceFMparametersgroup->redraw();} open
                xywh {560 390 75 15} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10
                code0 {o->add("Internal");}
                code1 {char tmp[50]; for (int i=0;i<nvoice;i++) {sprintf(tmp,"ExtM.%2d",i+1);o->add(tmp);};}
                code3 {o->value(pars->VoicePar[nvoice].PextFMoscil+1);}
              } {}
            }
            Fl_Choice {} {
              label {External Mod.}
              callback {pars->VoicePar[nvoice].PFMVoice=(int)o->value()-1;
if ((int) o->value() != 0) {
    modoscil->deactivate();
    modfrequency->deactivate();
} else { 
    modoscil->activate();
    modfrequency->activate();
};
voiceFMparametersgroup->redraw();} open
              xywh {635 40 85 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
              code0 {o->add("OFF");}
              code1 {char tmp[50]; for (int i=0;i<nvoice;i++) {sprintf(tmp,"ExtMod.%2d",i+1);o->add(tmp);};}
              code2 {o->value(pars->VoicePar[nvoice].PFMVoice+1);}
              code3 {if ((int) o->value() != 0) {modoscil->deactivate();modfrequency->deactivate();}}
            } {}
          }
          Fl_Choice {} {
            label {Type:}
            callback {pars->VoicePar[nvoice].PFMEnabled=(int)o->value();
if (o->value()==0) voiceFMparametersgroup->deactivate();
else voiceFMparametersgroup->activate();
o->redraw();}
            xywh {535 40 80 20} down_box BORDER_BOX align 5
            code0 {o->value(pars->VoicePar[nvoice].PFMEnabled);}
          } {
            menuitem {} {
              label OFF
              xywh {40 40 100 20} labelfont 1
            }
            menuitem {} {
              label MORPH
              xywh {50 50 100 20} labelfont 1
            }
            menuitem {} {
              label RING
              xywh {60 60 100 20} labelfont 1
            }
            menuitem {} {
              label PM
              xywh {70 70 100 20} labelfont 1
            }
            menuitem {} {
              label FM
              xywh {80 80 100 20} labelfont 1
            }
            menuitem {} {
              label PITCH
              xywh {90 90 100 20} labelfont 1 deactivate
            }
          }
          Fl_Group {} {
            label FREQUENCY
            xywh {5 250 525 120} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
          } {
            Fl_Group voicefreqenvgroup {
              label {ADSynth Voice - Frequency Envelope} open
              xywh {10 290 205 70} box FLAT_BOX color 51 align 144
              code0 {o->init(pars->VoicePar[nvoice].FreqEnvelope);}
              code1 {if (pars->VoicePar[nvoice].PFreqEnvelopeEnabled==0) o->deactivate();}
              class EnvelopeUI
            } {}
            Fl_Check_Button {} {
              label Enable
              callback {pars->VoicePar[nvoice].PFreqEnvelopeEnabled=(int)o->value();
if (o->value()==0) voicefreqenvgroup->deactivate();
else voicefreqenvgroup->activate();
o->redraw();}
              tooltip {Forced Relase} xywh {15 295 50 10} down_box DOWN_BOX labelfont 1 labelsize 10
              code0 {o->value(pars->VoicePar[nvoice].PFreqEnvelopeEnabled);}
            }
            Fl_Group voicefreqlfogroup {
              label {Frequency LFO     } open
              xywh {215 290 230 70} box FLAT_BOX color 47 align 144
              code0 {o->init(pars->VoicePar[nvoice].FreqLfo);}
              code1 {if (pars->VoicePar[nvoice].PFreqLfoEnabled==0) o->deactivate();}
              class LFOUI
            } {}
            Fl_Check_Button {} {
              label Enable
              callback {pars->VoicePar[nvoice].PFreqLfoEnabled=(int)o->value();
if (o->value()==0) voicefreqlfogroup->deactivate();
else voicefreqlfogroup->activate();
o->redraw();}
              tooltip {Forced Relase} xywh {220 295 55 10} down_box DOWN_BOX labelfont 1 labelsize 12 align 24
              code0 {o->value(pars->VoicePar[nvoice].PFreqLfoEnabled);}
            }
            Fl_Counter {} {
              label Octave
              callback {int k=(int) o->value();
if (k<0) k+=16;
pars->VoicePar[nvoice].PCoarseDetune = k*1024+
   pars->VoicePar[nvoice].PCoarseDetune%1024;}
              tooltip Octave xywh {470 270 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12
              code0 {int k=pars->VoicePar[nvoice].PCoarseDetune/1024;}
              code1 {if (k>=8) k-=16;}
              code2 {o->value(k);}
            }
            Fl_Counter {} {
              label {Coarse Det.}
              callback {int k=(int) o->value();
if (k<0) k+=1024;
pars->VoicePar[nvoice].PCoarseDetune = k+
   (pars->VoicePar[nvoice].PCoarseDetune/1024)*1024;}
              tooltip {Coarse Detune} xywh {455 340 60 20} labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 12
              code0 {int k=pars->VoicePar[nvoice].PCoarseDetune%1024;}
              code1 {if (k>=512) k-=1024;}
              code2 {o->value(k);}
              code3 {o->lstep(10);}
            }
            Fl_Slider {} {
              callback {pars->VoicePar[nvoice].PDetune=(int)o->value()+8192;
detunevalueoutput->do_callback();}
              tooltip {Fine Detune (cents)} xywh {58 272 392 13} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
              code0 {o->value(pars->VoicePar[nvoice].PDetune-8192);}
            }
            Fl_Value_Output detunevalueoutput {
              label Detune
              callback {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());}
              xywh {10 272 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
              code0 {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());}
            }
            Fl_Check_Button {} {
              label 440Hz
              callback {int x=(int) o->value();
pars->VoicePar[nvoice].Pfixedfreq=x;
if (x==0) fixedfreqetdial->deactivate();
    else fixedfreqetdial->activate();}
              tooltip {Set the voice base frequency to 440Hz} xywh {345 253 55 15} down_box DOWN_BOX labelfont 1 labelsize 12
              code0 {o->value(pars->VoicePar[nvoice].Pfixedfreq);}
            }
            Fl_Dial fixedfreqetdial {
              label {Eq.T.}
              callback {pars->VoicePar[nvoice].PfixedfreqET=(int) o->value();}
              tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {405 255 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
              code0 {o->value(pars->VoicePar[nvoice].PfixedfreqET);}
              code1 {if (pars->VoicePar[nvoice].Pfixedfreq==0) o->deactivate();}
              class WidgetPDial
            }
            Fl_Choice {} {
              label {Detune Type}
              callback {pars->VoicePar[nvoice].PDetuneType=(int) o->value();
detunevalueoutput->do_callback();} open
              xywh {450 305 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
              code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
              code1 {o->value(pars->VoicePar[nvoice].PDetuneType);}
            } {}
          }
          Fl_Group voiceoscil {
            xywh {80 375 445 145} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
            code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
            code1 {int nv=nvoice; if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil;}
            code2 {osc->init(pars->VoicePar[nv].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);}
          } {}
          Fl_Button changevoiceoscilbutton {
            label Change
            callback {if (oscedit!=NULL) delete(oscedit);

int nv=nvoice;
if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil;

oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,NULL,NULL,master);}
            xywh {5 475 65 20} box THIN_UP_BOX labelfont 1 labelsize 12
            code0 {if (pars->VoicePar[nvoice].Pextoscil>=0) o->labelcolor(FL_BLUE);}
          }
          Fl_Box {} {
            label {Voice Oscillator}
            xywh {5 375 75 35} labelfont 1 align 128
          }
          Fl_Slider {} {
            label Phase
            callback {pars->VoicePar[nvoice].Poscilphase=64-(int)o->value();
osc->phase=64-(int) o->value();
voiceoscil->redraw();}
            xywh {10 420 65 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1
            code0 {o->value(64-pars->VoicePar[nvoice].Poscilphase);}
          }
          Fl_Check_Button {} {
            label {R.}
            callback {pars->VoicePar[nvoice].Presonance=(int) o->value();}
            tooltip {Resonance On/Off} xywh {210 5 35 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 12
            code0 {o->value(pars->VoicePar[nvoice].Presonance);}
          }
          Fl_Choice {} {
            label {Use Oscil.}
            callback {pars->VoicePar[nvoice].Pextoscil=(int)o->value()-1;
if ((int) o->value() != 0) {
    osc->init(pars->VoicePar[(int) o->value()-1].OscilSmp,master);
    changevoiceoscilbutton->labelcolor(FL_BLUE);
} else { 
    osc->init(pars->VoicePar[nvoice].OscilSmp,master);
    changevoiceoscilbutton->labelcolor(FL_BLACK);
};

voiceparametersgroup->redraw();
voiceonbutton->redraw();} open
            xywh {5 455 65 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
            code0 {o->add("Internal");}
            code1 {char tmp[50]; for (int i=0;i<nvoice;i++) {sprintf(tmp,"Ext.%2d",i+1);o->add(tmp);};}
            code3 {o->value(pars->VoicePar[nvoice].Pextoscil+1);}
          } {}
        }
        Fl_Group {} {
          label AMPLITUDE
          xywh {5 40 240 210} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
        } {
          Fl_Value_Slider {} {
            label Vol
            callback {pars->VoicePar[nvoice].PVolume=(int)o->value();}
            tooltip Volume xywh {10 60 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
            code0 {o->value(pars->VoicePar[nvoice].PVolume);}
          }
          Fl_Value_Slider {} {
            label {V.Sns}
            callback {pars->VoicePar[nvoice].PAmpVelocityScaleFunction=(int) o->value();}
            tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 80 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
            code0 {o->value(pars->VoicePar[nvoice].PAmpVelocityScaleFunction);}
          }
          Fl_Group voiceampenvgroup {
            label {ADSynth Voice - Amplitude Envelope} open
            xywh {10 105 205 70} box FLAT_BOX color 51 align 144
            code0 {o->init(pars->VoicePar[nvoice].AmpEnvelope);}
            code1 {if (pars->VoicePar[nvoice].PAmpEnvelopeEnabled==0) o->deactivate();}
            class EnvelopeUI
          } {}
          Fl_Dial {} {
            label Pan
            callback {pars->VoicePar[nvoice].PPanning=(int) o->value();}
            tooltip {Panning (leftmost is Random)} xywh {210 60 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
            code0 {o->value(pars->VoicePar[nvoice].PPanning);}
            class WidgetPDial
          }
          Fl_Check_Button {} {
            label Enable
            callback {pars->VoicePar[nvoice].PAmpEnvelopeEnabled=(int)o->value();
if (o->value()==0) voiceampenvgroup->deactivate();
else voiceampenvgroup->activate();
o->redraw();}
            tooltip {Forced Relase} xywh {15 110 50 10} down_box DOWN_BOX labelfont 1 labelsize 10
            code0 {o->value(pars->VoicePar[nvoice].PAmpEnvelopeEnabled);}
          }
          Fl_Group voiceamplfogroup {
            label {Amplitude LFO     } open
            xywh {10 175 230 70} box FLAT_BOX color 47 align 144
            code0 {o->init(pars->VoicePar[nvoice].AmpLfo);}
            code1 {if (pars->VoicePar[nvoice].PAmpLfoEnabled==0) o->deactivate();}
            class LFOUI
          } {}
          Fl_Check_Button {} {
            label Enable
            callback {pars->VoicePar[nvoice].PAmpLfoEnabled=(int)o->value();
if (o->value()==0) voiceamplfogroup->deactivate();
else voiceamplfogroup->activate();
o->redraw();}
            tooltip {Forced Relase} xywh {15 180 55 10} down_box DOWN_BOX labelfont 1 labelsize 12 align 24
            code0 {o->value(pars->VoicePar[nvoice].PAmpLfoEnabled);}
          }
          Fl_Check_Button {} {
            label Minus
            callback {pars->VoicePar[nvoice].PVolumeminus=(int)o->value();}
            xywh {10 45 50 10} down_box DOWN_BOX labelfont 1 labelsize 10
            code0 {o->value(pars->VoicePar[nvoice].PVolumeminus);}
          }
        }
        Fl_Group voicefiltergroup {
          label FILTER
          xywh {245 5 285 245} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
          code0 {if (pars->VoicePar[nvoice].PFilterEnabled==0) o->deactivate();}
        } {
          Fl_Group {} {
            label {ADsynth Voice - Filter} open
            xywh {250 30 275 75} box FLAT_BOX color 50 align 144
            code0 {o->init(pars->VoicePar[nvoice].VoiceFilter,NULL,NULL);}
            class FilterUI
          } {}
          Fl_Group voicefilterenvgroup {
            label {ADSynth Voice - Filter Envelope} open
            xywh {250 105 275 70} box FLAT_BOX color 51 align 144
            code0 {o->init(pars->VoicePar[nvoice].FilterEnvelope);}
            code1 {if (pars->VoicePar[nvoice].PFilterEnvelopeEnabled==0) o->deactivate();}
            class EnvelopeUI
          } {}
          Fl_Check_Button {} {
            label Enable
            callback {pars->VoicePar[nvoice].PFilterEnvelopeEnabled=(int)o->value();
if (o->value()==0) voicefilterenvgroup->deactivate();
else voicefilterenvgroup->activate();
o->redraw();}
            tooltip {Forced Relase} xywh {255 110 55 10} down_box DOWN_BOX labelfont 1 labelsize 10
            code0 {o->value(pars->VoicePar[nvoice].PFilterEnvelopeEnabled);}
          }
          Fl_Group voicefilterlfogroup {
            label {Filter LFO     } open
            xywh {250 175 230 70} box FLAT_BOX color 47 align 144
            code0 {o->init(pars->VoicePar[nvoice].FilterLfo);}
            code1 {if (pars->VoicePar[nvoice].PFilterLfoEnabled==0) o->deactivate();}
            class LFOUI
          } {}
          Fl_Check_Button {} {
            label Enable
            callback {pars->VoicePar[nvoice].PFilterLfoEnabled=(int)o->value();
if (o->value()==0) voicefilterlfogroup->deactivate();
else voicefilterlfogroup->activate();
o->redraw();}
            tooltip {Forced Relase} xywh {255 180 55 10} down_box DOWN_BOX labelfont 1 labelsize 12 align 24
            code0 {o->value(pars->VoicePar[nvoice].PFilterLfoEnabled);}
          }
        }
        Fl_Group {} {
          label 01
          xywh {5 5 55 35} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 30 align 16
          code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));}
        } {}
        Fl_Choice {} {
          callback {int x=(int) o->value();
pars->VoicePar[nvoice].Type=x;
if (x==0) voicemodegroup->activate();
  else voicemodegroup->deactivate();
noiselabel->do_callback();}
          tooltip {Oscillator Type (sound/noise)} xywh {5 500 65 20} down_box BORDER_BOX labelsize 11 textfont 1 textsize 11
          code0 {o->value(pars->VoicePar[nvoice].Type);}
          code1 {if (pars->VoicePar[nvoice].Type!=0) voicemodegroup->deactivate();}
        } {
          menuitem {} {
            label Sound
            xywh {5 5 100 20} labelfont 1 labelsize 13
          }
          menuitem {} {
            label NOISE
            xywh {15 15 100 20} labelfont 1 labelsize 13 labelcolor 1
          }
        }
        Fl_Check_Button bypassfiltercheckbutton {
          label {Bypass Global F.}
          callback {pars->VoicePar[nvoice].Pfilterbypass=(int)o->value();}
          xywh {425 10 100 20} down_box DOWN_BOX labelfont 1 labelsize 10 align 148
          code0 {o->value(pars->VoicePar[nvoice].Pfilterbypass);}
        }
        Fl_Group {} {
          xywh {115 5 95 35} box THIN_UP_BOX
        } {
          Fl_Value_Slider {} {
            label Delay
            callback {pars->VoicePar[nvoice].PDelay=(int)o->value();}
            tooltip Volume xywh {120 21 84 12} type {Horz Knob} box FLAT_BOX labelsize 12 align 5 maximum 127 step 1
            code0 {o->value(pars->VoicePar[nvoice].PDelay);}
          }
        }
        Fl_Check_Button {} {
          label Enable
          callback {pars->VoicePar[nvoice].PFilterEnabled=(int)o->value();
if (o->value()==0) voicefiltergroup->deactivate();
else voicefiltergroup->activate();
o->redraw();
bypassfiltercheckbutton->redraw();}
          tooltip {Enable Filter} xywh {250 15 60 15} down_box DOWN_BOX labelfont 1 labelsize 12
          code0 {o->value(pars->VoicePar[nvoice].PFilterEnabled);}
        }
        Fl_Box noiselabel {
          label {White Noise}
          callback {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();}
          xywh {150 415 300 65} labelfont 1 labelsize 50 labelcolor 7
          code0 {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();}
        }
      }
      Fl_Check_Button voiceonbutton {
        label On
        callback {pars->VoicePar[nvoice].Enabled=(int)o->value();
if (o->value()==0) voiceparametersgroup->deactivate();
else voiceparametersgroup->activate();
o->redraw();}
        xywh {60 5 55 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 16
        code0 {o->value(pars->VoicePar[nvoice].Enabled);}
      }
    }
  }
  Function {ADvoiceUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {nvoice=0;
pars=NULL;
oscedit=NULL;} {}
  }
  Function {init(ADnoteParameters *parameters,int nvoice_,Master *master_)} {} {
    code {pars=parameters;
nvoice=nvoice_;
master=master_;
make_window();
end();
ADnoteVoiceParameters->show();} {}
  }
  Function {~ADvoiceUI()} {} {
    code {ADnoteVoiceParameters->hide();
hide();
if (oscedit!=NULL) {
    delete(oscedit);
};
//delete (ADnoteVoiceParameters);} {}
  }
  decl {int nvoice;} {}
  decl {ADnoteParameters *pars;} {}
  decl {OscilEditor *oscedit;} {}
  decl {Oscilloscope *osc;} {}
  decl {Oscilloscope *oscFM;} {}
  decl {Master *master;} {}
} 

class ADnoteUI {: {public PresetsUI_}
} {
  Function {make_window()} {private
  } {
    Fl_Window ADnoteGlobalParameters {
      label {ADsynth Global Parameters of the Instrument}
      xywh {66 187 535 405} type Double hide
    } {
      Fl_Group {} {
        label FREQUENCY
        xywh {5 255 525 115} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
      } {
        Fl_Group freqenv {
          label {ADSynth Global - Frequency Envelope} open
          xywh {10 295 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->GlobalPar.FreqEnvelope);}
          class EnvelopeUI
        } {}
        Fl_Counter octave {
          label Octave
          callback {int k=(int) o->value();
if (k<0) k+=16;
pars->GlobalPar.PCoarseDetune = k*1024+
   pars->GlobalPar.PCoarseDetune%1024;}
          tooltip Octave xywh {450 275 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12
          code0 {int k=pars->GlobalPar.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->GlobalPar.PCoarseDetune = k+
   (pars->GlobalPar.PCoarseDetune/1024)*1024;}
          tooltip {Coarse Detune} xywh {455 345 60 20} labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 12
          code0 {int k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024;}
          code2 {o->value(k);}
          code3 {o->lstep(10);}
        }
        Fl_Group freqlfo {
          label {Frequency LFO     } open
          xywh {215 295 230 70} box FLAT_BOX color 47 align 144
          code0 {o->init(pars->GlobalPar.FreqLfo);}
          class LFOUI
        } {}
        Fl_Slider freq {
          callback {pars->GlobalPar.PDetune=(int)o->value()+8192;
detunevalueoutput->do_callback();}
          tooltip {Fine Detune (cents)} xywh {60 275 385 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
          code0 {o->value(pars->GlobalPar.PDetune-8192);}
        }
        Fl_Value_Output detunevalueoutput {
          label Detune
          callback {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));}
          xywh {12 275 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
          code0 {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));}
        }
        Fl_Choice detunetype {
          label {Detune Type}
          callback {pars->GlobalPar.PDetuneType=(int) o->value()+1;
detunevalueoutput->do_callback();} open
          xywh {450 315 75 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->GlobalPar.PDetuneType-1);}
        } {}
        Fl_Dial {} {
          label relBW
          callback {pars->GlobalPar.PBandwidth=(int) o->value();

pars->getBandwidthDetuneMultiplier();

for (int i=0;i<NUM_VOICES;i++){
  voicelistitem[i]->refreshlist();
};}
          tooltip {Bandwidth - how the relative fine detune of the voice are changed} xywh {500 270 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PBandwidth);}
          class WidgetPDial
        }
      }
      Fl_Group {} {
        label AMPLITUDE
        xywh {5 5 240 250} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
      } {
        Fl_Value_Slider volume {
          label Vol
          callback {pars->GlobalPar.PVolume=(int)o->value();}
          tooltip Volume xywh {10 30 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PVolume);}
        }
        Fl_Value_Slider vsns {
          label {V.Sns}
          callback {pars->GlobalPar.PAmpVelocityScaleFunction=(int) o->value();}
          tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PAmpVelocityScaleFunction);}
        }
        Fl_Dial pan {
          label Pan
          callback {pars->GlobalPar.PPanning=(int) o->value();}
          tooltip {Panning (leftmost is Random)} xywh {210 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PPanning);}
          class WidgetPDial
        }
        Fl_Dial pstr {
          label {P.Str.}
          callback {pars->GlobalPar.PPunchStrength=(int) o->value();}
          tooltip {Punch Strength} xywh {125 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PPunchStrength);}
          class WidgetPDial
        }
        Fl_Dial pt {
          label {P.t.}
          callback {pars->GlobalPar.PPunchTime=(int) o->value();}
          tooltip {Punch Time (duration)} xywh {155 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PPunchTime);}
          class WidgetPDial
        }
        Fl_Dial pstc {
          label {P.Stc.}
          callback {pars->GlobalPar.PPunchStretch=(int) o->value();}
          tooltip {Punch Stretch} xywh {185 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PPunchStretch);}
          class WidgetPDial
        }
        Fl_Dial pvel {
          label {P.Vel.}
          callback {pars->GlobalPar.PPunchVelocitySensing=(int) o->value();}
          tooltip {Punch Velocity Sensing} xywh {215 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
          code0 {o->value(pars->GlobalPar.PPunchVelocitySensing);}
          class WidgetPDial
        }
        Fl_Group ampenv {
          label {ADSynth Global - Amplitude Envelope} open
          xywh {10 75 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->GlobalPar.AmpEnvelope);}
          class EnvelopeUI
        } {}
        Fl_Group amplfo {
          label {Amplitude LFO          } open
          xywh {10 145 230 70} box FLAT_BOX color 47 align 144
          code0 {o->init(pars->GlobalPar.AmpLfo);}
          class LFOUI
        } {}
        Fl_Check_Button rndgrp {
          label {Rnd Grp}
          callback {pars->GlobalPar.Hrandgrouping=(int) o->value();}
          tooltip {How the Harmonic Amplitude is applied to voices that use the same oscillator} xywh {70 225 40 25} down_box DOWN_BOX labelsize 10 align 148
          code0 {o->value(pars->GlobalPar.Hrandgrouping);}
        }
      }
      Fl_Group {} {
        label FILTER
        xywh {245 5 285 250} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
      } {
        Fl_Group filterenv {
          label {ADSynth Global - Filter Envelope} open
          xywh {250 110 275 70} box FLAT_BOX color 51 align 144
          code0 {o->init(pars->GlobalPar.FilterEnvelope);}
          class EnvelopeUI
        } {}
        Fl_Group filterlfo {
          label {Filter LFO} open
          xywh {250 180 230 70} box FLAT_BOX color 47 align 144
          code0 {o->init(pars->GlobalPar.FilterLfo);}
          class LFOUI
        } {}
        Fl_Group filterui {
          label {ADsynth Global - Filter} open
          xywh {250 35 275 75} box FLAT_BOX color 50 align 144
          code0 {o->init(pars->GlobalPar.GlobalFilter,&pars->GlobalPar.PFilterVelocityScale,&pars->GlobalPar.PFilterVelocityScaleFunction);}
          class FilterUI
        } {}
      }
      Fl_Check_Button stereo {
        label Stereo
        callback {pars->GlobalPar.PStereo=(int) o->value();}
        xywh {5 220 65 35} box ENGRAVED_BOX down_box DOWN_BOX labelfont 1 labelsize 12
        code0 {o->value(pars->GlobalPar.PStereo);}
      }
      Fl_Button {} {
        label {Show Voice List}
        callback {for (int i=0;i<NUM_VOICES;i++){
  voicelistitem[i]->refreshlist();
}
ADnoteVoiceList->show();}
        xywh {180 375 125 25}
      }
      Fl_Button {} {
        label {Show Voice Parameters}
        callback {ADnoteVoice->show();}
        xywh {5 375 170 25} labelfont 1
      }
      Fl_Button {} {
        label Close
        callback {ADnoteGlobalParameters->hide();}
        xywh {470 375 60 25} box THIN_UP_BOX
      }
      Fl_Button {} {
        label Resonance
        callback {resui->resonancewindow->redraw();
resui->resonancewindow->show();}
        tooltip Resonance xywh {309 375 86 25} box THIN_UP_BOX
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(pars);}
        xywh {405 380 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(pars,this);}
        xywh {435 380 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
    }
    Fl_Window ADnoteVoice {
      label {ADsynth Voice Parameters}
      xywh {53 58 765 560} type Double hide
    } {
      Fl_Group advoice {
        xywh {0 0 760 525} box BORDER_BOX
        code0 {o->init(pars,nvoice,master);}
        code1 {o->show();}
        class ADvoiceUI
      } {}
      Fl_Button {} {
        label {Close Window}
        callback {ADnoteVoice->hide();}
        xywh {300 530 195 25} box THIN_UP_BOX labelfont 1
      }
      Fl_Counter currentvoicecounter {
        label {Current Voice}
        callback {nvoice=(int)o->value()-1;
advoice->hide();
ADnoteVoice->remove(advoice);
delete advoice;
advoice=new ADvoiceUI(0,0,765,525);
ADnoteVoice->add(advoice);
advoice->init(pars,nvoice,master);
advoice->show();
ADnoteVoice->redraw();}
        xywh {5 530 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 18
        code0 {o->bounds(1,NUM_VOICES);}
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(pars,nvoice);}
        xywh {700 535 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(pars,this,nvoice);}
        xywh {730 535 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
    }
    Fl_Window ADnoteVoiceList {
      label {ADsynth Voices list}
      xywh {32 266 650 260} type Double hide
    } {
      Fl_Text_Display {} {
        label {No.}
        xywh {10 15 30 10} box NO_BOX labelfont 1 labelsize 13
      }
      Fl_Text_Display {} {
        label Vol
        xywh {145 15 30 10} box NO_BOX labelfont 1 labelsize 13
      }
      Fl_Text_Display {} {
        label Detune
        xywh {384 15 25 10} box NO_BOX labelfont 1 labelsize 13
      }
      Fl_Text_Display {} {
        label Pan
        xywh {210 15 30 10} box NO_BOX labelfont 1 labelsize 13
      }
      Fl_Text_Display {} {
        label {Vib. Depth}
        xywh {560 15 30 10} box NO_BOX labelfont 1 labelsize 13
      }
      Fl_Text_Display {} {
        label {R.}
        xywh {245 15 25 10} box NO_BOX labelfont 1 labelsize 13
      }
      Fl_Button {} {
        label {Hide Voice List}
        callback {ADnoteVoiceList->hide();}
        xywh {255 237 125 20}
      }
      Fl_Scroll {} {open
        xywh {0 15 640 220} type VERTICAL box THIN_UP_BOX
      } {
        Fl_Pack {} {open
          xywh {0 20 620 210}
          code0 {for (int i=0;i<NUM_VOICES;i++){voicelistitem[i]=new ADvoicelistitem(0,0,620,25,"");voicelistitem[i]->init(pars,i,master);}}
        } {}
      }
    }
  }
  Function {ADnoteUI(ADnoteParameters *parameters,Master *master_)} {} {
    code {pars=parameters;
master=master_;
nvoice=0;
resui=new ResonanceUI(pars->GlobalPar.Reson);
make_window();} {}
  }
  Function {~ADnoteUI()} {} {
    code {ADnoteVoiceList->hide();
ADnoteGlobalParameters->hide();
ADnoteVoice->hide();
delete(ADnoteVoiceList);
delete(ADnoteGlobalParameters);
delete(ADnoteVoice);
delete(resui);} {}
  }
  Function {refresh()} {} {
    code {volume->value(pars->GlobalPar.PVolume);
vsns->value(pars->GlobalPar.PAmpVelocityScaleFunction);
pan->value(pars->GlobalPar.PPanning);

stereo->value(pars->GlobalPar.PStereo);
rndgrp->value(pars->GlobalPar.Hrandgrouping);

pstr->value(pars->GlobalPar.PPunchStrength);
pt->value(pars->GlobalPar.PPunchTime);
pstc->value(pars->GlobalPar.PPunchStretch);
pvel->value(pars->GlobalPar.PPunchVelocitySensing);

detunevalueoutput->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));
freq->value(pars->GlobalPar.PDetune-8192);

int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16;
octave->value(k);

detunetype->value(pars->GlobalPar.PDetuneType-1);
k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024;
coarsedet->value(k);
amplfo->refresh();
freqlfo->refresh();
filterlfo->refresh();

ampenv->refresh();
freqenv->refresh();
filterenv->refresh();
filterui->refresh();

for (int i=0;i<NUM_VOICES;i++) voicelistitem[i]->refreshlist();

resui->refresh();
currentvoicecounter->do_callback();} {}
  }
  decl {ADnoteParameters *pars;} {}
  decl {ResonanceUI *resui;} {}
  decl {Master *master;} {}
  decl {int nvoice;} {}
  decl {ADvoicelistitem *voicelistitem[NUM_VOICES];} {}
}