# data file for the Fltk User Interface Designer (fluid)
version 1.0308
header_name {.h}
code_name {.cc}
comment {EffUI.h} {not_in_source in_header
}

comment {EffUI.cc} {in_source not_in_header
}

comment {Original ZynAddSubFX author Nasca Octavian Paul
Copyright (C) 2002-2005 Nasca Octavian Paul
Copyright 2009-2010, Alan Calvert
Copyright 2016-2024, 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

} {selected in_source in_header
}

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

decl {\#include <iostream>} {public local
}

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

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

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

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

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

decl {\#include "Misc/NumericFuncs.h"
    using func::power;} {private local
}

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

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

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

decl {\#include "Misc/TextMsgBuffer.h"

    namespace { // Implementation details...
        TextMsgBuffer& textMsgBuffer = TextMsgBuffer::instance();
    }} {private local
}

decl {using std::to_string;} {private global
}

class EQGraph {: {public Fl_Box}
} {
  Function {EQGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
    code {//} {}
  }
  Function {init(SynthEngine* synth, RoutingTag conEQ)} {} {
    code {//
        graph.activate(GuiDataExchange::Connection<EqGraphDTO>{synth->interchange.guiDataExchange, conEQ});} {}
  }
  Function {draw_freq_line(float freq, bool major = false)} {} {
    code {//
        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());} {}
  }
  Function {draw()} {} {
    code {//
        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);} {}
  }
  Function {lookupResponse(float scaleFac)} {return_type float
  } {
    code {return graph.get().lookup(scaleFac);} {}
  }
  decl {MirrorData<EqGraphDTO> graph;} {private local
  }
}

