|
- # data file for the Fltk User Interface Designer (fluid)
- version 1.0110
- header_name {.h}
- code_name {.cc}
- decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
-
- decl {//License: GNU GPL version 2 or later} {}
-
- decl {\#include "WidgetPDial.h"} {public
- }
-
- decl {\#include <stdio.h>} {public
- }
-
- decl {\#include <stdlib.h>} {public
- }
-
- decl {\#include "../globals.h"} {public
- }
-
- decl {\#include <FL/Fl_Group.H>} {public
- }
-
- decl {\#include "../Params/EnvelopeParams.h"} {public
- }
-
- decl {\#include <FL/Fl_Box.H>} {public
- }
-
- decl {\#include <FL/fl_draw.H>} {public
- }
-
- decl {\#include <FL/fl_ask.H>} {public
- }
-
- decl {\#include "PresetsUI.h"} {public
- }
-
- decl {\#include "common.H"} {public
- }
-
- class EnvelopeFreeEdit {: {public Fl_Box}
- } {
- Function {EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
- code {env=NULL;
- pair=NULL;} {}
- }
- Function {init(EnvelopeParams *env_)} {} {
- code {env=env_;
- oldx=-1;
- currentpoint=-1;
- cpx=0;
- lastpoint=-1;
- ctrldown=false;} {}
- }
- Function {setpair(Fl_Box *pair_)} {} {
- code {pair=pair_;} {}
- }
- Function {getpointx(int n)} {return_type int
- } {
- code {int lx=w()-10;
- int npoints=env->Penvpoints;
-
- float sum=0;
- for (int i=1;i<npoints;i++) sum+=env->getdt(i)+1;
-
- float sumbefore=0;//the sum of all points before the computed point
- for (int i=1;i<=n;i++) sumbefore+=env->getdt(i)+1;
-
- return((int) (sumbefore/(float) sum*lx));} {}
- }
- Function {getpointy(int n)} {return_type int
- } {
- code {int ly=h()-10;
-
- return((int) ((1.0-env->Penvval[n]/127.0)*ly));} {}
- }
- Function {getnearest(int x,int y)} {return_type int
- } {
- code {x-=5;y-=5;
-
- int nearestpoint=0;
- int nearestval=1000000;//a big value
- for (int i=0;i<env->Penvpoints;i++){
- int distance=abs(x-getpointx(i))+abs(y-getpointy(i));
- if (distance<nearestval) {
- nearestpoint=i;
- nearestval=distance;
- };
- };
- return(nearestpoint);} {}
- }
- Function {draw()} {private
- } {
- code {int ox=x(),oy=y(),lx=w(),ly=h();
- if (env->Pfreemode==0) env->converttofree();
- int npoints=env->Penvpoints;
-
- if (active_r()) fl_color(FL_BLACK);
- else fl_color(90,90,90);
- if (!active_r()) currentpoint=-1;
-
- fl_rectf(ox,oy,lx,ly);
-
- ox+=5;oy+=5;lx-=10;ly-=10;
-
- //draw the lines
- fl_color(FL_GRAY);
-
- fl_line_style(FL_SOLID);
- fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2);
-
- //draws the evelope points and lines
- Fl_Color alb=FL_WHITE;
- if (!active_r()) alb=fl_rgb_color(180,180,180);
- fl_color(alb);
- int oldxx=0,xx=0,oldyy=0,yy=getpointy(0);
- fl_rectf(ox-3,oy+yy-3,6,6);
- for (int i=1;i<npoints;i++){
- oldxx=xx;oldyy=yy;
- xx=getpointx(i);yy=getpointy(i);
- if (i==currentpoint) fl_color(FL_RED);
- else fl_color(alb);
- fl_line(ox+oldxx,oy+oldyy,ox+xx,oy+yy);
- fl_rectf(ox+xx-3,oy+yy-3,6,6);
- };
-
- //draw the last moved point point (if exists)
- if (lastpoint>=0){
- fl_color(FL_CYAN);
- fl_rectf(ox+getpointx(lastpoint)-5,oy+getpointy(lastpoint)-5,10,10);
- };
-
- //draw the sustain position
- if (env->Penvsustain>0){
- fl_color(FL_YELLOW);
- xx=getpointx(env->Penvsustain);
- fl_line(ox+xx,oy+0,ox+xx,oy+ly);
- };
-
- //Show the envelope duration and the current line duration
- fl_font(FL_HELVETICA|FL_BOLD,10);
- float time=0.0;
- if (currentpoint<=0 && (!ctrldown||lastpoint <= 0)){
- fl_color(alb);
- for (int i=1;i<npoints;i++) time+=env->getdt(i);
- } else {
- fl_color(255,0,0);
- time=env->getdt(lastpoint);
- };
- char tmpstr[20];
- if (time<1000.0) snprintf((char *)&tmpstr,20,"%.1fms",time);
- else snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0);
- fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0);
- if (lastpoint>=0){
- snprintf((char *)&tmpstr,20,"%d", env->Penvval[lastpoint]);
- fl_draw(tmpstr,ox+lx-20,oy+ly-23,20,10,FL_ALIGN_RIGHT,NULL,0);
- }} {}
- }
- Function {handle(int event)} {return_type int
- } {
- code {int x_=Fl::event_x()-x();
- int y_=Fl::event_y()-y();
-
- // Some window magic makes us lose focus, so reassert it.
- if (event==FL_ENTER)
- Fl::focus(this);
-
- if ((event==FL_KEYDOWN || event==FL_KEYUP)){
- int key = Fl::event_key();
- if (key==FL_Control_L || key==FL_Control_R){
- ctrldown = (event==FL_KEYDOWN);
- redraw();
- if (pair!=NULL) pair->redraw();
- }
- }
-
- if (event==FL_MOUSEWHEEL && lastpoint>=0) {
- if (!ctrldown) {
- int ny=env->Penvval[lastpoint] - Fl::event_dy();
- env->Penvval[lastpoint]=ny < 0 ? 0 : ny > 127 ? 127 : ny;
- } else if (lastpoint > 0) {
- int newdt = Fl::event_dy() + env->Penvdt[lastpoint];
- env->Penvdt[lastpoint] = newdt < 0 ? 0 : newdt > 127 ? 127 : newdt;
- }
- redraw();
- if (pair!=NULL) pair->redraw();
- }
-
- if (event==FL_PUSH) {
- currentpoint=getnearest(x_,y_);
- cpx=x_;
- cpdt=env->Penvdt[currentpoint];
- lastpoint=currentpoint;
- redraw();
- if (pair!=NULL) pair->redraw();
- };
-
- if (event==FL_RELEASE){
- currentpoint=-1;
- redraw();
- if (pair!=NULL) pair->redraw();
- };
-
- if ((event==FL_DRAG)&&(currentpoint>=0)){
- int ny=127-(int) (y_*127.0/h());
- if (ny<0) ny=0;if (ny>127) ny=127;
- env->Penvval[currentpoint]=ny;
-
- int dx=(int)((x_-cpx)*0.1);
- int newdt=cpdt+dx;
- if (newdt<0) newdt=0;if (newdt>127) newdt=127;
- if (currentpoint!=0) env->Penvdt[currentpoint]=newdt;
- else env->Penvdt[currentpoint]=0;
-
- redraw();
- if (pair!=NULL) pair->redraw();
- };
-
-
- return(1);} {}
- }
- decl {Fl_Box *pair;} {}
- decl {EnvelopeParams *env;} {}
- decl {int oldx,oldy;} {}
- decl {int currentpoint,cpx,cpdt;} {}
- decl {int lastpoint;} {public
- }
- decl {bool ctrldown;} {}
- }
-
- class EnvelopeUI {open : {public Fl_Group,PresetsUI_}
- } {
- Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
- code {env=NULL;
- freemodeeditwindow=NULL;
- envADSR=NULL;
- envASR=NULL;
- envADSRfilter=NULL;
- envASRbw=NULL;
- envfree=NULL;} {}
- }
- Function {~EnvelopeUI()} {} {
- code {envwindow->hide();
- hide();
- freemodeeditwindow->hide();
- delete (freemodeeditwindow);} {}
- }
- Function {make_freemode_edit_window()} {open
- } {
- Fl_Window freemodeeditwindow {
- label Envelope
- xywh {702 269 575 180} type Double visible
- } {
- Fl_Box freeedit {
- label Envelope
- xywh {5 5 565 145} box FLAT_BOX color 0
- code0 {o->init(env);}
- class EnvelopeFreeEdit
- }
- Fl_Button addpoint {
- label {Add point}
- callback {int curpoint=freeedit->lastpoint;
- if (curpoint<0) return;
- //if (curpoint>=env->Penvpoints-1) return;
- if (env->Penvpoints>=MAX_ENVELOPE_POINTS) return;
-
- for (int i=env->Penvpoints;i>=curpoint+1;i--){
- env->Penvdt[i]=env->Penvdt[i-1];
- env->Penvval[i]=env->Penvval[i-1];
- };
-
- if (curpoint==0) {
- env->Penvdt[1]=64;
- };
-
- env->Penvpoints++;
- if (curpoint<=env->Penvsustain) env->Penvsustain++;
-
- freeedit->lastpoint+=1;
- freeedit->redraw();
- envfree->redraw();
-
- sustaincounter->value(env->Penvsustain);
- sustaincounter->maximum(env->Penvpoints-2);}
- xywh {115 155 80 20} box THIN_UP_BOX labelsize 11
- code0 {if (env->Pfreemode==0) o->hide();}
- }
- Fl_Button deletepoint {
- label {Delete point}
- callback {int curpoint=freeedit->lastpoint;
- if (curpoint<1) return;
- if (curpoint>=env->Penvpoints-1) return;
- if (env->Penvpoints<=3) return;
-
- for (int i=curpoint+1;i<env->Penvpoints;i++){
- env->Penvdt[i-1]=env->Penvdt[i];
- env->Penvval[i-1]=env->Penvval[i];
- };
-
- env->Penvpoints--;
-
- if (curpoint<=env->Penvsustain) env->Penvsustain--;
-
-
- freeedit->lastpoint-=1;
- freeedit->redraw();
- envfree->redraw();
-
- sustaincounter->value(env->Penvsustain);
- sustaincounter->maximum(env->Penvpoints-2);}
- xywh {200 155 80 20} box THIN_UP_BOX labelsize 11
- code0 {if (env->Pfreemode==0) o->hide();}
- }
- Fl_Check_Button freemodebutton {
- label FreeMode
- callback {reinit();
-
- freeedit->lastpoint=-1;
- freeedit->redraw();}
- tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11
- }
- Fl_Check_Button forcedreleasecheck {
- label frcR
- callback {env->Pforcedrelease=(int)o->value();}
- tooltip {Forced Relase} xywh {410 165 40 15} down_box DOWN_BOX labelsize 10
- code0 {o->value(env->Pforcedrelease);}
- code1 {if (env->Pfreemode==0) o->hide();}
- }
- Fl_Dial envstretchdial {
- label {Str.}
- callback {env->Penvstretch=(int)o->value();}
- tooltip {Envelope stretch (on lower notes make the envelope longer)} xywh {380 155 25 25} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1
- code0 {o->value(env->Penvstretch);}
- code1 {if (env->Pfreemode==0) o->hide();}
- class WidgetPDial
- }
- Fl_Button {} {
- label Close
- callback {freemodeeditwindow->hide();}
- xywh {510 155 60 20} box THIN_UP_BOX
- }
- Fl_Check_Button linearenvelopecheck {
- label L
- callback {env->Plinearenvelope=(int)o->value();}
- tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 10
- code0 {o->value(env->Plinearenvelope);}
- code1 {if ((env->Pfreemode==0)||(env->Envmode>2)) o->hide();}
- }
- Fl_Counter sustaincounter {
- label Sust
- callback {env->Penvsustain=(int) o->value();
- freeedit->redraw();
- envfree->redraw();}
- tooltip {Sustain (0 is disabled)} xywh {315 155 40 15} type Simple labelsize 11 align 4 minimum 0 maximum 127 step 1
- code0 {o->value(env->Penvsustain);}
- code1 {if (env->Pfreemode==0) o->hide();}
- code2 {o->maximum(env->Penvpoints-2);}
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(env);}
- xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(env,this);}
- xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- }
- }
- Function {make_ADSR_window()} {open
- } {
- Fl_Window envADSR {open
- xywh {344 788 205 70} type Double color 50 labelfont 1
- class Fl_Group visible
- } {
- Fl_Group {} {
- label {Amplitude Envelope}
- xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
- code0 {set_module_parameters(o);}
- } {
- Fl_Dial e1adt {
- label {A.dt}
- callback {env->PA_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Attack time} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_dt);}
- class WidgetPDial
- }
- Fl_Dial e1ddt {
- label {D.dt}
- callback {env->PD_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Decay time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PD_dt);}
- class WidgetPDial
- }
- Fl_Dial e1rdt {
- label {R.dt}
- callback {env->PR_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Release time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_dt);}
- class WidgetPDial
- }
- Fl_Dial e1sval {
- label {S.val}
- callback {env->PS_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Sustain value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PS_val);}
- class WidgetPDial
- }
- Fl_Check_Button e1forcedrelease {
- label frcR
- callback {env->Pforcedrelease=(int)o->value();}
- tooltip {Forced Relase} xywh {180 35 20 15} down_box DOWN_BOX labelsize 10 align 6
- code0 {o->value(env->Pforcedrelease);}
- }
- Fl_Dial e1envstretch {
- label Stretch
- callback {env->Penvstretch=(int)o->value();}
- tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->Penvstretch);}
- class WidgetPDial
- }
- Fl_Button {} {
- label E
- callback {freemodeeditwindow->show();}
- tooltip {Envelope window} xywh {185 5 15 15} labelfont 1 labelsize 10
- }
- Fl_Check_Button e1linearenvelope {
- label L
- callback {env->Plinearenvelope=(int)o->value();}
- tooltip {The evelope is linear} xywh {180 20 15 15} down_box DOWN_BOX labelsize 10 align 4
- code0 {o->value(env->Plinearenvelope);}
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(env);}
- xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(env,this);}
- xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- }
- }
- }
- Function {make_ASR_window()} {open
- } {
- Fl_Window envASR {open
- xywh {648 667 210 70} type Double
- class Fl_Group visible
- } {
- Fl_Group {} {
- label {Frequency Envelope}
- xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
- code0 {set_module_parameters(o);}
- } {
- Fl_Dial e2aval {
- label {A.val}
- callback {env->PA_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_val);}
- class WidgetPDial
- }
- Fl_Dial e2adt {
- label {A.dt}
- callback {env->PA_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_dt);}
- class WidgetPDial
- }
- Fl_Dial e2rval {
- label {R.val}
- callback {env->PR_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_val);}
- class WidgetPDial
- }
- Fl_Dial e2rdt {
- label {R.dt}
- callback {env->PR_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_dt);}
- class WidgetPDial
- }
- Fl_Dial e2envstretch {
- label Stretch
- callback {env->Penvstretch=(int)o->value();}
- tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->Penvstretch);}
- class WidgetPDial
- }
- Fl_Check_Button e2forcedrelease {
- label frcR
- callback {env->Pforcedrelease=(int)o->value();}
- tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6
- code0 {o->value(env->Pforcedrelease);}
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(env);}
- xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(env,this);}
- xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- }
- Fl_Button {} {
- label E
- callback {freemodeeditwindow->show();}
- tooltip {Envelope window} xywh {190 5 15 15} labelfont 1 labelsize 10
- }
- }
- }
- Function {make_ADSRfilter_window()} {open
- } {
- Fl_Window envADSRfilter {open selected
- xywh {627 569 275 70} type Double color 50 labelfont 1
- class Fl_Group visible
- } {
- Fl_Group {} {
- label {Filter Envelope}
- xywh {0 0 275 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
- code0 {set_module_parameters(o);}
- } {
- Fl_Dial e3aval {
- label {A.val}
- callback {env->PA_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_val);}
- class WidgetPDial
- }
- Fl_Dial e3adt {
- label {A.dt}
- callback {env->PA_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_dt);}
- class WidgetPDial
- }
- Fl_Dial e3dval {
- label {D.val}
- callback {env->PD_val=(int)o->value();
- freeedit->redraw();}
- tooltip {decay value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PD_val);}
- class WidgetPDial
- }
- Fl_Dial e3ddt {
- label {D.dt}
- callback {env->PD_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {decay time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PD_dt);}
- class WidgetPDial
- }
- Fl_Dial e3rdt {
- label {R.dt}
- callback {env->PR_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Release time} xywh {145 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_dt);}
- class WidgetPDial
- }
- Fl_Dial e3rval {
- label {R.val}
- callback {env->PR_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Release value} xywh {180 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_val);}
- class WidgetPDial
- }
- Fl_Dial e3envstretch {
- label Stretch
- callback {env->Penvstretch=(int)o->value();}
- tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {215 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->Penvstretch);}
- class WidgetPDial
- }
- Fl_Check_Button e3forcedrelease {
- label frcR
- callback {env->Pforcedrelease=(int)o->value();}
- tooltip {Forced Relase} xywh {250 30 15 20} down_box DOWN_BOX labelsize 10 align 6
- code0 {o->value(env->Pforcedrelease);}
- }
- Fl_Button {} {
- label E
- callback {freemodeeditwindow->show();}
- xywh {255 5 15 15} labelfont 1 labelsize 10
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(env);}
- xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(env,this);}
- xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- }
- }
- }
- Function {make_ASRbw_window()} {open
- } {
- Fl_Window envASRbw {open
- xywh {362 642 210 70} type Double
- code0 {set_module_parameters(o);}
- class Fl_Group visible
- } {
- Fl_Group {} {
- label {BandWidth Envelope}
- xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
- code0 {set_module_parameters(o);}
- } {
- Fl_Dial e4aval {
- label {A.val}
- callback {env->PA_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_val);}
- class WidgetPDial
- }
- Fl_Dial e4adt {
- label {A.dt}
- callback {env->PA_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PA_dt);}
- class WidgetPDial
- }
- Fl_Dial e4rval {
- label {R.val}
- callback {env->PR_val=(int)o->value();
- freeedit->redraw();}
- tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_val);}
- class WidgetPDial
- }
- Fl_Dial e4rdt {
- label {R.dt}
- callback {env->PR_dt=(int)o->value();
- freeedit->redraw();}
- tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->PR_dt);}
- class WidgetPDial
- }
- Fl_Dial e4envstretch {
- label Stretch
- callback {env->Penvstretch=(int)o->value();}
- tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(env->Penvstretch);}
- class WidgetPDial
- }
- Fl_Check_Button e4forcedrelease {
- label frcR
- callback {env->Pforcedrelease=(int)o->value();}
- tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6
- code0 {o->value(env->Pforcedrelease);}
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(env);}
- xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(env,this);}
- xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- }
- Fl_Button {} {
- label E
- callback {freemodeeditwindow->show();}
- xywh {190 5 15 15} labelfont 1 labelsize 10
- }
- }
- }
- Function {make_free_window()} {open
- } {
- Fl_Window envfree {open
- xywh {376 436 205 70} type Double color 50 labelfont 1 resizable
- code0 {set_module_parameters(o);}
- class Fl_Group visible
- } {
- Fl_Group envfreegroup {
- label {Amplitude Envelope}
- xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 resizable
- code0 {set_module_parameters(o);}
- } {
- Fl_Box freeeditsmall {
- label Envelope
- callback {envfree->redraw();}
- xywh {5 20 195 45} box FLAT_BOX color 0 resizable
- code0 {o->init(env);}
- class EnvelopeFreeEdit
- }
- Fl_Button {} {
- label E
- callback {freemodeeditwindow->show();}
- xywh {185 5 15 15} labelfont 1 labelsize 10
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(env);}
- xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(env,this);}
- xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
- }
- }
- }
- }
- Function {init(EnvelopeParams *env_)} {open
- } {
- code {env=env_;
- make_ADSR_window();
- make_ASR_window();
- make_ADSRfilter_window();
- make_ASRbw_window();
- make_free_window();
-
- make_freemode_edit_window();
-
- envwindow=NULL;
- if (env->Envmode==3) envfreegroup->label("Frequency Envelope");
- if (env->Envmode==4) envfreegroup->label("Filter Envelope");
- if (env->Envmode==5) envfreegroup->label("Bandwidth Envelope");
-
- freemodeeditwindow->label(this->label());
-
-
- freeeditsmall->setpair(freeedit);
- freeedit->setpair(freeeditsmall);
-
-
- refresh();} {}
- }
- Function {reinit()} {} {
- code {if (env->Pfreemode!=0){
- int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
- if (env->Pfreemode!=0) freemodebutton->value(1);
- else freemodebutton->value(0);
- if (answer==0) return;
- };
-
- if (env->Pfreemode==0) env->Pfreemode=1;
- else env->Pfreemode=0;
-
- hide();
- int winx=freemodeeditwindow->x();
- int winy=freemodeeditwindow->y();
-
- freemodeeditwindow->hide();
-
- envwindow->hide();
- Fl_Group *par=envwindow->parent();
- par->hide();
-
-
- refresh();
- envwindow->show();
- par->redraw();
-
- par->show();
- show();
- freemodeeditwindow->position(winx,winy);
- freemodeeditwindow->show();
-
- if (env->Pfreemode!=0) {
- freemodebutton->value(1);
- addpoint->show();
- deletepoint->show();
- forcedreleasecheck->show();
- }else{
- freemodebutton->value(0);
- addpoint->hide();
- deletepoint->hide();
- forcedreleasecheck->hide();
- };} {}
- }
- Function {refresh()} {open
- } {
- code {freemodebutton->value(env->Pfreemode);
-
- sustaincounter->value(env->Penvsustain);
- if (env->Pfreemode==0) sustaincounter->hide();
- else sustaincounter->show();
- sustaincounter->maximum(env->Penvpoints-2);
-
- envstretchdial->value(env->Penvstretch);
- if (env->Pfreemode==0) envstretchdial->hide();
- else envstretchdial->show();
-
- linearenvelopecheck->value(env->Plinearenvelope);
- if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide();
- else linearenvelopecheck->show();
-
- forcedreleasecheck->value(env->Pforcedrelease);
- if (env->Pfreemode==0) forcedreleasecheck->hide();
- else forcedreleasecheck->show();
-
- if (env->Pfreemode==0){
- addpoint->hide();
- deletepoint->hide();
- } else {
- addpoint->show();
- deletepoint->show();
- }
-
- freeedit->redraw();
-
- if (env->Pfreemode==0){
- switch(env->Envmode){
- case(1):
- case(2):
- e1adt->value(env->PA_dt);
- e1ddt->value(env->PD_dt);
- e1sval->value(env->PS_val);
- e1rdt->value(env->PR_dt);
- e1envstretch->value(env->Penvstretch);
- e1linearenvelope->value(env->Plinearenvelope);
- e1forcedrelease->value(env->Pforcedrelease);
- break;
- case(3):
- e2aval->value(env->PA_val);
- e2adt->value(env->PA_dt);
- e2rdt->value(env->PR_dt);
- e2rval->value(env->PR_val);
- e2envstretch->value(env->Penvstretch);
- e2forcedrelease->value(env->Pforcedrelease);
- break;
- case(4):
- e3aval->value(env->PA_val);
- e3adt->value(env->PA_dt);
- e3dval->value(env->PD_val);
- e3ddt->value(env->PD_dt);
- e3rdt->value(env->PR_dt);
- e3rval->value(env->PR_val);
- e3envstretch->value(env->Penvstretch);
- e3forcedrelease->value(env->Pforcedrelease);
- break;
- case(5):
- e4aval->value(env->PA_val);
- e4adt->value(env->PA_dt);
- e4rdt->value(env->PR_dt);
- e4rval->value(env->PR_val);
- e4envstretch->value(env->Penvstretch);
- e4forcedrelease->value(env->Pforcedrelease);
- break;
- default:
- break;
- };
- }else{
- envfree->redraw();
- };
-
-
- envADSR->hide();
- envASR->hide();
- envADSRfilter->hide();
- envASRbw->hide();
- envfree->hide();
-
- if (env->Pfreemode==0){
- switch(env->Envmode){
- case(1):
- case(2):
- envwindow=envADSR;
- break;
- case(3):
- envwindow=envASR;
- break;
- case(4):
- envwindow=envADSRfilter;
- break;
- case(5):
- envwindow=envASRbw;
- break;
- default:
- break;
- };
- }else{
- envwindow=envfree;
- };
-
- envwindow->resize(this->x(),this->y(),this->w(),this->h());
-
- envwindow->show();} {}
- }
- decl {EnvelopeParams *env;} {}
- decl {Fl_Group *envwindow;} {}
- }
|