home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / ZynAddFX / Setup_ZynAddSubFX-2.1.1.exe / PADnoteUI.fl < prev    next >
Encoding:
FLTK User Interface Designer  |  2004-08-17  |  34.1 KB  |  1,065 lines

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0105 
  3. header_name {.h} 
  4. code_name {.cc}
  5. decl {\#include "../Params/PADnoteParameters.h"} {public
  6.  
  7. decl {\#include "../Misc/Util.h"} {public
  8.  
  9. decl {\#include "../Misc/Master.h"} {public
  10.  
  11. decl {\#include "ResonanceUI.h"} {public
  12.  
  13. decl {\#include <FL/Fl_Box.H>} {public
  14.  
  15. decl {\#include <FL/Fl_Group.H>} {public
  16.  
  17. decl {\#include <math.h>} {} 
  18.  
  19. decl {\#include <stdio.h>} {} 
  20.  
  21. decl {\#include <stdlib.h>} {} 
  22.  
  23. decl {\#include <string.h>} {} 
  24.  
  25. decl {\#include "WidgetPDial.h"} {public
  26.  
  27. decl {\#include "EnvelopeUI.h"} {public
  28.  
  29. decl {\#include "LFOUI.h"} {public
  30.  
  31. decl {\#include "FilterUI.h"} {public
  32.  
  33. decl {\#include "OscilGenUI.h"} {public
  34.  
  35. decl {\#include "PresetsUI.h"} {public
  36.  
  37. class PADnoteHarmonicProfile {: {public Fl_Box}
  38. } {
  39.   Function {PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  40.     code {pars=NULL;} {}
  41.   }
  42.   Function {init(PADnoteParameters *pars,Master *master_)} {} {
  43.     code {master=master_;
  44. this->pars=pars;} {}
  45.   }
  46.   Function {draw()} {} {
  47.     code {int ox=x(),oy=y(),lx=w(),ly=h();
  48. if (!visible()) return;
  49. REALTYPE smps[lx];
  50.  
  51. REALTYPE realbw=pars->getprofile(smps,lx);
  52. bool active=active_r();
  53.  
  54. //draw the equivalent bandwidth
  55. if (active) fl_color(220,220,220);
  56.  else fl_color(160,165,165);
  57. fl_line_style(0);
  58. int rbw=(int)(realbw*(lx-1.0)/2.0);
  59. for (int i=lx/2-rbw;i<(lx/2+rbw);i++) fl_line(ox+i,oy,ox+i,oy+ly-1);
  60.  
  61. fl_line_style(0);
  62. if (active) fl_color(200,200,200);
  63.  else  fl_color(160,160,160);
  64. for (int i=1;i<10;i++){
  65.     int kx=(int)(lx/10.0*i);
  66.     fl_line(ox+kx,oy,ox+kx,oy+ly-1);
  67. };
  68. for (int i=1;i<5;i++){
  69.     int ky=(int)(ly/5.0*i);
  70.     fl_line(ox,oy+ly-ky,ox+lx,oy+ly-ky-1);
  71. };
  72.  
  73.  
  74. fl_color(120,120,120);
  75. fl_line_style(FL_DOT);
  76. fl_line(ox+lx/2,oy,ox+lx/2,oy+ly);
  77.  
  78. //draw the graph
  79. fl_line_style(0);
  80. int old=0;
  81. for (int i=0;i<lx;i++){
  82.    int val=(int) ((ly-2)*smps[i]);
  83.    if (active) fl_color(180,210,240);
  84.       else fl_color(150,150,155);
  85.    fl_line(ox+i,oy+ly-1,ox+i,oy+ly-1-val);
  86.    if (active) fl_color(0,0,100);
  87.        else fl_color(150,150,150);
  88.    if (i>0) fl_line(ox+i-1,oy+ly-2-old,ox+i,oy+ly-2-val);
  89.    old=val;   
  90. };
  91.  
  92.  
  93. fl_line_style(FL_DASH);
  94. if (active) fl_color(0,100,220);
  95.     else fl_color(150,160,170);
  96. fl_line(ox+lx/2-rbw,oy,ox+lx/2-rbw,oy+ly-1);
  97. fl_line(ox+lx/2+rbw,oy,ox+lx/2+rbw,oy+ly-1);
  98.  
  99. fl_line_style(0);} {}
  100.   }
  101.   decl {Master *master;} {}
  102.   decl {PADnoteParameters *pars;} {public
  103.   }
  104.  
  105. class PADnoteOvertonePosition {: {public Fl_Box}
  106. } {
  107.   Function {PADnoteOvertonePosition(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  108.     code {pars=NULL;} {}
  109.   }
  110.   Function {init(PADnoteParameters *pars,Master *master_)} {} {
  111.     code {master=master_;
  112. this->pars=pars;} {}
  113.   }
  114.   Function {draw()} {} {
  115.     code {if (!visible()) return;
  116. const int maxdb=60;
  117.  
  118. int ox=x(),oy=y(),lx=w(),ly=h();
  119. const int maxharmonic=64;
  120.  
  121.  
  122. for (int i=1;i<maxharmonic;i++){
  123.     fl_color(200,200,200);
  124.     fl_line_style(FL_DOT);
  125.     if (i%5==0) fl_line_style(0);
  126.     if (i%10==0) fl_color(160,160,160);
  127.     int kx=(int)(lx/(REALTYPE)maxharmonic*i);
  128.     fl_line(ox+kx,oy,ox+kx,oy+ly);
  129. };
  130.  
  131.  
  132.  
  133. int n=OSCIL_SIZE/2;
  134. REALTYPE spc[n];
  135. for (int i=0;i<n;i++) spc[i]=0.0;
  136.  
  137. pthread_mutex_lock(&master->mutex);
  138. pars->oscilgen->getspectrum(n,spc,0);
  139. pthread_mutex_unlock(&master->mutex);
  140.  
  141.  
  142. //normalize
  143. REALTYPE max=0;
  144. for (int i=0;i<n;i++){
  145.    REALTYPE x=fabs(spc[i]);
  146.    if (max<x) max=x;
  147. }
  148. if (max<0.000001) max=1.0;
  149. max=max*1.05;
  150.  
  151. REALTYPE spectrum[lx];
  152. for (int i=0;i<lx;i++) spectrum[i]=0;
  153.  
  154.  
  155. for (int i=1;i<n;i++){
  156.     REALTYPE nhr=pars->getNhr(i);
  157.     int kx=(int)(lx/(REALTYPE)maxharmonic*nhr);
  158.     if ((kx<0)||(kx>lx)) continue;
  159.  
  160.         spectrum[kx]=spc[i-1]/max+1e-9;
  161.  
  162. };
  163.  
  164. fl_color(180,0,0);
  165. fl_line_style(0);
  166.  
  167. if (pars->Pmode==2){
  168.    int old=0;
  169.    for (int i=1;i<lx;i++){
  170.     if ((spectrum[i]>1e-10)||(i==(lx-1))){
  171.         int delta=i-old;
  172.         REALTYPE val1=spectrum[old];
  173.         REALTYPE val2=spectrum[i];
  174.  
  175.         REALTYPE idelta=1.0/delta;
  176.         for (int j=0;j<delta;j++){
  177.             REALTYPE x=idelta*j;
  178.             spectrum[old+j]=val1*(1.0-x)+val2*x;
  179.         };
  180.         old=i;
  181.     };
  182.       
  183.    };
  184. };
  185.  
  186. for (int i=0;i<lx;i++){
  187.     REALTYPE x=spectrum[i];
  188.         if (x>dB2rap(-maxdb)) x=rap2dB(x)/maxdb+1;
  189.              else continue;
  190.            int yy=(int)(x*ly);
  191.     fl_line(ox+i,oy+ly-1-yy,ox+i,oy+ly-1);
  192.       
  193. };} {}
  194.   }
  195.   decl {Master *master;} {}
  196.   decl {PADnoteParameters *pars;} {public
  197.   }
  198.  
  199. class PADnoteUI {: {public PresetsUI_}
  200. } {
  201.   Function {make_window()} {} {
  202.     Fl_Window padnotewindow {
  203.       label {PAD synth Parameters}
  204.       xywh {76 165 535 450} type Double hide
  205.     } {
  206.       Fl_Tabs {} {
  207.         callback {if (o->value()!=harmonicstructuregroup) applybutton->hide();
  208.     else applybutton->show();}
  209.         xywh {0 0 535 395}
  210.       } {
  211.         Fl_Group harmonicstructuregroup {
  212.           label {Harmonic Structure} selected
  213.           xywh {0 20 535 375} box ENGRAVED_BOX
  214.         } {
  215.           Fl_Group bwprofilegroup {
  216.             xywh {5 30 90 260} box ENGRAVED_BOX
  217.             code0 {if (pars->Pmode!=0) o->deactivate();}
  218.           } {
  219.             Fl_Dial hpbasepar1 {
  220.               label Width
  221.               callback {pars->Php.base.par1=(int) o->value();
  222. hprofile->redraw();
  223. cbwidget->do_callback();}
  224.               xywh {20 75 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  225.               code0 {o->value(pars->Php.base.par1);}
  226.               class WidgetPDial
  227.             }
  228.             Fl_Choice hpbasetype {
  229.               label {Base Type}
  230.               callback {pars->Php.base.type=o->value();
  231. hprofile->redraw();
  232. cbwidget->do_callback();}
  233.               xywh {15 45 75 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  234.               code0 {o->value(pars->Php.base.type);}
  235.             } {
  236.               menuitem {} {
  237.                 label Gauss
  238.                 xywh {15 15 100 20} labelfont 1 labelsize 10
  239.               }
  240.               menuitem {} {
  241.                 label Square
  242.                 xywh {25 25 100 20} labelfont 1 labelsize 10
  243.               }
  244.               menuitem {} {
  245.                 label DoubleExp
  246.                 xywh {35 35 100 20} labelfont 1 labelsize 10
  247.               }
  248.             }
  249.             Fl_Dial hpfreqmult {
  250.               label FreqMlt
  251.               callback {pars->Php.freqmult=(int) o->value();
  252. hprofile->redraw();
  253. cbwidget->do_callback();}
  254.               xywh {55 75 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  255.               code0 {o->value(pars->Php.freqmult);}
  256.               class WidgetPDial
  257.             }
  258.             Fl_Dial hpmpar1 {
  259.               label Str
  260.               callback {pars->Php.modulator.par1=(int) o->value();
  261. hprofile->redraw();
  262. cbwidget->do_callback();}
  263.               xywh {15 115 20 20} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  264.               code0 {o->value(pars->Php.modulator.par1);}
  265.               class WidgetPDial
  266.             }
  267.             Fl_Dial hpmfreq {
  268.               label SFreq
  269.               callback {pars->Php.modulator.freq=(int) o->value();
  270. hprofile->redraw();
  271. cbwidget->do_callback();}
  272.               xywh {40 115 20 20} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  273.               code0 {o->value(pars->Php.modulator.freq);}
  274.               class WidgetPDial
  275.             }
  276.             Fl_Group {} {
  277.               xywh {10 160 80 105} box BORDER_BOX
  278.             } {
  279.               Fl_Choice hpamptype {
  280.                 label AmpMultiplier
  281.                 callback {pars->Php.amp.type=o->value();
  282. hprofile->redraw();
  283. cbwidget->do_callback();}
  284.                 xywh {15 175 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  285.                 code0 {o->value(pars->Php.amp.type);}
  286.               } {
  287.                 menuitem {} {
  288.                   label OFF
  289.                   xywh {45 45 100 20} labelfont 1 labelsize 10
  290.                 }
  291.                 menuitem {} {
  292.                   label Gauss
  293.                   xywh {55 55 100 20} labelfont 1 labelsize 10
  294.                 }
  295.                 menuitem {} {
  296.                   label Sine
  297.                   xywh {65 65 100 20} labelfont 1 labelsize 10
  298.                 }
  299.                 menuitem {} {
  300.                   label Flat
  301.                   xywh {75 75 100 20} labelfont 1 labelsize 10
  302.                 }
  303.               }
  304.               Fl_Choice hpampmode {
  305.                 label AmpMode
  306.                 callback {pars->Php.amp.mode=o->value();
  307. hprofile->redraw();
  308. cbwidget->do_callback();}
  309.                 xywh {15 205 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  310.                 code0 {o->value(pars->Php.amp.mode);}
  311.               } {
  312.                 menuitem {} {
  313.                   label Sum
  314.                   xywh {60 60 100 20} labelfont 1 labelsize 10
  315.                 }
  316.                 menuitem {} {
  317.                   label Mult
  318.                   xywh {70 70 100 20} labelfont 1 labelsize 10
  319.                 }
  320.                 menuitem {} {
  321.                   label Div1
  322.                   xywh {80 80 100 20} labelfont 1 labelsize 10
  323.                 }
  324.                 menuitem {} {
  325.                   label Div2
  326.                   xywh {90 90 100 20} labelfont 1 labelsize 10
  327.                 }
  328.               }
  329.               Fl_Dial hpamppar1 {
  330.                 label Par1
  331.                 callback {pars->Php.amp.par1=(int) o->value();
  332. hprofile->redraw();
  333. cbwidget->do_callback();}
  334.                 xywh {15 235 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  335.                 code0 {o->value(pars->Php.amp.par1);}
  336.                 class WidgetPDial
  337.               }
  338.               Fl_Dial hpamppar2 {
  339.                 label Par2
  340.                 callback {pars->Php.amp.par2=(int) o->value();
  341. hprofile->redraw();
  342. cbwidget->do_callback();}
  343.                 xywh {55 235 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  344.                 code0 {o->value(pars->Php.amp.par2);}
  345.                 class WidgetPDial
  346.               }
  347.             }
  348.             Fl_Check_Button hpautoscale {
  349.               label autoscale
  350.               callback {pars->Php.autoscale=(int) o->value();
  351. hprofile->redraw();
  352. cbwidget->do_callback();}
  353.               xywh {10 270 60 15} down_box DOWN_BOX labelsize 10
  354.               code0 {o->value(pars->Php.autoscale);}
  355.             }
  356.             Fl_Choice hponehalf {
  357.               callback {pars->Php.onehalf=o->value();
  358. hprofile->redraw();
  359. cbwidget->do_callback();}
  360.               xywh {10 143 80 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  361.               code0 {o->value(pars->Php.onehalf);}
  362.             } {
  363.               menuitem {} {
  364.                 label Full
  365.                 xywh {25 25 100 20} labelfont 1 labelsize 10
  366.               }
  367.               menuitem {} {
  368.                 label {Upper Half}
  369.                 xywh {45 45 100 20} labelfont 1 labelsize 10
  370.               }
  371.               menuitem {} {
  372.                 label {Lower Half}
  373.                 xywh {35 35 100 20} labelfont 1 labelsize 10
  374.               }
  375.             }
  376.             Fl_Dial hpwidth {
  377.               label Size
  378.               callback {pars->Php.width=(int) o->value();
  379. hprofile->redraw();
  380. cbwidget->do_callback();}
  381.               xywh {65 115 20 20} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  382.               code0 {o->value(pars->Php.width);}
  383.               class WidgetPDial
  384.             }
  385.           }
  386.           Fl_Group {} {
  387.             xywh {100 155 270 135} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 align 6
  388.             code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
  389.             code1 {osc->init(pars->oscilgen,master);}
  390.           } {}
  391.           Fl_Button {} {
  392.             label Change
  393.             callback {if (oscui!=NULL) delete (oscui);
  394. oscui=new OscilEditor(pars->oscilgen,osc,cbwidget,master);}
  395.             xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 12
  396.           }
  397.           Fl_Box cbwidget {
  398.             label {Harmonic Content}
  399.             callback {overtonepos->redraw();
  400. applybutton->color(FL_RED);
  401. applybutton->redraw();}
  402.             xywh {125 135 205 20} align 16
  403.           }
  404.           Fl_Button {} {
  405.             label Resonance
  406.             callback {resui->resonancewindow->redraw();
  407. resui->resonancewindow->show();
  408. resui->setcbwidget(cbwidget);}
  409.             xywh {375 225 80 20} box THIN_UP_BOX
  410.           }
  411.           Fl_Dial bwdial {
  412.             label BandWidth
  413.             callback {bwcents->value(pars->setPbandwidth((int) o->value()));
  414. cbwidget->do_callback();}
  415.             xywh {15 295 35 35} box ROUND_UP_BOX labelsize 11 maximum 1000 step 1
  416.             code0 {o->value(pars->Pbandwidth);}
  417.             code1 {if (pars->Pmode!=0) o->deactivate();}
  418.             class WidgetPDial
  419.           }
  420.           Fl_Value_Output bwcents {
  421.             label cents
  422.             xywh {55 305 55 15} labelsize 10 align 6 maximum 10000 step 0.1
  423.             code0 {o->value(pars->setPbandwidth(pars->Pbandwidth));}
  424.             code1 {if (pars->Pmode!=0) o->deactivate();}
  425.           }
  426.           Fl_Group {} {
  427.             xywh {315 295 215 45} box ENGRAVED_BOX
  428.           } {
  429.             Fl_Choice hrpostype {
  430.               label OvertonesPosition
  431.               callback {pars->Phrpos.type=o->value();
  432. overtonepos->redraw();
  433. cbwidget->do_callback();}
  434.               xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 12
  435.               code0 {o->value(pars->Phrpos.type);}
  436.             } {
  437.               menuitem {} {
  438.                 label Harmonic
  439.                 xywh {70 70 100 20} labelfont 1 labelsize 12
  440.               }
  441.               menuitem {} {
  442.                 label ShiftU
  443.                 xywh {80 80 100 20} labelfont 1 labelsize 12
  444.               }
  445.               menuitem {} {
  446.                 label ShiftL
  447.                 xywh {90 90 100 20} labelfont 1 labelsize 12
  448.               }
  449.               menuitem {} {
  450.                 label PowerU
  451.                 xywh {90 90 100 20} labelfont 1 labelsize 12
  452.               }
  453.               menuitem {} {
  454.                 label PowerL
  455.                 xywh {100 100 100 20} labelfont 1 labelsize 12
  456.               }
  457.               menuitem {} {
  458.                 label Sine
  459.                 xywh {110 110 100 20} labelfont 1 labelsize 12
  460.               }
  461.               menuitem {} {
  462.                 label Power
  463.                 xywh {120 120 100 20} labelfont 1 labelsize 12
  464.               }
  465.             }
  466.             Fl_Dial hrpospar1 {
  467.               label Par1
  468.               callback {pars->Phrpos.par1=(int) o->value();
  469. overtonepos->redraw();
  470. cbwidget->do_callback();}
  471.               xywh {425 310 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 255 step 1
  472.               code0 {o->value(pars->Phrpos.par1);}
  473.               class WidgetPDial
  474.             }
  475.             Fl_Dial hrpospar2 {
  476.               label Par2
  477.               callback {pars->Phrpos.par2=(int) o->value();
  478. overtonepos->redraw();
  479. cbwidget->do_callback();}
  480.               xywh {460 310 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 255 step 1
  481.               code0 {o->value(pars->Phrpos.par2);}
  482.               class WidgetPDial
  483.             }
  484.             Fl_Dial hrpospar3 {
  485.               label ForceH
  486.               callback {pars->Phrpos.par3=(int) o->value();
  487. overtonepos->redraw();
  488. cbwidget->do_callback();}
  489.               xywh {495 310 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 255 step 1
  490.               code0 {o->value(pars->Phrpos.par3);}
  491.               class WidgetPDial
  492.             }
  493.           }
  494.           Fl_Choice bwscale {
  495.             label {Bandwidth Scale}
  496.             callback {pars->Pbwscale=(int) o->value();
  497. cbwidget->do_callback();}
  498.             xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 12
  499.             code0 {o->value(pars->Pbwscale);}
  500.             code1 {if (pars->Pmode!=0) o->deactivate();}
  501.           } {
  502.             menuitem {} {
  503.               label Normal
  504.               xywh {95 95 100 20} labelfont 1 labelsize 12
  505.             }
  506.             menuitem {} {
  507.               label EqualHz
  508.               xywh {105 105 100 20} labelfont 1 labelsize 12
  509.             }
  510.             menuitem {} {
  511.               label Quater
  512.               xywh {115 115 100 20} labelfont 1 labelsize 12
  513.             }
  514.             menuitem {} {
  515.               label Half
  516.               xywh {125 125 100 20} labelfont 1 labelsize 12
  517.             }
  518.             menuitem {} {
  519.               label {75%}
  520.               xywh {135 135 100 20} labelfont 1 labelsize 12
  521.             }
  522.             menuitem {} {
  523.               label {150%}
  524.               xywh {145 145 100 20} labelfont 1 labelsize 12
  525.             }
  526.             menuitem {} {
  527.               label Double
  528.               xywh {145 145 100 20} labelfont 1 labelsize 12
  529.             }
  530.             menuitem {} {
  531.               label {Inv.Half}
  532.               xywh {155 155 100 20} labelfont 1 labelsize 12
  533.             }
  534.           }
  535.           Fl_Group overtonepos {
  536.             xywh {5 345 525 45} box FLAT_BOX color 54 selection_color 218 labelcolor 63
  537.             code0 {PADnoteOvertonePosition *opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),"");}
  538.             code1 {opui->init(pars,master);}
  539.           } {}
  540.           Fl_Choice qsamplesize {
  541.             label {Sample Size}
  542.             callback {pars->Pquality.samplesize=(int) o->value();
  543. cbwidget->do_callback();}
  544.             xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 12
  545.             code0 {o->value(pars->Pquality.samplesize);}
  546.           } {
  547.             menuitem {} {
  548.               label {16k (Tiny)}
  549.               xywh {155 155 100 20} labelfont 1 labelsize 12
  550.             }
  551.             menuitem {} {
  552.               label 32k
  553.               xywh {165 165 100 20} labelfont 1 labelsize 12
  554.             }
  555.             menuitem {} {
  556.               label {64k (Small)}
  557.               xywh {175 175 100 20} labelfont 1 labelsize 12
  558.             }
  559.             menuitem {} {
  560.               label 128k
  561.               xywh {185 185 100 20} labelfont 1 labelsize 12
  562.             }
  563.             menuitem {} {
  564.               label {256k (Normal)}
  565.               xywh {205 205 100 20} labelfont 1 labelsize 12
  566.             }
  567.             menuitem {} {
  568.               label 512k
  569.               xywh {200 200 100 20} labelfont 1 labelsize 12
  570.             }
  571.             menuitem {} {
  572.               label {1M (Big)}
  573.               xywh {205 205 100 20} labelfont 1 labelsize 12
  574.             }
  575.           }
  576.           Fl_Choice qsmpoct {
  577.             label {smp/oct}
  578.             callback {pars->Pquality.smpoct=(int) o->value();
  579. cbwidget->do_callback();}
  580.             xywh {430 155 45 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12
  581.             code0 {o->value(pars->Pquality.smpoct);}
  582.           } {
  583.             menuitem {} {
  584.               label {0.5}
  585.               xywh {10 10 100 20} labelfont 1 labelsize 12
  586.             }
  587.             menuitem {} {
  588.               label 1
  589.               xywh {0 0 100 20} labelfont 1 labelsize 12
  590.             }
  591.             menuitem {} {
  592.               label 2
  593.               xywh {10 10 100 20} labelfont 1 labelsize 12
  594.             }
  595.             menuitem {} {
  596.               label 3
  597.               xywh {20 20 100 20} labelfont 1 labelsize 12
  598.             }
  599.             menuitem {} {
  600.               label 4
  601.               xywh {30 30 100 20} labelfont 1 labelsize 12
  602.             }
  603.             menuitem {} {
  604.               label 6
  605.               xywh {40 40 100 20} labelfont 1 labelsize 12
  606.             }
  607.             menuitem {} {
  608.               label 12
  609.               xywh {50 50 100 20} labelfont 1 labelsize 12
  610.             }
  611.           }
  612.           Fl_Choice qoct {
  613.             label {no.oct}
  614.             callback {pars->Pquality.oct=(int) o->value();
  615. cbwidget->do_callback();}
  616.             xywh {480 155 45 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12
  617.             code0 {o->value(pars->Pquality.oct);}
  618.           } {
  619.             menuitem {} {
  620.               label 1
  621.               xywh {10 10 100 20} labelfont 1 labelsize 12
  622.             }
  623.             menuitem {} {
  624.               label 2
  625.               xywh {20 20 100 20} labelfont 1 labelsize 12
  626.             }
  627.             menuitem {} {
  628.               label 3
  629.               xywh {30 30 100 20} labelfont 1 labelsize 12
  630.             }
  631.             menuitem {} {
  632.               label 4
  633.               xywh {40 40 100 20} labelfont 1 labelsize 12
  634.             }
  635.             menuitem {} {
  636.               label 5
  637.               xywh {50 50 100 20} labelfont 1 labelsize 12
  638.             }
  639.           }
  640.           Fl_Choice qbasenote {
  641.             label base
  642.             callback {pars->Pquality.basenote=(int) o->value();
  643. cbwidget->do_callback();}
  644.             xywh {375 155 50 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12
  645.             code0 {o->value(pars->Pquality.basenote);}
  646.           } {
  647.             menuitem {} {
  648.               label {C-2}
  649.               xywh {10 10 100 20} labelfont 1
  650.             }
  651.             menuitem {} {
  652.               label {G-2}
  653.               xywh {20 20 100 20} labelfont 1
  654.             }
  655.             menuitem {} {
  656.               label {C-3}
  657.               xywh {20 20 100 20} labelfont 1
  658.             }
  659.             menuitem {} {
  660.               label {G-3}
  661.               xywh {30 30 100 20} labelfont 1
  662.             }
  663.             menuitem {} {
  664.               label {C-4}
  665.               xywh {30 30 100 20} labelfont 1
  666.             }
  667.             menuitem {} {
  668.               label {G-4}
  669.               xywh {40 40 100 20} labelfont 1
  670.             }
  671.             menuitem {} {
  672.               label {C-5}
  673.               xywh {40 40 100 20} labelfont 1
  674.             }
  675.             menuitem {} {
  676.               label {G-5}
  677.               xywh {50 50 100 20} labelfont 1
  678.             }
  679.             menuitem {} {
  680.               label {G-6}
  681.               xywh {60 60 100 20} labelfont 1
  682.             }
  683.           }
  684.           Fl_Group hprofile {
  685.             xywh {100 45 430 90} box FLAT_BOX color 54 selection_color 218 labelcolor 63
  686.             code0 {PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");}
  687.             code1 {hpui->init(pars,master);}
  688.             code2 {if (pars->Pmode!=0) { o->deactivate(); o->color(48);};}
  689.           } {}
  690.           Fl_Box {} {
  691.             label {Profile of One Harmonic (Frequency Distribution)}
  692.             xywh {160 25 315 20}
  693.           }
  694.           Fl_Choice spectrummode {
  695.             label {Spectrum Mode}
  696.             callback {pars->Pmode=(int) o->value();
  697.  
  698. if (pars->Pmode==0){
  699.    bwprofilegroup->activate();
  700.    bwdial->activate();
  701.    bwcents->activate();
  702.    hprofile->activate();
  703.    hprofile->color(54);
  704.    bwscale->activate();
  705. } else {
  706.    bwprofilegroup->deactivate();
  707.    bwdial->deactivate();
  708.    bwcents->deactivate();
  709.    hprofile->deactivate();
  710.    hprofile->color(48);
  711.    bwscale->activate();
  712. };
  713.  
  714. cbwidget->do_callback();}
  715.             xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 labelcolor 0 align 5 textsize 12
  716.             code0 {o->value(pars->Pmode);}
  717.           } {
  718.             menuitem {} {
  719.               label Bandwidth
  720.               xywh {105 105 100 20} labelfont 1 labelsize 12
  721.             }
  722.             menuitem {} {
  723.               label Discrete
  724.               xywh {125 125 100 20} labelfont 1 labelsize 12 labelcolor 0
  725.             }
  726.             menuitem {} {
  727.               label Continous
  728.               xywh {115 115 100 20} labelfont 1 labelsize 12 labelcolor 0
  729.             }
  730.           }
  731.         }
  732.         Fl_Group {} {
  733.           label {Envelopes&LFOs}
  734.           xywh {0 20 535 375} box ENGRAVED_BOX hide
  735.         } {
  736.           Fl_Group {} {
  737.             label FREQUENCY
  738.             xywh {5 275 525 115} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
  739.           } {
  740.             Fl_Group freqenv {
  741.               label {PADSynth - Frequency Envelope} open
  742.               xywh {10 315 205 70} box FLAT_BOX color 51 align 144
  743.               code0 {o->init(pars->FreqEnvelope);}
  744.               class EnvelopeUI
  745.             } {}
  746.             Fl_Counter octave {
  747.               label Octave
  748.               callback {int k=(int) o->value();
  749. if (k<0) k+=16;
  750. pars->PCoarseDetune = k*1024+
  751.    pars->PCoarseDetune%1024;}
  752.               tooltip Octave xywh {470 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12
  753.               code0 {int k=pars->PCoarseDetune/1024;}
  754.               code1 {if (k>=8) k-=16;}
  755.               code2 {o->value(k);}
  756.             }
  757.             Fl_Counter coarsedet {
  758.               label {Coarse det.}
  759.               callback {int k=(int) o->value();
  760. if (k<0) k+=1024;
  761. pars->PCoarseDetune = k+
  762.    (pars->PCoarseDetune/1024)*1024;}
  763.               tooltip {Coarse Detune} xywh {455 365 60 20} labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 12
  764.               code0 {int k=pars->PCoarseDetune%1024;}
  765.               code1 {if (k>=512) k-=1024;}
  766.               code2 {o->value(k);}
  767.               code3 {o->lstep(10);}
  768.             }
  769.             Fl_Group freqlfo {
  770.               label {Frequency LFO     } open
  771.               xywh {215 315 230 70} box FLAT_BOX color 47 align 144
  772.               code0 {o->init(pars->FreqLfo);}
  773.               class LFOUI
  774.             } {}
  775.             Fl_Slider detune {
  776.               callback {pars->PDetune=(int)o->value()+8192;
  777. detunevalueoutput->do_callback();}
  778.               tooltip {Fine Detune (cents)} xywh {60 295 295 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1
  779.               code0 {o->value(pars->PDetune-8192);}
  780.             }
  781.             Fl_Value_Output detunevalueoutput {
  782.               label Detune
  783.               callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  784.               xywh {12 295 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
  785.               code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  786.             }
  787.             Fl_Choice detunetype {
  788.               label {Detune Type}
  789.               callback {pars->PDetuneType=(int) o->value()+1;
  790. detunevalueoutput->do_callback();} open
  791.               xywh {450 335 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
  792.               code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
  793.               code1 {o->value(pars->PDetuneType-1);}
  794.             } {}
  795.             Fl_Check_Button hz440 {
  796.               label 440Hz
  797.               callback {int x=(int) o->value();
  798. pars->Pfixedfreq=x;
  799. if (x==0) fixedfreqetdial->deactivate();
  800.    else fixedfreqetdial->activate();}
  801.               tooltip {set the base frequency to 440Hz} xywh {365 295 50 15} down_box DOWN_BOX labelfont 1 labelsize 11
  802.               code0 {o->value(pars->Pfixedfreq);}
  803.             }
  804.             Fl_Dial fixedfreqetdial {
  805.               label {Eq.T.}
  806.               callback {pars->PfixedfreqET=(int) o->value();}
  807.               tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
  808.               code0 {o->value(pars->PfixedfreqET);}
  809.               code1 {if (pars->Pfixedfreq==0) o->deactivate();}
  810.               class WidgetPDial
  811.             }
  812.           }
  813.           Fl_Group {} {
  814.             label AMPLITUDE
  815.             xywh {5 25 240 250} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
  816.           } {
  817.             Fl_Value_Slider volume {
  818.               label Vol
  819.               callback {pars->PVolume=(int)o->value();}
  820.               tooltip Volume xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
  821.               code0 {o->value(pars->PVolume);}
  822.             }
  823.             Fl_Value_Slider vsns {
  824.               label {V.Sns}
  825.               callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
  826.               tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 70 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1
  827.               code0 {o->value(pars->PAmpVelocityScaleFunction);}
  828.             }
  829.             Fl_Dial pan {
  830.               label Pan
  831.               callback {pars->PPanning=(int) o->value();}
  832.               tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
  833.               code0 {o->value(pars->PPanning);}
  834.               class WidgetPDial
  835.             }
  836.             Fl_Dial pstr {
  837.               label {P.Str.}
  838.               callback {pars->PPunchStrength=(int) o->value();}
  839.               tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  840.               code0 {o->value(pars->PPunchStrength);}
  841.               class WidgetPDial
  842.             }
  843.             Fl_Dial pt {
  844.               label {P.t.}
  845.               callback {pars->PPunchTime=(int) o->value();}
  846.               tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  847.               code0 {o->value(pars->PPunchTime);}
  848.               class WidgetPDial
  849.             }
  850.             Fl_Dial pstc {
  851.               label {P.Stc.}
  852.               callback {pars->PPunchStretch=(int) o->value();}
  853.               tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  854.               code0 {o->value(pars->PPunchStretch);}
  855.               class WidgetPDial
  856.             }
  857.             Fl_Dial pvel {
  858.               label {P.Vel.}
  859.               callback {pars->PPunchVelocitySensing=(int) o->value();}
  860.               tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
  861.               code0 {o->value(pars->PPunchVelocitySensing);}
  862.               class WidgetPDial
  863.             }
  864.             Fl_Group ampenv {
  865.               label {PADSynth - Amplitude Envelope} open
  866.               xywh {10 95 205 70} box FLAT_BOX color 51 align 144
  867.               code0 {o->init(pars->AmpEnvelope);}
  868.               class EnvelopeUI
  869.             } {}
  870.             Fl_Group amplfo {
  871.               label {Amplitude LFO     } open
  872.               xywh {10 165 230 70} box FLAT_BOX color 47 align 144
  873.               code0 {o->init(pars->AmpLfo);}
  874.               class LFOUI
  875.             } {}
  876.             Fl_Check_Button stereo {
  877.               label Stereo
  878.               callback {pars->PStereo=(int) o->value();
  879. hprofile->redraw();}
  880.               xywh {15 245 70 25} down_box DOWN_BOX
  881.               code0 {o->value(pars->PStereo);}
  882.             }
  883.           }
  884.           Fl_Group {} {
  885.             label FILTER
  886.             xywh {245 25 285 250} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17
  887.           } {
  888.             Fl_Group filterenv {
  889.               label {PADSynth - Filter Envelope} open
  890.               xywh {250 130 275 70} box FLAT_BOX color 51 align 144
  891.               code0 {o->init(pars->FilterEnvelope);}
  892.               class EnvelopeUI
  893.             } {}
  894.             Fl_Group filterlfo {
  895.               label {Filter LFO     } open
  896.               xywh {250 200 230 70} box FLAT_BOX color 47 align 144
  897.               code0 {o->init(pars->FilterLfo);}
  898.               class LFOUI
  899.             } {}
  900.             Fl_Group filterui {
  901.               label {PADsynth - Filter} open
  902.               xywh {250 55 275 75} box FLAT_BOX color 50 align 144
  903.               code0 {o->init(pars->GlobalFilter,&pars->PFilterVelocityScale,&pars->PFilterVelocityScaleFunction);}
  904.               class FilterUI
  905.             } {}
  906.           }
  907.         }
  908.       }
  909.       Fl_Button applybutton {
  910.         label {Apply Changes}
  911.         callback {pars->applyparameters(true);
  912. o->color(FL_GRAY);}
  913.         xywh {45 405 185 40} box THIN_UP_BOX labelfont 1 labelsize 23
  914.         code0 {o->color(FL_RED);}
  915.       }
  916.       Fl_Button {} {
  917.         label Close
  918.         callback {padnotewindow->hide();}
  919.         xywh {320 405 175 40} box THIN_UP_BOX labelsize 20
  920.       }
  921.       Fl_Button {} {
  922.         label C
  923.         callback {presetsui->copy(pars);}
  924.         xywh {240 430 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  925.       }
  926.       Fl_Button {} {
  927.         label P
  928.         callback {presetsui->paste(pars,this);}
  929.         xywh {270 430 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
  930.       }
  931.     }
  932.   }
  933.   Function {PADnoteUI(PADnoteParameters *parameters,Master *master_)} {} {
  934.     code {pars=parameters;
  935. master=master_;
  936. oscui=NULL;
  937. resui=new ResonanceUI(pars->resonance);
  938. make_window();} {}
  939.   }
  940.   Function {refresh()} {} {
  941.     code {volume->value(pars->PVolume);
  942. vsns->value(pars->PAmpVelocityScaleFunction);
  943. pan->value(pars->PPanning);
  944.  
  945. stereo->value(pars->PStereo);
  946.  
  947.  
  948. pstr->value(pars->PPunchStrength);
  949. pt->value(pars->PPunchTime);
  950. pstc->value(pars->PPunchStretch);
  951. pvel->value(pars->PPunchVelocitySensing);
  952.  
  953. detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  954. detune->value(pars->PDetune-8192);
  955.  
  956. int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
  957. octave->value(k);
  958.  
  959. detunetype->value(pars->PDetuneType-1);
  960. k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
  961. coarsedet->value(k);
  962.  
  963. hz440->value(pars->Pfixedfreq);
  964. fixedfreqetdial->value(pars->PfixedfreqET);
  965.  
  966. amplfo->refresh();
  967. freqlfo->refresh();
  968. filterlfo->refresh();
  969.  
  970. ampenv->refresh();
  971. freqenv->refresh();
  972. filterenv->refresh();
  973. filterui->refresh();
  974.  
  975.  
  976. /* harmonic structure parametrs */
  977.  
  978. resui->refresh();
  979. if (oscui!=NULL) oscui->refresh();
  980.  
  981. hpbasetype->value(pars->Php.base.type);
  982. hpbasepar1->value(pars->Php.base.par1);
  983. hpfreqmult->value(pars->Php.freqmult);
  984.  
  985. hpmpar1->value(pars->Php.modulator.par1);
  986. hpmfreq->value(pars->Php.modulator.freq);
  987. hpwidth->value(pars->Php.width);
  988.  
  989. hponehalf->value(pars->Php.onehalf);
  990. hpamptype->value(pars->Php.amp.type);
  991. hpampmode->value(pars->Php.amp.mode);
  992. hpamppar1->value(pars->Php.amp.par1);
  993. hpamppar2->value(pars->Php.amp.par2);
  994. hpautoscale->value(pars->Php.autoscale);
  995.  
  996. bwdial->value(pars->Pbandwidth);
  997. if (pars->Pmode==0){
  998.    bwprofilegroup->activate();
  999.    bwdial->activate();
  1000.    bwcents->activate();
  1001.    hprofile->activate();
  1002.    hprofile->color(54);
  1003.    bwscale->activate();
  1004. } else {
  1005.    bwprofilegroup->deactivate();
  1006.    bwdial->deactivate();
  1007.    bwcents->deactivate();
  1008.    hprofile->deactivate();
  1009.    hprofile->color(48);
  1010.    bwscale->activate();
  1011. };
  1012.  
  1013. spectrummode->value(pars->Pmode);
  1014.  
  1015. qbasenote->value(pars->Pquality.basenote);
  1016. qsmpoct->value(pars->Pquality.smpoct);
  1017. qoct->value(pars->Pquality.oct);
  1018. qsamplesize->value(pars->Pquality.samplesize);
  1019.  
  1020. hrpostype->value(pars->Phrpos.type);
  1021. hrpospar1->value(pars->Phrpos.par1);
  1022. hrpospar2->value(pars->Phrpos.par2);
  1023. hrpospar3->value(pars->Phrpos.par3);
  1024.  
  1025. hprofile->redraw();
  1026. overtonepos->redraw();
  1027.  
  1028. osc->redraw();
  1029. pars->applyparameters(true);
  1030. applybutton->color(FL_GRAY);
  1031. applybutton->parent()->redraw();} {}
  1032.   }
  1033.   Function {~PADnoteUI()} {} {
  1034.     code {delete(oscui);
  1035. delete(resui);
  1036.  
  1037. padnotewindow->hide();
  1038. delete(padnotewindow);} {}
  1039.   }
  1040.   decl {PADnoteParameters *pars;} {public
  1041.   }
  1042.   decl {Master *master;} {public
  1043.   }
  1044.   decl {OscilEditor *oscui;} {public
  1045.   }
  1046.   decl {Oscilloscope *osc;} {public
  1047.   }
  1048.   decl {ResonanceUI *resui;} {public
  1049.   }
  1050.