class EffUI {: {public Fl_Group,public PresetsUI_}
} {
  Function {EffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {//
    filterwindow = NULL;
    fwin_filterui = NULL;} {}
  }
  Function {~EffUI()} {} {
    code {//
        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);
        }} {}
  }
  Function {make_null_window()} {} {
    Fl_Window effnullwindow {
      xywh {912 927 380 95} type Double box PLASTIC_THIN_UP_BOX color 223 hide
      class Fl_Group
    } {
      Fl_Text_Display noeffect {
        label {No Effects Applied}
        xywh {120 35 10 20} box NO_BOX labelfont 1 labelcolor 64 align 8 textcolor 64
      }
    }
  }
  Function {make_reverb_window()} {} {
    Fl_Window effreverbwindow {
      xywh {839 53 380 95} type Double box PLASTIC_UP_BOX color 223 labelsize 12 labelcolor 64 align 33 hide
      class Fl_Group
    } {
      Fl_Text_Display revname {
        label {Reverb }
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice revp {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::reverb), TOPLEVEL::type::Integer);}
        xywh {115 13 90 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {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 revp10 {
        label Type
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 10, o->value(), (EFFECT::type::reverb), TOPLEVEL::type::Integer);}
        xywh {240 13 75 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {o->add("Random");o->add("Freeverb");o->add("Bandwidth");}
      } {}
      Fl_Dial revp0 {
        label Vol
        callback {//
        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);}
        tooltip {Effect volume} xywh {10 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code1 {o->setValueType(VC_FXReverbVol);}
        class WidgetPDial
      }
      Fl_Dial revp1 {
        label Pan
        callback {//
        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);}
        xywh {45 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code1 {o->setValueType(VC_PanningStd);}
        class WidgetPDial
      }
      Fl_Dial revp2 {
        label Time
        callback {//
        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);}
        tooltip {Duration of effect} xywh {80 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code1 {o->setValueType(VC_FXReverbTime);}
        class WidgetPDial
      }
      Fl_Dial revp3 {
        label {I.del}
        callback {//
        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);}
        tooltip {Initial delay} xywh {120 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127
        code0 {o->setValueType(VC_FXReverbIDelay);}
        class WidgetPDial
      }
      Fl_Dial revp4 {
        label {I.delfb}
        callback {//
        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);}
        tooltip {Initial delay feedback} xywh {155 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_percent128);}
        class WidgetPDial
      }
      Fl_Dial revp12 {
        label BW
        callback {//
        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);}
        xywh {200 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 deactivate
        code0 {if (effParam(10)==2) o->activate();}
        code1 {o->setValueType(VC_FXReverbBandwidth);}
        class WidgetPDial
      }
      Fl_Dial revp6 {
        label {E/R}
        callback {//
        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);}
        xywh {235 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 deactivate
        class WidgetPDial
      }
      Fl_Dial revp7 {
        label LPF
        callback {//
        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);}
        tooltip {Low pass filter} xywh {270 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXReverbLowPass);}
        class WidgetPDial
      }
      Fl_Dial revp8 {
        label HPF
        callback {//
        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);}
        tooltip {High pass filter} xywh {305 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXReverbHighPass);}
        class WidgetPDial
      }
      Fl_Dial revp9 {
        label Damp
        callback {//
        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);}
        tooltip Dampening xywh {340 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 minimum 64 maximum 127 step 1
        code0 {o->setValueType(VC_percent64_127);}
        class WidgetPDial
      }
      Fl_Dial revp11 {
        label {R.S.}
        callback {//
        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);}
        tooltip RoomSize xywh {342 8 25 25} box ROUND_UP_BOX labelsize 10 labelcolor 64 align 4 minimum 1 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
    }
  }
  Function {make_echo_window()} {} {
    Fl_Window effechowindow {
      xywh {782 171 380 95} type Double box PLASTIC_UP_BOX color 223 labelfont 1 labelsize 12 hide
      class Fl_Group
    } {
      Fl_Text_Display echoname {
        label Echo
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice echop {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);}
        xywh {102 13 96 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {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_Dial echop0 {
        label Vol
        callback {//
        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);}
        tooltip {Effect volume} xywh {10 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXEchoVol);}
        class WidgetPDial
      }
      Fl_Dial echop1 {
        label Pan
        callback {//
        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);}
        xywh {64 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_PanningStd);}
        class WidgetPDial
      }
      Fl_Dial echop2 {
        label Delay
        callback {//
        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);}
        xywh {118 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXEchoDelay);}
        code1 {o->label(isSepDelay() ? "L.Delay" : "Delay");}
        class WidgetPDial
      }
      Fl_Dial echop3 {
        label {LRdl.}
        callback {//
        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);}
        tooltip {If Sep is disabled: Delay between L/R
If Sep is enabled: Right Delay} xywh {172 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(isSepDelay() ? (isBeatSync() ? VC_FXlfofreqBPM : VC_FXEchoDelay) : VC_FXEchoLRdel);}
        code1 {o->label(isSepDelay() ? "R.Delay" : "LRdl.");}
        class WidgetPDial
      }
      Fl_Dial echop4 {
        label {LRc.}
        callback {//
        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);}
        tooltip {L/R crossover} xywh {226 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial echop5 {
        label {Fb.}
        callback {//
        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);}
        tooltip Feedback xywh {280 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial echop6 {
        label Damp
        callback {//
        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);}
        tooltip Dampening xywh {334 45 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Check_Button echop7 {
        label Separate
        callback {//
        send_data(0, EFFECT::control::sepLRDelay, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);}
        tooltip {Separate Left / Right Delay} xywh {153 44 15 15} down_box DOWN_BOX labelsize 11 align 1
      }
      Fl_Check_Button echop17 {
        label BPM
        callback {//
        send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::echo), TOPLEVEL::type::Integer);}
        tooltip {Synchronize the frequency to a multiple of the BPM. Note that the delay is capped at 5 seconds, even if the tempo is slower than this.} xywh {325 15 15 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64
      }
    }
  }
  Function {make_chorus_window()} {} {
    Fl_Window effchoruswindow {
      xywh {712 188 380 95} type Double box PLASTIC_UP_BOX color 223 labelfont 1 hide
      class Fl_Group
    } {
      Fl_Text_Display chorusname {
        label Chorus
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice chorusp {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);}
        xywh {121 13 96 16} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {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 chorusp4 {
        label {LFO type}
        callback {//
        send_data(0, 4, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);}
        tooltip {LFO function} xywh {189 65 43 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 10 labelcolor 64 align 2 textfont 1 textsize 9 textcolor 188
        code0 {o->add("Sine");o->add("Tri");}
      } {}
      Fl_Dial chorusp0 {
        label Vol
        callback {//
        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);}
        xywh {10 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXdefaultVol);}
        class WidgetPDial
      }
      Fl_Dial chorusp1 {
        label Pan
        callback {//
        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);}
        xywh {45 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_PanningStd);}
        class WidgetPDial
      }
      Fl_Dial chorusp2 {
        label Freq
        callback {//
        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);}
        tooltip {LFO frequency} xywh {85 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);}
        class WidgetPDial
      }
      Fl_Dial chorusp18 {
        label Start
        callback {//
        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);}
        tooltip {Start of LFO phase relative to start of beat. This has no effect unless you are syncing to a song position, using MIDI or a plugin host.} xywh {120 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127
        code0 {o->setValueType(VC_PhaseOffset);}
        code1 {if (isBeatSync()) o->activate(); else o->deactivate();}
        class WidgetPDial
      }
      Fl_Dial chorusp3 {
        label Rnd
        callback {//
        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);}
        tooltip {LFO randomness} xywh {155 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial chorusp5 {
        label {St.df}
        callback {//
        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);}
        tooltip {L/R phase shift} xywh {237 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXlfoStereo);}
        class WidgetPDial
      }
      Fl_Dial chorusp6 {
        label Dpth
        callback {//
        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);}
        tooltip {LFO depth} xywh {272 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXChorusDepth);}
        class WidgetPDial
      }
      Fl_Dial chorusp7 {
        label Delay
        callback {//
        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);}
        xywh {307 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXChorusDelay);}
        class WidgetPDial
      }
      Fl_Dial chorusp8 {
        label Fb
        callback {//
        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);}
        tooltip Feedback xywh {342 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXdefaultFb);}
        class WidgetPDial
      }
      Fl_Dial chorusp9 {
        label {L/R}
        callback {//
        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);}
        tooltip {Channel routing} xywh {254 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Check_Button chorusflange {
        label Flange
        callback {//
        send_data(0, 10, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);}
        xywh {120 10 55 20} box THIN_UP_BOX down_box DOWN_BOX color 223 selection_color 64 labelfont 1 labelsize 10 labelcolor 64 hide deactivate
        code0 {o->value(effParam(10));}
        class Fl_Check_Button2
      }
      Fl_Check_Button chorusp11 {
        label Subtract
        callback {//
        send_data(0, 11, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);}
        tooltip {Inverts the output} xywh {300 19 70 16} down_box DOWN_BOX color 223 selection_color 64 labelsize 11 labelcolor 64
        class Fl_Check_Button2
      }
      Fl_Check_Button chorusp17 {
        label BPM
        callback {//
        send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::chorus), TOPLEVEL::type::Integer);}
        tooltip {Synchronize the frequency to a multiple of the BPM.} xywh {190 45 50 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64
      }
    }
  }
  Function {make_phaser_window()} {} {
    Fl_Window effphaserwindow {
      xywh {1121 411 380 95} type Double box PLASTIC_UP_BOX color 223 labelsize 11 hide
      class Fl_Group
    } {
      Fl_Text_Display phasername {
        label Phaser
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice phaserp {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        xywh {65 21 82 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 align 1 textfont 1 textsize 10 textcolor 188
        code0 {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 phaserp4 {
        label {LFO Type}
        callback {//
        send_data(0, 4, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        tooltip {LFO function} xywh {199 65 43 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 10 labelcolor 64 align 2 textfont 1 textsize 9 textcolor 188
        code0 {o->add("Sine");o->add("Tri");}
      } {}
      Fl_Dial phaserp0 {
        label Vol
        callback {//
        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);}
        tooltip {Effect volume} xywh {8 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXdefaultVol);}
        class WidgetPDial
      }
      Fl_Dial phaserp1 {
        label Pan
        callback {//
        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);}
        xywh {46 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_PanningStd);}
        class WidgetPDial
      }
      Fl_Dial phaserp2 {
        label Freq
        callback {//
        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);}
        tooltip {LFO frequency} xywh {84 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);}
        class WidgetPDial
      }
      Fl_Dial phaserp18 {
        label Start
        callback {//
        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);}
        tooltip {Start of LFO phase relative to start of beat. This has no effect unless you are syncing to a song position, using MIDI or a plugin host.} xywh {125 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_PhaseOffset);}
        code1 {if (isBeatSync()) o->activate(); else o->deactivate();}
        class WidgetPDial
      }
      Fl_Dial phaserp3 {
        label Rnd
        callback {//
        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);}
        tooltip {LFO randomness} xywh {165 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Check_Button phaserp17 {
        label BPM
        callback {//
        send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        tooltip {Synchronize the frequency to a multiple of the BPM.} xywh {200 47 17 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 8
        code0 {o->value(isBeatSync());}
        class Fl_Check_Button2
      }
      Fl_Dial phaserp5 {
        label {St.df}
        callback {//
        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);}
        tooltip {Left/Right channel phase shift} xywh {248 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXlfoStereo);}
        class WidgetPDial
      }
      Fl_Dial phaserp6 {
        label Depth
        callback {//
        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);}
        tooltip {LFO depth} xywh {191 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial phaserp7 {
        label Fb
        callback {//
        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);}
        tooltip Feedback xywh {286 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXdefaultFb);}
        class WidgetPDial
      }
      Fl_Counter phaserp8 {
        label Stages
        callback {//
        send_data(0, 8, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        xywh {326 63 45 15} type Simple labelsize 11 labelcolor 64 minimum 1 maximum 12 step 1 textfont 1 textsize 11 textcolor 64
      }
      Fl_Dial phaserp9 {
        label {L/R}
        callback {//
        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);}
        tooltip {Channel routing} xywh {229 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Check_Button phaserp10 {
        label {Sub.}
        callback {//
        send_data(0, 10, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        tooltip {Inverts the output} xywh {356 42 17 16} down_box DOWN_BOX color 223 selection_color 64 labelsize 11 labelcolor 64 align 4
        class Fl_Check_Button2
      }
      Fl_Dial phaserp11 {
        label Phase
        callback {//
        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);}
        xywh {150 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Check_Button phaserp12 {
        label Hyper
        callback {//
        send_data(0, 12, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        tooltip {Hyper-sine} xywh {356 26 17 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 4 deactivate
        class Fl_Check_Button2
      }
      Fl_Dial phaserp13 {
        label Dist
        callback {//
        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);}
        tooltip Distortion xywh {267 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127 step 1 deactivate
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Check_Button phaserp14 {
        label Analog
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 14, o->value(), (EFFECT::type::phaser), TOPLEVEL::type::Integer);}
        tooltip {Emulates FET} xywh {356 10 17 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 4
        class Fl_Check_Button2
      }
    }
  }
  Function {make_alienwah_window()} {} {
    Fl_Window effalienwahwindow {
      xywh {877 543 380 95} type Double box PLASTIC_UP_BOX color 223 labelfont 1 hide
      class Fl_Group
    } {
      Fl_Text_Display alienname {
        label AlienWah
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice awp {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);}
        xywh {135 13 96 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {o->add("Alienwah 1");o->add("Alienwah 2");o->add("Alienwah 3");o->add("Alienwah 4");}
      } {}
      Fl_Choice awp4 {
        label {LFO type}
        callback {//
        send_data(0, 4, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);}
        tooltip {LFO function} xywh {185 65 43 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 10 labelcolor 64 align 2 textfont 1 textsize 9 textcolor 188
        code0 {o->add("Sine");o->add("Tri");}
      } {}
      Fl_Dial awp0 {
        label Vol
        callback {//
        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);}
        tooltip {Effect volume} xywh {5 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial awp1 {
        label Pan
        callback {//
        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);}
        xywh {40 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial awp2 {
        label Freq
        callback {//
        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);}
        tooltip {LFO frequency} xywh {80 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);}
        class WidgetPDial
      }
      Fl_Dial awp3 {
        label Rnd
        callback {//
        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);}
        tooltip {LFO randomness} xywh {150 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial awp18 {
        label Start
        callback {//
        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);}
        tooltip {Start of LFO phase relative to start of beat. This has no effect unless you are syncing to a song position, using MIDI or a plugin host.} xywh {115 50 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_PhaseOffset);}
        code1 {if (isBeatSync()) o->activate(); else o->deactivate();}
        class WidgetPDial
      }
      Fl_Dial awp5 {
        label {St.df}
        callback {//
        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);}
        tooltip {Left/Right channel phase shift} xywh {231 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial awp6 {
        label Dpth
        callback {//
        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);}
        tooltip Depth xywh {266 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial awp7 {
        label Fb
        callback {//
        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);}
        tooltip Feedback xywh {301 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial awp9 {
        label {L/R}
        callback {//
        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);}
        xywh {285 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial awp10 {
        label Phase
        callback {//
        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);}
        xywh {245 15 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 1 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Counter awp8 {
        label Delay
        callback {//
        send_data(0, 8, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);}
        xywh {338 64 35 15} type Simple labelsize 11 labelcolor 64 minimum 0 maximum 100 step 1 textsize 11 textcolor 64
      }
      Fl_Check_Button awp17 {
        label BPM
        callback {//
        send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::alienWah), TOPLEVEL::type::Integer);}
        tooltip {Synchronize the frequency to a multiple of the BPM.} xywh {185 45 45 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64
        code0 {o->value(isBeatSync());}
      }
    }
  }
  Function {make_distortion_window()} {} {
    Fl_Window effdistortionwindow {
      xywh {879 667 380 95} type Double box PLASTIC_UP_BOX color 223 labelfont 1 hide
      class Fl_Group
    } {
      Fl_Text_Display distname {
        label Distortion
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice distp {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);}
        xywh {139 13 96 16} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {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 distp5 {
        label Type
        callback {//
        send_data(0, 5, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);}
        xywh {192 56 60 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 10 labelcolor 64 align 2 textfont 1 textsize 9 textcolor 188
        code0 {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_Dial distp0 {
        label Vol
        callback {//
        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);}
        tooltip {Effect volume} xywh {10 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXDistVol);}
        class WidgetPDial
      }
      Fl_Dial distp1 {
        label Pan
        callback {//
        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);}
        xywh {45 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_PanningStd);}
        class WidgetPDial
      }
      Fl_Dial distp2 {
        label {LRc.}
        callback {//
        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);}
        tooltip {L/R mix} xywh {80 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial distp3 {
        label Drive
        callback {//
        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);}
        tooltip {Input amplification} xywh {120 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial distp4 {
        label Level
        callback {//
        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);}
        tooltip {Output amplification} xywh {155 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXDistLevel);}
        class WidgetPDial
      }
      Fl_Dial distp7 {
        label LPF
        callback {//
        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);}
        tooltip {Low pass filter} xywh {285 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXDistLowPass);}
        class WidgetPDial
      }
      Fl_Dial distp8 {
        label HPF
        callback {//
        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);}
        tooltip {High pass filter} xywh {320 40 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(VC_FXDistHighPass);}
        class WidgetPDial
      }
      Fl_Check_Button distp6 {
        label {Neg.}
        callback {//
        send_data(0, 6, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);}
        xywh {260 55 15 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 2
        class Fl_Check_Button2
      }
      Fl_Check_Button distp9 {
        label {St.}
        callback {//
        send_data(0, 9, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);}
        tooltip Stereo xywh {357 55 15 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 2
        class Fl_Check_Button2
      }
      Fl_Check_Button distp10 {
        label PF
        callback {//
        send_data(0, 10, o->value(), (EFFECT::type::distortion), TOPLEVEL::type::Integer);}
        tooltip {Applies the filters(before or after) the distortion} xywh {357 38 15 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 1
        class Fl_Check_Button2
      }
    }
  }
  Function {make_eq_window()} {} {
    Fl_Window effeqwindow {
      xywh {753 685 380 95} type Double box PLASTIC_UP_BOX color 223 labelfont 1 hide
      class Fl_Group
    } {
      Fl_Text_Display eqname {
        label EQ
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Dial eqp0 {
        label Gain
        callback {//
	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);}
        xywh {10 41 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127
        code0 {o->setValueType(VC_FXEQgain);}
        class WidgetPDial
      }
      Fl_Counter bandcounter {
        label Band
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 1, o->value() - 1, (EFFECT::type::eq), TOPLEVEL::type::Integer);}
        tooltip {Band no.} xywh {263 20 45 15} type Simple labelsize 11 labelcolor 64 align 1 minimum 0 maximum 1 step 1 value 1 textsize 11 textcolor 64
        code0 {o->bounds(1,MAX_EQ_BANDS);}
      }
      Fl_Choice typechoice {
        label Type
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 10, o->value(), (EFFECT::type::eq), TOPLEVEL::type::Integer);}
        tooltip Type xywh {323 20 40 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 align 1 when 6 textfont 1 textsize 9 textcolor 188
        code0 {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_Group bandgroup {
        xywh {241 40 134 45} box ENGRAVED_FRAME deactivate
      } {
        Fl_Dial freqdial {
          label Freq
          callback {//
        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);}
          xywh {247 45 25 25} box ROUND_UP_BOX labelsize 10 labelcolor 64 when 3 maximum 127
          code0 {o->setValueType(VC_FXEQfreq);}
          class WidgetPDial
        }
        Fl_Dial gaindial {
          label Gain
          callback {//
        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);}
          xywh {277 45 25 25} box ROUND_UP_BOX labelsize 10 labelcolor 64 when 3 maximum 127 step 1
          code0 {o->setValueType(VC_FXEQfilterGain);}
          class WidgetPDial
        }
        Fl_Dial qdial {
          label Q
          callback {//
        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);}
          tooltip {Resonance/Bandwidth} xywh {307 45 25 25} box ROUND_UP_BOX labelsize 10 labelcolor 64 when 3 maximum 127
          code0 {o->setValueType(VC_FXEQq);}
          class WidgetPDial
        }
        Fl_Counter stagescounter {
          label Stages
          callback {//
          send_data(TOPLEVEL::action::forceUpdate, 14, o->value(), (EFFECT::type::eq), TOPLEVEL::type::Integer);}
          tooltip {Additional filter stages} xywh {337 55 30 15} type Simple labelsize 10 labelcolor 64 minimum 1 maximum 127 step 1 value 1 textfont 1 textsize 11 textcolor 64
          code0 {o->bounds(0,MAX_FILTER_STAGES - 1);}
        }
        Fl_Text_Display extra {
          label Extra
          xywh {334 55 35 0} labelsize 11 labelcolor 64 textsize 9 textcolor 64
        }
      }
      Fl_Box eqgraph {
        xywh {45 10 190 75} box BORDER_BOX
        class EQGraph
      }
    }
  }
  Function {make_dynamicfilter_window()} {} {
    Fl_Window effdynamicfilterwindow {
      xywh {877 915 380 95} type Double box PLASTIC_UP_BOX color 223 labelfont 1 hide
      class Fl_Group
    } {
      Fl_Text_Display dfname {
        label DynFilter
        xywh {10 10 0 20} box NO_BOX labelfont 1 labelsize 12 labelcolor 64 align 8 textcolor 64
      }
      Fl_Choice dfp {
        label Preset
        callback {//
        send_data(TOPLEVEL::action::forceUpdate, 16, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);}
        xywh {132 13 90 16} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 11 labelcolor 64 textfont 1 textsize 10 textcolor 188
        code0 {o->add("WahWah");o->add("AutoWah");o->add("Sweep");o->add("VocalMorph1");o->add("VocalMorph2");}
      } {}
      Fl_Choice dfp4 {
        label {LFO type}
        callback {//
        send_data(0, 4, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);}
        tooltip {LFO function} xywh {190 60 43 15} box UP_BOX down_box BORDER_BOX selection_color 49 labelsize 10 labelcolor 64 align 2 textfont 1 textsize 9 textcolor 188
        code0 {o->add("Sine");o->add("Tri");}
      } {}
      Fl_Dial dfp0 {
        label Vol
        callback {//
        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);}
        tooltip {Effect volume} xywh {6 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial dfp1 {
        label Pan
        callback {//
        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);}
        xywh {42 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial dfp2 {
        label Freq
        callback {//
        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);}
        tooltip {LFO frequency} xywh {80 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        code0 {o->setValueType(isBeatSync() ? VC_FXlfofreqBPM : VC_FXlfofreq);}
        class WidgetPDial
      }
      Fl_Dial dfp3 {
        label Rnd
        callback {//
        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);}
        tooltip {LFO randomness} xywh {155 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_percent127);}
        class WidgetPDial
      }
      Fl_Dial dfp18 {
        label Start
        callback {//
        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);}
        tooltip {Start of LFO phase relative to start of beat. This has no effect unless you are syncing to a song position, using MIDI or a plugin host.} xywh {118 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 when 4 maximum 127 step 1
        code0 {o->setValueType(VC_PhaseOffset);}
        code1 {if (isBeatSync()) o->activate(); else o->deactivate();}
        class WidgetPDial
      }
      Fl_Dial dfp5 {
        label {St.df}
        callback {//
        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);}
        tooltip {Left/Right channel phase shift} xywh {240 49 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Dial dfp6 {
        label LfoD
        callback {//
        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);}
        tooltip {LFO depth} xywh {240 8 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 align 8 maximum 127 step 1
        class WidgetPDial
      }
      Fl_Button filter {
        label Filter
        callback {//
        Showfilt();}
        xywh {325 12 37 16} box GTK_THIN_UP_BOX color 221 labelsize 11 labelcolor 64
      }
      Fl_Group {} {
        xywh {277 37 99 53} box EMBOSSED_BOX color 181
      } {
        Fl_Dial dfp7 {
          label {A.S.}
          callback {//
          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);}
          tooltip {Filter vs amplitude} xywh {282 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
          class WidgetPDial
        }
        Fl_Dial dfp9 {
          label {A.M}
          callback {//
        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);}
          tooltip {Rate that  amplitude changes the filter} xywh {318 44 30 30} box ROUND_UP_BOX labelsize 11 labelcolor 64 maximum 127 step 1
          class WidgetPDial
        }
        Fl_Check_Button dfp8 {
          label {Inv.}
          callback {//
          send_data(0, 8, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);}
          tooltip {Enable for filter frequency to lower with higher input amplitude} xywh {353 58 15 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64 align 2
          class Fl_Check_Button2
        }
      }
      Fl_Check_Button dfp17 {
        label BPM
        callback {//
        send_data(0, EFFECT::control::bpm, o->value(), (EFFECT::type::dynFilter), TOPLEVEL::type::Integer);}
        tooltip {Synchronize the frequency to a multiple of the BPM.} xywh {191 41 45 15} down_box DOWN_BOX selection_color 64 labelsize 11 labelcolor 64
        code0 {o->value(isBeatSync());}
      }
    }
  }
  Function {make_filter_window()} {} {
    Fl_Window filterwindow {
      label {Yoshimi : Filter Parameters for DynFilter Effect}
      callback {filterclose->do_callback();}
      xywh {1109 779 285 110} type Double hide resizable
      code0 {filtDW = o->w(); filtDH = o->h();}
      code1 {o->size_range(filtDW, filtDH, 0, 0, 0, 0, 1);}
      code2 {o->copy_label(textMsgBuffer.fetch(collect_readData(synth, textMsgBuffer.push("DynFilter"), npart, TOPLEVEL::windowTitle,UNUSED, effNum())).c_str());}
    } {
      Fl_Group fwin_filterui {
        label {DynFilter effect  - Filter}
        xywh {5 5 275 75} box FLAT_BOX color 50 labelsize 12 align 144
        code0 {o->init(effect.get().eff_in_core_TODO_deprecated->filterpars,NULL,NULL, npart, (EFFECT::type::dynFilter), effNum());}
        class FilterUI
      } {}
      Fl_Button filterclose {
        label Close
        callback {//
    saveWin(synth, filterwindow->w(), filterwindow->h(), filterwindow->x(), filterwindow->y(), false, "xFilter-dynamic " + to_string(npart));
    filterwindow->hide();}
        xywh {124 86 46 20} box THIN_UP_BOX color 196 labelsize 12 labelcolor 64
      }
    }
  }
  Function {isInsert()} {return_type bool
  } {
    code {return effect.get().isInsert;} {}
  }
  Function {isBeatSync()} {return_type bool
  } {
    code {return effect.get().param[EFFECT::control::bpm];} {}
  }
  Function {isSepDelay()} {return_type bool
  } {
    code {return effect.get().param[EFFECT::control::sepLRDelay];} {}
  }
  Function {isEnabled()} {return_type bool
  } {
    code {return effect.get().enabled;} {}
  }
  Function {isChanged()} {return_type bool
  } {
    code {return effect.get().changed;} {}
  }
  Function {effNum()} {return_type uchar
  } {
    code {return effect.get().effNum;} {}
  }
  Function {effType()} {return_type int
  } {
    code {return effect.get().effType;} {}
  }
  Function {effParam(uint paramNum)} {return_type uchar
  } {
    code {return effect.get().param[paramNum];} {}
  }
  Function {effPreset()} {return_type uchar
  } {
    code {return effect.get().currPreset;} {}
  }
  Function {getInsertFxRouting()} {return_type int
  } {
    code {return effect.get().insertFxRouting;} {}
  }
  Function {getPartFxRouting()} {return_type uchar
  } {
    code {return effect.get().partFxRouting;} {}
  }
  Function {getPartFxBypass()} {return_type bool
  } {
    code {return effect.get().partFxBypass;} {}
  }
  Function {send_data(int action, int control, float value, int group, int type)} {} {
    code {//
    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);} {}
  }
  Function {fetchData(float value, int control, int part, int kititem = UNUSED, int engine = UNUSED, int insert = UNUSED, int parameter = UNUSED, int offset = UNUSED, int miscmsg = UNUSED, int request = UNUSED)} {return_type float
  } {
    code {//
        return collect_readData(synth, value, control, part, kititem, engine, insert, parameter, offset, miscmsg, request);} {}
  }
  Function {returns_update(CommandBlock *getData)} {} {
    code {//
    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;
    };} {}
  }
  Function {init(SynthEngine* synth_, RoutingTag conEffect, RoutingTag conEQ, int npart_)} {} {
    code {//
    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();} {}
  }
  Function {refresh(int npart_)} {} {
    code {//
    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();
    //if (nextEff != EFFECT::type::none)
    {
        //effRtext(this->w()/380, nextEff - EFFECT::type::none);
    }} {}
  }
  Function {refresh()} {} {
    code {refresh(npart);} {}
  }
  Function {UpdatePresetColour(int changed, int efftype)} {} {
    code {//
    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;
    }
    //} {}
  }
  Function {effRtext(float dScale, int efftype)} {} {
    code {//
        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;
        }} {}
  }
  Function {Showfilt()} {} {
    code {//
    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();} {}
  }
  Function {filtRtext()} {} {
    code {//
    float dScale = filterwindow->w() / filtDW;
    if (dScale < 1.0f)
        dScale = 1.0f;

    filterclose->labelsize(12 * dScale);

    fwin_filterui->filterRtext(dScale);

    filterwindow->redraw();} {}
  }
  Function {EQbandUpdate(int eqband)} {} {
    code {//
    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);} {}
  }
  decl {SynthEngine *synth;} {private local
  }
  decl {MirrorData<EffectDTO> effect;} {private local
  }
  decl {int eqband;} {private local
  }
  decl {int npart;} {private local
  }
  decl {float filtDW;} {private local
  }
  decl {float filtDH;} {private local
  }
  decl {int lastEff;} {private local
  }
  decl {int presetNum;} {private local
  }
}
