# 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 "../Params/ADnoteParameters.h"} {public local
} 
decl {\#include "ResonanceUI.h"} {public local
} 

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

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

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

decl {\#include <cmath>} {private local
} 

decl {\#include <cstdio>} {private local
} 

decl {\#include <cstdlib>} {private local
} 

decl {\#include <cstring>} {private local
} 

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

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

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

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

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

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

decl {\#include "Osc_IntModel.h"} {private local
}

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

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

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

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

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

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

decl {\#include "PartUI.h"} {private local
} 

decl {\#include "MasterUI.h"} {private local
} 

decl {extern class MasterUI *ui;} {private local
} 

class PhaseSlider {: {public Fl_Osc_TSlider}
} {
  Function {PhaseSlider(int x,int y, int w, int h, const char *label=0)
  :Fl_Osc_TSlider(x,y,w,h,label)} {open
  } { code {
  set_rounding(1);
  reset_value=0;
  set_transform([](float x){return 180.0f*x/64.0f;});
  } {}}
  Function {set_scope(Fl_Oscilloscope *newscope)} {
  } { code { oscope = newscope; } {} }
   Function {OSC_value(int i)} {open return_type void
   } { code {
       value(64-i);
       oscope->phase=i;
       oscope->parent()->redraw();
   } {} }
  Function {cb(void)} {open return_type void
  } { code {
        oscWrite(ext, "i", (int)(64-Fl_Slider::value()));
        if(cb_data.first)
            cb_data.first(this, cb_data.second);
} {} }
   decl {Fl_Oscilloscope *oscope = NULL; } {private local}
}


