// generated by Fast Light User Interface Designer (fluid) version 1.0405

#include "EffUI.h"
// EffUI.cc
// Original ZynAddSubFX author Nasca Octavian Paul
// Copyright (C) 2002-2005 Nasca Octavian Paul
// Copyright 2009-2010, Alan Calvert
// Copyright 2016-2025, Will Godfrey, Kristian Amlie & others

// This file is part of yoshimi, which is free software: you can redistribute
// it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.

// yoshimi is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.   See the GNU General Public License (version 2 or
// later) for more details.

// You should have received a copy of the GNU General Public License along with
// yoshimi; if not, write to the Free Software Foundation, Inc., 51 Franklin
// Street, Fifth Floor, Boston, MA  02110-1301, USA.

// This file is a derivative of the ZynAddSubFX original


#include "Misc/NumericFuncs.h"
    using func::power;
#include "Misc/TextMsgBuffer.h"

    namespace { // Implementation details...
        TextMsgBuffer& textMsgBuffer = TextMsgBuffer::instance();
    }
using std::to_string;

EQGraph::EQGraph(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) {
  //
}

void EQGraph::init(SynthEngine* synth, RoutingTag conEQ) {
  //
          graph.activate(GuiDataExchange::Connection<EqGraphDTO>{synth->interchange.guiDataExchange, conEQ});
}

void EQGraph::draw_freq_line(float freq, bool major ) {
  //
          fl_color(EQ_grid);
          float xFac = EQ::xScaleFac(freq);

          if (major)
          {
              if (active_r())
                  fl_color(EQ_major_grid);
              else
                  fl_color(EQ_grid);
          }

          if (0.0 < xFac && xFac < 1.0)
              fl_line(x() + int(xFac * w()), y(),
                      x() + int(xFac * w()), y() + h());
}

void EQGraph::draw() {
  //
          int ox = x(), oy = y();
          fl_line_style(0, int(1 * w() / 190.0f));

          if (active_r())
              fl_color(EQ_back);
          else
              fl_color(EQ_back_off);
          fl_rectf(ox, oy, w(), h());

          // draw the lines
          fl_color(EQ_grid);
          fl_line(ox + 2, oy + h() / 2, ox + w() - 2, oy + h() / 2);

          float xFac = EQ::xScaleFac(1000.0);
          if (0.0 < xFac && xFac < 1.0)
              fl_line(ox + int(xFac * w()), oy,
                      ox + int(xFac * w()), oy + h());

          for (int i = 1; i < 10; ++i)
              if (i == 1)
              {
                  draw_freq_line(i *  100.0, true);
                  draw_freq_line(i * 1000.0, true);
              }
              else
              {
                  draw_freq_line(i *   10.0, i==5);
                  draw_freq_line(i *  100.0, i==5);
                  draw_freq_line(i * 1000.0, i==5);
              }
          draw_freq_line(10000.0, true);
          draw_freq_line(20000.0, false);

          const int gridY = 6;
          if (h() >= 3 * gridY)
              for (int i = 1; i < gridY; ++i)
              {
                  int level = oy + int( i * float(h()) / gridY);
                  fl_line(ox+2,       level,
                          ox-2 + w(), level);
              }

          fl_line_style(0, int(2 * w() / 190.0f));
          // draw the frequency response
          //if (active_r())
              fl_color(EQ_line);
          //else
              //fl_color(EQ_line_off);
          int oix = 0;
          int oiy( h() * lookupResponse(0.0));
          for (int i = 1; i < w(); ++i)
          {
              float scalePos = float(i) / w();
              auto iy = int( h() * lookupResponse(scalePos));
              if (oiy >= 0 && oiy < h() && iy >= 0 && iy < h())
                  fl_line(ox + oix, oy+h() - oiy
                         ,ox + i,   oy+h() - iy);
              oix = i;
              oiy = iy;
          }
          fl_line_style(0, 1);
}

float EQGraph::lookupResponse(float scaleFac) {
  return graph.get().lookup(scaleFac);
}

void EffUI::cb_revp_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp_i(o,v);
}

void EffUI::cb_revp10_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 10, o->value(), (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp10(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp10_i(o,v);
}

void EffUI::cb_revp0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
              if (isInsert()) // D/W
              {
                  value = value / 2;
              }
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp0_i(o,v);
}

void EffUI::cb_revp1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp1_i(o,v);
}

void EffUI::cb_revp2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp2_i(o,v);
}

void EffUI::cb_revp3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp3_i(o,v);
}

void EffUI::cb_revp4_i(WidgetPDial* o, void*) {
  //
          int butt = 4;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp4(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp4_i(o,v);
}

void EffUI::cb_revp12_i(WidgetPDial* o, void*) {
  //
          int butt = 12;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp12(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp12_i(o,v);
}

void EffUI::cb_revp6_i(WidgetPDial* o, void*) {
  //
          int butt = 6;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp6(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp6_i(o,v);
}

void EffUI::cb_revp7_i(WidgetPDial* o, void*) {
  //
          int butt = 7;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp7(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp7_i(o,v);
}

void EffUI::cb_revp8_i(WidgetPDial* o, void*) {
  //
          int butt = 8;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp8(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp8_i(o,v);
}

void EffUI::cb_revp9_i(WidgetPDial* o, void*) {
  //
          int butt = 9;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp9(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp9_i(o,v);
}

void EffUI::cb_revp11_i(WidgetPDial* o, void*) {
  //
          int butt = 11;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = reverbPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::reverb), TOPLEVEL::type::Integer);
}
void EffUI::cb_revp11(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_revp11_i(o,v);
}

void EffUI::cb_echop_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop_i(o,v);
}

void EffUI::cb_echop0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
              if (isInsert()) // D/W
              {
                  value = value / 2;
              }
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
  //        send_data(0, 0, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop0_i(o,v);
}

void EffUI::cb_echop1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop1_i(o,v);
}

void EffUI::cb_echop2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop2_i(o,v);
}

void EffUI::cb_echop3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop3_i(o,v);
}

