# data file for the Fltk User Interface Designer (fluid)
version 1.0302 
header_name {.h} 
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local
} 

decl {//License: GNU GPL version 2 or later} {private local
} 

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

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

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

decl {\#include "../globals.h"} {public local
} 

decl {\#include "Fl_Osc_VSlider.H"} {public local
} 

decl {\#include "Fl_Osc_TSlider.H"} {public local
} 

decl {\#include "Fl_Osc_Dial.H"} {public local
} 

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

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

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

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

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

class SUBSlider {: {public Fl_Osc_TSlider}
} {
  Function {SUBSlider(int x,int y, int w, int h, const char *label=0)
  :Fl_Osc_TSlider(x,y,w,h,label)} {open
  } { code {} {}}
   Function {OSC_value(char c)} {open return_type void
   } { code {
       value(127-c);
       selection_color(value() == reset_value ? 0 : 222);	
   } {} }
  Function {cb(void)} {open return_type void
  } {
    code {
	selection_color(value() == reset_value ? 0 : 222);	
	oscWrite(ext, "c", (int)(127-Fl_Slider::value()));
	if(cb_data.first)
	    cb_data.first(this, cb_data.second);
} {}
   }
}

class SUBnoteharmonic {: {public Fl_Osc_Group}
} {
  Function {make_window()} {private
  } {
    Fl_Window harmonic {
      xywh {329 403 90 305} type Double hide
      class Fl_Osc_Group
    } {
      Fl_Slider mag {
        tooltip {harmonic's magnitude} xywh {0 15 10 135} type {Vert Knob} box FLAT_BOX selection_color 0 maximum 127 step 1 value 127
        class SUBSlider
      }
      Fl_Slider bw {
        tooltip {harmonic's bandwidth} xywh {0 157 10 130} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64
        class SUBSlider
      }
      Fl_Box {} {
        xywh {10 219 5 5} box FLAT_BOX color 45
        code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();}
      }
      Fl_Box {} {
        label 01
        xywh {0 288 10 15} labelfont 1 labelsize 9 align 20
        code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
      }
      Fl_Box {} {
        label 01
        xywh {0 0 10 15} labelfont 1 labelsize 9 align 20
        code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
      }
    }
  }
  Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} {
    code {n=0;} {}
  }
  Function {init(int n_)} {} {
    code {n=n_;
make_window();
harmonic->show();
mag->reset_value=127;
mag->ext = "Phmag" + to_s(n);
mag->oscRegister(mag->ext.c_str());
mag->set_transform([](float x){return 127.0f - x;});
bw->reset_value=63;
bw->ext = "Phrelbw" + to_s(n);
bw->oscRegister(bw->ext.c_str());
bw->set_transform([](float x){return 63.0f - x;});
osc->requestValue(base+"Phrelbw"+to_s(n));

end();} {}
  }
  Function {refresh()} {} {
    code {// request values for the widgets
mag->oscWrite(mag->ext);
bw->oscWrite(bw->ext);} {}
  }
  Function {~SUBnoteharmonic()} {} {
    code {harmonic->hide();
hide();
//delete(harmonic);} {}
  }
  decl {int n;} {private local
  }
} 

class SUBnoteUI {open : {public PresetsUI_}
} {
  Function {make_window()} {open
  } {
    Fl_Window SUBparameters {
      label {SUBsynth Parameters} open
      xywh {542 511 735 475} type Double
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0} box FLAT_BOX color 45
        code0 {SUBparameters->init(osc, loc);}
      }
      Fl_Scroll {} {
        label scroll open
        xywh {5 140 434 330} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL
      } {
        Fl_Pack harmonics {open
          xywh {5 145 425 325} type HORIZONTAL
          code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(i);}}
        } {}
      }
      Fl_Button {} {
        label Close
        callback {SUBparameters->hide();}
        xywh {670 446 60 25} box THIN_UP_BOX
      }
      Fl_Group {} {
        label AMPLITUDE open
        xywh {5 5 215 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Value_Slider vol {
          label Vol
          tooltip Volume xywh {10 25 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
          code0 {o->init("PVolume");o->reset_value=96;}
          class Fl_Osc_VSlider
        }
        Fl_Value_Slider vsns {
          label {V.Sns}
          tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
          code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=90;}
          class Fl_Osc_VSlider
        }
        Fl_Dial pan {
          label Pan
          tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
          code0 {o->init("PPanning");o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Group ampenv {
          label {SUBsynth - Amplitude Envelope} open
          xywh {10 65 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ADSR, osc, loc, "AmpEnvelope/");}
          class EnvelopeUI
        } {}
      }
      Fl_Group {} {
        xywh {495 406 235 35} box UP_FRAME
      } {
        Fl_Counter filterstages {
          label {Filter Stages}
          tooltip {How many times the noise is filtered} xywh {515 421 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10
          code0 {o->init("Pnumstages");}
          class Fl_Osc_Counter
        }
        Fl_Choice magtype {
          label {Mag.Type}
          xywh {585 421 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11
          code0 {o->init("Phmagtype");}
          class Fl_Osc_Choice
        } {
          MenuItem {} {
            label Linear
            xywh {20 20 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {-40dB}
            xywh {30 30 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {-60dB}
            xywh {40 40 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {-80dB}
            xywh {50 50 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {-100dB}
            xywh {60 60 100 20} labelfont 1 labelsize 11
          }
        }
        Fl_Choice start {
          label Start selected
          xywh {670 420 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11
          code0 {o->init("Pstart");}
          class Fl_Osc_Choice
        } {
          MenuItem {} {
            label Zero
            xywh {30 30 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label RND
            xywh {40 40 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label {Max.}
            xywh {50 50 100 20} labelfont 1 labelsize 11
          }
        }
      }
      Fl_Group freqsettingsui {
        label FREQUENCY open
        xywh {440 5 295 146} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Group freqenvelopegroup {
          label {SUBsynth - Frequency Envelope} open
          xywh {445 75 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ASR, osc, loc, "FreqEnvelope/");}
          class EnvelopeUI
        } {}
        Fl_Check_Button freqee {
          label Enabled
          callback {if (o->value()==0) freqenvelopegroup->deactivate();
              else freqenvelopegroup->activate();
o->show();
freqsettingsui->redraw();}
          xywh {445 77 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
          code0 {o->init("PFreqEnvelopeEnabled");}
          class Fl_Osc_Check
        }
        Fl_Counter octave {
          label Octave
          tooltip Octave xywh {670 58 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
          code0 {o->init("octave");}
          class Fl_Osc_Counter
        }
        Fl_Counter coarsedet {
          label {Coarse Det.}
          tooltip {Coarse Detune} xywh {655 125 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11
          code0 {o->init("coarsedetune");}
          code3 {o->lstep(10);}
          class Fl_Osc_Counter
        }
        Fl_Slider detune {
          callback {o->oscWrite("detunevalue");}
          tooltip {Fine Detune (cents)} xywh {495 27 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
          code0 {o->init("PDetune",'i');}
          class Fl_Osc_Slider
        }
        Fl_Value_Output detunevalueoutput {
          label Detune
          xywh {448 27 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
          code0 {o->init("detunevalue");}
          class Fl_Osc_Output
        }
        Fl_Dial bendadjdial {
          label Bend
          tooltip {How the frequency varies according to the pitch wheel} xywh {448 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1
          code0 {o->init("PBendAdjust"); o->reset_value=24;o->set_transform([](float x){return x/24.0f;});o->set_rounding(2);}
          class Fl_Osc_Dial
        }
        Fl_Dial offsethzdial {
          label Offset
          tooltip {Offset of frequency in Hz} xywh {500 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1
          code0 {o->init("POffsetHz"); o->set_rounding(2); o->set_transform([](float x){x/=64; return 15*(x*sqrtf(fabsf(x)));});}
          class Fl_Osc_Dial
        }
        Fl_Check_Button hz440 {
          label 440Hz
          callback {if (o->value()==0) fixedfreqetdial->deactivate();
   else fixedfreqetdial->activate();}
          tooltip {set the base frequency to 440Hz} xywh {555 53 50 15} down_box DOWN_BOX labelfont 1 labelsize 10
          code0 {o->init("Pfixedfreq");}
          class Fl_Osc_Check
        }
        Fl_Dial fixedfreqetdial {
          label {Eq.T.}
          tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {610 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
          code0 {o->init("PfixedfreqET");}
          class Fl_Osc_Dial
        }
        Fl_Choice detunetype {
          label {Detune Type}
          callback {o->oscWrite("detunevalue");} open
          xywh {655 94 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
          code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
          code1 {o->init("PDetuneType",1);}
          class Fl_Osc_Choice
        } {}
      }
      Fl_Check_Button stereo {
        label Stereo
        xywh {440 406 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
        code0 {o->init("Pstereo");}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label Clear
        callback {o->oscWrite("clear");
        for (int i=1;i<MAX_SUB_HARMONICS;i++){
    h[i]->mag->oscWrite(h[i]->mag->ext, "c", 0);
    h[i]->bw->oscWrite(h[i]->bw->ext, "c", 64);
};
h[0]->mag->oscWrite(h[0]->mag->ext, "c", 127);
h[0]->bw->oscWrite(h[0]->bw->ext, "c", 64);
SUBparameters->redraw();}
        tooltip {Clear the harmonics} xywh {445 446 70 25} box THIN_UP_BOX
        class Fl_Osc_Button
      }
      Fl_Group bandwidthsettingsui {
        label BANDWIDTH
        xywh {220 5 220 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Group bandwidthenvelopegroup {
          label {SUBsynth - BandWidth Envelope} open
          xywh {225 65 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ADSR_BW, osc, loc, "BandWidthEnvelope/");}
          class EnvelopeUI
        } {}
        Fl_Check_Button bwee {
          label Enabled
          callback {if (o->value()==0) bandwidthenvelopegroup->deactivate();
    else bandwidthenvelopegroup->activate();
o->show();
bandwidthsettingsui->redraw();}
          xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
          code0 {o->init("PBandWidthEnvelopeEnabled");}
          class Fl_Osc_Check
        }
        Fl_Value_Slider bandwidth {
          label {Band Width}
          xywh {225 40 115 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->init("Pbandwidth");o->reset_value=40;}
          class Fl_Osc_VSlider
        }
        Fl_Value_Slider bwidthscale {
          label {B.Width Scale}
          tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1
          code0 {o->init("Pbwscale",'i');}
          class Fl_Osc_TSlider
        }
      }
      Fl_Group globalfiltergroup {
        label FILTER
        xywh {440 221 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
      } {
        Fl_Group filterenv {
          label {SUBsynth - Filter Envelope} open
          xywh {445 331 275 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ADSR_FILTER, osc, loc, "GlobalFilterEnvelope/");}
          class EnvelopeUI
        } {}
        Fl_Group filterui {
          label {SUBsynthl - Filter} open
          xywh {445 246 275 75} box FLAT_BOX color 50 align 144
          code0 {o->init(loc + "PGlobalFilter" , osc, loc, "GlobalFilter/");}
          class FilterUI
        } {}
      }
      Fl_Check_Button filtere {
        label Enabled
        callback {if (o->value()==0) globalfiltergroup->deactivate();
    else globalfiltergroup->activate();
o->show();
globalfiltergroup->redraw();}
        xywh {445 226 85 20} down_box DOWN_BOX labelfont 1 labelsize 11
        code0 {o->init("PGlobalFilterEnabled");}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(loc);}
        xywh {600 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(loc,this);}
        xywh {630 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Group {} {
        label OVERTONES open
        xywh {440 151 220 70} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
      } {
        Fl_Choice spreadtype {
          label OvertonesPosition
          xywh {450 190 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10
          code0 {o->init("POvertoneSpread.type");}
          class Fl_Osc_Choice
        } {
          MenuItem {} {
            label Harmonic
            xywh {0 0 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label ShiftU
            xywh {10 10 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label ShiftL
            xywh {20 20 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label PowerU
            xywh {20 20 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label PowerL
            xywh {30 30 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Sine
            xywh {40 40 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Power
            xywh {50 50 34 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Shift
            xywh {20 20 34 20} labelfont 1 labelsize 11
          }
        }
        Fl_Dial spreadpar1 {
          label Par1
          xywh {548 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1
          code0 {o->init("POvertoneSpread.par1");}
          class Fl_Osc_Dial
        }
        Fl_Dial spreadpar2 {
          label Par2
          xywh {583 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1
          code0 {o->init("POvertoneSpread.par2");}
          class Fl_Osc_Dial
        }
        Fl_Dial spreadpar3 {
          label ForceH
          xywh {618 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1
          code0 {o->init("POvertoneSpread.par3");}
          class Fl_Osc_Dial
        }
      }
    }
  }
  Function {refresh()} {} {
    code {
SUBparameters->update();
for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh();
//globalfiltergroup->redraw();
//ampenv->refresh();
//bandwidthenvelopegroup->refresh();
//freqenvelopegroup->refresh();
//filterui->refresh();
//filterenv->refresh();} {}
  }
  Function {SUBnoteUI(Fl_Osc_Interface *osc_, std::string loc_)} {} {
    code {osc = osc_;
    loc = loc_;
make_window();} {}
  }
  Function {~SUBnoteUI()} {} {
    code {//for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]);
SUBparameters->hide();
delete(SUBparameters);} {}
  }
  decl {Fl_Osc_Interface *osc;} {private local
  }
  decl {std::string loc;} {private local
  }
  decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {private local
  }
} 