class ADvoicelistitem {open : {public Fl_Osc_Group}
} {
  Function {make_window()} {open private
  } {
    Fl_Window ADnoteVoiceListItem {open
      private xywh {117 90 670 100} type Double box NO_BOX
      class Fl_Osc_Group visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {ADnoteVoiceListItem->base = loc;}
      }
      Fl_Group voicelistitemgroup {open
        private xywh {0 0 670 25}
        class Fl_Osc_Group
      } {
        Fl_Value_Slider voicevolume {
          tooltip Volume xywh {132 5 115 20} type {Horz Knob} box NO_BOX labelsize 8 align 5 maximum 127 step 1
          code1 {o->init("PVolume"); o->reset_value=100;}
          class Fl_Osc_VSlider
        }
        Fl_Check_Button voiceresonanceenabled {
          tooltip {Resonance On/Off} xywh {287 7 15 17} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 11 align 4
          code0 {o->init("Presonance");}
          class Fl_Osc_Check
        }
        Fl_Value_Slider voicelfofreq {
          tooltip {Frequency LFO amount} xywh {542 5 115 20} type {Horz Knob} box NO_BOX labelsize 8 align 5 maximum 127 step 1
          code0 {o->init("FreqLfo/Pintensity", 'i');o->reset_value=40;}
          class Fl_Osc_VSlider
        }
        Fl_Dial voicepanning {
          tooltip {Panning (leftmost is Random)} xywh {257 5 20 20} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1
          code0 {o->init("PPanning");o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Group voiceoscil {open
          xywh {102 5 30 20} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
          code0 {voiceoscil->ext = "OscilSmp/";}
          code1 {oscil=new Fl_Oscilloscope(o->x(),o->y()+1,o->w(),o->h(),"");}
          code2 {oscil->init(false);}
          class Fl_Osc_Group
        } {}
        Fl_Value_Output detunevalueoutput {
          xywh {307 5 45 20} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
          code0 {o->init("detunevalue");}
          class Fl_Osc_Output
        }
        Fl_Slider voicedetune {
          callback {detunevalueoutput->update();}
          tooltip {Fine Detune (cents)} xywh {357 5 185 20} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
          code0 {o->init("PDetune",'i');}
          class Fl_Osc_Slider
        }
        Fl_Box whitenoiselabel {
          label N
          xywh {107 5 20 20} labelfont 1 labelsize 13 labelcolor 54 hide
        }
        Fl_Box pinknoiselabel {
          label N
          xywh {107 5 20 20} labelfont 1 labelsize 13 labelcolor 212 hide
        }
      }
      Fl_Check_Button voiceenabled {
        label 01
        callback {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 13 align 4
        code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));}
        code1 {o->init("Enabled");}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label edit
        callback {
class ADnoteUI *adnoteui = ui->partui->adnoteui;
adnoteui->ADnoteVoice->show();
adnoteui->currentvoicecounter->value(nvoice+1);
adnoteui->currentvoicecounter->do_callback();
class ADvoiceUI *advoice = adnoteui->advoice;
if (advoice->mod_type->value() == 0)
    advoice->voiceFMparametersgroup->deactivate();
else
    advoice->voiceFMparametersgroup->activate();
}
        xywh {53 6 40 15} box THIN_UP_BOX labelsize 11
      }
    }
  }
  Function {ADvoicelistitem(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {open
  } {
    code {assert(osc);
    voice_phase = new Osc_IntModel(osc);
    voice_phase->callback=[this](int phase) {
    oscil->phase=phase;
    voiceoscil->redraw();
    return;
};
    sound_type = new Osc_IntModel(osc);
    sound_type->callback=[this](int voice_type) {
    switch (voice_type) {
        case 0:
	    whitenoiselabel->hide();
	    pinknoiselabel->hide();
	    oscil->Overlay = NULL;
	    voiceresonanceenabled->activate();
	    detunevalueoutput->activate();
	    voicedetune->activate();
	    voicelfofreq->activate();
	    voiceoscil->activate();
	    return;
	case 1:
            whitenoiselabel->show();
            pinknoiselabel->hide();
	    oscil->Overlay = whitenoiselabel;
	    break;
	default:
            pinknoiselabel->show();
            whitenoiselabel->hide();
	    oscil->Overlay = pinknoiselabel;
    }

    voiceresonanceenabled->deactivate();
    detunevalueoutput->deactivate();
    voicedetune->deactivate();
    voicelfofreq->deactivate();
    voiceoscil->deactivate();
    };

    ext_oscil = new Osc_IntModel(osc);
    ext_oscil->callback = [this](int ext) {
        if(ext == -1)
            voiceoscil->reext("OscilSmp/");
        else
            voiceoscil->reext("../VoicePar"+to_s(ext)+"/OscilSmp/");
    };
    nvoice=0;} {}
  }
  Function {init(int nvoice_, std::string loc_, Fl_Osc_Interface *osc_)} {open
  } {
    code {assert(osc_);
assert(!loc_.empty());
    voice_phase->doUpdate(loc_ + "Poscilphase");
    sound_type->doUpdate(loc_ + "Type");
    ext_oscil->doUpdate(loc_ + "Pextoscil");

nvoice=nvoice_;
loc   = loc_;
make_window();
ADnoteVoiceListItem->show();
end();} {}
  }
  Function {refreshlist()} {open
  } {
    code {if (voiceenabled->value()==0) voicelistitemgroup->deactivate();
    else voicelistitemgroup->activate();
detunevalueoutput->do_callback();
ADnoteVoiceListItem->redraw();} {}
  }
  Function {~ADvoicelistitem()} {} {
    code {ADnoteVoiceListItem->hide();
    delete voice_phase;
    delete sound_type;
    delete ext_oscil;
    } {}
  }
  decl {int nvoice;} {private local
  }
  decl {class Osc_IntModel *voice_phase;} {private local
  }
  decl {class Osc_IntModel *sound_type;} {private local
  }
  decl {class Osc_IntModel *ext_oscil;} {private local
  }
  decl {Fl_Oscilloscope *oscil;} {private local
  }
  decl {std::string loc;} {private local
  }
} 

class ADvoiceUI {open : {public Fl_Group}
} {
  Function {make_window()} {open
  } {
    Fl_Window ADnoteVoiceParameters {
      label Voice open
      xywh {512 391 765 595} type Double box NO_BOX
      class Fl_Osc_Group visible
    } {
      Fl_Box {} {
        label label
        xywh {25 25 35 16}
        code0 {ADnoteVoiceParameters->base = base+"VoicePar"+to_s(nvoice)+"/";}
        code1 {ADnoteVoiceParameters->osc = osc_i;}
      }
      Fl_Group voiceparametersgroup {open
        xywh {0 0 770 590} color 48
      } {
        Fl_Group voicemodegroup {open
          xywh {0 5 770 585} color 64
        } {
          Fl_Group voiceFMparametersgroup {
            label MODULATOR open
            xywh {530 5 230 585} box UP_FRAME color 48 labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
          } {
            Fl_Group modfrequency {
              label {Mod.FREQUENCY}
              xywh {535 219 220 174} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
            } {
              Fl_Group voiceFMfreqenvgroup {
                label {ADSynth Modulator - Frequency Envelope}
                xywh {540 315 210 70} box FLAT_BOX color 51 align 144
                code0 {o->init(ENV_ASR, osc_i, loc, "FMFreqEnvelope/");}
                class EnvelopeUI
              } {}
              Fl_Check_Button {} {
                label On
                callback {if (o->value()==0) voiceFMfreqenvgroup->deactivate();
else voiceFMfreqenvgroup->activate();
o->redraw();}
                tooltip {Forced Release} xywh {545 322 50 10} down_box DOWN_BOX labelfont 1 labelsize 11
                code0 {o->init("PFMFreqEnvelopeEnabled");}
                class Fl_Osc_Check
              }
              Fl_Counter {} {
                label {Coarse Det.}
                tooltip {Coarse Detune} xywh {685 295 60 15} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11
                code0 {o->init("FMcoarsedetune");}
                code3 {o->lstep(10);}
                class Fl_Osc_Counter
              }
              Fl_Counter {} {
                label Octave
                tooltip Octave xywh {625 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
                code0 {o->init("FMoctave");}
                class Fl_Osc_Counter
              }
              Fl_Slider {} {
                callback {fmdetunevalueoutput->update();}
                tooltip {Fine Detune (cents)} xywh {590 245 155 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
                code0 {o->init("PFMDetune", 'i');}
                class Fl_Osc_Slider
              }
              Fl_Value_Output fmdetunevalueoutput {
                label Detune
                xywh {540 247 45 18} labelsize 8 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 8
                code0 {o->init("FMdetunevalue");}
                class Fl_Osc_Output
              }
              Fl_Choice {} {
                label {Detune Type}
                callback {fmdetunevalueoutput->update();} open
                xywh {540 294 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->init("PFMDetuneType");}
                class Fl_Osc_Choice
              } {}
              Fl_Check_Button {} {
                label 440Hz
                callback {if (o->value()==0) fixedfreqetdial->deactivate();
    else fixedfreqetdial->activate();} selected
                tooltip {Set the modulator base frequency to 440Hz} xywh {683 266 55 15} down_box DOWN_BOX labelfont 1 labelsize 11
                code0 {o->init("PFMFixedFreq");}
                class Fl_Osc_Check
              }
            }
            Fl_Group {} {
              label {Mod.AMPLITUDE}
              xywh {535 60 220 160} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
            } {
              Fl_Value_Slider {} {
                label Vol
                tooltip Volume xywh {540 80 155 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
                code0 {o->init("PFMVolume", 'i');o->reset_value=90;}
                class Fl_Osc_VSlider
              }
              Fl_Value_Slider {} {
                label {V.Sns}
                tooltip {Velocity Sensing Function (rightmost to disable)} xywh {540 100 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
                code0 {o->init("PFMVelocityScaleFunction");o->reset_value=64;}
                class Fl_Osc_VSlider
              }
              Fl_Group voiceFMampenvgroup {
                label {ADSynth Modulator - Amplitude Envelope} open
                xywh {540 140 205 70} box FLAT_BOX color 51 align 144
                code0 {o->init(//pars->VoicePar[nvoice].FMAmpEnvelope,
                ENV_ADSR, osc_i, loc, "FMAmpEnvelope/");}
                class EnvelopeUI
              } {}
              Fl_Check_Button {} {
                label On
                callback {if (o->value()==0) voiceFMampenvgroup->deactivate();
else voiceFMampenvgroup->activate();
o->redraw();}
                tooltip {Forced Release} xywh {545 150 50 10} down_box DOWN_BOX labelfont 1 labelsize 11
                code0 {o->init("PFMAmpEnvelopeEnabled");}
                class Fl_Osc_Check
              }
              Fl_Value_Slider {} {
                label {F.Damp}
                tooltip {Modulator Damp at Higher frequency} xywh {540 120 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 minimum -64 maximum 63 step 1
                code0 {o->init("PFMVolumeDamp",'i');}
                class Fl_Osc_VSlider
              }
            }
            Fl_Group modoscil {open
              xywh {535 390 220 195}
            } {
              Fl_Group fmoscil {open
                xywh {535 445 220 140} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
                code0 {fmoscil->base = loc; fmoscil->ext="FMSmp/";fmoscil->osc = osc_i;fmoscil->begin();}
                code1 {oscFM=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
                code2 {//int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;}
                code3 {oscFM->parent(fmoscil);oscFM->init(false);oscFM->update();fmoscil->end();}
                class Fl_Osc_Group
              } {}
              Fl_Box {} {
                label {Mod.Oscillator}
                xywh {535 393 155 20} labelfont 1 align 20
              }
              Fl_Button changeFMoscilbutton {
                label Change
                callback {if (oscedit!=NULL)
    delete(oscedit);

                if(extFMoscil->value() == 0)
                    oscedit=new OscilEditor(true,loc+"FMSmp/", osc_i);
                else
                    oscedit=new OscilEditor(true,loc+"../VoicePar"+to_s(extFMoscil->value()-1)+"/FMSmp/", osc_i);}
                xywh {700 398 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
                code0 {(void)o;/*if (extFMoscil->value()>=0) o->labelcolor(FL_BLUE);*/}
              }
              Fl_Slider {} {
                label Phase
                xywh {645 425 105 15} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -63 maximum 64 step 1
                code0 {o->init("PFMoscilphase", 'i'); o->set_scope(oscFM);}
                class PhaseSlider
              }
              Fl_Choice extFMoscil {
                label Use
                callback {if ((int) o->value() != 0) {
    oscFM->init(false);
    changeFMoscilbutton->labelcolor(FL_BLUE);
} else { 
    oscFM->init(false);
    changeFMoscilbutton->labelcolor(FL_BLACK);
};
if(o->value() == 0)
fmoscil->rebase(loc);
else
fmoscil->rebase(loc+"../VoicePar"+to_s(o->value()-1)+"/");
voiceFMparametersgroup->redraw();} open
                xywh {560 420 75 20} 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->init("PextFMoscil",-1);}
                class Fl_Osc_Choice
              } {}
            }
            Fl_Choice extMod {
              label {External Mod.}
              callback {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->init("PFMVoice", -1);}
              code3 {if ((int) o->value() != 0) {modoscil->deactivate();modfrequency->deactivate();}}
              class Fl_Osc_Choice
            } {}
          }
          Fl_Choice mod_type {
            label {Type:}
            callback {if (o->value()==0) voiceFMparametersgroup->deactivate();
else voiceFMparametersgroup->activate();
o->redraw();}
            xywh {535 40 80 20} down_box BORDER_BOX align 5
            code0 {o->init("PFMEnabled");}
            class Fl_Osc_Choice
          } {
            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 PWM
              xywh {80 80 100 20} labelfont 1
            }
          }
          Fl_Group {} {
            label FREQUENCY open
            xywh {5 265 525 120} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
          } {
            Fl_Group voicefreqenvgroup {
              label {ADSynth Voice - Frequency Envelope} open
              xywh {10 305 205 70} box FLAT_BOX color 51 align 144
              code0 {o->init(//pars->VoicePar[nvoice].FreqEnvelope,
              ENV_ASR, osc_i, loc, "FreqEnvelope/");}
              class EnvelopeUI
            } {}
            Fl_Check_Button {} {
              label On
              callback {if (o->value()==0) voicefreqenvgroup->deactivate();
else voicefreqenvgroup->activate();
o->redraw();}
              tooltip {Forced Release} xywh {15 310 50 10} down_box DOWN_BOX labelfont 1 labelsize 11
              code0 {o->init("PFreqEnvelopeEnabled");}
              class Fl_Osc_Check
            }
            Fl_Group voicefreqlfogroup {
              label {Frequency LFO     } open
              xywh {220 305 230 70} box FLAT_BOX color 47 align 144
              code0 {o->init(osc_i, loc,"FreqLfo/");}
              class LFOUI
            } {}
            Fl_Check_Button {} {
              label On
              callback {if (o->value()==0) voicefreqlfogroup->deactivate();
else voicefreqlfogroup->activate();
o->redraw();}
              tooltip {Forced Release} xywh {225 311 55 10} down_box DOWN_BOX labelfont 1 labelsize 11
              code0 {o->init("PFreqLfoEnabled");}
              class Fl_Osc_Check
            }
            Fl_Counter {} {
              label Octave
              tooltip Octave xywh {470 285 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 {} {
              label {Coarse Det.}
              tooltip {Coarse Detune} xywh {455 355 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_Dial bendadjdial {
              label Bend
              tooltip {How the frequency varies according to the pitch wheel} xywh {60 270 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 {110 270 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_Slider {} {
              callback {detunevalueoutput->update();}
              tooltip {Fine Detune (cents)} xywh {58 287 392 13} 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
              code0 {o->init("detunevalue");}
              xywh {10 287 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
              class Fl_Osc_Output
            }
            Fl_Check_Button {} {
              label 440Hz
              callback {if (o->value()==0) fixedfreqetdial->deactivate();
    else fixedfreqetdial->activate();}
              tooltip {Set the voice base frequency to 440Hz} xywh {345 268 55 15} down_box DOWN_BOX labelfont 1 labelsize 11
              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 {405 270 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
              code0 {o->init("PfixedfreqET");}
              class Fl_Osc_Dial
            }
            Fl_Choice {} {
              label {Detune Type}
              callback {detunevalueoutput->update();} open
              xywh {455 320 70 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->init("PDetuneType");}
              class Fl_Osc_Choice
            } {}
          }
          Fl_Group voiceoscil {
            xywh {80 390 445 145} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
            code0 {voiceoscil->base = loc;voiceoscil->ext="OscilSmp/";voiceoscil->begin();//int nv=nvoice; if (extoscil->value()>=0) nv=extoscil->value();}
            code1 {osc=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
            code2 {voiceoscil->osc = osc_i;}
            code3 {osc->parent(voiceoscil); osc->init(false);voiceoscil->end();}
            class Fl_Osc_Group
          } {}
          Fl_Button changevoiceoscilbutton {
            label Change
            callback {delete oscedit;
                if(extoscil->value() == 0)
                    oscedit=new OscilEditor(true,loc+"OscilSmp/", osc_i);
                else
                    oscedit=new OscilEditor(true,loc+"../VoicePar"+to_s(extoscil->value()-1)+"/OscilSmp/", osc_i);}
            xywh {5 490 65 20} box THIN_UP_BOX labelfont 1 labelsize 11
          }
          Fl_Box {} {
            label {Voice Oscillator}
            xywh {5 390 75 35} labelfont 1 labelsize 12 align 128
          }
          Fl_Slider {} {
            label Phase
            xywh {10 435 65 10} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -63 maximum 64 step 1
            code0 { o->init("Poscilphase", 'i'); o->set_scope(osc); }
            class PhaseSlider
          }
          Fl_Check_Button {} {
            label {R.}
            tooltip {Resonance On/Off} xywh {210 5 35 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11
            code0 {o->init("Presonance");}
            class Fl_Osc_Check
          }
          Fl_Choice extoscil {
            label {Use Oscil.}
            callback {if ((int) o->value() != 0) {
    osc->init(false);
    changevoiceoscilbutton->labelcolor(FL_BLUE);
} else { 
    osc->init(false);
    changevoiceoscilbutton->labelcolor(FL_BLACK);
};
if(o->value() == 0)
voiceoscil->rebase(loc);
else
voiceoscil->rebase(loc+"../VoicePar"+to_s(o->value()-1)+"/");

voiceparametersgroup->redraw();
voiceonbutton->redraw();} open
            xywh {5 470 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->init("Pextoscil",-1);}
            class Fl_Osc_Choice
          } {}
          Fl_Group {} {open
            xywh {5 540 520 50} box UP_FRAME
          } {
            Fl_Dial {} {
              label Vibrato
              tooltip Vibrato xywh {364 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Unison_vibratto");o->reset_value=64;}
              class Fl_Osc_Dial
            }
            Fl_Choice {} {
              label Invert
              tooltip {Phase Invert} xywh {445 560 65 15} down_box BORDER_BOX labelsize 11 align 5 textfont 1 textsize 10
              code0 {o->add("None");o->add("Random");char tmp[100];for (int i=2;i<=5;i++){snprintf(tmp,100,"%d %%",100/i);o->add(tmp);};}
              code1 {o->init("Unison_invert_phase");}
              class Fl_Osc_Choice
            } {}
            Fl_Slider {} {
              label {Frequency Spread}
              callback {unisonspreadoutput->update();}
              tooltip {Frequency Spread of the Unison} xywh {95 562 125 13} type {Horz Knob} box NO_BOX labelsize 12 align 1 maximum 127 step 1 value 64
              code0 {o->init("Unison_frequency_spread", 'i');o->reset_value=60;}
              class Fl_Osc_Slider
            }
            Fl_Value_Output unisonspreadoutput {
              label {(cents)}
              xywh {225 560 40 15} labelsize 10 align 5 maximum 1000 step 0.1 textfont 1 textsize 10
              code0 {o->init("unisonFrequencySpreadCents");//o->value(pars->getUnisonFrequencySpreadCents(nvoice));}
              class Fl_Osc_Output
            }
            Fl_Dial {} {
              label {V.speed}
              tooltip {Vibrato Average Speed} xywh {406 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Unison_vibratto_speed");o->reset_value=64;}
              class Fl_Osc_Dial
            }
            Fl_Dial {} {
              label {Ph.rand}
              tooltip {Phase randomness} xywh {280 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Unison_phase_randomness");o->reset_value=127;}
              class Fl_Osc_Dial
            }
            Fl_Dial {} {
              label Stereo
              tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
              code0 {o->init("Unison_stereo_spread");o->reset_value=64;}
              class Fl_Osc_Dial
            }
          }
        }
        Fl_Group {} {
          label AMPLITUDE open
          xywh {5 40 240 220} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
        } {
          Fl_Value_Slider {} {
            label Vol
            tooltip Volume xywh {10 60 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
            code0 {o->init("PVolume");o->reset_value=100;}
            class Fl_Osc_VSlider
          }
          Fl_Value_Slider {} {
            label {V.Sns}
            tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 80 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
            code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=127;}
            class Fl_Osc_VSlider
          }
          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,
            ENV_ADSR, osc_i, loc, "AmpEnvelope/");}
            class EnvelopeUI
          } {}
          Fl_Dial {} {
            label Pan
            tooltip {Panning (leftmost is Random)} xywh {212 65 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_Check_Button {} {
            label On
            callback {if (o->value()==0) voiceampenvgroup->deactivate();
else voiceampenvgroup->activate();
o->redraw();}
            tooltip {Forced Release} xywh {15 110 50 10} down_box DOWN_BOX labelfont 1 labelsize 11
            code0 {o->init("PAmpEnvelopeEnabled");}
            class Fl_Osc_Check
          }
          Fl_Group voiceamplfogroup {
            label {Amplitude LFO     } open
            xywh {10 180 230 75} box FLAT_BOX color 47 align 144
            code0 {o->init(osc_i, loc, "AmpLfo/");}
            class LFOUI
          } {}
          Fl_Check_Button {} {
            label On
            callback {if (o->value()==0) voiceamplfogroup->deactivate();
else voiceamplfogroup->activate();
o->redraw();}
            tooltip {Forced Release} xywh {15 185 55 10} down_box DOWN_BOX labelfont 1 labelsize 11
            code0 {o->init("PAmpLfoEnabled");}
            class Fl_Osc_Check
          }
          Fl_Check_Button {} {
            label Minus
            xywh {10 45 50 10} down_box DOWN_BOX labelfont 1 labelsize 10
            code0 {o->init("PVolumeminus");}
            class Fl_Osc_Check
          }
        }
        Fl_Group voicefiltergroup {
          label FILTER open
          xywh {245 5 285 260} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
        } {
          Fl_Group {} {
            label {ADsynth Voice - Filter} open
            xywh {250 30 275 75} box FLAT_BOX color 50 align 144
            code0 {o->init(loc + "PFilter", osc_i, loc, "VoiceFilter/");}
            class FilterUI
          } {}
          Fl_Group voicefilterenvgroup {
            label {ADSynth Voice - Filter Envelope} open
            xywh {250 115 275 70} box FLAT_BOX color 51 align 144
            code0 {o->init(
            ENV_ADSR_FILTER, osc_i, loc, "FilterEnvelope/");}
            class EnvelopeUI
          } {}
          Fl_Check_Button {} {
            label On
            callback {if (o->value()==0) voicefilterenvgroup->deactivate();
else voicefilterenvgroup->activate();
o->redraw();}
            tooltip {Forced Release} xywh {255 119 55 10} down_box DOWN_BOX labelfont 1 labelsize 11
            code0 {o->init("PFilterEnvelopeEnabled");}
            class Fl_Osc_Check
          }
          Fl_Group voicefilterlfogroup {
            label {Filter LFO     } open
            xywh {250 190 230 70} box FLAT_BOX color 47 align 144
            code0 {o->init(osc_i, loc, "FilterLfo/");}
            class LFOUI
          } {}
          Fl_Check_Button {} {
            label On
            callback {if (o->value()==0) voicefilterlfogroup->deactivate();
else voicefilterlfogroup->activate();
o->redraw();}
            tooltip {Forced Release} xywh {255 196 55 10} down_box DOWN_BOX labelfont 1 labelsize 11
            code0 {o->init("PFilterLfoEnabled");}
            class Fl_Osc_Check
          }
        }
        Fl_Group activeVoiceID {
          label 01
          xywh {5 5 55 35} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 16
          code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));}
        } {}
        Fl_Choice {} {
          callback {switch (o->value()) {
  case 0: voicemodegroup->activate(); whitenoiselabel->hide(); pinknoiselabel->hide(); osc->Overlay=NULL; break;
  case 1: voicemodegroup->deactivate(); whitenoiselabel->show(); pinknoiselabel->hide(); osc->Overlay=whitenoiselabel; break;
  default: voicemodegroup->deactivate(); whitenoiselabel->hide(); pinknoiselabel->show(); osc->Overlay=pinknoiselabel; break;
}} open
          tooltip {Oscillator Type (sound/noise)} xywh {5 515 65 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10
          code0 {o->init("Type");}
          class Fl_Osc_Choice
        } {
          MenuItem {} {
            label Sound
            xywh {5 5 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label White
            xywh {15 15 100 20} labelfont 1 labelsize 11
          }
          MenuItem {} {
            label Pink
            xywh {25 25 100 20} labelfont 1 labelsize 11
          }
        }
        Fl_Check_Button bypassfiltercheckbutton {
          label {Bypass Global F.}
          xywh {425 10 100 20} down_box DOWN_BOX labelfont 1 labelsize 10 align 148
          code0 {o->init("Pfilterbypass");}
          class Fl_Osc_Check
        }
        Fl_Group {} {open
          xywh {115 5 95 35} box THIN_UP_BOX
        } {
          Fl_Value_Slider {} {
            label Delay
            tooltip Volume xywh {120 21 84 12} type {Horz Knob} box NO_BOX labelsize 11 align 5 maximum 127 step 1
            code0 {o->init("PDelay");}
            class Fl_Osc_VSlider
          }
        }
        Fl_Check_Button {} {
          label On
          callback {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 11
          code0 {o->init("PFilterEnabled");}
          class Fl_Osc_Check
        }
        Fl_Box whitenoiselabel {
          label {White Noise}
          xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 54 hide
        }
        Fl_Box pinknoiselabel {
          label {Pink Noise}
          xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 212 hide
        }
        Fl_Counter {} {
          label Unison selected
          tooltip {Unison size} xywh {20 568 65 18} labelfont 1 align 5 minimum 1 maximum 64 step 1 value 1 textfont 1 textsize 11
          code0 {o->init("Unison_size", 1);}
          code1 {o->lstep(5);}
          class Fl_Osc_Counter
        }
      }
      Fl_Check_Button voiceonbutton {
        label On
        callback {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 13
        code0 {o->init("Enabled");}
        class Fl_Osc_Check
      }
    }
  }
  Function {ADvoiceUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {nvoice=0;
oscedit=NULL;} {}
  }
  Function {init(int nvoice_, std::string loc_, Fl_Osc_Interface *osc_)} {open
  } {
    code {assert(osc_);
assert(!loc_.empty());
nvoice=nvoice_;
loc=loc_+"VoicePar"+to_s(nvoice)+"/";
base = loc_;
osc_i=osc_;
make_window();
end();
ADnoteVoiceParameters->show();} {}
  }
  Function {~ADvoiceUI()} {open
  } {
    code {ADnoteVoiceParameters->hide();
hide();
delete(oscedit);
//delete (ADnoteVoiceParameters);} {}
  }
  Function {change_voice(int nvoice_)} {open
  } {
    code {nvoice = nvoice_;
    loc = base+"VoicePar"+to_s(nvoice)+"/";
    char tmp[50];snprintf(tmp,10,"%d",nvoice+1);
    activeVoiceID->label(strdup(tmp));
    extoscil->clear();
    extoscil->add("Internal");
    for (int i=0;i<nvoice;i++) {
        sprintf(tmp,"Ext.%2d",i+1);
        extoscil->add(tmp);
    };

    extFMoscil->clear();
    extFMoscil->add("Internal");
    for (int i=0;i<nvoice;i++) {
        sprintf(tmp,"ExtM.%2d",i+1);
        extFMoscil->add(tmp);
    }
              
    extMod->clear();
    extMod->add("OFF");
    for (int i=0;i<nvoice;i++) {
        sprintf(tmp,"ExtMod.%2d",i+1);
        extMod->add(tmp);
    }
    ADnoteVoiceParameters->rebase(base+"VoicePar"+to_s(nvoice)+"/");} {selected
    }
  }
  decl {int nvoice;} {private local
  }
  decl {OscilEditor *oscedit;} {private local
  }
  decl {Fl_Oscilloscope *osc;} {private local
  }
  decl {Fl_Oscilloscope *oscFM;} {private local
  }
  decl {std::string loc;} {private local
  }
  decl {std::string base;} {private local
  }
  decl {Fl_Osc_Interface *osc_i;} {private local
  }
} 

class ADnoteUI {open : {public PresetsUI_}
} {
  Function {make_window()} {open private
  } {
    Fl_Window ADnoteGlobalParameters {
      label {ADsynth Global Parameters of the Instrument} open
      xywh {688 551 540 430} type Double
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {ADnoteGlobalParameters->init(osc, loc + "GlobalPar/");}
      }
      Fl_Group {} {
        label FREQUENCY open
        xywh {5 280 530 115} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
      } {
        Fl_Group freqenv {
          label {ADSynth Global - Frequency Envelope} open
          xywh {10 320 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ASR, osc, loc, "GlobalPar/FreqEnvelope/");}
          class EnvelopeUI
        } {}
        Fl_Counter octave {
          label Octave
          tooltip Octave xywh {455 300 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 {460 370 60 20} type Simple labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11
          code0 {o->init("coarsedetune");}
          code3 {o->lstep(10);}
          class Fl_Osc_Counter
        }
        Fl_Group freqlfo {
          label {Frequency LFO     } open
          xywh {220 320 230 70} box FLAT_BOX color 47 align 144
          code0 {o->init(osc, loc, "GlobalPar/FreqLfo/");}
          class LFOUI
        } {}
        Fl_Slider detune {
          callback {detunevalueoutput->update();}
          tooltip {Fine Detune (cents)} xywh {60 300 385 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 {12 300 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_Choice detunetype {
          label {Detune Type}
          callback {detunevalueoutput->update();
	  ui->partui->adnoteui->advoice->detunevalueoutput->update();
	  ui->partui->adnoteui->advoice->fmdetunevalueoutput->update();
	  } open
          xywh {455 340 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->init("PDetuneType",1);}
          class Fl_Osc_Choice
        } {}
        Fl_Dial {} {
          label relBW
          callback {for (int i=0;i<NUM_VOICES;i++){
  voicelistitem[i]->refreshlist();
};}
          tooltip {Bandwidth - how the relative fine detune of the voice are changed} xywh {505 295 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->init("PBandwidth");o->reset_value=64;}
          class Fl_Osc_Dial
        }
      }
      Fl_Group {} {
        label AMPLITUDE open
        xywh {5 5 240 260} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
      } {
        Fl_Value_Slider volume {
          label Vol
          tooltip Volume xywh {10 30 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
          code0 {o->init("PVolume");o->reset_value=90;}
          class Fl_Osc_VSlider
        }
        Fl_Value_Slider vsns {
          label {V.Sns}
          tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 50 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
          code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=64;}
          class Fl_Osc_VSlider
        }
        Fl_Dial pan {
          label Pan
          tooltip {Panning (leftmost is Random)} xywh {210 25 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_Dial {} {
	    label De-pop selected
            tooltip {Pop suppression} xywh {208 228 20 20} type Float labelsize 10 maximum 127 step 1 textfont 1 textsize 11
            code0 {o->init("Fadein_adjustment");o->reset_value=20;}
	    class Fl_Osc_Dial
          }

        Fl_Dial pstr {
          label {P.Str.}
          tooltip {Punch Strength} xywh {78 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->init("PPunchStrength");}
          class Fl_Osc_Dial
        }
        Fl_Dial pt {
          label {P.t.}
          tooltip {Punch Time (duration)} xywh {108 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->init("PPunchTime");o->reset_value=60;}
          class Fl_Osc_Dial
        }
        Fl_Dial pstc {
          label {P.Stc.}
          tooltip {Punch Stretch} xywh {138 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->init("PPunchStretch");o->reset_value=64;}
          class Fl_Osc_Dial
        }
        Fl_Dial pvel {
          label {P.Vel.}
          tooltip {Punch Velocity Sensing} xywh {168 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
          code0 {o->init("PPunchVelocitySensing");o->reset_value=72;}
          class Fl_Osc_Dial
        }
        Fl_Group ampenv {
          label {ADSynth Global - Amplitude Envelope} open
          xywh {10 75 205 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ADSR, osc, loc, "GlobalPar/AmpEnvelope/");}
          class EnvelopeUI
        } {}
        Fl_Group amplfo {
          label {Amplitude LFO          } open
          xywh {10 150 230 70} box FLAT_BOX color 47 align 144
          code0 {o->init(osc, loc, "GlobalPar/AmpLfo/");}
          class LFOUI
        } {}
        Fl_Check_Button rndgrp {
          label {Rnd Grp}
          tooltip {How the Harmonic Amplitude is applied to voices that use the same oscillator} xywh {7 241 65 18} down_box DOWN_BOX labelsize 11
          code0 {o->init("Hrandgrouping");}
          class Fl_Osc_Check
        }
      }
      Fl_Group {} {
        label FILTER open
        xywh {250 5 285 265} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
      } {
        Fl_Group filterenv {
          label {ADSynth Global - Filter Envelope} open
          xywh {255 118 275 70} box FLAT_BOX color 51 align 144
          code0 {o->init(ENV_ADSR_FILTER, osc, loc, "GlobalPar/FilterEnvelope/");}
          class EnvelopeUI
        } {}
        Fl_Group filterlfo {
          label {Filter LFO} open
          xywh {255 195 230 70} box FLAT_BOX color 47 align 144
          code0 {o->init(osc, loc, "GlobalPar/FilterLfo/");}
          class LFOUI
        } {}
        Fl_Group filterui {
          label {ADsynth Global - Filter} open
          xywh {255 35 275 75} box FLAT_BOX color 50 align 144
          code0 {o->init(loc + "GlobalPar/PFilter",
          osc, loc, "GlobalPar/GlobalFilter/");}
          class FilterUI
        } {}
      }
      Fl_Check_Button stereo {
        label Stereo
        xywh {7 223 65 18} down_box DOWN_BOX labelsize 11
        code0 {o->init("PStereo");}
        class Fl_Osc_Check
      }
      Fl_Button {} {
        label {Show Voice List}
        callback {for (int i=0;i<NUM_VOICES;i++){
  voicelistitem[i]->refreshlist();
}
ADnoteVoiceList->show();}
        xywh {180 400 125 25} labelsize 12
      }
      Fl_Button {} {
        label {Show Voice Parameters}
        callback {
        if (advoice->mod_type->value() == 0)
            advoice->voiceFMparametersgroup->deactivate();
        else
            advoice->voiceFMparametersgroup->activate();
        ADnoteVoice->show();}
        xywh {5 400 170 25} labelsize 12
      }
      Fl_Button {} {
        label Close
        callback {ADnoteGlobalParameters->hide();}
        xywh {475 400 60 25} box THIN_UP_BOX
      }
      Fl_Button {} {
        label Resonance
        callback {resui->resonancewindow->redraw();
resui->resonancewindow->show();}
        tooltip Resonance xywh {309 400 86 25} box THIN_UP_BOX labelsize 12
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(loc);}
        xywh {405 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(loc,this);}
        xywh {435 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
    }
    Fl_Window ADnoteVoice {
      label {ADsynth Voice Parameters} open
      xywh {48 361 765 630} type Double
      class Fl_Osc_Window visible
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {ADnoteVoice->init(osc,loc);}
      }
      Fl_Group advoice {open
        xywh {0 0 765 595}
        code0 {o->init(nvoice,loc, osc);}
        code1 {o->show();}
        class ADvoiceUI
      } {}
      Fl_Button {} {
        label {Close}
        callback {ADnoteVoice->hide();}
        xywh {700 601 60 25} box THIN_UP_BOX
      }
      Fl_Counter currentvoicecounter {
        label {Current Voice}
        callback {nvoice=(int)o->value()-1;
advoice->change_voice(nvoice);}
        xywh {10 601 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13
        code0 {o->bounds(1,NUM_VOICES);}
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(ADnoteVoice->loc(),nvoice);}
        xywh {630 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(ADnoteVoice->loc(),this,nvoice);}
        xywh {660 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
      }
      Fl_Button {} {
        label {Show ADsynth}
        callback {ADnoteGlobalParameters->show();}
        xywh {280 601 110 25} labelfont 0 labelsize 12
      }
      Fl_Button {} {
        label {Show Voice List}
        callback {
	  for (int i=0;i<NUM_VOICES;i++){
               voicelistitem[i]->refreshlist();
          }
          ADnoteVoiceList->show();
	}
        xywh {400 601 130 25} labelfont 0 labelsize 12
      }
    }
    Fl_Window ADnoteVoiceList {
      label {ADsynth Voices list} open
      xywh {6 263 670 260} type Double hide
      class Fl_Osc_Window
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {ADnoteVoiceList->init(osc, loc);}
      }
      Fl_Text_Display {} {
        label {No.}
        xywh {17 15 30 10} box NO_BOX labelfont 1 labelsize 11
      }
      Fl_Text_Display {} {
        label Vol
        xywh {190 15 30 10} box NO_BOX labelfont 1 labelsize 11
      }
      Fl_Text_Display {} {
        label Detune
        xywh {431 15 25 10} box NO_BOX labelfont 1 labelsize 11
      }
      Fl_Text_Display {} {
        label Pan
        xywh {253 15 30 10} box NO_BOX labelfont 1 labelsize 11
      }
      Fl_Text_Display {} {
        label {Vib. Depth} selected
        xywh {600 15 30 10} box NO_BOX labelfont 1 labelsize 11
      }
      Fl_Text_Display {} {
        label {R.}
        xywh {285 15 25 10} box NO_BOX labelfont 1 labelsize 11
      }
      Fl_Button {} {
        label {Close}
        callback {ADnoteVoiceList->hide();}
        xywh {271 237 80 20}
      }
      Fl_Scroll {} {open
        xywh {0 15 670 220} type VERTICAL box THIN_UP_BOX
      } {
        Fl_Pack {} {open
          xywh {0 20 670 210}
          code0 {o->begin();for (int i=0;i<NUM_VOICES;i++){voicelistitem[i]=new ADvoicelistitem(0,0,670,25,"");voicelistitem[i]->init(i,loc+"VoicePar"+to_s(i)+"/",osc);}o->end();}
        } {}
      }
      Fl_Button {} {
        label {Edit ADsynth}
        callback {ui->partui->adnoteui->ADnoteGlobalParameters->show();}
        xywh {5 237 106 20} labelsize 12
      }
    }
  }
  Function {ADnoteUI(std::string loc_, Fl_Osc_Interface *osc_)} {open
  } {
    code {assert(osc_);
assert(!loc_.empty());

nvoice=0;
resui=new ResonanceUI(osc_, loc_+"GlobalPar/Reson/");
loc=loc_;
osc=osc_;
make_window();} {}
  }
  Function {~ADnoteUI()} {open
  } {
    code {ADnoteVoiceList->hide();
ADnoteGlobalParameters->hide();
ADnoteVoice->hide();
delete ADnoteVoiceList;
delete ADnoteGlobalParameters;
delete ADnoteVoice;
delete resui;} {}
  }
  Function {refresh()} {open
  } {
    code {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 {ResonanceUI *resui;} {private local
  }
  decl {int nvoice;} {private local
  }
  decl {ADvoicelistitem *voicelistitem[NUM_VOICES];} {private local
  }
  decl {std::string loc;} {private local
  }
  decl {Fl_Osc_Interface *osc;} {private local
  }
} 