void EffUI::cb_echop4_i(WidgetPDial* o, void*) {
  //
          int butt = 4;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop4(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop4_i(o,v);
}

void EffUI::cb_echop5_i(WidgetPDial* o, void*) {
  //
          int butt = 5;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop5(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop5_i(o,v);
}

void EffUI::cb_echop6_i(WidgetPDial* o, void*) {
  //
          int butt = 6;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = echoPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop6(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop6_i(o,v);
}

void EffUI::cb_echop7_i(Fl_Check_Button* o, void*) {
  //
          send_data(0, EFFECT::control::sepLRDelay, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop7(Fl_Check_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop7_i(o,v);
}

void EffUI::cb_echop17_i(Fl_Check_Button* o, void*) {
  //
          send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);
}
void EffUI::cb_echop17(Fl_Check_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_echop17_i(o,v);
}

void EffUI::cb_chorusp_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp_i(o,v);
}

void EffUI::cb_chorusp4_i(Fl_Choice* o, void*) {
  //
          send_data(0, 4, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp4(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp4_i(o,v);
}

void EffUI::cb_chorusp0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp0_i(o,v);
}

void EffUI::cb_chorusp1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp1_i(o,v);
}

void EffUI::cb_chorusp2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp2_i(o,v);
}

void EffUI::cb_chorusp18_i(WidgetPDial* o, void*) {
  //
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = 0;
          }

          send_data(0, EFFECT::control::bpmStart, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp18(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp18_i(o,v);
}

void EffUI::cb_chorusp3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp3_i(o,v);
}

void EffUI::cb_chorusp5_i(WidgetPDial* o, void*) {
  //
          int butt = 5;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp5(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp5_i(o,v);
}

void EffUI::cb_chorusp6_i(WidgetPDial* o, void*) {
  //
          int butt = 6;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp6(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp6_i(o,v);
}

void EffUI::cb_chorusp7_i(WidgetPDial* o, void*) {
  //
          int butt = 7;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp7(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp7_i(o,v);
}

void EffUI::cb_chorusp8_i(WidgetPDial* o, void*) {
  //
          int butt = 8;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp8(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp8_i(o,v);
}

void EffUI::cb_chorusp9_i(WidgetPDial* o, void*) {
  //
          int butt = 9;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = chorusPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp9(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp9_i(o,v);
}

void EffUI::cb_chorusflange_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 10, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusflange(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusflange_i(o,v);
}

void EffUI::cb_chorusp11_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 11, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp11(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp11_i(o,v);
}

void EffUI::cb_chorusp17_i(Fl_Check_Button* o, void*) {
  //
          send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);
}
void EffUI::cb_chorusp17(Fl_Check_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_chorusp17_i(o,v);
}

void EffUI::cb_phaserp_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp_i(o,v);
}

void EffUI::cb_phaserp4_i(Fl_Choice* o, void*) {
  //
          send_data(0, 4, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp4(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp4_i(o,v);
}

void EffUI::cb_phaserp0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp0_i(o,v);
}

void EffUI::cb_phaserp1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp1_i(o,v);
}

void EffUI::cb_phaserp2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp2_i(o,v);
}

void EffUI::cb_phaserp18_i(WidgetPDial* o, void*) {
  //
          int butt = 18;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = 0;
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp18(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp18_i(o,v);
}

void EffUI::cb_phaserp3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp3_i(o,v);
}

void EffUI::cb_phaserp17_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp17(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp17_i(o,v);
}

void EffUI::cb_phaserp5_i(WidgetPDial* o, void*) {
  //
          int butt = 5;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp5(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp5_i(o,v);
}

void EffUI::cb_phaserp6_i(WidgetPDial* o, void*) {
  //
          int butt = 6;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp6(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp6_i(o,v);
}

void EffUI::cb_phaserp7_i(WidgetPDial* o, void*) {
  //
          int butt = 7;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp7(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp7_i(o,v);
}

void EffUI::cb_phaserp8_i(Fl_Counter* o, void*) {
  //
          send_data(0, 8, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp8(Fl_Counter* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp8_i(o,v);
}

void EffUI::cb_phaserp9_i(WidgetPDial* o, void*) {
  //
          int butt = 9;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp9(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp9_i(o,v);
}

void EffUI::cb_phaserp10_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 10, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp10(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp10_i(o,v);
}

void EffUI::cb_phaserp11_i(WidgetPDial* o, void*) {
  //
          int butt = 11;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp11(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp11_i(o,v);
}

void EffUI::cb_phaserp12_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 12, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp12(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp12_i(o,v);
}

void EffUI::cb_phaserp13_i(WidgetPDial* o, void*) {
  //
          int butt = 13;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = phaserPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp13(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp13_i(o,v);
}

void EffUI::cb_phaserp14_i(Fl_Check_Button2* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 14, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);
}
void EffUI::cb_phaserp14(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_phaserp14_i(o,v);
}

void EffUI::cb_awp_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp_i(o,v);
}

void EffUI::cb_awp4_i(Fl_Choice* o, void*) {
  //
          send_data(0, 4, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp4(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp4_i(o,v);
}

void EffUI::cb_awp0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
              if (isInsert()) // D/W
              {
                  value = value / 2;
              }
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp0_i(o,v);
}

void EffUI::cb_awp1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp1_i(o,v);
}

void EffUI::cb_awp2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp2_i(o,v);
}

void EffUI::cb_awp3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp3_i(o,v);
}

void EffUI::cb_awp18_i(WidgetPDial* o, void*) {
  //
          int butt = 18;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = 0;
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp18(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp18_i(o,v);
}

void EffUI::cb_awp5_i(WidgetPDial* o, void*) {
  //
          int butt = 5;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp5(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp5_i(o,v);
}

void EffUI::cb_awp6_i(WidgetPDial* o, void*) {
  //
          int butt = 6;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp6(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp6_i(o,v);
}

void EffUI::cb_awp7_i(WidgetPDial* o, void*) {
  //
          int butt = 7;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp7(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp7_i(o,v);
}

void EffUI::cb_awp9_i(WidgetPDial* o, void*) {
  //
          int butt = 9;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp9(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp9_i(o,v);
}

void EffUI::cb_awp10_i(WidgetPDial* o, void*) {
  //
          int butt = 10;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = alienPresets[presetNum][butt];
          }

          send_data(0, butt, value, (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp10(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp10_i(o,v);
}

void EffUI::cb_awp8_i(Fl_Counter* o, void*) {
  //
          send_data(0, 8, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp8(Fl_Counter* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp8_i(o,v);
}

void EffUI::cb_awp17_i(Fl_Check_Button* o, void*) {
  //
          send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);
}
void EffUI::cb_awp17(Fl_Check_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_awp17_i(o,v);
}

void EffUI::cb_distp_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);
}
void EffUI::cb_distp(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp_i(o,v);
}

void EffUI::cb_distp5_i(Fl_Choice* o, void*) {
  //
          send_data(0, 5, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);
}
void EffUI::cb_distp5(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp5_i(o,v);
}

void EffUI::cb_distp0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
              if (isInsert()) // D/W
              {
                  value = value / 2;
              }
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp0_i(o,v);
}

void EffUI::cb_distp1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp1_i(o,v);
}

void EffUI::cb_distp2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp2_i(o,v);
}

void EffUI::cb_distp3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp3_i(o,v);
}

void EffUI::cb_distp4_i(WidgetPDial* o, void*) {
  //
          int butt = 4;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp4(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp4_i(o,v);
}

void EffUI::cb_distp7_i(WidgetPDial* o, void*) {
  //
          int butt = 7;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp7(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp7_i(o,v);
}

void EffUI::cb_distp8_i(WidgetPDial* o, void*) {
  //
          int butt = 8;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = distPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::distortion, TOPLEVEL::type::Integer);
}
void EffUI::cb_distp8(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp8_i(o,v);
}

void EffUI::cb_distp6_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 6, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);
}
void EffUI::cb_distp6(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp6_i(o,v);
}

void EffUI::cb_distp9_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 9, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);
}
void EffUI::cb_distp9(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp9_i(o,v);
}

void EffUI::cb_distp10_i(Fl_Check_Button2* o, void*) {
  //
          send_data(0, 10, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);
}
void EffUI::cb_distp10(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_distp10_i(o,v);
}

void EffUI::cb_eqp0_i(WidgetPDial* o, void*) {
  //
  	int butt = 0;
  	int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = EQmaster_def;
          }

          send_data(TOPLEVEL::action::forceUpdate, butt, value, (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_eqp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_eqp0_i(o,v);
}

void EffUI::cb_bandcounter_i(Fl_Counter* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 1, o->value() - 1, (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_bandcounter(Fl_Counter* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_bandcounter_i(o,v);
}

void EffUI::cb_typechoice_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 10, o->value(), (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_typechoice(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_typechoice_i(o,v);
}

void EffUI::cb_freqdial_i(WidgetPDial* o, void*) {
  //
          int butt = 11;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = EQfreq_def;
          }

          send_data(TOPLEVEL::action::forceUpdate, butt, value, (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_freqdial(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_freqdial_i(o,v);
}

void EffUI::cb_gaindial_i(WidgetPDial* o, void*) {
  //
          int butt = 12;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = EQgain_def;
          }

          send_data(TOPLEVEL::action::forceUpdate, butt, value, (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_gaindial(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_gaindial_i(o,v);
}

void EffUI::cb_qdial_i(WidgetPDial* o, void*) {
  //
          int butt = 13;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = EQq_def;
          }

          send_data(TOPLEVEL::action::forceUpdate, butt, value, (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_qdial(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_qdial_i(o,v);
}

void EffUI::cb_stagescounter_i(Fl_Counter* o, void*) {
  //
            send_data(TOPLEVEL::action::forceUpdate, 14, o->value(), (EFFECT::type::eq), TOPLEVEL::type::Integer);
}
void EffUI::cb_stagescounter(Fl_Counter* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_stagescounter_i(o,v);
}

void EffUI::cb_dfp_i(Fl_Choice* o, void*) {
  //
          send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp_i(o,v);
}

void EffUI::cb_dfp4_i(Fl_Choice* o, void*) {
  //
          send_data(0, 4, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp4(Fl_Choice* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp4_i(o,v);
}

void EffUI::cb_dfp0_i(WidgetPDial* o, void*) {
  //
          int butt = 0;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
              if (not isInsert()) // D/W - yes this one is reversed!
              {
                  value = value / 2;
              }
          }

          send_data(0, 0, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp0(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp0_i(o,v);
}

void EffUI::cb_dfp1_i(WidgetPDial* o, void*) {
  //
          int butt = 1;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp1(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp1_i(o,v);
}

void EffUI::cb_dfp2_i(WidgetPDial* o, void*) {
  //
          int butt = 2;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp2(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp2_i(o,v);
}

void EffUI::cb_dfp3_i(WidgetPDial* o, void*) {
  //
          int butt = 3;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp3(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp3_i(o,v);
}

void EffUI::cb_dfp18_i(WidgetPDial* o, void*) {
  //
          int butt = 18;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = 0;
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp18(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp18_i(o,v);
}

void EffUI::cb_dfp5_i(WidgetPDial* o, void*) {
  //
          int butt = 5;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp5(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp5_i(o,v);
}

void EffUI::cb_dfp6_i(WidgetPDial* o, void*) {
  //
          int butt = 6;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp6(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp6_i(o,v);
}

void EffUI::cb_filter_i(Fl_Button*, void*) {
  //
          Showfilt();
}
void EffUI::cb_filter(Fl_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_filter_i(o,v);
}

void EffUI::cb_dfp7_i(WidgetPDial* o, void*) {
  //
            int butt = 7;
            int value = lrint(o->value());
            if (Fl::event_button() == 3)
            {
                value = dynPresets[presetNum][butt];
            }

            send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp7(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_dfp7_i(o,v);
}

void EffUI::cb_dfp9_i(WidgetPDial* o, void*) {
  //
          int butt = 9;
          int value = lrint(o->value());
          if (Fl::event_button() == 3)
          {
              value = dynPresets[presetNum][butt];
          }

          send_data(0, butt, value, EFFECT::type::dynFilter, TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp9(WidgetPDial* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_dfp9_i(o,v);
}

void EffUI::cb_dfp8_i(Fl_Check_Button2* o, void*) {
  //
            send_data(0, 8, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp8(Fl_Check_Button2* o, void* v) {
  ((EffUI*)(o->parent()->parent()->user_data()))->cb_dfp8_i(o,v);
}

void EffUI::cb_dfp17_i(Fl_Check_Button* o, void*) {
  //
          send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);
}
void EffUI::cb_dfp17(Fl_Check_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_dfp17_i(o,v);
}

void EffUI::cb_filterwindow_i(ScaleTrackedWindow*, void*) {
  filterclose->do_callback();
}
void EffUI::cb_filterwindow(ScaleTrackedWindow* o, void* v) {
  ((EffUI*)(o->user_data()))->cb_filterwindow_i(o,v);
}

void EffUI::cb_filterclose_i(Fl_Button*, void*) {
  //
      saveWin(synth, filterwindow->w(), filterwindow->h(), filterwindow->x(), filterwindow->y(), false, "xFilter-dynamic " + to_string(npart));
      filterwindow->hide();
}
void EffUI::cb_filterclose(Fl_Button* o, void* v) {
  ((EffUI*)(o->parent()->user_data()))->cb_filterclose_i(o,v);
}

EffUI::EffUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) {
  //
      filterwindow = NULL;
      fwin_filterui = NULL;
}

EffUI::~EffUI() {
  //
          effnullwindow->hide();        // delete (effnullwindow);
          effreverbwindow->hide();        // delete (effreverbwindow);
          effechowindow->hide();          // delete (effechowindow);
          effchoruswindow->hide();        // delete (effchoruswindow);
          effphaserwindow->hide();        // delete (effphaserwindow);
          effalienwahwindow->hide();      // delete (effalienwahwindow);
          effdistortionwindow->hide();    // delete (effdistortionwindow);
          effeqwindow->hide();            // delete (effeqwindow);
          effdynamicfilterwindow->hide(); // delete (effdynamicfilterwindow);

          if (filterwindow != NULL)
          {
              if (filterwindow->visible())
                  saveWin(synth, filterwindow->w(), filterwindow->h(), filterwindow->x(), filterwindow->y(), true, "xFilter-dynamic " + to_string(npart));
              filterwindow->hide();
              delete(filterwindow);
          }
}

Fl_Group* EffUI::make_null_window() {
  { effnullwindow = new Fl_Group(0, 0, 380, 95);
    effnullwindow->box(FL_PLASTIC_THIN_UP_BOX);
    effnullwindow->color(FL_CYAN);
    effnullwindow->selection_color(FL_BACKGROUND_COLOR);
    effnullwindow->labeltype(FL_NO_LABEL);
    effnullwindow->labelfont(0);
    effnullwindow->labelsize(14);
    effnullwindow->labelcolor(FL_FOREGROUND_COLOR);
    effnullwindow->user_data((void*)(this));
    effnullwindow->align(Fl_Align(FL_ALIGN_TOP));
    effnullwindow->when(FL_WHEN_RELEASE);
    { noeffect = new Fl_Text_Display(120, 35, 10, 20, "No Effects Applied");
      noeffect->box(FL_NO_BOX);
      noeffect->labelfont(1);
      noeffect->labelcolor((Fl_Color)64);
      noeffect->textcolor((Fl_Color)64);
      noeffect->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* noeffect
    effnullwindow->end();
  } // Fl_Group* effnullwindow
  return effnullwindow;
}

Fl_Group* EffUI::make_reverb_window() {
  { effreverbwindow = new Fl_Group(0, 0, 380, 95);
    effreverbwindow->box(FL_PLASTIC_UP_BOX);
    effreverbwindow->color(FL_CYAN);
    effreverbwindow->selection_color(FL_BACKGROUND_COLOR);
    effreverbwindow->labeltype(FL_NO_LABEL);
    effreverbwindow->labelfont(0);
    effreverbwindow->labelsize(12);
    effreverbwindow->labelcolor((Fl_Color)64);
    effreverbwindow->user_data((void*)(this));
    effreverbwindow->align(Fl_Align(33));
    effreverbwindow->when(FL_WHEN_RELEASE);
    { revname = new Fl_Text_Display(10, 10, 0, 20, "Reverb ");
      revname->box(FL_NO_BOX);
      revname->labelfont(1);
      revname->labelsize(12);
      revname->labelcolor((Fl_Color)64);
      revname->textcolor((Fl_Color)64);
      revname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* revname
    { Fl_Choice* o = revp = new Fl_Choice(115, 13, 90, 15, "Preset");
      revp->down_box(FL_BORDER_BOX);
      revp->selection_color(FL_BACKGROUND_COLOR);
      revp->labelsize(11);
      revp->labelcolor((Fl_Color)64);
      revp->textfont(1);
      revp->textsize(10);
      revp->textcolor((Fl_Color)188);
      revp->callback((Fl_Callback*)cb_revp);
      o->add("Cathedral 1");o->add("Cathedral 2");o->add("Cathedral 3");o->add("Hall 1");o->add("Hall 2");o->add("Room 1");o->add("Room 2");o->add("Basement");o->add("Tunnel");o->add("Echoed 1");o->add("Echoed 2");o->add("Very Long 1");o->add("Very Long 2");
    } // Fl_Choice* revp
    { Fl_Choice* o = revp10 = new Fl_Choice(240, 13, 75, 15, "Type");
      revp10->down_box(FL_BORDER_BOX);
      revp10->selection_color(FL_BACKGROUND_COLOR);
      revp10->labelsize(11);
      revp10->labelcolor((Fl_Color)64);
      revp10->textfont(1);
      revp10->textsize(10);
      revp10->textcolor((Fl_Color)188);
      revp10->callback((Fl_Callback*)cb_revp10);
      o->add("Random");o->add("Freeverb");o->add("Bandwidth");
    } // Fl_Choice* revp10
    { WidgetPDial* o = revp0 = new WidgetPDial(10, 40, 30, 30, "Vol");
      revp0->tooltip("Effect volume");
      revp0->box(FL_ROUND_UP_BOX);
      revp0->color(FL_BACKGROUND_COLOR);
      revp0->selection_color(FL_INACTIVE_COLOR);
      revp0->labeltype(FL_NORMAL_LABEL);
      revp0->labelfont(0);
      revp0->labelsize(11);
      revp0->labelcolor((Fl_Color)64);
      revp0->maximum(127);
      revp0->step(1);
      revp0->callback((Fl_Callback*)cb_revp0);
      revp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp0->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXReverbVol);
    } // WidgetPDial* revp0
    { WidgetPDial* o = revp1 = new WidgetPDial(45, 40, 30, 30, "Pan");
      revp1->box(FL_ROUND_UP_BOX);
      revp1->color(FL_BACKGROUND_COLOR);
      revp1->selection_color(FL_INACTIVE_COLOR);
      revp1->labeltype(FL_NORMAL_LABEL);
      revp1->labelfont(0);
      revp1->labelsize(11);
      revp1->labelcolor((Fl_Color)64);
      revp1->maximum(127);
      revp1->callback((Fl_Callback*)cb_revp1);
      revp1->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp1->when(FL_WHEN_CHANGED);
      o->setValueType(VC_PanningStd);
    } // WidgetPDial* revp1
    { WidgetPDial* o = revp2 = new WidgetPDial(80, 40, 30, 30, "Time");
      revp2->tooltip("Duration of effect");
      revp2->box(FL_ROUND_UP_BOX);
      revp2->color(FL_BACKGROUND_COLOR);
      revp2->selection_color(FL_INACTIVE_COLOR);
      revp2->labeltype(FL_NORMAL_LABEL);
      revp2->labelfont(0);
      revp2->labelsize(11);
      revp2->labelcolor((Fl_Color)64);
      revp2->maximum(127);
      revp2->callback((Fl_Callback*)cb_revp2);
      revp2->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp2->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXReverbTime);
    } // WidgetPDial* revp2
    { WidgetPDial* o = revp3 = new WidgetPDial(120, 40, 30, 30, "I.del");
      revp3->tooltip("Initial delay");
      revp3->box(FL_ROUND_UP_BOX);
      revp3->color(FL_BACKGROUND_COLOR);
      revp3->selection_color(FL_INACTIVE_COLOR);
      revp3->labeltype(FL_NORMAL_LABEL);
      revp3->labelfont(0);
      revp3->labelsize(11);
      revp3->labelcolor((Fl_Color)64);
      revp3->maximum(127);
      revp3->callback((Fl_Callback*)cb_revp3);
      revp3->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp3->when(FL_WHEN_RELEASE);
      o->setValueType(VC_FXReverbIDelay);
    } // WidgetPDial* revp3
    { WidgetPDial* o = revp4 = new WidgetPDial(155, 40, 30, 30, "I.delfb");
      revp4->tooltip("Initial delay feedback");
      revp4->box(FL_ROUND_UP_BOX);
      revp4->color(FL_BACKGROUND_COLOR);
      revp4->selection_color(FL_INACTIVE_COLOR);
      revp4->labeltype(FL_NORMAL_LABEL);
      revp4->labelfont(0);
      revp4->labelsize(11);
      revp4->labelcolor((Fl_Color)64);
      revp4->maximum(127);
      revp4->callback((Fl_Callback*)cb_revp4);
      revp4->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp4->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent128);
    } // WidgetPDial* revp4
    { WidgetPDial* o = revp12 = new WidgetPDial(200, 40, 30, 30, "BW");
      revp12->box(FL_ROUND_UP_BOX);
      revp12->color(FL_BACKGROUND_COLOR);
      revp12->selection_color(FL_INACTIVE_COLOR);
      revp12->labeltype(FL_NORMAL_LABEL);
      revp12->labelfont(0);
      revp12->labelsize(11);
      revp12->labelcolor((Fl_Color)64);
      revp12->maximum(127);
      revp12->callback((Fl_Callback*)cb_revp12);
      revp12->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp12->when(FL_WHEN_RELEASE);
      revp12->deactivate();
      if (effParam(10)==2) o->activate();
      o->setValueType(VC_FXReverbBandwidth);
    } // WidgetPDial* revp12
    { revp6 = new WidgetPDial(235, 40, 30, 30, "E/R");
      revp6->box(FL_ROUND_UP_BOX);
      revp6->color(FL_BACKGROUND_COLOR);
      revp6->selection_color(FL_INACTIVE_COLOR);
      revp6->labeltype(FL_NORMAL_LABEL);
      revp6->labelfont(0);
      revp6->labelsize(11);
      revp6->labelcolor((Fl_Color)64);
      revp6->maximum(127);
      revp6->callback((Fl_Callback*)cb_revp6);
      revp6->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp6->when(FL_WHEN_CHANGED);
      revp6->deactivate();
    } // WidgetPDial* revp6
    { WidgetPDial* o = revp7 = new WidgetPDial(270, 40, 30, 30, "LPF");
      revp7->tooltip("Low pass filter");
      revp7->box(FL_ROUND_UP_BOX);
      revp7->color(FL_BACKGROUND_COLOR);
      revp7->selection_color(FL_INACTIVE_COLOR);
      revp7->labeltype(FL_NORMAL_LABEL);
      revp7->labelfont(0);
      revp7->labelsize(11);
      revp7->labelcolor((Fl_Color)64);
      revp7->maximum(127);
      revp7->callback((Fl_Callback*)cb_revp7);
      revp7->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp7->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXReverbLowPass);
    } // WidgetPDial* revp7
    { WidgetPDial* o = revp8 = new WidgetPDial(305, 40, 30, 30, "HPF");
      revp8->tooltip("High pass filter");
      revp8->box(FL_ROUND_UP_BOX);
      revp8->color(FL_BACKGROUND_COLOR);
      revp8->selection_color(FL_INACTIVE_COLOR);
      revp8->labeltype(FL_NORMAL_LABEL);
      revp8->labelfont(0);
      revp8->labelsize(11);
      revp8->labelcolor((Fl_Color)64);
      revp8->maximum(127);
      revp8->callback((Fl_Callback*)cb_revp8);
      revp8->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp8->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXReverbHighPass);
    } // WidgetPDial* revp8
    { WidgetPDial* o = revp9 = new WidgetPDial(340, 40, 30, 30, "Damp");
      revp9->tooltip("Dampening");
      revp9->box(FL_ROUND_UP_BOX);
      revp9->color(FL_BACKGROUND_COLOR);
      revp9->selection_color(FL_INACTIVE_COLOR);
      revp9->labeltype(FL_NORMAL_LABEL);
      revp9->labelfont(0);
      revp9->labelsize(11);
      revp9->labelcolor((Fl_Color)64);
      revp9->minimum(64);
      revp9->maximum(127);
      revp9->step(1);
      revp9->callback((Fl_Callback*)cb_revp9);
      revp9->align(Fl_Align(FL_ALIGN_BOTTOM));
      revp9->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent64_127);
    } // WidgetPDial* revp9
    { WidgetPDial* o = revp11 = new WidgetPDial(342, 8, 25, 25, "R.S.");
      revp11->tooltip("RoomSize");
      revp11->box(FL_ROUND_UP_BOX);
      revp11->color(FL_BACKGROUND_COLOR);
      revp11->selection_color(FL_INACTIVE_COLOR);
      revp11->labeltype(FL_NORMAL_LABEL);
      revp11->labelfont(0);
      revp11->labelsize(10);
      revp11->labelcolor((Fl_Color)64);
      revp11->minimum(1);
      revp11->maximum(127);
      revp11->step(1);
      revp11->callback((Fl_Callback*)cb_revp11);
      revp11->align(Fl_Align(FL_ALIGN_LEFT));
      revp11->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* revp11
    effreverbwindow->end();
  } // Fl_Group* effreverbwindow
  return effreverbwindow;
}

Fl_Group* EffUI::make_echo_window() {
  { effechowindow = new Fl_Group(0, 0, 380, 95);
    effechowindow->box(FL_PLASTIC_UP_BOX);
    effechowindow->color(FL_CYAN);
    effechowindow->selection_color(FL_BACKGROUND_COLOR);
    effechowindow->labeltype(FL_NO_LABEL);
    effechowindow->labelfont(1);
    effechowindow->labelsize(12);
    effechowindow->labelcolor(FL_FOREGROUND_COLOR);
    effechowindow->user_data((void*)(this));
    effechowindow->align(Fl_Align(FL_ALIGN_TOP));
    effechowindow->when(FL_WHEN_RELEASE);
    { echoname = new Fl_Text_Display(10, 10, 0, 20, "Echo");
      echoname->box(FL_NO_BOX);
      echoname->labelfont(1);
      echoname->labelsize(12);
      echoname->labelcolor((Fl_Color)64);
      echoname->textcolor((Fl_Color)64);
      echoname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* echoname
    { Fl_Choice* o = echop = new Fl_Choice(102, 13, 96, 15, "Preset");
      echop->down_box(FL_BORDER_BOX);
      echop->selection_color(FL_BACKGROUND_COLOR);
      echop->labelsize(11);
      echop->labelcolor((Fl_Color)64);
      echop->textfont(1);
      echop->textsize(10);
      echop->textcolor((Fl_Color)188);
      echop->callback((Fl_Callback*)cb_echop);
      o->add("Echo 1");o->add("Echo 2");o->add("Echo 3");o->add("Echo 4");o->add("Simple Echo");o->add("Canyon");o->add("Panning Echo 1");o->add("Panning Echo 2");o->add("Feedback Echo 3");
    } // Fl_Choice* echop
    { WidgetPDial* o = echop0 = new WidgetPDial(10, 45, 30, 30, "Vol");
      echop0->tooltip("Effect volume");
      echop0->box(FL_ROUND_UP_BOX);
      echop0->color(FL_BACKGROUND_COLOR);
      echop0->selection_color(FL_INACTIVE_COLOR);
      echop0->labeltype(FL_NORMAL_LABEL);
      echop0->labelfont(0);
      echop0->labelsize(11);
      echop0->labelcolor((Fl_Color)64);
      echop0->maximum(127);
      echop0->step(1);
      echop0->callback((Fl_Callback*)cb_echop0);
      echop0->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop0->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXEchoVol);
    } // WidgetPDial* echop0
    { WidgetPDial* o = echop1 = new WidgetPDial(64, 45, 30, 30, "Pan");
      echop1->box(FL_ROUND_UP_BOX);
      echop1->color(FL_BACKGROUND_COLOR);
      echop1->selection_color(FL_INACTIVE_COLOR);
      echop1->labeltype(FL_NORMAL_LABEL);
      echop1->labelfont(0);
      echop1->labelsize(11);
      echop1->labelcolor((Fl_Color)64);
      echop1->maximum(127);
      echop1->step(1);
      echop1->callback((Fl_Callback*)cb_echop1);
      echop1->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop1->when(FL_WHEN_CHANGED);
      o->setValueType(VC_PanningStd);
    } // WidgetPDial* echop1
    { WidgetPDial* o = echop2 = new WidgetPDial(118, 45, 30, 30, "Delay");
      echop2->box(FL_ROUND_UP_BOX);
      echop2->color(FL_BACKGROUND_COLOR);
      echop2->selection_color(FL_INACTIVE_COLOR);
      echop2->labeltype(FL_NORMAL_LABEL);
      echop2->labelfont(0);
      echop2->labelsize(11);
      echop2->labelcolor((Fl_Color)64);
      echop2->maximum(127);
      echop2->step(1);
      echop2->callback((Fl_Callback*)cb_echop2);
      echop2->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop2->when(FL_WHEN_RELEASE);
      o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXEchoDelay);
      o->label(isSepDelay() ? "L.Delay" : "Delay");
    } // WidgetPDial* echop2
    { WidgetPDial* o = echop3 = new WidgetPDial(172, 45, 30, 30, "LRdl.");
      echop3->tooltip("If Sep is disabled: Delay between L/R\nIf Sep is enabled: Right Delay");
      echop3->box(FL_ROUND_UP_BOX);
      echop3->color(FL_BACKGROUND_COLOR);
      echop3->selection_color(FL_INACTIVE_COLOR);
      echop3->labeltype(FL_NORMAL_LABEL);
      echop3->labelfont(0);
      echop3->labelsize(11);
      echop3->labelcolor((Fl_Color)64);
      echop3->maximum(127);
      echop3->step(1);
      echop3->callback((Fl_Callback*)cb_echop3);
      echop3->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop3->when(FL_WHEN_RELEASE);
      o->setValueType(isSepDelay() ? (isBeatSync() ? VC_FXlfofreqBPM : VC_FXEchoDelay) : VC_FXEchoLRdel);
      o->label(isSepDelay() ? "R.Delay" : "LRdl.");
    } // WidgetPDial* echop3
    { WidgetPDial* o = echop4 = new WidgetPDial(226, 45, 30, 30, "LRc.");
      echop4->tooltip("L/R crossover");
      echop4->box(FL_ROUND_UP_BOX);
      echop4->color(FL_BACKGROUND_COLOR);
      echop4->selection_color(FL_INACTIVE_COLOR);
      echop4->labeltype(FL_NORMAL_LABEL);
      echop4->labelfont(0);
      echop4->labelsize(11);
      echop4->labelcolor((Fl_Color)64);
      echop4->maximum(127);
      echop4->step(1);
      echop4->callback((Fl_Callback*)cb_echop4);
      echop4->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop4->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* echop4
    { WidgetPDial* o = echop5 = new WidgetPDial(280, 45, 30, 30, "Fb.");
      echop5->tooltip("Feedback");
      echop5->box(FL_ROUND_UP_BOX);
      echop5->color(FL_BACKGROUND_COLOR);
      echop5->selection_color(FL_INACTIVE_COLOR);
      echop5->labeltype(FL_NORMAL_LABEL);
      echop5->labelfont(0);
      echop5->labelsize(11);
      echop5->labelcolor((Fl_Color)64);
      echop5->maximum(127);
      echop5->step(1);
      echop5->callback((Fl_Callback*)cb_echop5);
      echop5->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop5->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* echop5
    { WidgetPDial* o = echop6 = new WidgetPDial(334, 45, 30, 30, "Damp");
      echop6->tooltip("Dampening");
      echop6->box(FL_ROUND_UP_BOX);
      echop6->color(FL_BACKGROUND_COLOR);
      echop6->selection_color(FL_INACTIVE_COLOR);
      echop6->labeltype(FL_NORMAL_LABEL);
      echop6->labelfont(0);
      echop6->labelsize(11);
      echop6->labelcolor((Fl_Color)64);
      echop6->maximum(127);
      echop6->step(1);
      echop6->callback((Fl_Callback*)cb_echop6);
      echop6->align(Fl_Align(FL_ALIGN_BOTTOM));
      echop6->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* echop6
    { echop7 = new Fl_Check_Button(153, 44, 15, 15, "Separate");
      echop7->tooltip("Separate Left / Right Delay");
      echop7->down_box(FL_DOWN_BOX);
      echop7->labelsize(11);
      echop7->callback((Fl_Callback*)cb_echop7);
      echop7->align(Fl_Align(FL_ALIGN_TOP));
    } // Fl_Check_Button* echop7
    { echop17 = new Fl_Check_Button(325, 15, 15, 15, "BPM");
      echop17->tooltip("Synchronize the frequency to a multiple of the BPM. Note that the delay is ca"
"pped at 5 seconds, even if the tempo is slower than this.");
      echop17->down_box(FL_DOWN_BOX);
      echop17->selection_color((Fl_Color)64);
      echop17->labelsize(11);
      echop17->labelcolor((Fl_Color)64);
      echop17->callback((Fl_Callback*)cb_echop17);
    } // Fl_Check_Button* echop17
    effechowindow->end();
  } // Fl_Group* effechowindow
  return effechowindow;
}

Fl_Group* EffUI::make_chorus_window() {
  { effchoruswindow = new Fl_Group(0, 0, 380, 95);
    effchoruswindow->box(FL_PLASTIC_UP_BOX);
    effchoruswindow->color(FL_CYAN);
    effchoruswindow->selection_color(FL_BACKGROUND_COLOR);
    effchoruswindow->labeltype(FL_NO_LABEL);
    effchoruswindow->labelfont(1);
    effchoruswindow->labelsize(14);
    effchoruswindow->labelcolor(FL_FOREGROUND_COLOR);
    effchoruswindow->user_data((void*)(this));
    effchoruswindow->align(Fl_Align(FL_ALIGN_TOP));
    effchoruswindow->when(FL_WHEN_RELEASE);
    { chorusname = new Fl_Text_Display(10, 10, 0, 20, "Chorus");
      chorusname->box(FL_NO_BOX);
      chorusname->labelfont(1);
      chorusname->labelsize(12);
      chorusname->labelcolor((Fl_Color)64);
      chorusname->textcolor((Fl_Color)64);
      chorusname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* chorusname
    { Fl_Choice* o = chorusp = new Fl_Choice(121, 13, 96, 16, "Preset");
      chorusp->down_box(FL_BORDER_BOX);
      chorusp->selection_color(FL_BACKGROUND_COLOR);
      chorusp->labelsize(11);
      chorusp->labelcolor((Fl_Color)64);
      chorusp->textfont(1);
      chorusp->textsize(10);
      chorusp->textcolor((Fl_Color)188);
      chorusp->callback((Fl_Callback*)cb_chorusp);
      o->add("Chorus 1");o->add("Chorus 2");o->add("Chorus 3");o->add("Celeste 1");o->add("Celeste 2");o->add("Flange 1");o->add("Flange 2");o->add("Flange 3");o->add("Flange 4");o->add("Flange 5");
    } // Fl_Choice* chorusp
    { Fl_Choice* o = chorusp4 = new Fl_Choice(189, 65, 43, 15, "LFO type");
      chorusp4->tooltip("LFO function");
      chorusp4->down_box(FL_BORDER_BOX);
      chorusp4->selection_color(FL_BACKGROUND_COLOR);
      chorusp4->labelsize(10);
      chorusp4->labelcolor((Fl_Color)64);
      chorusp4->textfont(1);
      chorusp4->textsize(9);
      chorusp4->textcolor((Fl_Color)188);
      chorusp4->callback((Fl_Callback*)cb_chorusp4);
      chorusp4->align(Fl_Align(FL_ALIGN_BOTTOM));
      o->add("Sine");o->add("Tri");
    } // Fl_Choice* chorusp4
    { WidgetPDial* o = chorusp0 = new WidgetPDial(10, 49, 30, 30, "Vol");
      chorusp0->box(FL_ROUND_UP_BOX);
      chorusp0->color(FL_BACKGROUND_COLOR);
      chorusp0->selection_color(FL_INACTIVE_COLOR);
      chorusp0->labeltype(FL_NORMAL_LABEL);
      chorusp0->labelfont(0);
      chorusp0->labelsize(11);
      chorusp0->labelcolor((Fl_Color)64);
      chorusp0->maximum(127);
      chorusp0->callback((Fl_Callback*)cb_chorusp0);
      chorusp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp0->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXdefaultVol);
    } // WidgetPDial* chorusp0
    { WidgetPDial* o = chorusp1 = new WidgetPDial(45, 49, 30, 30, "Pan");
      chorusp1->box(FL_ROUND_UP_BOX);
      chorusp1->color(FL_BACKGROUND_COLOR);
      chorusp1->selection_color(FL_INACTIVE_COLOR);
      chorusp1->labeltype(FL_NORMAL_LABEL);
      chorusp1->labelfont(0);
      chorusp1->labelsize(11);
      chorusp1->labelcolor((Fl_Color)64);
      chorusp1->maximum(127);
      chorusp1->callback((Fl_Callback*)cb_chorusp1);
      chorusp1->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp1->when(FL_WHEN_CHANGED);
      o->setValueType(VC_PanningStd);
    } // WidgetPDial* chorusp1
    { WidgetPDial* o = chorusp2 = new WidgetPDial(85, 49, 30, 30, "Freq");
      chorusp2->tooltip("LFO frequency");
      chorusp2->box(FL_ROUND_UP_BOX);
      chorusp2->color(FL_BACKGROUND_COLOR);
      chorusp2->selection_color(FL_INACTIVE_COLOR);
      chorusp2->labeltype(FL_NORMAL_LABEL);
      chorusp2->labelfont(0);
      chorusp2->labelsize(11);
      chorusp2->labelcolor((Fl_Color)64);
      chorusp2->maximum(127);
      chorusp2->callback((Fl_Callback*)cb_chorusp2);
      chorusp2->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp2->when(FL_WHEN_CHANGED);
      o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);
    } // WidgetPDial* chorusp2
    { WidgetPDial* o = chorusp18 = new WidgetPDial(120, 50, 30, 30, "Start");
      chorusp18->tooltip("Start of LFO phase relative to start of beat. This has no effect unless you a"
"re syncing to a song position, using MIDI or a plugin host.");
      chorusp18->box(FL_ROUND_UP_BOX);
      chorusp18->color(FL_BACKGROUND_COLOR);
      chorusp18->selection_color(FL_INACTIVE_COLOR);
      chorusp18->labeltype(FL_NORMAL_LABEL);
      chorusp18->labelfont(0);
      chorusp18->labelsize(11);
      chorusp18->labelcolor((Fl_Color)64);
      chorusp18->maximum(127);
      chorusp18->callback((Fl_Callback*)cb_chorusp18);
      chorusp18->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp18->when(FL_WHEN_RELEASE);
      o->setValueType(VC_PhaseOffset);
      if (isBeatSync()) o->activate(); else o->deactivate();
    } // WidgetPDial* chorusp18
    { WidgetPDial* o = chorusp3 = new WidgetPDial(155, 49, 30, 30, "Rnd");
      chorusp3->tooltip("LFO randomness");
      chorusp3->box(FL_ROUND_UP_BOX);
      chorusp3->color(FL_BACKGROUND_COLOR);
      chorusp3->selection_color(FL_INACTIVE_COLOR);
      chorusp3->labeltype(FL_NORMAL_LABEL);
      chorusp3->labelfont(0);
      chorusp3->labelsize(11);
      chorusp3->labelcolor((Fl_Color)64);
      chorusp3->maximum(127);
      chorusp3->callback((Fl_Callback*)cb_chorusp3);
      chorusp3->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp3->when(FL_WHEN_RELEASE);
      o->setValueType(VC_percent127);
    } // WidgetPDial* chorusp3
    { WidgetPDial* o = chorusp5 = new WidgetPDial(237, 49, 30, 30, "St.df");
      chorusp5->tooltip("L/R phase shift");
      chorusp5->box(FL_ROUND_UP_BOX);
      chorusp5->color(FL_BACKGROUND_COLOR);
      chorusp5->selection_color(FL_INACTIVE_COLOR);
      chorusp5->labeltype(FL_NORMAL_LABEL);
      chorusp5->labelfont(0);
      chorusp5->labelsize(11);
      chorusp5->labelcolor((Fl_Color)64);
      chorusp5->maximum(127);
      chorusp5->callback((Fl_Callback*)cb_chorusp5);
      chorusp5->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp5->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXlfoStereo);
    } // WidgetPDial* chorusp5
    { WidgetPDial* o = chorusp6 = new WidgetPDial(272, 49, 30, 30, "Dpth");
      chorusp6->tooltip("LFO depth");
      chorusp6->box(FL_ROUND_UP_BOX);
      chorusp6->color(FL_BACKGROUND_COLOR);
      chorusp6->selection_color(FL_INACTIVE_COLOR);
      chorusp6->labeltype(FL_NORMAL_LABEL);
      chorusp6->labelfont(0);
      chorusp6->labelsize(11);
      chorusp6->labelcolor((Fl_Color)64);
      chorusp6->maximum(127);
      chorusp6->callback((Fl_Callback*)cb_chorusp6);
      chorusp6->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp6->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXChorusDepth);
    } // WidgetPDial* chorusp6
    { WidgetPDial* o = chorusp7 = new WidgetPDial(307, 49, 30, 30, "Delay");
      chorusp7->box(FL_ROUND_UP_BOX);
      chorusp7->color(FL_BACKGROUND_COLOR);
      chorusp7->selection_color(FL_INACTIVE_COLOR);
      chorusp7->labeltype(FL_NORMAL_LABEL);
      chorusp7->labelfont(0);
      chorusp7->labelsize(11);
      chorusp7->labelcolor((Fl_Color)64);
      chorusp7->maximum(127);
      chorusp7->callback((Fl_Callback*)cb_chorusp7);
      chorusp7->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp7->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXChorusDelay);
    } // WidgetPDial* chorusp7
    { WidgetPDial* o = chorusp8 = new WidgetPDial(342, 49, 30, 30, "Fb");
      chorusp8->tooltip("Feedback");
      chorusp8->box(FL_ROUND_UP_BOX);
      chorusp8->color(FL_BACKGROUND_COLOR);
      chorusp8->selection_color(FL_INACTIVE_COLOR);
      chorusp8->labeltype(FL_NORMAL_LABEL);
      chorusp8->labelfont(0);
      chorusp8->labelsize(11);
      chorusp8->labelcolor((Fl_Color)64);
      chorusp8->maximum(127);
      chorusp8->callback((Fl_Callback*)cb_chorusp8);
      chorusp8->align(Fl_Align(FL_ALIGN_BOTTOM));
      chorusp8->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXdefaultFb);
    } // WidgetPDial* chorusp8
    { WidgetPDial* o = chorusp9 = new WidgetPDial(254, 15, 30, 30, "L/R");
      chorusp9->tooltip("Channel routing");
      chorusp9->box(FL_ROUND_UP_BOX);
      chorusp9->color(FL_BACKGROUND_COLOR);
      chorusp9->selection_color(FL_INACTIVE_COLOR);
      chorusp9->labeltype(FL_NORMAL_LABEL);
      chorusp9->labelfont(0);
      chorusp9->labelsize(11);
      chorusp9->labelcolor((Fl_Color)64);
      chorusp9->maximum(127);
      chorusp9->callback((Fl_Callback*)cb_chorusp9);
      chorusp9->align(Fl_Align(FL_ALIGN_TOP));
      chorusp9->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* chorusp9
    { Fl_Check_Button2* o = chorusflange = new Fl_Check_Button2(120, 10, 55, 20, "Flange");
      chorusflange->box(FL_THIN_UP_BOX);
      chorusflange->down_box(FL_DOWN_BOX);
      chorusflange->color(FL_CYAN);
      chorusflange->selection_color((Fl_Color)64);
      chorusflange->labeltype(FL_NORMAL_LABEL);
      chorusflange->labelfont(1);
      chorusflange->labelsize(10);
      chorusflange->labelcolor((Fl_Color)64);
      chorusflange->callback((Fl_Callback*)cb_chorusflange);
      chorusflange->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
      chorusflange->when(FL_WHEN_RELEASE);
      chorusflange->hide();
      chorusflange->deactivate();
      o->value(effParam(10));
    } // Fl_Check_Button2* chorusflange
    { chorusp11 = new Fl_Check_Button2(300, 19, 70, 16, "Subtract");
      chorusp11->tooltip("Inverts the output");
      chorusp11->box(FL_NO_BOX);
      chorusp11->down_box(FL_DOWN_BOX);
      chorusp11->color(FL_CYAN);
      chorusp11->selection_color((Fl_Color)64);
      chorusp11->labeltype(FL_NORMAL_LABEL);
      chorusp11->labelfont(0);
      chorusp11->labelsize(11);
      chorusp11->labelcolor((Fl_Color)64);
      chorusp11->callback((Fl_Callback*)cb_chorusp11);
      chorusp11->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
      chorusp11->when(FL_WHEN_RELEASE);
    } // Fl_Check_Button2* chorusp11
    { chorusp17 = new Fl_Check_Button(190, 45, 50, 15, "BPM");
      chorusp17->tooltip("Synchronize the frequency to a multiple of the BPM.");
      chorusp17->down_box(FL_DOWN_BOX);
      chorusp17->selection_color((Fl_Color)64);
      chorusp17->labelsize(11);
      chorusp17->labelcolor((Fl_Color)64);
      chorusp17->callback((Fl_Callback*)cb_chorusp17);
    } // Fl_Check_Button* chorusp17
    effchoruswindow->end();
  } // Fl_Group* effchoruswindow
  return effchoruswindow;
}

Fl_Group* EffUI::make_phaser_window() {
  { effphaserwindow = new Fl_Group(0, 0, 380, 95);
    effphaserwindow->box(FL_PLASTIC_UP_BOX);
    effphaserwindow->color(FL_CYAN);
    effphaserwindow->selection_color(FL_BACKGROUND_COLOR);
    effphaserwindow->labeltype(FL_NO_LABEL);
    effphaserwindow->labelfont(0);
    effphaserwindow->labelsize(11);
    effphaserwindow->labelcolor(FL_FOREGROUND_COLOR);
    effphaserwindow->user_data((void*)(this));
    effphaserwindow->align(Fl_Align(FL_ALIGN_TOP));
    effphaserwindow->when(FL_WHEN_RELEASE);
    { phasername = new Fl_Text_Display(10, 10, 0, 20, "Phaser");
      phasername->box(FL_NO_BOX);
      phasername->labelfont(1);
      phasername->labelsize(12);
      phasername->labelcolor((Fl_Color)64);
      phasername->textcolor((Fl_Color)64);
      phasername->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* phasername
    { Fl_Choice* o = phaserp = new Fl_Choice(65, 21, 82, 15, "Preset");
      phaserp->down_box(FL_BORDER_BOX);
      phaserp->selection_color(FL_BACKGROUND_COLOR);
      phaserp->labelsize(11);
      phaserp->labelcolor((Fl_Color)64);
      phaserp->textfont(1);
      phaserp->textsize(10);
      phaserp->textcolor((Fl_Color)188);
      phaserp->callback((Fl_Callback*)cb_phaserp);
      phaserp->align(Fl_Align(FL_ALIGN_TOP));
      o->add("Phaser 1");o->add("Phaser 2");o->add("Phaser 3");o->add("Phaser 4");o->add("Phaser 5");o->add("Phaser 6");o->add("APhaser 1");o->add("APhaser 2");o->add("APhaser 3");o->add("APhaser 4");o->add("APhaser 5");o->add("APhaser 6");
    } // Fl_Choice* phaserp
    { Fl_Choice* o = phaserp4 = new Fl_Choice(199, 65, 43, 15, "LFO Type");
      phaserp4->tooltip("LFO function");
      phaserp4->down_box(FL_BORDER_BOX);
      phaserp4->selection_color(FL_BACKGROUND_COLOR);
      phaserp4->labelsize(10);
      phaserp4->labelcolor((Fl_Color)64);
      phaserp4->textfont(1);
      phaserp4->textsize(9);
      phaserp4->textcolor((Fl_Color)188);
      phaserp4->callback((Fl_Callback*)cb_phaserp4);
      phaserp4->align(Fl_Align(FL_ALIGN_BOTTOM));
      o->add("Sine");o->add("Tri");
    } // Fl_Choice* phaserp4
    { WidgetPDial* o = phaserp0 = new WidgetPDial(8, 50, 30, 30, "Vol");
      phaserp0->tooltip("Effect volume");
      phaserp0->box(FL_ROUND_UP_BOX);
      phaserp0->color(FL_BACKGROUND_COLOR);
      phaserp0->selection_color(FL_INACTIVE_COLOR);
      phaserp0->labeltype(FL_NORMAL_LABEL);
      phaserp0->labelfont(0);
      phaserp0->labelsize(11);
      phaserp0->labelcolor((Fl_Color)64);
      phaserp0->maximum(127);
      phaserp0->step(1);
      phaserp0->callback((Fl_Callback*)cb_phaserp0);
      phaserp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp0->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXdefaultVol);
    } // WidgetPDial* phaserp0
    { WidgetPDial* o = phaserp1 = new WidgetPDial(46, 50, 30, 30, "Pan");
      phaserp1->box(FL_ROUND_UP_BOX);
      phaserp1->color(FL_BACKGROUND_COLOR);
      phaserp1->selection_color(FL_INACTIVE_COLOR);
      phaserp1->labeltype(FL_NORMAL_LABEL);
      phaserp1->labelfont(0);
      phaserp1->labelsize(11);
      phaserp1->labelcolor((Fl_Color)64);
      phaserp1->maximum(127);
      phaserp1->step(1);
      phaserp1->callback((Fl_Callback*)cb_phaserp1);
      phaserp1->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp1->when(FL_WHEN_CHANGED);
      o->setValueType(VC_PanningStd);
    } // WidgetPDial* phaserp1
    { WidgetPDial* o = phaserp2 = new WidgetPDial(84, 50, 30, 30, "Freq");
      phaserp2->tooltip("LFO frequency");
      phaserp2->box(FL_ROUND_UP_BOX);
      phaserp2->color(FL_BACKGROUND_COLOR);
      phaserp2->selection_color(FL_INACTIVE_COLOR);
      phaserp2->labeltype(FL_NORMAL_LABEL);
      phaserp2->labelfont(0);
      phaserp2->labelsize(11);
      phaserp2->labelcolor((Fl_Color)64);
      phaserp2->maximum(127);
      phaserp2->step(1);
      phaserp2->callback((Fl_Callback*)cb_phaserp2);
      phaserp2->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp2->when(FL_WHEN_CHANGED);
      o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);
    } // WidgetPDial* phaserp2
    { WidgetPDial* o = phaserp18 = new WidgetPDial(125, 50, 30, 30, "Start");
      phaserp18->tooltip("Start of LFO phase relative to start of beat. This has no effect unless you a"
"re syncing to a song position, using MIDI or a plugin host.");
      phaserp18->box(FL_ROUND_UP_BOX);
      phaserp18->color(FL_BACKGROUND_COLOR);
      phaserp18->selection_color(FL_INACTIVE_COLOR);
      phaserp18->labeltype(FL_NORMAL_LABEL);
      phaserp18->labelfont(0);
      phaserp18->labelsize(11);
      phaserp18->labelcolor((Fl_Color)64);
      phaserp18->maximum(127);
      phaserp18->step(1);
      phaserp18->callback((Fl_Callback*)cb_phaserp18);
      phaserp18->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp18->when(FL_WHEN_RELEASE);
      o->setValueType(VC_PhaseOffset);
      if (isBeatSync()) o->activate(); else o->deactivate();
    } // WidgetPDial* phaserp18
    { WidgetPDial* o = phaserp3 = new WidgetPDial(165, 50, 30, 30, "Rnd");
      phaserp3->tooltip("LFO randomness");
      phaserp3->box(FL_ROUND_UP_BOX);
      phaserp3->color(FL_BACKGROUND_COLOR);
      phaserp3->selection_color(FL_INACTIVE_COLOR);
      phaserp3->labeltype(FL_NORMAL_LABEL);
      phaserp3->labelfont(0);
      phaserp3->labelsize(11);
      phaserp3->labelcolor((Fl_Color)64);
      phaserp3->maximum(127);
      phaserp3->step(1);
      phaserp3->callback((Fl_Callback*)cb_phaserp3);
      phaserp3->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp3->when(FL_WHEN_RELEASE);
      o->setValueType(VC_percent127);
    } // WidgetPDial* phaserp3
    { Fl_Check_Button2* o = phaserp17 = new Fl_Check_Button2(200, 47, 17, 15, "BPM");
      phaserp17->tooltip("Synchronize the frequency to a multiple of the BPM.");
      phaserp17->box(FL_NO_BOX);
      phaserp17->down_box(FL_DOWN_BOX);
      phaserp17->color(FL_BACKGROUND_COLOR);
      phaserp17->selection_color((Fl_Color)64);
      phaserp17->labeltype(FL_NORMAL_LABEL);
      phaserp17->labelfont(0);
      phaserp17->labelsize(11);
      phaserp17->labelcolor((Fl_Color)64);
      phaserp17->callback((Fl_Callback*)cb_phaserp17);
      phaserp17->align(Fl_Align(FL_ALIGN_RIGHT));
      phaserp17->when(FL_WHEN_RELEASE);
      o->value(isBeatSync());
    } // Fl_Check_Button2* phaserp17
    { WidgetPDial* o = phaserp5 = new WidgetPDial(248, 50, 30, 30, "St.df");
      phaserp5->tooltip("Left/Right channel phase shift");
      phaserp5->box(FL_ROUND_UP_BOX);
      phaserp5->color(FL_BACKGROUND_COLOR);
      phaserp5->selection_color(FL_INACTIVE_COLOR);
      phaserp5->labeltype(FL_NORMAL_LABEL);
      phaserp5->labelfont(0);
      phaserp5->labelsize(11);
      phaserp5->labelcolor((Fl_Color)64);
      phaserp5->maximum(127);
      phaserp5->step(1);
      phaserp5->callback((Fl_Callback*)cb_phaserp5);
      phaserp5->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp5->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXlfoStereo);
    } // WidgetPDial* phaserp5
    { WidgetPDial* o = phaserp6 = new WidgetPDial(191, 15, 30, 30, "Depth");
      phaserp6->tooltip("LFO depth");
      phaserp6->box(FL_ROUND_UP_BOX);
      phaserp6->color(FL_BACKGROUND_COLOR);
      phaserp6->selection_color(FL_INACTIVE_COLOR);
      phaserp6->labeltype(FL_NORMAL_LABEL);
      phaserp6->labelfont(0);
      phaserp6->labelsize(11);
      phaserp6->labelcolor((Fl_Color)64);
      phaserp6->maximum(127);
      phaserp6->step(1);
      phaserp6->callback((Fl_Callback*)cb_phaserp6);
      phaserp6->align(Fl_Align(FL_ALIGN_TOP));
      phaserp6->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* phaserp6
    { WidgetPDial* o = phaserp7 = new WidgetPDial(286, 50, 30, 30, "Fb");
      phaserp7->tooltip("Feedback");
      phaserp7->box(FL_ROUND_UP_BOX);
      phaserp7->color(FL_BACKGROUND_COLOR);
      phaserp7->selection_color(FL_INACTIVE_COLOR);
      phaserp7->labeltype(FL_NORMAL_LABEL);
      phaserp7->labelfont(0);
      phaserp7->labelsize(11);
      phaserp7->labelcolor((Fl_Color)64);
      phaserp7->maximum(127);
      phaserp7->step(1);
      phaserp7->callback((Fl_Callback*)cb_phaserp7);
      phaserp7->align(Fl_Align(FL_ALIGN_BOTTOM));
      phaserp7->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXdefaultFb);
    } // WidgetPDial* phaserp7
    { phaserp8 = new Fl_Counter(326, 63, 45, 15, "Stages");
      phaserp8->type(1);
      phaserp8->labelsize(11);
      phaserp8->labelcolor((Fl_Color)64);
      phaserp8->minimum(1);
      phaserp8->maximum(12);
      phaserp8->step(1);
      phaserp8->textfont(1);
      phaserp8->textsize(11);
      phaserp8->textcolor((Fl_Color)64);
      phaserp8->callback((Fl_Callback*)cb_phaserp8);
    } // Fl_Counter* phaserp8
    { WidgetPDial* o = phaserp9 = new WidgetPDial(229, 15, 30, 30, "L/R");
      phaserp9->tooltip("Channel routing");
      phaserp9->box(FL_ROUND_UP_BOX);
      phaserp9->color(FL_BACKGROUND_COLOR);
      phaserp9->selection_color(FL_INACTIVE_COLOR);
      phaserp9->labeltype(FL_NORMAL_LABEL);
      phaserp9->labelfont(0);
      phaserp9->labelsize(11);
      phaserp9->labelcolor((Fl_Color)64);
      phaserp9->maximum(127);
      phaserp9->step(1);
      phaserp9->callback((Fl_Callback*)cb_phaserp9);
      phaserp9->align(Fl_Align(FL_ALIGN_TOP));
      phaserp9->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* phaserp9
    { phaserp10 = new Fl_Check_Button2(356, 42, 17, 16, "Sub.");
      phaserp10->tooltip("Inverts the output");
      phaserp10->box(FL_NO_BOX);
      phaserp10->down_box(FL_DOWN_BOX);
      phaserp10->color(FL_CYAN);
      phaserp10->selection_color((Fl_Color)64);
      phaserp10->labeltype(FL_NORMAL_LABEL);
      phaserp10->labelfont(0);
      phaserp10->labelsize(11);
      phaserp10->labelcolor((Fl_Color)64);
      phaserp10->callback((Fl_Callback*)cb_phaserp10);
      phaserp10->align(Fl_Align(FL_ALIGN_LEFT));
      phaserp10->when(FL_WHEN_RELEASE);
    } // Fl_Check_Button2* phaserp10
    { WidgetPDial* o = phaserp11 = new WidgetPDial(150, 15, 30, 30, "Phase");
      phaserp11->box(FL_ROUND_UP_BOX);
      phaserp11->color(FL_BACKGROUND_COLOR);
      phaserp11->selection_color(FL_INACTIVE_COLOR);
      phaserp11->labeltype(FL_NORMAL_LABEL);
      phaserp11->labelfont(0);
      phaserp11->labelsize(11);
      phaserp11->labelcolor((Fl_Color)64);
      phaserp11->maximum(127);
      phaserp11->step(1);
      phaserp11->callback((Fl_Callback*)cb_phaserp11);
      phaserp11->align(Fl_Align(FL_ALIGN_TOP));
      phaserp11->when(FL_WHEN_CHANGED);
      o->setValueType(VC_percent127);
    } // WidgetPDial* phaserp11
    { phaserp12 = new Fl_Check_Button2(356, 26, 17, 15, "Hyper");
      phaserp12->tooltip("Hyper-sine");
      phaserp12->box(FL_NO_BOX);
      phaserp12->down_box(FL_DOWN_BOX);
      phaserp12->color(FL_BACKGROUND_COLOR);
      phaserp12->selection_color((Fl_Color)64);
      phaserp12->labeltype(FL_NORMAL_LABEL);
      phaserp12->labelfont(0);
      phaserp12->labelsize(11);
      phaserp12->labelcolor((Fl_Color)64);
      phaserp12->callback((Fl_Callback*)cb_phaserp12);
      phaserp12->align(Fl_Align(FL_ALIGN_LEFT));
      phaserp12->when(FL_WHEN_RELEASE);
      phaserp12->deactivate();
    } // Fl_Check_Button2* phaserp12
    { WidgetPDial* o = phaserp13 = new WidgetPDial(267, 15, 30, 30, "Dist");
      phaserp13->tooltip("Distortion");
      phaserp13->box(FL_ROUND_UP_BOX);
      phaserp13->color(FL_BACKGROUND_COLOR);
      phaserp13->selection_color(FL_INACTIVE_COLOR);
      phaserp13->labeltype(FL_NORMAL_LABEL);
      phaserp13->labelfont(0);
      phaserp13->labelsize(11);
      phaserp13->labelcolor((Fl_Color)64);
      phaserp13->maximum(127);
      phaserp13->step(1);
      phaserp13->callback((Fl_Callback*)cb_phaserp13);
      phaserp13->align(Fl_Align(FL_ALIGN_TOP));
      phaserp13->when(FL_WHEN_CHANGED);
      phaserp13->deactivate();
      o->setValueType(VC_percent127);
    } // WidgetPDial* phaserp13
    { phaserp14 = new Fl_Check_Button2(356, 10, 17, 15, "Analog");
      phaserp14->tooltip("Emulates FET");
      phaserp14->box(FL_NO_BOX);
      phaserp14->down_box(FL_DOWN_BOX);
      phaserp14->color(FL_BACKGROUND_COLOR);
      phaserp14->selection_color((Fl_Color)64);
      phaserp14->labeltype(FL_NORMAL_LABEL);
      phaserp14->labelfont(0);
      phaserp14->labelsize(11);
      phaserp14->labelcolor((Fl_Color)64);
      phaserp14->callback((Fl_Callback*)cb_phaserp14);
      phaserp14->align(Fl_Align(FL_ALIGN_LEFT));
      phaserp14->when(FL_WHEN_RELEASE);
    } // Fl_Check_Button2* phaserp14
    effphaserwindow->end();
  } // Fl_Group* effphaserwindow
  return effphaserwindow;
}

Fl_Group* EffUI::make_alienwah_window() {
  { effalienwahwindow = new Fl_Group(0, 0, 380, 95);
    effalienwahwindow->box(FL_PLASTIC_UP_BOX);
    effalienwahwindow->color(FL_CYAN);
    effalienwahwindow->selection_color(FL_BACKGROUND_COLOR);
    effalienwahwindow->labeltype(FL_NO_LABEL);
    effalienwahwindow->labelfont(1);
    effalienwahwindow->labelsize(14);
    effalienwahwindow->labelcolor(FL_FOREGROUND_COLOR);
    effalienwahwindow->user_data((void*)(this));
    effalienwahwindow->align(Fl_Align(FL_ALIGN_TOP));
    effalienwahwindow->when(FL_WHEN_RELEASE);
    { alienname = new Fl_Text_Display(10, 10, 0, 20, "AlienWah");
      alienname->box(FL_NO_BOX);
      alienname->labelfont(1);
      alienname->labelsize(12);
      alienname->labelcolor((Fl_Color)64);
      alienname->textcolor((Fl_Color)64);
      alienname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* alienname
    { Fl_Choice* o = awp = new Fl_Choice(135, 13, 96, 15, "Preset");
      awp->down_box(FL_BORDER_BOX);
      awp->selection_color(FL_BACKGROUND_COLOR);
      awp->labelsize(11);
      awp->labelcolor((Fl_Color)64);
      awp->textfont(1);
      awp->textsize(10);
      awp->textcolor((Fl_Color)188);
      awp->callback((Fl_Callback*)cb_awp);
      o->add("Alienwah 1");o->add("Alienwah 2");o->add("Alienwah 3");o->add("Alienwah 4");
    } // Fl_Choice* awp
    { Fl_Choice* o = awp4 = new Fl_Choice(185, 65, 43, 15, "LFO type");
      awp4->tooltip("LFO function");
      awp4->down_box(FL_BORDER_BOX);
      awp4->selection_color(FL_BACKGROUND_COLOR);
      awp4->labelsize(10);
      awp4->labelcolor((Fl_Color)64);
      awp4->textfont(1);
      awp4->textsize(9);
      awp4->textcolor((Fl_Color)188);
      awp4->callback((Fl_Callback*)cb_awp4);
      awp4->align(Fl_Align(FL_ALIGN_BOTTOM));
      o->add("Sine");o->add("Tri");
    } // Fl_Choice* awp4
    { awp0 = new WidgetPDial(5, 49, 30, 30, "Vol");
      awp0->tooltip("Effect volume");
      awp0->box(FL_ROUND_UP_BOX);
      awp0->color(FL_BACKGROUND_COLOR);
      awp0->selection_color(FL_INACTIVE_COLOR);
      awp0->labeltype(FL_NORMAL_LABEL);
      awp0->labelfont(0);
      awp0->labelsize(11);
      awp0->labelcolor((Fl_Color)64);
      awp0->maximum(127);
      awp0->step(1);
      awp0->callback((Fl_Callback*)cb_awp0);
      awp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp0->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp0
    { awp1 = new WidgetPDial(40, 49, 30, 30, "Pan");
      awp1->box(FL_ROUND_UP_BOX);
      awp1->color(FL_BACKGROUND_COLOR);
      awp1->selection_color(FL_INACTIVE_COLOR);
      awp1->labeltype(FL_NORMAL_LABEL);
      awp1->labelfont(0);
      awp1->labelsize(11);
      awp1->labelcolor((Fl_Color)64);
      awp1->maximum(127);
      awp1->step(1);
      awp1->callback((Fl_Callback*)cb_awp1);
      awp1->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp1->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp1
    { WidgetPDial* o = awp2 = new WidgetPDial(80, 49, 30, 30, "Freq");
      awp2->tooltip("LFO frequency");
      awp2->box(FL_ROUND_UP_BOX);
      awp2->color(FL_BACKGROUND_COLOR);
      awp2->selection_color(FL_INACTIVE_COLOR);
      awp2->labeltype(FL_NORMAL_LABEL);
      awp2->labelfont(0);
      awp2->labelsize(11);
      awp2->labelcolor((Fl_Color)64);
      awp2->maximum(127);
      awp2->step(1);
      awp2->callback((Fl_Callback*)cb_awp2);
      awp2->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp2->when(FL_WHEN_CHANGED);
      o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);
    } // WidgetPDial* awp2
    { WidgetPDial* o = awp3 = new WidgetPDial(150, 50, 30, 30, "Rnd");
      awp3->tooltip("LFO randomness");
      awp3->box(FL_ROUND_UP_BOX);
      awp3->color(FL_BACKGROUND_COLOR);
      awp3->selection_color(FL_INACTIVE_COLOR);
      awp3->labeltype(FL_NORMAL_LABEL);
      awp3->labelfont(0);
      awp3->labelsize(11);
      awp3->labelcolor((Fl_Color)64);
      awp3->maximum(127);
      awp3->step(1);
      awp3->callback((Fl_Callback*)cb_awp3);
      awp3->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp3->when(FL_WHEN_RELEASE);
      o->setValueType(VC_percent127);
    } // WidgetPDial* awp3
    { WidgetPDial* o = awp18 = new WidgetPDial(115, 50, 30, 30, "Start");
      awp18->tooltip("Start of LFO phase relative to start of beat. This has no effect unless you a"
"re syncing to a song position, using MIDI or a plugin host.");
      awp18->box(FL_ROUND_UP_BOX);
      awp18->color(FL_BACKGROUND_COLOR);
      awp18->selection_color(FL_INACTIVE_COLOR);
      awp18->labeltype(FL_NORMAL_LABEL);
      awp18->labelfont(0);
      awp18->labelsize(11);
      awp18->labelcolor((Fl_Color)64);
      awp18->maximum(127);
      awp18->step(1);
      awp18->callback((Fl_Callback*)cb_awp18);
      awp18->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp18->when(FL_WHEN_RELEASE);
      o->setValueType(VC_PhaseOffset);
      if (isBeatSync()) o->activate(); else o->deactivate();
    } // WidgetPDial* awp18
    { awp5 = new WidgetPDial(231, 49, 30, 30, "St.df");
      awp5->tooltip("Left/Right channel phase shift");
      awp5->box(FL_ROUND_UP_BOX);
      awp5->color(FL_BACKGROUND_COLOR);
      awp5->selection_color(FL_INACTIVE_COLOR);
      awp5->labeltype(FL_NORMAL_LABEL);
      awp5->labelfont(0);
      awp5->labelsize(11);
      awp5->labelcolor((Fl_Color)64);
      awp5->maximum(127);
      awp5->step(1);
      awp5->callback((Fl_Callback*)cb_awp5);
      awp5->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp5->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp5
    { awp6 = new WidgetPDial(266, 49, 30, 30, "Dpth");
      awp6->tooltip("Depth");
      awp6->box(FL_ROUND_UP_BOX);
      awp6->color(FL_BACKGROUND_COLOR);
      awp6->selection_color(FL_INACTIVE_COLOR);
      awp6->labeltype(FL_NORMAL_LABEL);
      awp6->labelfont(0);
      awp6->labelsize(11);
      awp6->labelcolor((Fl_Color)64);
      awp6->maximum(127);
      awp6->step(1);
      awp6->callback((Fl_Callback*)cb_awp6);
      awp6->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp6->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp6
    { awp7 = new WidgetPDial(301, 49, 30, 30, "Fb");
      awp7->tooltip("Feedback");
      awp7->box(FL_ROUND_UP_BOX);
      awp7->color(FL_BACKGROUND_COLOR);
      awp7->selection_color(FL_INACTIVE_COLOR);
      awp7->labeltype(FL_NORMAL_LABEL);
      awp7->labelfont(0);
      awp7->labelsize(11);
      awp7->labelcolor((Fl_Color)64);
      awp7->maximum(127);
      awp7->step(1);
      awp7->callback((Fl_Callback*)cb_awp7);
      awp7->align(Fl_Align(FL_ALIGN_BOTTOM));
      awp7->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp7
    { awp9 = new WidgetPDial(285, 15, 30, 30, "L/R");
      awp9->box(FL_ROUND_UP_BOX);
      awp9->color(FL_BACKGROUND_COLOR);
      awp9->selection_color(FL_INACTIVE_COLOR);
      awp9->labeltype(FL_NORMAL_LABEL);
      awp9->labelfont(0);
      awp9->labelsize(11);
      awp9->labelcolor((Fl_Color)64);
      awp9->maximum(127);
      awp9->step(1);
      awp9->callback((Fl_Callback*)cb_awp9);
      awp9->align(Fl_Align(FL_ALIGN_TOP));
      awp9->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp9
    { awp10 = new WidgetPDial(245, 15, 30, 30, "Phase");
      awp10->box(FL_ROUND_UP_BOX);
      awp10->color(FL_BACKGROUND_COLOR);
      awp10->selection_color(FL_INACTIVE_COLOR);
      awp10->labeltype(FL_NORMAL_LABEL);
      awp10->labelfont(0);
      awp10->labelsize(11);
      awp10->labelcolor((Fl_Color)64);
      awp10->maximum(127);
      awp10->step(1);
      awp10->callback((Fl_Callback*)cb_awp10);
      awp10->align(Fl_Align(FL_ALIGN_TOP));
      awp10->when(FL_WHEN_CHANGED);
    } // WidgetPDial* awp10
    { awp8 = new Fl_Counter(338, 64, 35, 15, "Delay");
      awp8->type(1);
      awp8->labelsize(11);
      awp8->labelcolor((Fl_Color)64);
      awp8->minimum(0);
      awp8->maximum(100);
      awp8->step(1);
      awp8->textsize(11);
      awp8->textcolor((Fl_Color)64);
      awp8->callback((Fl_Callback*)cb_awp8);
    } // Fl_Counter* awp8
    { Fl_Check_Button* o = awp17 = new Fl_Check_Button(185, 45, 45, 15, "BPM");
      awp17->tooltip("Synchronize the frequency to a multiple of the BPM.");
      awp17->down_box(FL_DOWN_BOX);
      awp17->selection_color((Fl_Color)64);
      awp17->labelsize(11);
      awp17->labelcolor((Fl_Color)64);
      awp17->callback((Fl_Callback*)cb_awp17);
      o->value(isBeatSync());
    } // Fl_Check_Button* awp17
    effalienwahwindow->end();
  } // Fl_Group* effalienwahwindow
  return effalienwahwindow;
}

Fl_Group* EffUI::make_distortion_window() {
  { effdistortionwindow = new Fl_Group(0, 0, 380, 95);
    effdistortionwindow->box(FL_PLASTIC_UP_BOX);
    effdistortionwindow->color(FL_CYAN);
    effdistortionwindow->selection_color(FL_BACKGROUND_COLOR);
    effdistortionwindow->labeltype(FL_NO_LABEL);
    effdistortionwindow->labelfont(1);
    effdistortionwindow->labelsize(14);
    effdistortionwindow->labelcolor(FL_FOREGROUND_COLOR);
    effdistortionwindow->user_data((void*)(this));
    effdistortionwindow->align(Fl_Align(FL_ALIGN_TOP));
    effdistortionwindow->when(FL_WHEN_RELEASE);
    { distname = new Fl_Text_Display(10, 10, 0, 20, "Distortion");
      distname->box(FL_NO_BOX);
      distname->labelfont(1);
      distname->labelsize(12);
      distname->labelcolor((Fl_Color)64);
      distname->textcolor((Fl_Color)64);
      distname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* distname
    { Fl_Choice* o = distp = new Fl_Choice(139, 13, 96, 16, "Preset");
      distp->down_box(FL_BORDER_BOX);
      distp->selection_color(FL_BACKGROUND_COLOR);
      distp->labelsize(11);
      distp->labelcolor((Fl_Color)64);
      distp->textfont(1);
      distp->textsize(10);
      distp->textcolor((Fl_Color)188);
      distp->callback((Fl_Callback*)cb_distp);
      o->add("Overdrive 1");o->add("Overdrive 2");o->add("Exciter 1");o->add("Exciter 2");o->add("Guitar Amp");o->add("Quantize");
    } // Fl_Choice* distp
    { Fl_Choice* o = distp5 = new Fl_Choice(192, 56, 60, 15, "Type");
      distp5->down_box(FL_BORDER_BOX);
      distp5->selection_color(FL_BACKGROUND_COLOR);
      distp5->labelsize(10);
      distp5->labelcolor((Fl_Color)64);
      distp5->textfont(1);
      distp5->textsize(9);
      distp5->textcolor((Fl_Color)188);
      distp5->callback((Fl_Callback*)cb_distp5);
      distp5->align(Fl_Align(FL_ALIGN_BOTTOM));
      o->add("Atan");o->add("Asym 1");o->add("Power1");o->add("Sine");o->add("Quants");o->add("Zigzag");o->add("Limit");o->add("LimtiU");o->add("LimitL");o->add("ILimit");o->add("Clip");o->add("Asym 2");o->add("Power2");o->add("Sigm");
    } // Fl_Choice* distp5
    { WidgetPDial* o = distp0 = new WidgetPDial(10, 40, 30, 30, "Vol");
      distp0->tooltip("Effect volume");
      distp0->box(FL_ROUND_UP_BOX);
      distp0->color(FL_BACKGROUND_COLOR);
      distp0->selection_color(FL_INACTIVE_COLOR);
      distp0->labeltype(FL_NORMAL_LABEL);
      distp0->labelfont(0);
      distp0->labelsize(11);
      distp0->labelcolor((Fl_Color)64);
      distp0->maximum(127);
      distp0->step(1);
      distp0->callback((Fl_Callback*)cb_distp0);
      distp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp0->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXDistVol);
    } // WidgetPDial* distp0
    { WidgetPDial* o = distp1 = new WidgetPDial(45, 40, 30, 30, "Pan");
      distp1->box(FL_ROUND_UP_BOX);
      distp1->color(FL_BACKGROUND_COLOR);
      distp1->selection_color(FL_INACTIVE_COLOR);
      distp1->labeltype(FL_NORMAL_LABEL);
      distp1->labelfont(0);
      distp1->labelsize(11);
      distp1->labelcolor((Fl_Color)64);
      distp1->maximum(127);
      distp1->step(1);
      distp1->callback((Fl_Callback*)cb_distp1);
      distp1->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp1->when(FL_WHEN_CHANGED);
      o->setValueType(VC_PanningStd);
    } // WidgetPDial* distp1
    { WidgetPDial* o = distp2 = new WidgetPDial(80, 40, 30, 30, "LRc.");
      distp2->tooltip("L/R mix");
      distp2->box(FL_ROUND_UP_BOX);
      distp2->color(FL_BACKGROUND_COLOR);
      distp2->selection_color(FL_INACTIVE_COLOR);
      distp2->labeltype(FL_NORMAL_LABEL);
      distp2->labelfont(0);
      distp2->labelsize(11);
      distp2->labelcolor((Fl_Color)64);
      distp2->maximum(127);
      distp2->step(1);
      distp2->callback((Fl_Callback*)cb_distp2);
      distp2->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp2->when(FL_WHEN_RELEASE);
      o->setValueType(VC_percent127);
    } // WidgetPDial* distp2
    { WidgetPDial* o = distp3 = new WidgetPDial(120, 40, 30, 30, "Drive");
      distp3->tooltip("Input amplification");
      distp3->box(FL_ROUND_UP_BOX);
      distp3->color(FL_BACKGROUND_COLOR);
      distp3->selection_color(FL_INACTIVE_COLOR);
      distp3->labeltype(FL_NORMAL_LABEL);
      distp3->labelfont(0);
      distp3->labelsize(11);
      distp3->labelcolor((Fl_Color)64);
      distp3->maximum(127);
      distp3->step(1);
      distp3->callback((Fl_Callback*)cb_distp3);
      distp3->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp3->when(FL_WHEN_RELEASE);
      o->setValueType(VC_percent127);
    } // WidgetPDial* distp3
    { WidgetPDial* o = distp4 = new WidgetPDial(155, 40, 30, 30, "Level");
      distp4->tooltip("Output amplification");
      distp4->box(FL_ROUND_UP_BOX);
      distp4->color(FL_BACKGROUND_COLOR);
      distp4->selection_color(FL_INACTIVE_COLOR);
      distp4->labeltype(FL_NORMAL_LABEL);
      distp4->labelfont(0);
      distp4->labelsize(11);
      distp4->labelcolor((Fl_Color)64);
      distp4->maximum(127);
      distp4->step(1);
      distp4->callback((Fl_Callback*)cb_distp4);
      distp4->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp4->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXDistLevel);
    } // WidgetPDial* distp4
    { WidgetPDial* o = distp7 = new WidgetPDial(285, 40, 30, 30, "LPF");
      distp7->tooltip("Low pass filter");
      distp7->box(FL_ROUND_UP_BOX);
      distp7->color(FL_BACKGROUND_COLOR);
      distp7->selection_color(FL_INACTIVE_COLOR);
      distp7->labeltype(FL_NORMAL_LABEL);
      distp7->labelfont(0);
      distp7->labelsize(11);
      distp7->labelcolor((Fl_Color)64);
      distp7->maximum(127);
      distp7->step(1);
      distp7->callback((Fl_Callback*)cb_distp7);
      distp7->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp7->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXDistLowPass);
    } // WidgetPDial* distp7
    { WidgetPDial* o = distp8 = new WidgetPDial(320, 40, 30, 30, "HPF");
      distp8->tooltip("High pass filter");
      distp8->box(FL_ROUND_UP_BOX);
      distp8->color(FL_BACKGROUND_COLOR);
      distp8->selection_color(FL_INACTIVE_COLOR);
      distp8->labeltype(FL_NORMAL_LABEL);
      distp8->labelfont(0);
      distp8->labelsize(11);
      distp8->labelcolor((Fl_Color)64);
      distp8->maximum(127);
      distp8->step(1);
      distp8->callback((Fl_Callback*)cb_distp8);
      distp8->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp8->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXDistHighPass);
    } // WidgetPDial* distp8
    { distp6 = new Fl_Check_Button2(260, 55, 15, 15, "Neg.");
      distp6->box(FL_NO_BOX);
      distp6->down_box(FL_DOWN_BOX);
      distp6->color(FL_BACKGROUND_COLOR);
      distp6->selection_color((Fl_Color)64);
      distp6->labeltype(FL_NORMAL_LABEL);
      distp6->labelfont(0);
      distp6->labelsize(11);
      distp6->labelcolor((Fl_Color)64);
      distp6->callback((Fl_Callback*)cb_distp6);
      distp6->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp6->when(FL_WHEN_RELEASE);
    } // Fl_Check_Button2* distp6
    { distp9 = new Fl_Check_Button2(357, 55, 15, 15, "St.");
      distp9->tooltip("Stereo");
      distp9->box(FL_NO_BOX);
      distp9->down_box(FL_DOWN_BOX);
      distp9->color(FL_BACKGROUND_COLOR);
      distp9->selection_color((Fl_Color)64);
      distp9->labeltype(FL_NORMAL_LABEL);
      distp9->labelfont(0);
      distp9->labelsize(11);
      distp9->labelcolor((Fl_Color)64);
      distp9->callback((Fl_Callback*)cb_distp9);
      distp9->align(Fl_Align(FL_ALIGN_BOTTOM));
      distp9->when(FL_WHEN_RELEASE);
    } // Fl_Check_Button2* distp9
    { distp10 = new Fl_Check_Button2(357, 38, 15, 15, "PF");
      distp10->tooltip("Applies the filters(before or after) the distortion");
      distp10->box(FL_NO_BOX);
      distp10->down_box(FL_DOWN_BOX);
      distp10->color(FL_BACKGROUND_COLOR);
      distp10->selection_color((Fl_Color)64);
      distp10->labeltype(FL_NORMAL_LABEL);
      distp10->labelfont(0);
      distp10->labelsize(11);
      distp10->labelcolor((Fl_Color)64);
      distp10->callback((Fl_Callback*)cb_distp10);
      distp10->align(Fl_Align(FL_ALIGN_TOP));
      distp10->when(FL_WHEN_RELEASE);
    } // Fl_Check_Button2* distp10
    effdistortionwindow->end();
  } // Fl_Group* effdistortionwindow
  return effdistortionwindow;
}

Fl_Group* EffUI::make_eq_window() {
  { effeqwindow = new Fl_Group(0, 0, 380, 95);
    effeqwindow->box(FL_PLASTIC_UP_BOX);
    effeqwindow->color(FL_CYAN);
    effeqwindow->selection_color(FL_BACKGROUND_COLOR);
    effeqwindow->labeltype(FL_NO_LABEL);
    effeqwindow->labelfont(1);
    effeqwindow->labelsize(14);
    effeqwindow->labelcolor(FL_FOREGROUND_COLOR);
    effeqwindow->user_data((void*)(this));
    effeqwindow->align(Fl_Align(FL_ALIGN_TOP));
    effeqwindow->when(FL_WHEN_RELEASE);
    { eqname = new Fl_Text_Display(10, 10, 0, 20, "EQ");
      eqname->box(FL_NO_BOX);
      eqname->labelfont(1);
      eqname->labelsize(12);
      eqname->labelcolor((Fl_Color)64);
      eqname->textcolor((Fl_Color)64);
      eqname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* eqname
    { WidgetPDial* o = eqp0 = new WidgetPDial(10, 41, 30, 30, "Gain");
      eqp0->box(FL_ROUND_UP_BOX);
      eqp0->color(FL_BACKGROUND_COLOR);
      eqp0->selection_color(FL_INACTIVE_COLOR);
      eqp0->labeltype(FL_NORMAL_LABEL);
      eqp0->labelfont(0);
      eqp0->labelsize(11);
      eqp0->labelcolor((Fl_Color)64);
      eqp0->maximum(127);
      eqp0->callback((Fl_Callback*)cb_eqp0);
      eqp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      eqp0->when(FL_WHEN_CHANGED);
      o->setValueType(VC_FXEQgain);
    } // WidgetPDial* eqp0
    { Fl_Counter* o = bandcounter = new Fl_Counter(263, 20, 45, 15, "Band");
      bandcounter->tooltip("Band no.");
      bandcounter->type(1);
      bandcounter->labelsize(11);
      bandcounter->labelcolor((Fl_Color)64);
      bandcounter->minimum(0);
      bandcounter->maximum(1);
      bandcounter->step(1);
      bandcounter->value(1);
      bandcounter->textsize(11);
      bandcounter->textcolor((Fl_Color)64);
      bandcounter->callback((Fl_Callback*)cb_bandcounter);
      bandcounter->align(Fl_Align(FL_ALIGN_TOP));
      o->bounds(1,MAX_EQ_BANDS);
    } // Fl_Counter* bandcounter
    { Fl_Choice* o = typechoice = new Fl_Choice(323, 20, 40, 15, "Type");
      typechoice->tooltip("Type");
      typechoice->down_box(FL_BORDER_BOX);
      typechoice->selection_color(FL_BACKGROUND_COLOR);
      typechoice->labelsize(11);
      typechoice->labelcolor((Fl_Color)64);
      typechoice->textfont(1);
      typechoice->textsize(9);
      typechoice->textcolor((Fl_Color)188);
      typechoice->callback((Fl_Callback*)cb_typechoice);
      typechoice->align(Fl_Align(FL_ALIGN_TOP));
      typechoice->when(FL_WHEN_RELEASE_ALWAYS);
      o->add("Off");o->add("Lp1");o->add("Hp1");o->add("Lp2");o->add("Hp2");o->add("Bp2");o->add("N2");o->add("Pk");o->add("LSh");o->add("HSh");
    } // Fl_Choice* typechoice
    { bandgroup = new Fl_Group(241, 40, 134, 45);
      bandgroup->box(FL_ENGRAVED_FRAME);
      bandgroup->deactivate();
      { WidgetPDial* o = freqdial = new WidgetPDial(247, 45, 25, 25, "Freq");
        freqdial->box(FL_ROUND_UP_BOX);
        freqdial->color(FL_BACKGROUND_COLOR);
        freqdial->selection_color(FL_INACTIVE_COLOR);
        freqdial->labeltype(FL_NORMAL_LABEL);
        freqdial->labelfont(0);
        freqdial->labelsize(10);
        freqdial->labelcolor((Fl_Color)64);
        freqdial->maximum(127);
        freqdial->callback((Fl_Callback*)cb_freqdial);
        freqdial->align(Fl_Align(FL_ALIGN_BOTTOM));
        freqdial->when(FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED);
        o->setValueType(VC_FXEQfreq);
      } // WidgetPDial* freqdial
      { WidgetPDial* o = gaindial = new WidgetPDial(277, 45, 25, 25, "Gain");
        gaindial->box(FL_ROUND_UP_BOX);
        gaindial->color(FL_BACKGROUND_COLOR);
        gaindial->selection_color(FL_INACTIVE_COLOR);
        gaindial->labeltype(FL_NORMAL_LABEL);
        gaindial->labelfont(0);
        gaindial->labelsize(10);
        gaindial->labelcolor((Fl_Color)64);
        gaindial->maximum(127);
        gaindial->step(1);
        gaindial->callback((Fl_Callback*)cb_gaindial);
        gaindial->align(Fl_Align(FL_ALIGN_BOTTOM));
        gaindial->when(FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED);
        o->setValueType(VC_FXEQfilterGain);
      } // WidgetPDial* gaindial
      { WidgetPDial* o = qdial = new WidgetPDial(307, 45, 25, 25, "Q");
        qdial->tooltip("Resonance/Bandwidth");
        qdial->box(FL_ROUND_UP_BOX);
        qdial->color(FL_BACKGROUND_COLOR);
        qdial->selection_color(FL_INACTIVE_COLOR);
        qdial->labeltype(FL_NORMAL_LABEL);
        qdial->labelfont(0);
        qdial->labelsize(10);
        qdial->labelcolor((Fl_Color)64);
        qdial->maximum(127);
        qdial->callback((Fl_Callback*)cb_qdial);
        qdial->align(Fl_Align(FL_ALIGN_BOTTOM));
        qdial->when(FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED);
        o->setValueType(VC_FXEQq);
      } // WidgetPDial* qdial
      { Fl_Counter* o = stagescounter = new Fl_Counter(337, 55, 30, 15, "Stages");
        stagescounter->tooltip("Additional filter stages");
        stagescounter->type(1);
        stagescounter->labelsize(10);
        stagescounter->labelcolor((Fl_Color)64);
        stagescounter->minimum(1);
        stagescounter->maximum(127);
        stagescounter->step(1);
        stagescounter->value(1);
        stagescounter->textfont(1);
        stagescounter->textsize(11);
        stagescounter->textcolor((Fl_Color)64);
        stagescounter->callback((Fl_Callback*)cb_stagescounter);
        o->bounds(0,MAX_FILTER_STAGES - 1);
      } // Fl_Counter* stagescounter
      { extra = new Fl_Text_Display(334, 55, 35, 0, "Extra");
        extra->labelsize(11);
        extra->labelcolor((Fl_Color)64);
        extra->textsize(9);
        extra->textcolor((Fl_Color)64);
      } // Fl_Text_Display* extra
      bandgroup->end();
    } // Fl_Group* bandgroup
    { eqgraph = new EQGraph(45, 10, 190, 75);
      eqgraph->box(FL_BORDER_BOX);
      eqgraph->color(FL_BACKGROUND_COLOR);
      eqgraph->selection_color(FL_BACKGROUND_COLOR);
      eqgraph->labeltype(FL_NORMAL_LABEL);
      eqgraph->labelfont(0);
      eqgraph->labelsize(14);
      eqgraph->labelcolor(FL_FOREGROUND_COLOR);
      eqgraph->align(Fl_Align(FL_ALIGN_CENTER));
      eqgraph->when(FL_WHEN_RELEASE);
    } // EQGraph* eqgraph
    effeqwindow->end();
  } // Fl_Group* effeqwindow
  return effeqwindow;
}

Fl_Group* EffUI::make_dynamicfilter_window() {
  { effdynamicfilterwindow = new Fl_Group(0, 0, 380, 95);
    effdynamicfilterwindow->box(FL_PLASTIC_UP_BOX);
    effdynamicfilterwindow->color(FL_CYAN);
    effdynamicfilterwindow->selection_color(FL_BACKGROUND_COLOR);
    effdynamicfilterwindow->labeltype(FL_NO_LABEL);
    effdynamicfilterwindow->labelfont(1);
    effdynamicfilterwindow->labelsize(14);
    effdynamicfilterwindow->labelcolor(FL_FOREGROUND_COLOR);
    effdynamicfilterwindow->user_data((void*)(this));
    effdynamicfilterwindow->align(Fl_Align(FL_ALIGN_TOP));
    effdynamicfilterwindow->when(FL_WHEN_RELEASE);
    { dfname = new Fl_Text_Display(10, 10, 0, 20, "DynFilter");
      dfname->box(FL_NO_BOX);
      dfname->labelfont(1);
      dfname->labelsize(12);
      dfname->labelcolor((Fl_Color)64);
      dfname->textcolor((Fl_Color)64);
      dfname->align(Fl_Align(FL_ALIGN_RIGHT));
    } // Fl_Text_Display* dfname
    { Fl_Choice* o = dfp = new Fl_Choice(132, 13, 90, 16, "Preset");
      dfp->down_box(FL_BORDER_BOX);
      dfp->selection_color(FL_BACKGROUND_COLOR);
      dfp->labelsize(11);
      dfp->labelcolor((Fl_Color)64);
      dfp->textfont(1);
      dfp->textsize(10);
      dfp->textcolor((Fl_Color)188);
      dfp->callback((Fl_Callback*)cb_dfp);
      o->add("WahWah");o->add("AutoWah");o->add("Sweep");o->add("VocalMorph1");o->add("VocalMorph2");
    } // Fl_Choice* dfp
    { Fl_Choice* o = dfp4 = new Fl_Choice(190, 60, 43, 15, "LFO type");
      dfp4->tooltip("LFO function");
      dfp4->down_box(FL_BORDER_BOX);
      dfp4->selection_color(FL_BACKGROUND_COLOR);
      dfp4->labelsize(10);
      dfp4->labelcolor((Fl_Color)64);
      dfp4->textfont(1);
      dfp4->textsize(9);
      dfp4->textcolor((Fl_Color)188);
      dfp4->callback((Fl_Callback*)cb_dfp4);
      dfp4->align(Fl_Align(FL_ALIGN_BOTTOM));
      o->add("Sine");o->add("Tri");
    } // Fl_Choice* dfp4
    { dfp0 = new WidgetPDial(6, 44, 30, 30, "Vol");
      dfp0->tooltip("Effect volume");
      dfp0->box(FL_ROUND_UP_BOX);
      dfp0->color(FL_BACKGROUND_COLOR);
      dfp0->selection_color(FL_INACTIVE_COLOR);
      dfp0->labeltype(FL_NORMAL_LABEL);
      dfp0->labelfont(0);
      dfp0->labelsize(11);
      dfp0->labelcolor((Fl_Color)64);
      dfp0->maximum(127);
      dfp0->step(1);
      dfp0->callback((Fl_Callback*)cb_dfp0);
      dfp0->align(Fl_Align(FL_ALIGN_BOTTOM));
      dfp0->when(FL_WHEN_CHANGED);
    } // WidgetPDial* dfp0
    { dfp1 = new WidgetPDial(42, 44, 30, 30, "Pan");
      dfp1->box(FL_ROUND_UP_BOX);
      dfp1->color(FL_BACKGROUND_COLOR);
      dfp1->selection_color(FL_INACTIVE_COLOR);
      dfp1->labeltype(FL_NORMAL_LABEL);
      dfp1->labelfont(0);
      dfp1->labelsize(11);
      dfp1->labelcolor((Fl_Color)64);
      dfp1->maximum(127);
      dfp1->step(1);
      dfp1->callback((Fl_Callback*)cb_dfp1);
      dfp1->align(Fl_Align(FL_ALIGN_BOTTOM));
      dfp1->when(FL_WHEN_CHANGED);
    } // WidgetPDial* dfp1
    { WidgetPDial* o = dfp2 = new WidgetPDial(80, 44, 30, 30, "Freq");
      dfp2->tooltip("LFO frequency");
      dfp2->box(FL_ROUND_UP_BOX);
      dfp2->color(FL_BACKGROUND_COLOR);
      dfp2->selection_color(FL_INACTIVE_COLOR);
      dfp2->labeltype(FL_NORMAL_LABEL);
      dfp2->labelfont(0);
      dfp2->labelsize(11);
      dfp2->labelcolor((Fl_Color)64);
      dfp2->maximum(127);
      dfp2->step(1);
      dfp2->callback((Fl_Callback*)cb_dfp2);
      dfp2->align(Fl_Align(FL_ALIGN_BOTTOM));
      dfp2->when(FL_WHEN_CHANGED);
      o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);
    } // WidgetPDial* dfp2
    { WidgetPDial* o = dfp3 = new WidgetPDial(155, 44, 30, 30, "Rnd");
      dfp3->tooltip("LFO randomness");
      dfp3->box(FL_ROUND_UP_BOX);
      dfp3->color(FL_BACKGROUND_COLOR);
      dfp3->selection_color(FL_INACTIVE_COLOR);
      dfp3->labeltype(FL_NORMAL_LABEL);
      dfp3->labelfont(0);
      dfp3->labelsize(11);
      dfp3->labelcolor((Fl_Color)64);
      dfp3->maximum(127);
      dfp3->step(1);
      dfp3->callback((Fl_Callback*)cb_dfp3);
      dfp3->align(Fl_Align(FL_ALIGN_BOTTOM));
      dfp3->when(FL_WHEN_RELEASE);
      o->setValueType(VC_percent127);
    } // WidgetPDial* dfp3
    { WidgetPDial* o = dfp18 = new WidgetPDial(118, 44, 30, 30, "Start");
      dfp18->tooltip("Start of LFO phase relative to start of beat. This has no effect unless you a"
"re syncing to a song position, using MIDI or a plugin host.");
      dfp18->box(FL_ROUND_UP_BOX);
      dfp18->color(FL_BACKGROUND_COLOR);
      dfp18->selection_color(FL_INACTIVE_COLOR);
      dfp18->labeltype(FL_NORMAL_LABEL);
      dfp18->labelfont(0);
      dfp18->labelsize(11);
      dfp18->labelcolor((Fl_Color)64);
      dfp18->maximum(127);
      dfp18->step(1);
      dfp18->callback((Fl_Callback*)cb_dfp18);
      dfp18->align(Fl_Align(FL_ALIGN_BOTTOM));
      dfp18->when(FL_WHEN_RELEASE);
      o->setValueType(VC_PhaseOffset);
      if (isBeatSync()) o->activate(); else o->deactivate();
    } // WidgetPDial* dfp18
    { dfp5 = new WidgetPDial(240, 49, 30, 30, "St.df");
      dfp5->tooltip("Left/Right channel phase shift");
      dfp5->box(FL_ROUND_UP_BOX);
      dfp5->color(FL_BACKGROUND_COLOR);
      dfp5->selection_color(FL_INACTIVE_COLOR);
      dfp5->labeltype(FL_NORMAL_LABEL);
      dfp5->labelfont(0);
      dfp5->labelsize(11);
      dfp5->labelcolor((Fl_Color)64);
      dfp5->maximum(127);
      dfp5->step(1);
      dfp5->callback((Fl_Callback*)cb_dfp5);
      dfp5->align(Fl_Align(FL_ALIGN_BOTTOM));
      dfp5->when(FL_WHEN_CHANGED);
    } // WidgetPDial* dfp5
    { dfp6 = new WidgetPDial(240, 8, 30, 30, "LfoD");
      dfp6->tooltip("LFO depth");
      dfp6->box(FL_ROUND_UP_BOX);
      dfp6->color(FL_BACKGROUND_COLOR);
      dfp6->selection_color(FL_INACTIVE_COLOR);
      dfp6->labeltype(FL_NORMAL_LABEL);
      dfp6->labelfont(0);
      dfp6->labelsize(11);
      dfp6->labelcolor((Fl_Color)64);
      dfp6->maximum(127);
      dfp6->step(1);
      dfp6->callback((Fl_Callback*)cb_dfp6);
      dfp6->align(Fl_Align(FL_ALIGN_RIGHT));
      dfp6->when(FL_WHEN_CHANGED);
    } // WidgetPDial* dfp6
    { filter = new Fl_Button(325, 12, 37, 16, "Filter");
      filter->box(FL_GTK_THIN_UP_BOX);
      filter->color((Fl_Color)221);
      filter->labelsize(11);
      filter->labelcolor((Fl_Color)64);
      filter->callback((Fl_Callback*)cb_filter);
    } // Fl_Button* filter
    { Fl_Group* o = new Fl_Group(277, 37, 99, 53);
      o->box(FL_EMBOSSED_BOX);
      o->color((Fl_Color)181);
      { dfp7 = new WidgetPDial(282, 44, 30, 30, "A.S.");
        dfp7->tooltip("Filter vs amplitude");
        dfp7->box(FL_ROUND_UP_BOX);
        dfp7->color(FL_BACKGROUND_COLOR);
        dfp7->selection_color(FL_INACTIVE_COLOR);
        dfp7->labeltype(FL_NORMAL_LABEL);
        dfp7->labelfont(0);
        dfp7->labelsize(11);
        dfp7->labelcolor((Fl_Color)64);
        dfp7->maximum(127);
        dfp7->step(1);
        dfp7->callback((Fl_Callback*)cb_dfp7);
        dfp7->align(Fl_Align(FL_ALIGN_BOTTOM));
        dfp7->when(FL_WHEN_CHANGED);
      } // WidgetPDial* dfp7
      { dfp9 = new WidgetPDial(318, 44, 30, 30, "A.M");
        dfp9->tooltip("Rate that  amplitude changes the filter");
        dfp9->box(FL_ROUND_UP_BOX);
        dfp9->color(FL_BACKGROUND_COLOR);
        dfp9->selection_color(FL_INACTIVE_COLOR);
        dfp9->labeltype(FL_NORMAL_LABEL);
        dfp9->labelfont(0);
        dfp9->labelsize(11);
        dfp9->labelcolor((Fl_Color)64);
        dfp9->maximum(127);
        dfp9->step(1);
        dfp9->callback((Fl_Callback*)cb_dfp9);
        dfp9->align(Fl_Align(FL_ALIGN_BOTTOM));
        dfp9->when(FL_WHEN_CHANGED);
      } // WidgetPDial* dfp9
      { dfp8 = new Fl_Check_Button2(353, 58, 15, 15, "Inv.");
        dfp8->tooltip("Enable for filter frequency to lower with higher input amplitude");
        dfp8->box(FL_NO_BOX);
        dfp8->down_box(FL_DOWN_BOX);
        dfp8->color(FL_BACKGROUND_COLOR);
        dfp8->selection_color((Fl_Color)64);
        dfp8->labeltype(FL_NORMAL_LABEL);
        dfp8->labelfont(0);
        dfp8->labelsize(11);
        dfp8->labelcolor((Fl_Color)64);
        dfp8->callback((Fl_Callback*)cb_dfp8);
        dfp8->align(Fl_Align(FL_ALIGN_BOTTOM));
        dfp8->when(FL_WHEN_RELEASE);
      } // Fl_Check_Button2* dfp8
      o->end();
    } // Fl_Group* o
    { Fl_Check_Button* o = dfp17 = new Fl_Check_Button(191, 41, 45, 15, "BPM");
      dfp17->tooltip("Synchronize the frequency to a multiple of the BPM.");
      dfp17->down_box(FL_DOWN_BOX);
      dfp17->selection_color((Fl_Color)64);
      dfp17->labelsize(11);
      dfp17->labelcolor((Fl_Color)64);
      dfp17->callback((Fl_Callback*)cb_dfp17);
      o->value(isBeatSync());
    } // Fl_Check_Button* dfp17
    effdynamicfilterwindow->end();
  } // Fl_Group* effdynamicfilterwindow
  return effdynamicfilterwindow;
}

ScaleTrackedWindow* EffUI::make_filter_window() {
  { ScaleTrackedWindow* o = filterwindow = new ScaleTrackedWindow(285, 110, "Yoshimi : Filter Parameters for DynFilter Effect");
    filterwindow->box(FL_FLAT_BOX);
    filterwindow->color(FL_BACKGROUND_COLOR);
    filterwindow->selection_color(FL_BACKGROUND_COLOR);
    filterwindow->labeltype(FL_NO_LABEL);
    filterwindow->labelfont(0);
    filterwindow->labelsize(14);
    filterwindow->labelcolor(FL_FOREGROUND_COLOR);
    filterwindow->callback((Fl_Callback*)cb_filterwindow, (void*)(this));
    filterwindow->align(Fl_Align(FL_ALIGN_TOP));
    filterwindow->when(FL_WHEN_RELEASE);
    { FilterUI* o = fwin_filterui = new FilterUI(5, 5, 275, 75, "DynFilter effect  - Filter");
      fwin_filterui->box(FL_FLAT_BOX);
      fwin_filterui->color(FL_LIGHT1);
      fwin_filterui->selection_color(FL_BACKGROUND_COLOR);
      fwin_filterui->labeltype(FL_NORMAL_LABEL);
      fwin_filterui->labelfont(0);
      fwin_filterui->labelsize(12);
      fwin_filterui->labelcolor(FL_FOREGROUND_COLOR);
      fwin_filterui->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
      fwin_filterui->when(FL_WHEN_RELEASE);
      o->init(effect.get().eff_in_core_TODO_deprecated->filterpars,NULL,NULL, npart, (EFFECT::type::dynFilter), effNum());
      fwin_filterui->end();
    } // FilterUI* fwin_filterui
    { filterclose = new Fl_Button(124, 86, 46, 20, "Close");
      filterclose->box(FL_THIN_UP_BOX);
      filterclose->color((Fl_Color)196);
      filterclose->labelsize(12);
      filterclose->labelcolor((Fl_Color)64);
      filterclose->callback((Fl_Callback*)cb_filterclose);
    } // Fl_Button* filterclose
    filterwindow->resizable(filterwindow);
    filtDW = o->w(); filtDH = o->h();
    o->size_range(filtDW, filtDH, 0, 0, 0, 0, 1);
    o->copy_label(textMsgBuffer.fetch(collect_readData(synth, textMsgBuffer.push("DynFilter"), npart, TOPLEVEL::windowTitle,UNUSED, effNum())).c_str());
    filterwindow->end();
  } // ScaleTrackedWindow* filterwindow
  return filterwindow;
}

bool EffUI::isInsert() {
  return effect.get().isInsert;
}

bool EffUI::isBeatSync() {
  return effect.get().param[EFFECT::control::bpm];
}

bool EffUI::isSepDelay() {
  return effect.get().param[EFFECT::control::sepLRDelay];
}

bool EffUI::isEnabled() {
  return effect.get().enabled;
}

bool EffUI::isChanged() {
  return effect.get().changed;
}

uchar EffUI::effNum() {
  return effect.get().effNum;
}

int EffUI::effType() {
  return effect.get().effType;
}

uchar EffUI::effParam(uint paramNum) {
  return effect.get().param[paramNum];
}

uchar EffUI::effPreset() {
  return effect.get().currPreset;
}

int EffUI::getInsertFxRouting() {
  return effect.get().insertFxRouting;
}

uchar EffUI::getPartFxRouting() {
  return effect.get().partFxRouting;
}

bool EffUI::getPartFxBypass() {
  return effect.get().partFxBypass;
}

void EffUI::send_data(int action, int control, float value, int group, int type) {
  //
      type |= TOPLEVEL::type::Write;
      int parameter = UNUSED;
      if (group == EFFECT::type::eq)
      {
          parameter = bandcounter->value() - 1;
      }
      int offset = UNUSED;
      if (group == EFFECT::type::dynFilter)
      {
          offset = dfp->value();
      }
      collect_writeData(synth, value, action, type, control, npart, group, effNum(), UNUSED, parameter, offset);
}

float EffUI::fetchData(float value, int control, int part, int kititem , int engine , int insert , int parameter , int offset , int miscmsg , int request ) {
  //
          return collect_readData(synth, value, control, part, kititem, engine, insert, parameter, offset, miscmsg, request);
}

void EffUI::returns_update(CommandBlock *getData) {
  //
      float value = getData->data.value;
      int value_int = int(value + 0.5f);
      unsigned char control = getData->data.control;
      unsigned char efftype = getData->data.kit;
      unsigned char effnum = getData->data.engine;
      bool isdynfilter = (effnum == (EFFECT::type::dynFilter));
      unsigned char eqband =  getData->data.parameter;
      unsigned char secondary = getData->data.offset;
      if (efftype != EFFECT::type::eq)
          presetNum = effPreset();

      int textCol = eff_preset;
      if (isChanged())
          textCol = eff_preset_changed;
      auto __setColor = [this,value](auto& widget, auto& preset, uint paramIdx)
                        {widget->selection_color(setKnob(value,preset[presetNum][paramIdx]));};
      switch(efftype)
      {
          case EFFECT::type::none:
              break;

          case EFFECT::type::reverb:
              switch (control)
              {
                  case EFFECT::control::level:
                      revp0->value(value);
                      if (isInsert()) // D/W
                          revp0->selection_color(setKnob(value,int(reverbPresets[presetNum][0])/2));
                      else
                          __setColor(revp0,reverbPresets,0);
                      break;
                  case EFFECT::control::panning:
                      revp1->value(value);
                      __setColor(revp1,reverbPresets,1);
                      break;
                  case EFFECT::control::frequency: // time here
                      revp2->value(value);
                      __setColor(revp2,reverbPresets,2);
                      break;
                  case 3:
                      revp3->value(value);
                      __setColor(revp3,reverbPresets,3);
                      break;
                  case 4:
                      revp4->value(value);
                      __setColor(revp4,reverbPresets,4);
                      break;
                  case 6:
                      revp6->value(value);
                      __setColor(revp6,reverbPresets,6);
                      break;
                  case 7:
                      revp7->value(value);
                      __setColor(revp7,reverbPresets,7);
                      break;
                  case 8:
                      revp8->value(value);
                      __setColor(revp8,reverbPresets,8);
                      break;
                  case 9:
                      revp9->value(value);
                      __setColor(revp9,reverbPresets,9);
                      break;
                  case 10:
                      revp10->value(value_int);
                      if (value_int == 2)
                      {
                          revp12->activate();
                          revp12->value(secondary);
                      }
                      else
                          revp12->deactivate();
                      break;
                  case 11:
                      revp11->value(value);
                      __setColor(revp11,reverbPresets,11);
                      break;
                  case 12:
                      revp12->value(value);
                      __setColor(revp12,reverbPresets,12);
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              revp->textcolor(textCol);
              revp->redraw();
              break;

          case EFFECT::type::echo:
              switch (control)
              {
                  case EFFECT::control::level:
                      echop0->value(value);
                      if (isInsert()) // D/W
                          echop0->selection_color(setKnob(value,int(echoPresets[presetNum][0])/2));
                      else
                          __setColor(echop0,echoPresets,0);
                      break;
                  case EFFECT::control::panning:
                      echop1->value(value);
                      __setColor(echop1,echoPresets,1);
                      break;
                  case EFFECT::control::frequency: // delay here
                      echop2->value(value);
                      __setColor(echop2,echoPresets,2);
                      break;
                  case 3:
                      echop3->value(value);
                      __setColor(echop3,echoPresets,3);
                      break;
                  case 4:
                      echop4->value(value);
                      __setColor(echop4,echoPresets,4);
                      break;
                  case 5:
                      echop5->value(value);
                      __setColor(echop5,echoPresets,5);
                      break;
                  case 6:
                      echop6->value(value);
                      __setColor(echop6,echoPresets,6);
                      break;
                  case EFFECT::control::sepLRDelay:
                      echop7->value(value);
                      if (value)
                      {
                          echop2->label("L.Delay");
                          echop3->label("R.Delay");
                          if (isBeatSync())
                          {
                              echop3->setValueType(VC_FXlfofreqBPM);
                          }
                          else
                          {
                              echop3->setValueType(VC_FXEchoDelay);
                          }
                      }
                      else
                      {
                          echop2->label("Delay");
                          echop3->label("LRdl.");
                          echop3->setValueType(VC_FXEchoLRdel);
                      }
                      // This is needed because the labels do not draw cleanly on
                      // top of each other.
                      effechowindow->redraw();
                      break;
                  case EFFECT::control::bpm:
                      echop17->value(value);
                      if (value)
                          echop2->setValueType(VC_FXlfofreqBPM);
                      else
                          echop2->setValueType(VC_FXEchoDelay);

                      if (isSepDelay())
                      {
                          if (value)
                          {
                              echop3->setValueType(VC_FXlfofreqBPM);
                          }
                          else
                          {
                              echop3->setValueType(VC_FXEchoDelay);
                          }
                      }
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              echop->textcolor(textCol);
              echop->redraw();
              break;

          case EFFECT::type::chorus:
              switch (control)
              {
                  case EFFECT::control::level:
                      chorusp0->value(value);
                      __setColor(chorusp0,chorusPresets,0);
                      break;
                  case EFFECT::control::panning:
                      chorusp1->value(value);
                      __setColor(chorusp1,chorusPresets,1);
                      break;
                  case EFFECT::control::frequency:
                      chorusp2->value(value);
                      __setColor(chorusp2,chorusPresets,2);
                      break;
                  case 3:
                      chorusp3->value(value);
                      __setColor(chorusp3,chorusPresets,3);
                      break;
                  case 5:
                      chorusp5->value(value);
                      __setColor(chorusp5,chorusPresets,5);
                      break;
                  case 6:
                      chorusp6->value(value_int);
                      __setColor(chorusp6,chorusPresets,6);
                      break;
                  case 7:
                      chorusp7->value(value);
                      __setColor(chorusp7,chorusPresets,7);
                      break;
                  case 8:
                      chorusp8->value(value);
                      __setColor(chorusp8,chorusPresets,8);
                      break;
                  case 9:
                      chorusp9->value(value);
                      __setColor(chorusp9,chorusPresets,9);
                      break;
                  case 11:
                      chorusp11->value(value_int);
                      break;
                  case EFFECT::control::bpm:
                      chorusp17->value(value);
                      if (value)
                      {
                          chorusp2->setValueType(VC_FXlfofreqBPM);
                          chorusp18->activate();
                      }
                      else
                      {
                          chorusp2->setValueType(VC_FXlfofreq);
                          chorusp18->deactivate();
                      }
                      break;
                  case EFFECT::control::bpmStart:
                      chorusp18->value(value);
                      chorusp18->selection_color(setKnob(value,0));
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              chorusp->textcolor(textCol);
              chorusp->redraw();
              break;

          case EFFECT::type::phaser:
              switch (control)
              {
                  case EFFECT::control::level:
                      phaserp0->value(value);
                      __setColor(phaserp0,phaserPresets,0);
                      break;
                  case EFFECT::control::panning:
                      phaserp1->value(value);
                      __setColor(phaserp1,phaserPresets,1);
                      break;
                  case EFFECT::control::frequency:
                      phaserp2->value(value);
                      __setColor(phaserp2,phaserPresets,2);
                      break;
                  case 3:
                      phaserp3->value(value);
                      __setColor(phaserp3,phaserPresets,3);
                      break;
                  case 4:
                      phaserp4->value(value_int);
                      break;
                  case 5:
                      phaserp5->value(value);
                      __setColor(phaserp5,phaserPresets,5);
                      break;
                  case 6:
                      phaserp6->value(value);
                      __setColor(phaserp6,phaserPresets,6);
                      break;
                  case 7:
                      phaserp7->value(value);
                      __setColor(phaserp7,phaserPresets,7);
                      break;
                  case 8:
                      phaserp8->value(value_int);
                      break;
                  case 9:
                      phaserp9->value(value);
                      __setColor(phaserp9,phaserPresets,9);
                      break;
                  case 10:
                      phaserp10->value(value_int);
                      break;
                  case 11:
                      phaserp11->value(value);
                      __setColor(phaserp11,phaserPresets,11);
                      break;
                  case 12:
                      phaserp12->value(value_int);
                      break;
                  case 13:
                      phaserp13->value(value);
                      __setColor(phaserp13,phaserPresets,13);
                      break;
                  case 14:
                      phaserp14->value(value_int);
                      if (value_int != 0)
                      {
                          phaserp9->deactivate();
                          phaserp7->deactivate();
                          phaserp12->activate();
                          phaserp13->activate();
                      }
                      else
                      {
                          phaserp9->activate();
                          phaserp7->activate();
                          phaserp12->deactivate();
                          phaserp13->deactivate();
                      }
                      break;
                  case EFFECT::control::bpm:
                      phaserp17->value(value);
                      if (value)
                      {
                          phaserp2->setValueType(VC_FXlfofreqBPM);
                          phaserp18->activate();
                      }
                      else
                      {
                          phaserp2->setValueType(VC_FXlfofreq);
                          phaserp18->deactivate();
                      }
                      break;
                  case EFFECT::control::bpmStart:
                      phaserp18->value(value);
                      phaserp18->selection_color(setKnob(value,0));
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              phaserp->textcolor(textCol);
              phaserp->redraw();
              break;

          case EFFECT::type::alienWah:
              switch (control)
              {
                  case EFFECT::control::level:
                      awp0->value(value);
                      echop0->value(value);
                      if (isInsert()) // D/W
                          awp0->selection_color(setKnob(value,int(alienPresets[presetNum][0])/2));
                      else
                          __setColor(awp0,alienPresets,0);
                      break;
                  case EFFECT::control::panning:
                      awp1->value(value);
                      __setColor(awp1,alienPresets,1);
                      break;
                  case EFFECT::control::frequency:
                      awp2->value(value);
                      __setColor(awp2,alienPresets,2);
                      break;
                  case 3:
                      awp3->value(value);
                      __setColor(awp3,alienPresets,3);
                      break;
                  case 4:
                      awp4->value(value_int);
                      break;
                  case 5:
                      awp5->value(value);
                      __setColor(awp5,alienPresets,5);
                      break;
                  case 6:
                      awp6->value(value);
                      __setColor(awp6,alienPresets,6);
                      break;
                  case 7:
                      awp7->value(value);
                      __setColor(awp7,alienPresets,7);
                      break;
                  case 8:
                      awp8->value(value_int);
                      break;
                  case 9:
                      awp9->value(value);
                      __setColor(awp9,alienPresets,9);
                      break;
                  case 10:
                      awp10->value(value);
                      __setColor(awp10,alienPresets,10);
                      break;
                  case EFFECT::control::bpm:
                      awp17->value(value);
                      if (value)
                      {
                          awp2->setValueType(VC_FXlfofreqBPM);
                          awp18->activate();
                      }
                      else
                      {
                          awp2->setValueType(VC_FXlfofreq);
                          awp18->deactivate();
                      }
                      break;
                  case EFFECT::control::bpmStart:
                      awp18->value(value);
                      awp18->selection_color(setKnob(value,0));
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              awp->textcolor(textCol);
              awp->redraw();
              break;

          case EFFECT::type::distortion:
              switch (control)
              {
                  case EFFECT::control::level:
                      distp0->value(value);
                      if (isInsert()) // D/W
                          distp0->selection_color(setKnob(value,int(distPresets[presetNum][0])/2));
                      else
                          __setColor(distp0,distPresets,0);
                      break;
                  case EFFECT::control::panning:
                      distp1->value(value);
                      __setColor(distp1,distPresets,1);
                      break;
                  case EFFECT::control::frequency: // LR-mix here
                      distp2->value(value);
                      __setColor(distp2,distPresets,2);
                      break;
                  case 3:
                      distp3->value(value);
                      __setColor(distp3,distPresets,3);
                      break;
                  case 4:
                      distp4->value(value);
                      __setColor(distp4,distPresets,4);
                      break;
                  case 5:
                      distp5->value(value_int);
                      break;
                  case 6:
                      distp6->value(value_int);
                      break;
                  case 7:
                      distp7->value(value);
                      __setColor(distp7,distPresets,7);
                      break;
                  case 8:
                      distp8->value(value);
                      __setColor(distp8,distPresets,8);
                      break;
                  case 9:
                      distp9->value(value_int);
                      break;
                  case 10:
                      distp10->value(value_int);
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              distp->textcolor(textCol);
              distp->redraw();
              break;

          case EFFECT::type::eq:
              if (control == EFFECT::control::level)
              {
                  eqp0->value(value);
                  eqp0->selection_color(setKnob(value,EQmaster_def));

              }
              else if (control == EFFECT::control::panning) // band number here!
              {
                  eqband = value_int;
                  bandcounter->value(eqband + 1);
                  EQbandUpdate(eqband);
              }
              else if (bandcounter->value() == eqband + 1)
              {
                  switch (control)
                  {
                  case 10:
                      typechoice->value(value_int);
                      if (value_int == 0)
                          bandgroup->deactivate();
                      else
                          bandgroup->activate();
                      if (value_int > 2)
                          qdial->activate();
                      else
                          qdial->deactivate();
                      if (value_int > 6)
                          gaindial->activate();
                      else
                          gaindial->deactivate();
                      break;
                  case 11:
                      freqdial->value(value);
                      freqdial->selection_color(setKnob(value,EQfreq_def));
                      break;
                  case 12:
                      gaindial->value(value);
                      gaindial->selection_color(setKnob(value,EQgain_def));
                      break;
                  case 13:
                      qdial->value(value);
                      qdial->selection_color(setKnob(value,EQq_def));
                      break;
                  case 14:
                      stagescounter->value(value_int);
                  }
              }
              effeqwindow->redraw();
              break;

          case EFFECT::type::dynFilter:
              if (isdynfilter)
              { // shouldn't get here
                  return;
              }
              switch (control)
              {
                  case EFFECT::control::level:
                      dfp0->value(value);
                      if (not isInsert()) // D/W (reversed)
                          dfp0->selection_color(setKnob(value,int(dynPresets[presetNum][0])/2));
                      else
                          __setColor(dfp0,dynPresets,0);
                      break;
                  case EFFECT::control::panning:
                      dfp1->value(value);
                      __setColor(dfp1,dynPresets,1);
                      break;
                  case EFFECT::control::frequency:
                      dfp2->value(value);
                      __setColor(dfp2,dynPresets,2);
                      break;
                  case 3:
                      dfp3->value(value);
                      __setColor(dfp3,dynPresets,3);
                      break;
                  case 4:
                      dfp4->value(value_int);
                      __setColor(dfp4,dynPresets,4);
                      break;
                  case 5:
                      dfp5->value(value);
                      __setColor(dfp5,dynPresets,5);
                      break;
                  case 6:
                      dfp6->value(value);
                      __setColor(dfp6,dynPresets,6);
                      break;
                  case 7:
                      dfp7->value(value);
                      __setColor(dfp7,dynPresets,7);
                      break;
                  case 8:
                      dfp8->value(value_int);
                      break;
                  case 9:
                      dfp9->value(value);
                      __setColor(dfp9,dynPresets,9);
                      break;
                  case EFFECT::control::bpm:
                      dfp17->value(value);
                      if (value)
                      {
                          dfp2->setValueType(VC_FXlfofreqBPM);
                          dfp18->activate();
                      }
                      else
                      {
                          dfp2->setValueType(VC_FXlfofreq);
                          dfp18->deactivate();
                      }
                      break;
                  case EFFECT::control::bpmStart:
                      dfp18->value(value);
                      dfp18->selection_color(setKnob(value,0));
                      break;
                  case EFFECT::control::preset:
                      refresh();
                      break;
              }
              dfp->textcolor(textCol);
              dfp->redraw();
              break;
      };
}

void EffUI::init(SynthEngine* synth_, RoutingTag conEffect, RoutingTag conEQ, int npart_) {
  //
      synth = synth_;
      effect.activate(GuiDataExchange::Connection<EffectDTO>{synth->interchange.guiDataExchange, conEffect});
      npart = npart_;

      make_null_window();
      make_reverb_window();
      make_echo_window();
      make_chorus_window();
      make_phaser_window();
      make_alienwah_window();
      make_distortion_window();
      make_dynamicfilter_window();
      make_eq_window();
      eqgraph->init(synth, conEQ);

      int px=this->parent()->x();
      int py=this->parent()->y();

      lastEff = -1;
      presetNum = 0;
      effnullwindow->position(px,py);
      effreverbwindow->position(px,py);
      effechowindow->position(px,py);
      effchoruswindow->position(px,py);
      effphaserwindow->position(px,py);
      effalienwahwindow->position(px,py);
      effdistortionwindow->position(px,py);
      effeqwindow->position(px,py);
      effdynamicfilterwindow->position(px,py);
      refresh();
}

void EffUI::refresh(int npart_) {
  //
      npart = npart_;
      this->hide();
      effnullwindow->hide();
      effreverbwindow->hide();
      effechowindow->hide();
      effchoruswindow->hide();
      effphaserwindow->hide();
      effalienwahwindow->hide();
      effdistortionwindow->hide();
      effeqwindow->hide();
      effdynamicfilterwindow->hide();
      eqband=0;
      if (filterwindow != NULL)
      {
          filterwindow->hide();
          delete(filterwindow);
          filterwindow=NULL;
      }
      int nextEff = effect.get().effType + EFFECT::type::none; // get effect not yet converted
      if (lastEff != nextEff)
      {
          presetNum = 0;
      }
      auto __setColor = [this](auto& widget, auto& preset, uint paramIdx)
                        {widget->selection_color(setKnob(widget->value(),preset[presetNum][paramIdx]));};
      switch(nextEff)
      {
          case EFFECT::type::reverb:
              revp->value(effPreset());
              revp0->value(effParam(0));
               if (isInsert()) // D/W
                   revp0->selection_color(setKnob(revp0->value(),int(reverbPresets[presetNum][0] / 2)));
               else
                  __setColor(revp0,reverbPresets,0);
              if (isInsert())
              {
                  revp0->label("D/W");
                  revp0->setValueType(VC_FXReverbDW);
              }
              revp1->value(effParam(1));
              __setColor(revp1,reverbPresets,1);
              revp2->value(effParam(2));
              __setColor(revp2,reverbPresets,2);
              revp3->value(effParam(3));
              __setColor(revp3,reverbPresets,3);
              revp4->value(effParam(4));
              __setColor(revp4,reverbPresets,4);
              revp6->value(effParam(6));
              __setColor(revp6,reverbPresets,6);
              revp7->value(effParam(7));
              __setColor(revp7,reverbPresets,7);
              revp8->value(effParam(8));
              __setColor(revp8,reverbPresets,8);
              revp9->value(effParam(9));
              __setColor(revp9,reverbPresets,9);
              revp10->value(effParam(10));
              revp11->value(effParam(11));
              __setColor(revp11,reverbPresets,11);
              revp12->value(effParam(12));
              __setColor(revp12,reverbPresets,12);
              effreverbwindow->show();
              break;
          case EFFECT::type::echo:
              echop->value(effPreset());
              echop0->value(effParam(0));
              if (isInsert())
              {
                  echop0->label("D/W");
                  echop0->setValueType(VC_FXEchoDW);
                  echop0->selection_color(setKnob(echop0->value(),int(echoPresets[presetNum][0])/2));
              }
              else
                  __setColor(echop0,echoPresets,0);
              echop1->value(effParam(1));
              __setColor(echop1,echoPresets,1);
              echop2->value(effParam(2));
              __setColor(echop2,echoPresets,2);
              echop3->value(effParam(3));
              __setColor(echop3,echoPresets,3);
              echop4->value(effParam(4));
              __setColor(echop4,echoPresets,4);
              echop5->value(effParam(5));
              __setColor(echop5,echoPresets,5);
              echop6->value(effParam(6));
              __setColor(echop6,echoPresets,6);
              echop7->value(isSepDelay());
              if (isSepDelay())
              {
                  echop2->label("L.Delay");
                  echop3->label("R.Delay");
                  if (isBeatSync())
                  {
                      echop3->setValueType(VC_FXlfofreqBPM);
                  }
                  else
                  {
                      echop3->setValueType(VC_FXEchoDelay);
                  }
              }
              else
              {
                  echop2->label("Delay");
                  echop3->label("LRdl.");
                  echop3->setValueType(VC_FXEchoLRdel);
              }
              echop17->value(effParam(EFFECT::control::bpm));
              effechowindow->show();
              break;
          case EFFECT::type::chorus:
              chorusp->value(effPreset());
              chorusp0->value(effParam(0));
              __setColor(chorusp0,chorusPresets,0);
              if (isInsert())
              {
                  chorusp0->label("D/W");
                  chorusp0->setValueType(VC_FXdefaultDW);
              }
              chorusp1->value(effParam(1));
              __setColor(chorusp1,chorusPresets,1);
              chorusp2->value(effParam(2));
              __setColor(chorusp2,chorusPresets,2);
              chorusp3->value(effParam(3));
              __setColor(chorusp3,chorusPresets,3);
              chorusp4->value(effParam(4));
              __setColor(chorusp4,chorusPresets,4);
              chorusp5->value(effParam(5));
              __setColor(chorusp5,chorusPresets,5);
              chorusp6->value(effParam(6));
              __setColor(chorusp6,chorusPresets,6);
              chorusp7->value(effParam(7));
              __setColor(chorusp7,chorusPresets,7);
              chorusp8->value(effParam(8));
              __setColor(chorusp8,chorusPresets,8);
              chorusp9->value(effParam(9));
              __setColor(chorusp9,chorusPresets,9);
              chorusp11->value(effParam(11));
              chorusp17->value(effParam(EFFECT::control::bpm));
              if (chorusp17->value())
              {
                  chorusp2->setValueType(VC_FXlfofreqBPM);
                  chorusp18->activate();
              }
              else
              {
                  chorusp2->setValueType(VC_FXlfofreq);
                  chorusp18->deactivate();
              }
              chorusp18->value(effParam(EFFECT::control::bpmStart));
              chorusp18->selection_color(setKnob(chorusp18->value(),0));
              effchoruswindow->show();
              break;
          case EFFECT::type::phaser:
              phaserp->value(effPreset());
              phaserp0->value(effParam(0));
              __setColor(phaserp0,phaserPresets,0);
              if (isInsert())
              {
                  phaserp0->label("D/W");
                  phaserp0->setValueType(VC_FXdefaultDW);
              }
              phaserp1->value(effParam(1));
              __setColor(phaserp1,phaserPresets,1);
              phaserp2->value(effParam(2));
              __setColor(phaserp2,phaserPresets,2);
              phaserp3->value(effParam(3));
              __setColor(phaserp3,phaserPresets,3);
              phaserp4->value(effParam(4));
              phaserp5->value(effParam(5));
              __setColor(phaserp5,phaserPresets,5);
              phaserp6->value(effParam(6));
              __setColor(phaserp6,phaserPresets,6);
              phaserp7->value(effParam(7));
              __setColor(phaserp7,phaserPresets,7);
              phaserp8->value(effParam(8));
              phaserp9->value(effParam(9));
              __setColor(phaserp9,phaserPresets,9);
              phaserp10->value(effParam(10));
              phaserp11->value(effParam(11));
              __setColor(phaserp11,phaserPresets,11);
              phaserp12->value(effParam(12));
              phaserp13->value(effParam(13));
              __setColor(phaserp13,phaserPresets,13);
              phaserp14->value(effParam(14));
              if (phaserp14->value() != 0)
              {
                  phaserp9->deactivate();
                  //phaserp11->deactivate();
                  phaserp12->activate();
                  phaserp13->activate();
              }
              else
              {
                  phaserp9->activate();
                  //phaserp11->activate();
                  phaserp12->deactivate();
                  phaserp13->deactivate();
              }
              phaserp17->value(effParam(EFFECT::control::bpm));
              if (phaserp17->value())
              {
                  phaserp2->setValueType(VC_FXlfofreqBPM);
                  phaserp18->activate();
              }
              else
              {
                  phaserp2->setValueType(VC_FXlfofreq);
                  phaserp18->deactivate();
              }
              phaserp18->value(effParam(EFFECT::control::bpmStart));
              phaserp18->selection_color(setKnob(phaserp18->value(),0));
              effphaserwindow->show();
              break;
          case EFFECT::type::alienWah:
              awp->value(effPreset());
              awp0->value(effParam(0));
              if (isInsert())
              {
                  awp0->label("D/W");
                  awp0->selection_color(setKnob(awp0->value(),int(alienPresets[presetNum][0])/2));
              }
              else
                  __setColor(awp0,alienPresets,0);
              awp1->value(effParam(1));
              __setColor(awp1,alienPresets,1);
              awp2->value(effParam(2));
              __setColor(awp2,alienPresets,2);
              awp3->value(effParam(3));
              __setColor(awp3,alienPresets,3);
              awp4->value(effParam(4));
              awp5->value(effParam(5));
              __setColor(awp5,alienPresets,5);
              awp6->value(effParam(6));
              __setColor(awp6,alienPresets,6);
              awp7->value(effParam(7));
              __setColor(awp7,alienPresets,7);
              awp8->value(effParam(8));
              awp9->value(effParam(9));
              __setColor(awp9,alienPresets,9);
              awp10->value(effParam(10));
              __setColor(awp10,alienPresets,10);
              awp17->value(effParam(EFFECT::control::bpm));
              if (awp17->value())
              {
                  awp2->setValueType(VC_FXlfofreqBPM);
                  awp18->activate();
              }
              else
              {
                  awp2->setValueType(VC_FXlfofreq);
                  awp18->deactivate();
              }
              awp18->value(effParam(EFFECT::control::bpmStart));
              awp18->selection_color(setKnob(awp18->value(),0));
              effalienwahwindow->show();
              break;
          case EFFECT::type::distortion:
              distp->value(effPreset());
              distp0->value(effParam(0));
              __setColor(distp0,distPresets,0);
              if (isInsert())
              {
                  distp0->label("D/W");
                  distp0->setValueType(VC_FXdefaultDW);
              }
              distp1->value(effParam(1));
              __setColor(distp1,distPresets,1);
              distp2->value(effParam(2));
              __setColor(distp2,distPresets,2);
              distp3->value(effParam(3));
              __setColor(distp3,distPresets,3);
              distp4->value(effParam(4));
              __setColor(distp4,distPresets,4);
              distp5->value(effParam(5));
              __setColor(distp5,distPresets,5);
              distp6->value(effParam(6));
              __setColor(distp6,distPresets,6);
              distp7->value(effParam(7));
              __setColor(distp7,distPresets,7);
              distp8->value(effParam(8));
              __setColor(distp8,distPresets,8);
              distp9->value(effParam(9));
              __setColor(distp9,distPresets,9);
              distp10->value(effParam(10));
              __setColor(distp10,distPresets,10);
              effdistortionwindow->show();
              break;
          case EFFECT::type::eq:
          {
              eqband = 0;
              int type = effParam(10);
              if (type > 0)
                  bandgroup->activate();
              else
                  bandgroup->activate();
              eqp0->value(effParam(0));
              eqp0->selection_color(setKnob(eqp0->value(),EQmaster_def));
              bandcounter->value(eqband + 1);
              typechoice->value(type);
              freqdial->value(effParam(11));
              freqdial->selection_color(setKnob(freqdial->value(),EQfreq_def));
              gaindial->value(effParam(12));
              gaindial->selection_color(setKnob(gaindial->value(),EQgain_def));
              qdial->value(effParam(13));
              qdial->selection_color(setKnob(qdial->value(),EQq_def));
              if (type < 3)
                  qdial->deactivate();
              if (type < 6)
                  gaindial->deactivate();
              stagescounter->value(effParam(14));
              eqgraph->damage(1);
              eqgraph->redraw();
              effeqwindow->show();
              break;
          }
          case EFFECT::type::dynFilter:
              make_filter_window();
              dfp->value(effPreset());
              dfp0->value(effParam(0));
              if (isInsert())
              {
                  dfp0->label("D/W");
                  dfp0->selection_color(setKnob(dfp0->value(),int(dynPresets[presetNum][0])/2));
              }
              else
                  __setColor(dfp0,dynPresets,0);
              dfp1->value(effParam(1));
              __setColor(dfp1,dynPresets,1);
              dfp2->value(effParam(2));
              __setColor(dfp2,dynPresets,2);
              dfp3->value(effParam(3));
              __setColor(dfp3,dynPresets,3);
              dfp4->value(effParam(4));
              __setColor(dfp4,dynPresets,4);
              dfp5->value(effParam(5));
              __setColor(dfp5,dynPresets,5);
              dfp6->value(effParam(6));
              __setColor(dfp6,dynPresets,6);
              dfp7->value(effParam(7));
              __setColor(dfp7,dynPresets,7);
              dfp8->value(effParam(8));
              dfp9->value(effParam(9));
              __setColor(dfp9,dynPresets,9);
              dfp17->value(effParam(EFFECT::control::bpm));
              if (dfp17->value())
              {
                  dfp2->setValueType(VC_FXlfofreqBPM);
                  dfp18->activate();
              }
              else
              {
                  dfp2->setValueType(VC_FXlfofreq);
                  dfp18->deactivate();
              }
              dfp18->value(effParam(EFFECT::control::bpmStart));
              dfp18->selection_color(setKnob(dfp1->value(),0));
              effdynamicfilterwindow->show();
              break;
          default:
              effnullwindow->show();
              break;
      }
      lastEff = nextEff;
      this->show();
}

void EffUI::refresh() {
  refresh(npart);
}

void EffUI::UpdatePresetColour(int changed, int efftype) {
  //
      int textCol = eff_preset;
      if (changed)
           textCol = eff_preset_changed;
      switch (efftype + EFFECT::type::none)
      {
          case EFFECT::type::reverb:
              revp->textcolor(textCol);
              revp->redraw();
              break;
          case EFFECT::type::echo:
              echop->textcolor(textCol);
              echop->redraw();
              break;
          case EFFECT::type::chorus:
              chorusp->textcolor(textCol);
              chorusp->redraw();
              break;
          case EFFECT::type::phaser:
              phaserp->textcolor(textCol);
              phaserp->redraw();
              break;
          case EFFECT::type::alienWah:
              awp->textcolor(textCol);
              awp->redraw();
              break;
          case EFFECT::type::distortion:
              distp->textcolor(textCol);
              distp->redraw();
              break;
          case EFFECT::type::eq:
              break;
          case EFFECT::type::dynFilter:
              dfp->textcolor(textCol);
              dfp->redraw();
              break;
      }
      //
}

void EffUI::effRtext(float dScale, int efftype) {
  //
          int size9 = int(9 * dScale);
          int size = int(10 * dScale);
          int size11 = int(11 * dScale);
          int size12 = int(12 * dScale);
          switch (efftype)
          {
              case 0:
                  noeffect->labelsize(14 * dScale);
                  break;
              case 1: // reverb
                  revname->labelsize(size12);
                  revp->labelsize(size11);
                      revp->textsize(size);
                  revp10->labelsize(size11);
                      revp10->textsize(size);

                  revp0->labelsize(size11);
                  revp1->labelsize(size11);
                  revp2->labelsize(size11);
                  revp3->labelsize(size11);
                  revp4->labelsize(size11);
                  revp12->labelsize(size11);
                  revp6->labelsize(size11);
                  revp7->labelsize(size11);
                  revp8->labelsize(size11);
                  revp9->labelsize(size11);
                  revp11->labelsize(size11);
                  break;
              case 2: // echo
                  echoname->labelsize(size12);
                  echop->labelsize(size11);
                      echop->textsize(size);

                  echop0->labelsize(size11);
                  echop1->labelsize(size11);
                  echop2->labelsize(size11);
                  echop3->labelsize(size11);
                  echop4->labelsize(size11);
                  echop5->labelsize(size11);
                  echop6->labelsize(size11);
                  echop7->labelsize(size11);
                  echop17->labelsize(size11);
                  break;
              case 3: // chorus
                  chorusname->labelsize(size12);
                  chorusp->labelsize(size11);
                      chorusp->textsize(size);
                  chorusp4->labelsize(size);
                      chorusp4->textsize(size9);

                  chorusp0->labelsize(size11);
                  chorusp1->labelsize(size11);
                  chorusp2->labelsize(size11);
                  chorusp3->labelsize(size11);
                  chorusp5->labelsize(size11);
                  chorusp6->labelsize(size11);
                  chorusp7->labelsize(size11);
                  chorusp8->labelsize(size11);
                  chorusp9->labelsize(size11);
                  chorusflange->labelsize(size);
                  chorusp11->labelsize(size11);
                  chorusp17->labelsize(size11);
                  chorusp18->labelsize(size11);
                  break;
              case 4: // phaser
                  phasername->labelsize(size12);
                  phaserp->labelsize(size11);
                      phaserp->textsize(size);
                  phaserp4->labelsize(size);
                      phaserp4->textsize(size9);

                  phaserp0->labelsize(size11);
                  phaserp1->labelsize(size11);
                  phaserp2->labelsize(size11);
                  phaserp3->labelsize(size11);
                  phaserp5->labelsize(size11);
                  phaserp6->labelsize(size11);
                  phaserp7->labelsize(size11);
                  phaserp8->labelsize(size11);
                      phaserp8->textsize(size11);
                  phaserp9->labelsize(size11);
                  phaserp10->labelsize(size11);
                  phaserp11->labelsize(size11);
                  phaserp12->labelsize(size11);
                  phaserp13->labelsize(size11);
                  phaserp14->labelsize(size11);
                  phaserp17->labelsize(size11);
                  phaserp18->labelsize(size11);
                  break;
              case 5: // alienwah
                  alienname->labelsize(size12);
                  awp->labelsize(size11);
                      awp->textsize(size);
                  awp4->labelsize(size);
                      awp4->textsize(size9);

                  awp0->labelsize(size11);
                  awp1->labelsize(size11);
                  awp2->labelsize(size11);
                  awp3->labelsize(size11);
                  awp5->labelsize(size11);
                  awp6->labelsize(size11);
                  awp7->labelsize(size11);
                  awp9->labelsize(size11);

                  awp10->labelsize(size11);
                  awp8->labelsize(size11);
                      awp8->textsize(size11);
                  awp17->labelsize(size11);
                  awp18->labelsize(size11);
                  break;
              case 6: // distortion
                  distname->labelsize(size12);
                  distp->labelsize(size11);
                      distp->textsize(size);
                  distp5->labelsize(size);
                      distp5->textsize(size9);

                  distp0->labelsize(size11);
                  distp1->labelsize(size11);
                  distp2->labelsize(size11);
                  distp3->labelsize(size11);
                  distp4->labelsize(size11);
                  distp7->labelsize(size11);
                  distp8->labelsize(size11);

                  distp6->labelsize(size11);
                  distp9->labelsize(size11);
                  distp10->labelsize(size11);
                  break;
              case 7: // EQ
                  eqname->labelsize(size12);
                  eqp0->labelsize(size11);
                  bandcounter->labelsize(size11);
                      bandcounter->textsize(size11);

                  freqdial->labelsize(size11);
                  gaindial->labelsize(size11);
                  qdial->labelsize(size11);
                  stagescounter->labelsize(size);
                      stagescounter->textsize(size11);
                      extra->labelsize(size);

                  typechoice->labelsize(size11);
                      typechoice->textsize(size9);

                  effeqwindow->redraw();
                  break;
              case 8: // dynfilter
                  dfname->labelsize(size12);
                  dfp->labelsize(size11);
                      dfp->textsize(size);
                  dfp4->labelsize(size);
                      dfp4->textsize(size9);

                  dfp0->labelsize(size11);
                  dfp1->labelsize(size11);
                  dfp2->labelsize(size11);
                  dfp3->labelsize(size11);
                  dfp5->labelsize(size11);
                  dfp6->labelsize(size11);

                  filter->labelsize(size11);
                  dfp7->labelsize(size11);
                  dfp8->labelsize(size11);
                  dfp9->labelsize(size11);
                  dfp17->labelsize(size11);
                  dfp18->labelsize(size11);

                  filterclose->labelsize(size12);
                  break;
              default:
                  break;
          }
}

void EffUI::Showfilt() {
  //
      int fetchW, fetchH, fetchX, fetchY, fetchO;
      loadWin(synth, fetchW, fetchH, fetchX, fetchY, fetchO, "xFilter-dynamic " + to_string(npart));

      if (fetchW < filtDW || fetchH < filtDH)
      {
          fetchW = filtDW;
          fetchH = filtDH;
      }
      checkSane(fetchX, fetchY, fetchW, fetchH, filtDW, filtDH);
      filterwindow->resize(fetchX, fetchY, fetchW, fetchH);
      filtRtext();
      filterwindow->show();
}

void EffUI::filtRtext() {
  //
      float dScale = filterwindow->w() / filtDW;
      if (dScale < 1.0f)
          dScale = 1.0f;

      filterclose->labelsize(12 * dScale);

      fwin_filterui->filterRtext(dScale);

      filterwindow->redraw();
}

void EffUI::EQbandUpdate(int eqband) {
  //
      int npb = (eqband) * 5 + 10;
      int type = effParam(npb);
      typechoice->value(type);

      if (type == 0)
          bandgroup->deactivate();
      else
          bandgroup->activate();

      if (type > 2)
          qdial->activate();
      else
          qdial->deactivate();

      if (type > 6)
          gaindial->activate();
      else
          gaindial->deactivate();

      int freq = effParam(npb + 1);
      freqdial->value(freq);

      int gain = effParam(npb + 2);
      gaindial->value(gain);

      int q = effParam(npb + 3);
      qdial->value(q);

      int dbl = effParam(npb + 4);
      stagescounter->value(dbl);
}
