zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 1a81e22e7271d44acf37eda4007a7fc658a9ccd1
parent 936102ee5ed3e0d68894c476be904e8154cc775a
Author: paulnasca <paulnasca>
Date:   Fri, 18 Jun 2004 17:26:41 +0000

*** empty log message ***

Diffstat:
Msrc/UI/ADnoteUI.fl | 875+------------------------------------------------------------------------------
Msrc/UI/Makefile | 5+++--
Asrc/UI/OscilGenUI.fl | 920+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 924 insertions(+), 876 deletions(-)

diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -9,9 +9,6 @@ decl {//License: GNU GPL version 2} {} decl {\#include "../Params/ADnoteParameters.h"} {public } -decl {\#include "../Synth/OscilGen.h"} {public -} - decl {\#include "../Misc/Util.h"} {public } @@ -47,877 +44,7 @@ decl {\#include "LFOUI.h"} {public decl {\#include "FilterUI.h"} {public } -class ADSpectrum {: {public Fl_Box} -} { - Function {ADSpectrum(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {oscil=NULL;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -master=master_;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i; -const int maxdb=60;//must be multiple of 10 -int GX=2; -int n=lx/GX-1; -if (n>OSCIL_SIZE/2) n=OSCIL_SIZE/2; - -REALTYPE x; -REALTYPE spc[n]; -for (i=0;i<n;i++) spc[i]=0.0; - -pthread_mutex_lock(&master->mutex); -if (oscbase==0) oscil->getspectrum(n,spc,0); - else oscil->getspectrum(n,spc,1); -pthread_mutex_unlock(&master->mutex); - -//normalize -REALTYPE max=0; -for (i=0;i<n;i++){ - x=fabs(spc[i]); - if (max<x) max=x; -} -if (max<0.000001) max=1.0; -max=max*1.05; - -//draw - -if (this->active_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->color()); -if ((ANTI_ALIAS==0)&&(oscbase==0)) fl_color(this->parent()->color()); -fl_line_style(FL_DOT); - -for (i=1;i<maxdb/10;i++){ - int ky=(int)((REALTYPE)i*ly*10.0/maxdb)/2; - ky*=2; - fl_line(ox,oy+ky-1,ox+lx-2,oy+ky-1); -}; - -for (i=2;i<n;i++){ - int tmp=i*GX-2; - if (i%10==1) fl_line_style(0); - else fl_line_style(FL_DOT); - fl_line(ox+tmp,oy+2,ox+tmp,oy+ly-2); -} - -if (this->active_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); -fl_line_style(0); - -//draws the spectrum -for (i=0;i<n;i++){ - int tmp=i*GX+2; - x=spc[i]/max; - - if (x>dB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else x=0; - - int val=(int) ((ly-2)*x); - if (val>0) fl_line(ox+tmp,oy+ly-2-val,ox+tmp,oy+ly-2); -};} {} - } - decl {OscilGen *oscil;} {} - decl {int oscbase;} {} - decl {Master *master;} {} -} - -class ADOscilloscope {: {public Fl_Box} -} { - Function {ADOscilloscope(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {oscil=NULL; -phase=64; -oscbase=0;} {} - } - Function {init(OscilGen *oscil_,Master *master_)} {} { - code {oscil=oscil_; -master=master_;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -master=master_;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -phase=phase_; -master=master_;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h()-1,i; -REALTYPE smps[OSCIL_SIZE]; -pthread_mutex_lock(&master->mutex); -if (oscbase==0) oscil->get(smps,-1.0); - else oscil->getcurrentbasefunction(smps); -pthread_mutex_unlock(&master->mutex); - -//normalize -REALTYPE max=0; -for (i=0;i<OSCIL_SIZE;i++) - if (max<fabs(smps[i])) max=fabs(smps[i]); -//fprintf(stderr,"%.4f\\n",max); -if (max<0.00001) max=1.0; -max=-max*1.05; - -//draw -fl_line_style(FL_DASH); -if (this->active_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); -int GX=16;if (lx<GX*3) GX=-1; -for (i=1;i<GX;i++){ - int tmp=(int)(lx/(REALTYPE)GX*i); - fl_line(ox+tmp,oy+2,ox+tmp,oy+ly-2); -}; -int GY=8;if (ly<GY*3) GY=-1; -for (i=1;i<GY;i++){ - int tmp=(int)(ly/(REALTYPE)GY*i); - fl_line(ox+2,oy+tmp,ox+lx-2,oy+tmp); -}; - -//draw the function -fl_line_style(0,1); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); -if (this->active_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->labelcolor()); -int lw=1; -//if ((lx<135)||(ly<135)) lw=1; -fl_line_style(0,lw); -int ph=(int)((phase-64.0)/128.0*OSCIL_SIZE+OSCIL_SIZE); -for (i=1;i<lx;i++){ - int k1=(int)((REALTYPE)OSCIL_SIZE*(i-1)/lx)+ph; - int k2=(int)((REALTYPE)OSCIL_SIZE*i/lx)+ph; - REALTYPE y1=smps[k1%OSCIL_SIZE]/max; - REALTYPE y2=smps[k2%OSCIL_SIZE]/max; - fl_line(i-1+ox,(int)(y1*ly/2.0)+oy+ly/2,i+ox,(int)(y2*ly/2.0)+oy+ly/2); -};} {} - } - decl {OscilGen *oscil;} {} - decl {int oscbase;} {} - decl {int phase;} {public - } - decl {Master *master;} {} -} - -class ADOscilharmonic {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window harmonic { - private xywh {421 154 90 225} type Double hide - class Fl_Group - } { - Fl_Slider mag { - callback {int x=64; -if (Fl::event_button1()) x=127-(int)o->value(); - else o->value(x); -if (x==64) o->selection_color(0); - else o->selection_color(222); - -pthread_mutex_lock(&master->mutex); - oscil->Phmag[n]=x; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw();} - xywh {0 15 15 115} type {Vert Knob} box FLAT_BOX selection_color 222 labelcolor 0 maximum 127 step 1 value 64 - code0 {o->value(127-oscil->Phmag[n]);} - code1 {if (oscil->Phmag[n]==64) o->selection_color(0);} - } - Fl_Slider phase { - callback {int x=64; -if (Fl::event_button1()) x=(int)o->value(); - else o->value(x); - -pthread_mutex_lock(&master->mutex); - oscil->Phphase[n]=x; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw();} - xywh {0 135 15 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(oscil->Phphase[n]);} - } - Fl_Box {} { - xywh {15 70 5 5} box FLAT_BOX color 45 - } - Fl_Box {} { - xywh {15 170 5 5} box FLAT_BOX color 45 - } - Fl_Box {} { - label 01 - xywh {0 210 20 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - Fl_Box {} { - label 01 - xywh {0 0 20 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - } - } - Function {ADOscilharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0; -oscil=NULL; -display=NULL;} {} - } - Function {init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_, Master *master_)} {} { - code {oscil=oscil_; -n=n_; -display=display_; -master=master_; -oldosc=oldosc_; -make_window(); -end(); -harmonic->show();} {} - } - Function {~ADOscilharmonic()} {} { - code {harmonic->hide(); -delete(harmonic);} {} - } - decl {OscilGen *oscil;} {} - decl {Fl_Group *display;} {} - decl {int n;} {} - decl {Fl_Widget *oldosc;} {} - decl {Master *master;} {} -} - -class ADOscilEditor {} { - Function {make_window()} {} { - Fl_Window osceditUI { - label {ADsynth Oscillator Editor} - xywh {66 94 750 590} type Double hide - } { - Fl_Group oscildisplaygroup { - xywh {15 5 360 300} box ENGRAVED_FRAME - } { - Fl_Group {} {open - xywh {20 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {ADOscilloscope *osc=new ADOscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(oscil,master);} - } {} - Fl_Box {} { - label Oscillator - xywh {130 10 110 20} box FLAT_BOX labelfont 1 - } - Fl_Value_Slider {} { - label rnd - callback {oscil->Prand=(int)o->value()+64; -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {150 285 100 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(oscil->Prand-64);} - } - Fl_Group {} {open - xywh {20 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 - code0 {ADSpectrum *spc=new ADSpectrum(o->x(),o->y(),o->w(),o->h(),"");} - code1 {spc->init(oscil,0,master);} - } {} - Fl_Group {} { - xywh {256 277 115 25} box ENGRAVED_BOX - } { - Fl_Choice {} { - label {H.rnd} - callback {oscil->Pamprandtype=(int) o->value();} - tooltip {Harmonic Amplitude Randomness} xywh {291 282 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - code0 {o->value(oscil->Pamprandtype);} - } { - menuitem {} { - label None - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Pow - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Sin - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial {} { - callback {oscil->Pamprandpower=(int) o->value();} - tooltip {Oscillator's spectrum adjust parameter} xywh {348 280 18 18} maximum 127 step 1 - code0 {o->value(oscil->Pamprandpower);} - class WidgetPDial - } - } - } - Fl_Box {} { - label {Base Func.} - xywh {505 15 110 20} box FLAT_BOX labelfont 1 - } - Fl_Group basefuncdisplaygroup { - xywh {375 5 360 300} box ENGRAVED_FRAME - } { - Fl_Group {} { - xywh {380 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {ADOscilloscope *osc=new ADOscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(oscil,1,master);} - } {} - Fl_Dial {} { - callback {oscil->Pbasefuncpar=(int)o->value()+64; -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw(); -bfparval->value(oscil->Pbasefuncpar-64);} - tooltip {Base Function Parameter} xywh {530 280 20 20} minimum -64 maximum 63 step 1 - code0 {o->value(oscil->Pbasefuncpar-64);} - class WidgetPDial - } - Fl_Choice {} { - label {Base.F..} - callback {oscil->Pcurrentbasefunc=(int) o->value(); - -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw(); - -if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); - else basefuncmodulation->activate();} - xywh {380 285 90 15} down_box BORDER_BOX labelsize 10 align 5 textsize 12 - code0 {o->value(oscil->Pcurrentbasefunc);} - } { - menuitem {} { - label Sine - xywh {10 10 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Triangle - xywh {20 20 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Pulse - xywh {30 30 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Saw - xywh {40 40 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Power - xywh {50 50 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Gauss - xywh {50 50 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Diode - xywh {60 60 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label AbsSine - xywh {70 70 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label PulseSine - xywh {80 80 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label StrchSine - xywh {90 90 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Chirp - xywh {100 100 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label AbsStrSine - xywh {102 102 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Chebyshev - xywh {112 112 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label Sqr - xywh {122 122 100 20} labelfont 1 labelsize 12 - } - } - Fl_Box {} { - label {Base Func.} - xywh {490 10 110 20} box FLAT_BOX labelfont 1 - } - Fl_Group {} {open - xywh {380 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 - code0 {ADSpectrum *spc=new ADSpectrum (o->x(),o->y(),o->w(),o->h(),"");} - code1 {spc->init(oscil,1,master);} - } {} - Fl_Value_Output bfparval { - label {Par.} - xywh {500 285 25 15} labelsize 13 minimum -63 maximum 63 step 1 - code0 {o->value(oscil->Pbasefuncpar-64);} - } - Fl_Group basefuncmodulation { - xywh {579 276 150 25} box ENGRAVED_BOX - code0 {if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();} - } { - Fl_Choice {} { - label {Mod.} - callback {oscil->Pbasefuncmodulation=(int) o->value(); -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Base function modulation} xywh {609 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - code0 {o->value(oscil->Pbasefuncmodulation);} - } { - menuitem {} { - label None - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Rev - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Sine - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Pow - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial {} { - callback {oscil->Pbasefuncmodulationpar1=(int)o->value(); -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's modulation parameter 1} xywh {669 281 15 15} maximum 127 step 1 - code0 {o->value(oscil->Pbasefuncmodulationpar1);} - class WidgetPDial - } - Fl_Dial {} { - callback {oscil->Pbasefuncmodulationpar2=(int)o->value(); -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's modulation parameter 2} xywh {689 281 15 15} maximum 127 step 1 - code0 {o->value(oscil->Pbasefuncmodulationpar2);} - class WidgetPDial - } - Fl_Dial {} { - callback {oscil->Pbasefuncmodulationpar3=(int)o->value(); -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's modulation parameter 3} xywh {709 281 15 15} maximum 127 step 1 - code0 {o->value(oscil->Pbasefuncmodulationpar3);} - class WidgetPDial - } - } - } - Fl_Choice {} { - label {Mag.Type} - callback {oscil->Phmagtype=(int) o->value(); -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - xywh {80 280 65 20} down_box BORDER_BOX labelsize 12 textsize 12 - code0 {o->value(oscil->Phmagtype);} - } { - menuitem {} { - label Linear - xywh {0 0 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label {-40dB} - xywh {10 10 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label {-60dB} - xywh {20 20 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label {-80dB} - xywh {30 30 100 20} labelfont 1 labelsize 12 - } - menuitem {} { - label {-100dB} - xywh {40 40 100 20} labelfont 1 labelsize 12 - } - } - Fl_Button {} { - label {Use as base} - callback {oscil->useasbase(); -if (autoclearbutton->value()){ - for (int i=0;i<MAX_AD_HARMONICS;i++){ - h[i]->mag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; - }; - oscil->Phmag[0]=127; - - oscil->Pharmonicshift=0; - harmonicshiftcounter->value(0); - - h[0]->mag->value(0); - wshbutton->value(0); - wshbutton->do_callback(); - fltbutton->value(0); - fltbutton->do_callback(); - sabutton->value(0); - sabutton->do_callback(); -}; - -pthread_mutex_lock(&master->mutex); - for (int i=0;i<MAX_AD_HARMONICS;i++){ - if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -oscildisplaygroup->redraw(); -basefuncdisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Use this Oscillator as base function} xywh {15 310 85 20} box THIN_UP_BOX labelfont 1 labelsize 12 - } - Fl_Button {} { - label Close - callback {osceditUI->hide();} - xywh {678 557 69 28} box THIN_UP_BOX - } - Fl_Button {} { - label Clear - callback {for (int i=0;i<MAX_AD_HARMONICS;i++){ - h[i]->mag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; -}; -oscil->Phmag[0]=127; -h[0]->mag->value(0); - -for (int i=0;i<MAX_AD_HARMONICS;i++){ - if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); -}; - -//harmonics->redraw(); - -pthread_mutex_lock(&master->mutex); - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -oscildisplaygroup->redraw(); -oldosc->redraw();} - xywh {685 310 50 20} box THIN_UP_BOX labelfont 1 labelsize 12 - } - Fl_Group {} { - xywh {145 305 185 30} box ENGRAVED_BOX - } { - Fl_Choice wshbutton { - label {Wsh.} - callback {oscil->Pwaveshapingfunction=(int) o->value(); -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} open - tooltip {Waveshaping function} xywh {175 310 55 20} down_box BORDER_BOX labelsize 10 textsize 10 - code0 {o->value(oscil->Pwaveshapingfunction);} - } { - menuitem {} { - label None - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Atan - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Asym1 - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Pow - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Sine - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Qnts - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Zigzg - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Lmt - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label LmtU - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label LmtL - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label ILmt - xywh {127 127 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Clip - xywh {137 137 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Asym2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Pow2 - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Sgm - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Value_Slider {} { - callback {oscil->Pwaveshaping=(int)o->value()+64; -//basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Waveshaping Parameter} xywh {230 315 95 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(oscil->Pwaveshaping-64);} - } - } - Fl_Light_Button autoclearbutton { - label {Clr.} - tooltip {Auto clear when using the oscillator as base function} xywh {105 310 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 - } - Fl_Group {} { - xywh {330 305 160 30} box ENGRAVED_BOX - } { - Fl_Choice fltbutton { - label Filter - callback {oscil->Pfiltertype=(int) o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's filter type} xywh {360 310 50 20} down_box BORDER_BOX labelsize 10 textsize 10 - code0 {o->value(oscil->Pfiltertype);} - } { - menuitem {} { - label None - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label LP1 - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label HP1a - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label HP1b - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label BP1 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label BS1 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label LP2 - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label HP2 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label BP2 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label BS2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Cos - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Sin - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial {} { - callback {oscil->Pfilterpar=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's filter parameter} xywh {415 310 20 20} maximum 127 step 1 - code0 {o->value(oscil->Pfilterpar);} - class WidgetPDial - } - Fl_Check_Button {} { - label preF - callback {oscil->Pfilterbeforews=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Apply the filter before the waveshaping} xywh {445 310 35 20} down_box DOWN_BOX labelsize 10 align 24 - code0 {o->value(oscil->Pfilterbeforews);} - } - } - Fl_Scroll _this_has_to_be_the_last { - xywh {15 335 660 250} type HORIZONTAL box ENGRAVED_BOX - } { - Fl_Pack harmonics {open - xywh {20 340 650 225} type HORIZONTAL - code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new ADOscilharmonic(0,0,20,o->h(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,master);}} - } {} - } - Fl_Choice {} { - label Normalize - callback {oscil->Pnormalizemethod=(int) o->value();} - tooltip {Normalize type (harmonic's sum/RMS) of the oscillator} xywh {680 420 60 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(oscil->Pnormalizemethod);} - } { - menuitem {} { - label Sum - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label RMS - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label {F.RMS} - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group {} { - xywh {490 305 130 30} box ENGRAVED_BOX - } { - Fl_Choice sabutton { - label {Sp.adj.} - callback {oscil->Psatype=(int) o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's spectrum adjust} xywh {530 310 60 20} down_box BORDER_BOX labelsize 10 textsize 10 - code0 {o->value(oscil->Psatype);} - } { - menuitem {} { - label None - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label Pow - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label ThrsD - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label ThrsU - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial {} { - callback {oscil->Psapar=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's spectrum adjust parameter} xywh {595 310 20 20} maximum 127 step 1 - code0 {o->value(oscil->Psapar);} - class WidgetPDial - } - } - Fl_Group {} { - xywh {675 335 70 65} box ENGRAVED_BOX - } { - Fl_Counter harmonicshiftcounter { - label {Harmonic Shift} - callback {oscil->Pharmonicshift=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - xywh {680 360 60 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10 - code0 {o->value(oscil->Pharmonicshift);} - } - Fl_Check_Button {} { - label preH - callback {oscil->Pharmonicshiftfirst=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {706 380 35 15} down_box DOWN_BOX labelsize 10 align 24 - code0 {o->value(oscil->Pharmonicshiftfirst);} - } - Fl_Button {} { - label R - callback {oscil->Pharmonicshift=0; -harmonicshiftcounter->value(0); -oscildisplaygroup->redraw(); -oldosc->redraw();} - xywh {680 380 25 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - } - Fl_Group {} { - xywh {675 445 65 90} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {Adaptive Harmonics} - xywh {680 445 55 25} labelsize 10 align 144 - } - Fl_Choice {} { - callback {oscil->Padaptiveharmonics=(int) o->value();} open - tooltip {The type of the addaptive harmonics} xywh {680 470 55 15} down_box BORDER_BOX labelsize 10 textsize 10 - code0 {o->value(oscil->Padaptiveharmonics);} - } { - menuitem {} { - label OFF - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - menuitem {} { - label On - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial {} { - label pow - callback {oscil->Padaptiveharmonicspower=(int)o->value();} - tooltip {Adaptive harmonics power} xywh {710 495 25 25} labelsize 6 maximum 100 step 1 - code0 {o->value(oscil->Padaptiveharmonicspower);} - class WidgetPDial - } - Fl_Dial {} { - label baseF - callback {oscil->Padaptiveharmonicsbasefreq=(int)o->value();} - tooltip {Adaptive harmonics base frequency} xywh {680 495 25 25} labelsize 9 maximum 255 step 1 - code0 {o->value(oscil->Padaptiveharmonicsbasefreq);} - class WidgetPDial - } - } - } - } - Function {ADOscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Master *master_)} {} { - code {oscil=oscil_; -oldosc=oldosc_; -master=master_; -make_window(); -osceditUI->show();} {} - } - Function {~ADOscilEditor()} {} { - code {osceditUI->hide(); -for (int i=0;i<MAX_AD_HARMONICS;i++) delete (h[i]); -delete (osceditUI);} {} - } - decl {OscilGen *oscil;} {} - decl {Fl_Widget *oldosc;} {} - decl {ADOscilharmonic *h[MAX_AD_HARMONICS];} {} - decl {Master *master;} {} +decl {\#include "OscilGenUI.h"} {selected public } class ADvoicelistitem {: {public Fl_Group} diff --git a/src/UI/Makefile b/src/UI/Makefile @@ -4,7 +4,7 @@ include ../Makefile.inc fluid -c $< objects=WidgetPDial.o EnvelopeUI.o LFOUI.o FilterUI.o VirKeyboard.o ConfigUI.o\ - SUBnoteUI.o ResonanceUI.o ADnoteUI.o EffUI.o BankUI.o \ + SUBnoteUI.o ResonanceUI.o OscilGenUI.o ADnoteUI.o EffUI.o BankUI.o \ PartUI.o MicrotonalUI.o SeqUI.o MasterUI.o @@ -15,7 +15,8 @@ EnvelopeUI.o: EnvelopeUI.fl EnvelopeUI.cc EnvelopeUI.h LFOUI.o: LFOUI.fl LFOUI.cc LFOUI.h FilterUI.o: FilterUI.fl FilterUI.cc FilterUI.h -ResonanceUI.o: ResonanceUI.fl ResonanceUI.cc ResonanceUI.h +ResonanceUI.o:ResonanceUI.fl ResonanceUI.cc ResonanceUI.h +OscilGenUI.o:OscilGenUI.fl OscilGenUI.cc OscilGenUI.h ADnoteUI.o:ADnoteUI.fl ADnoteUI.cc ADnoteUI.h SUBnoteUI.o:SUBnoteUI.fl SUBnoteUI.cc SUBnoteUI.h diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl @@ -0,0 +1,920 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0200 +header_name {.h} +code_name {.cc} +decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} + +decl {//License: GNU GPL version 2} {} + +decl {\#include "../Synth/OscilGen.h"} {public +} + +decl {\#include "../Misc/Util.h"} {public +} + +decl {\#include "../Misc/Master.h"} {public +} + +decl {\#include "ResonanceUI.h"} {public +} + +decl {\#include <FL/Fl_Box.H>} {public +} + +decl {\#include <FL/Fl_Group.H>} {public +} + +decl {\#include <math.h>} {} + +decl {\#include <stdio.h>} {} + +decl {\#include <stdlib.h>} {} + +decl {\#include <string.h>} {} + +decl {\#include "WidgetPDial.h"} {public +} + +decl {\#include "EnvelopeUI.h"} {public +} + +decl {\#include "LFOUI.h"} {public +} + +decl {\#include "FilterUI.h"} {public +} + +class ADSpectrum {: {public Fl_Box} +} { + Function {ADSpectrum(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { + code {oscil=NULL;} {} + } + Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { + code {oscil=oscil_; +oscbase=oscbase_; +master=master_;} {} + } + Function {draw()} {open + } { + code {int ox=x(),oy=y(),lx=w(),ly=h(),i; +const int maxdb=60;//must be multiple of 10 +int GX=2; +int n=lx/GX-1; +if (n>OSCIL_SIZE/2) n=OSCIL_SIZE/2; + +REALTYPE x; +REALTYPE spc[n]; +for (i=0;i<n;i++) spc[i]=0.0; + +pthread_mutex_lock(&master->mutex); +if (oscbase==0) oscil->getspectrum(n,spc,0); + else oscil->getspectrum(n,spc,1); +pthread_mutex_unlock(&master->mutex); + +//normalize +REALTYPE max=0; +for (i=0;i<n;i++){ + x=fabs(spc[i]); + if (max<x) max=x; +} +if (max<0.000001) max=1.0; +max=max*1.05; + +//draw + +if (this->active_r()) fl_color(this->parent()->selection_color()); + else fl_color(this->parent()->color()); +if ((ANTI_ALIAS==0)&&(oscbase==0)) fl_color(this->parent()->color()); +fl_line_style(FL_DOT); + +for (i=1;i<maxdb/10;i++){ + int ky=(int)((REALTYPE)i*ly*10.0/maxdb)/2; + ky*=2; + fl_line(ox,oy+ky-1,ox+lx-2,oy+ky-1); +}; + +for (i=2;i<n;i++){ + int tmp=i*GX-2; + if (i%10==1) fl_line_style(0); + else fl_line_style(FL_DOT); + fl_line(ox+tmp,oy+2,ox+tmp,oy+ly-2); +} + +if (this->active_r()) fl_color(this->parent()->labelcolor()); + else fl_color(this->parent()->color()); +fl_line_style(0); + +//draws the spectrum +for (i=0;i<n;i++){ + int tmp=i*GX+2; + x=spc[i]/max; + + if (x>dB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; + else x=0; + + int val=(int) ((ly-2)*x); + if (val>0) fl_line(ox+tmp,oy+ly-2-val,ox+tmp,oy+ly-2); +};} {selected + } + } + decl {OscilGen *oscil;} {} + decl {int oscbase;} {} + decl {Master *master;} {} +} + +class ADOscilloscope {: {public Fl_Box} +} { + Function {ADOscilloscope(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { + code {oscil=NULL; +phase=64; +oscbase=0;} {} + } + Function {init(OscilGen *oscil_,Master *master_)} {} { + code {oscil=oscil_; +master=master_;} {} + } + Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { + code {oscil=oscil_; +oscbase=oscbase_; +master=master_;} {} + } + Function {init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_)} {} { + code {oscil=oscil_; +oscbase=oscbase_; +phase=phase_; +master=master_;} {} + } + Function {draw()} {} { + code {int ox=x(),oy=y(),lx=w(),ly=h()-1,i; +REALTYPE smps[OSCIL_SIZE]; +pthread_mutex_lock(&master->mutex); +if (oscbase==0) oscil->get(smps,-1.0); + else oscil->getcurrentbasefunction(smps); +pthread_mutex_unlock(&master->mutex); + +//normalize +REALTYPE max=0; +for (i=0;i<OSCIL_SIZE;i++) + if (max<fabs(smps[i])) max=fabs(smps[i]); +//fprintf(stderr,"%.4f\\n",max); +if (max<0.00001) max=1.0; +max=-max*1.05; + +//draw +fl_line_style(FL_DASH); +if (this->active_r()) fl_color(this->parent()->labelcolor()); + else fl_color(this->parent()->color()); +int GX=16;if (lx<GX*3) GX=-1; +for (i=1;i<GX;i++){ + int tmp=(int)(lx/(REALTYPE)GX*i); + fl_line(ox+tmp,oy+2,ox+tmp,oy+ly-2); +}; +int GY=8;if (ly<GY*3) GY=-1; +for (i=1;i<GY;i++){ + int tmp=(int)(ly/(REALTYPE)GY*i); + fl_line(ox+2,oy+tmp,ox+lx-2,oy+tmp); +}; + +//draw the function +fl_line_style(0,1); +fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); +if (this->active_r()) fl_color(this->parent()->selection_color()); + else fl_color(this->parent()->labelcolor()); +int lw=1; +//if ((lx<135)||(ly<135)) lw=1; +fl_line_style(0,lw); +int ph=(int)((phase-64.0)/128.0*OSCIL_SIZE+OSCIL_SIZE); +for (i=1;i<lx;i++){ + int k1=(int)((REALTYPE)OSCIL_SIZE*(i-1)/lx)+ph; + int k2=(int)((REALTYPE)OSCIL_SIZE*i/lx)+ph; + REALTYPE y1=smps[k1%OSCIL_SIZE]/max; + REALTYPE y2=smps[k2%OSCIL_SIZE]/max; + fl_line(i-1+ox,(int)(y1*ly/2.0)+oy+ly/2,i+ox,(int)(y2*ly/2.0)+oy+ly/2); +};} {} + } + decl {OscilGen *oscil;} {} + decl {int oscbase;} {} + decl {int phase;} {public + } + decl {Master *master;} {} +} + +class ADOscilharmonic {: {public Fl_Group} +} { + Function {make_window()} {private + } { + Fl_Window harmonic { + private xywh {421 154 90 225} type Double hide + class Fl_Group + } { + Fl_Slider mag { + callback {int x=64; +if (Fl::event_button1()) x=127-(int)o->value(); + else o->value(x); +if (x==64) o->selection_color(0); + else o->selection_color(222); + +pthread_mutex_lock(&master->mutex); + oscil->Phmag[n]=x; + oscil->prepare(); +pthread_mutex_unlock(&master->mutex); + +display->redraw(); +oldosc->redraw();} + xywh {0 15 15 115} type {Vert Knob} box FLAT_BOX selection_color 222 labelcolor 0 maximum 127 step 1 value 64 + code0 {o->value(127-oscil->Phmag[n]);} + code1 {if (oscil->Phmag[n]==64) o->selection_color(0);} + } + Fl_Slider phase { + callback {int x=64; +if (Fl::event_button1()) x=(int)o->value(); + else o->value(x); + +pthread_mutex_lock(&master->mutex); + oscil->Phphase[n]=x; + oscil->prepare(); +pthread_mutex_unlock(&master->mutex); + +display->redraw(); +oldosc->redraw();} + xywh {0 135 15 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 + code0 {o->value(oscil->Phphase[n]);} + } + Fl_Box {} { + xywh {15 70 5 5} box FLAT_BOX color 45 + } + Fl_Box {} { + xywh {15 170 5 5} box FLAT_BOX color 45 + } + Fl_Box {} { + label 01 + xywh {0 210 20 15} labelfont 1 labelsize 9 align 20 + code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} + } + Fl_Box {} { + label 01 + xywh {0 0 20 15} labelfont 1 labelsize 9 align 20 + code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} + } + } + } + Function {ADOscilharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { + code {n=0; +oscil=NULL; +display=NULL;} {} + } + Function {init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_, Master *master_)} {} { + code {oscil=oscil_; +n=n_; +display=display_; +master=master_; +oldosc=oldosc_; +make_window(); +end(); +harmonic->show();} {} + } + Function {~ADOscilharmonic()} {} { + code {harmonic->hide(); +delete(harmonic);} {} + } + decl {OscilGen *oscil;} {} + decl {Fl_Group *display;} {} + decl {int n;} {} + decl {Fl_Widget *oldosc;} {} + decl {Master *master;} {} +} + +class ADOscilEditor {} { + Function {make_window()} {} { + Fl_Window osceditUI { + label {ADsynth Oscillator Editor} + xywh {66 94 750 590} type Double hide + } { + Fl_Group oscildisplaygroup { + xywh {15 5 360 300} box ENGRAVED_FRAME + } { + Fl_Group {} {open + xywh {20 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 + code0 {ADOscilloscope *osc=new ADOscilloscope(o->x(),o->y(),o->w(),o->h(),"");} + code1 {osc->init(oscil,master);} + } {} + Fl_Box {} { + label Oscillator + xywh {130 10 110 20} box FLAT_BOX labelfont 1 + } + Fl_Value_Slider {} { + label rnd + callback {oscil->Prand=(int)o->value()+64; +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {150 285 100 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 + code0 {o->value(oscil->Prand-64);} + } + Fl_Group {} {open + xywh {20 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 + code0 {ADSpectrum *spc=new ADSpectrum(o->x(),o->y(),o->w(),o->h(),"");} + code1 {spc->init(oscil,0,master);} + } {} + Fl_Group {} { + xywh {256 277 115 25} box ENGRAVED_BOX + } { + Fl_Choice {} { + label {H.rnd} + callback {oscil->Pamprandtype=(int) o->value();} + tooltip {Harmonic Amplitude Randomness} xywh {291 282 50 15} down_box BORDER_BOX labelsize 10 textsize 10 + code0 {o->value(oscil->Pamprandtype);} + } { + menuitem {} { + label None + xywh {60 60 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Pow + xywh {70 70 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Sin + xywh {80 80 100 20} labelfont 1 labelsize 10 + } + } + Fl_Dial {} { + callback {oscil->Pamprandpower=(int) o->value();} + tooltip {Oscillator's spectrum adjust parameter} xywh {348 280 18 18} maximum 127 step 1 + code0 {o->value(oscil->Pamprandpower);} + class WidgetPDial + } + } + } + Fl_Box {} { + label {Base Func.} + xywh {505 15 110 20} box FLAT_BOX labelfont 1 + } + Fl_Group basefuncdisplaygroup { + xywh {375 5 360 300} box ENGRAVED_FRAME + } { + Fl_Group {} { + xywh {380 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 + code0 {ADOscilloscope *osc=new ADOscilloscope(o->x(),o->y(),o->w(),o->h(),"");} + code1 {osc->init(oscil,1,master);} + } {} + Fl_Dial {} { + callback {oscil->Pbasefuncpar=(int)o->value()+64; +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw(); +bfparval->value(oscil->Pbasefuncpar-64);} + tooltip {Base Function Parameter} xywh {530 280 20 20} minimum -64 maximum 63 step 1 + code0 {o->value(oscil->Pbasefuncpar-64);} + class WidgetPDial + } + Fl_Choice {} { + label {Base.F..} + callback {oscil->Pcurrentbasefunc=(int) o->value(); + +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw(); + +if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); + else basefuncmodulation->activate();} + xywh {380 285 90 15} down_box BORDER_BOX labelsize 10 align 5 textsize 12 + code0 {o->value(oscil->Pcurrentbasefunc);} + } { + menuitem {} { + label Sine + xywh {10 10 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Triangle + xywh {20 20 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Pulse + xywh {30 30 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Saw + xywh {40 40 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Power + xywh {50 50 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Gauss + xywh {50 50 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Diode + xywh {60 60 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label AbsSine + xywh {70 70 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label PulseSine + xywh {80 80 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label StrchSine + xywh {90 90 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Chirp + xywh {100 100 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label AbsStrSine + xywh {102 102 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Chebyshev + xywh {112 112 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Sqr + xywh {122 122 100 20} labelfont 1 labelsize 12 + } + } + Fl_Box {} { + label {Base Func.} + xywh {490 10 110 20} box FLAT_BOX labelfont 1 + } + Fl_Group {} {open + xywh {380 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 + code0 {ADSpectrum *spc=new ADSpectrum (o->x(),o->y(),o->w(),o->h(),"");} + code1 {spc->init(oscil,1,master);} + } {} + Fl_Value_Output bfparval { + label {Par.} + xywh {500 285 25 15} labelsize 13 minimum -63 maximum 63 step 1 + code0 {o->value(oscil->Pbasefuncpar-64);} + } + Fl_Group basefuncmodulation { + xywh {579 276 150 25} box ENGRAVED_BOX + code0 {if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();} + } { + Fl_Choice {} { + label {Mod.} + callback {oscil->Pbasefuncmodulation=(int) o->value(); +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Base function modulation} xywh {609 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 + code0 {o->value(oscil->Pbasefuncmodulation);} + } { + menuitem {} { + label None + xywh {50 50 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Rev + xywh {60 60 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Sine + xywh {70 70 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Pow + xywh {80 80 100 20} labelfont 1 labelsize 10 + } + } + Fl_Dial {} { + callback {oscil->Pbasefuncmodulationpar1=(int)o->value(); +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's modulation parameter 1} xywh {669 281 15 15} maximum 127 step 1 + code0 {o->value(oscil->Pbasefuncmodulationpar1);} + class WidgetPDial + } + Fl_Dial {} { + callback {oscil->Pbasefuncmodulationpar2=(int)o->value(); +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's modulation parameter 2} xywh {689 281 15 15} maximum 127 step 1 + code0 {o->value(oscil->Pbasefuncmodulationpar2);} + class WidgetPDial + } + Fl_Dial {} { + callback {oscil->Pbasefuncmodulationpar3=(int)o->value(); +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's modulation parameter 3} xywh {709 281 15 15} maximum 127 step 1 + code0 {o->value(oscil->Pbasefuncmodulationpar3);} + class WidgetPDial + } + } + } + Fl_Choice {} { + label {Mag.Type} + callback {oscil->Phmagtype=(int) o->value(); +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + xywh {80 280 65 20} down_box BORDER_BOX labelsize 12 textsize 12 + code0 {o->value(oscil->Phmagtype);} + } { + menuitem {} { + label Linear + xywh {0 0 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {-40dB} + xywh {10 10 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {-60dB} + xywh {20 20 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {-80dB} + xywh {30 30 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {-100dB} + xywh {40 40 100 20} labelfont 1 labelsize 12 + } + } + Fl_Button {} { + label {Use as base} + callback {oscil->useasbase(); +if (autoclearbutton->value()){ + for (int i=0;i<MAX_AD_HARMONICS;i++){ + h[i]->mag->value(64); + oscil->Phmag[i]=64; + h[i]->phase->value(64); + oscil->Phphase[i]=64; + }; + oscil->Phmag[0]=127; + + oscil->Pharmonicshift=0; + harmonicshiftcounter->value(0); + + h[0]->mag->value(0); + wshbutton->value(0); + wshbutton->do_callback(); + fltbutton->value(0); + fltbutton->do_callback(); + sabutton->value(0); + sabutton->do_callback(); +}; + +pthread_mutex_lock(&master->mutex); + for (int i=0;i<MAX_AD_HARMONICS;i++){ + if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0); + else h[i]->mag->selection_color(222); + }; + oscil->prepare(); +pthread_mutex_unlock(&master->mutex); + +oscildisplaygroup->redraw(); +basefuncdisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Use this Oscillator as base function} xywh {15 310 85 20} box THIN_UP_BOX labelfont 1 labelsize 12 + } + Fl_Button {} { + label Close + callback {osceditUI->hide();} + xywh {678 557 69 28} box THIN_UP_BOX + } + Fl_Button {} { + label Clear + callback {for (int i=0;i<MAX_AD_HARMONICS;i++){ + h[i]->mag->value(64); + oscil->Phmag[i]=64; + h[i]->phase->value(64); + oscil->Phphase[i]=64; +}; +oscil->Phmag[0]=127; +h[0]->mag->value(0); + +for (int i=0;i<MAX_AD_HARMONICS;i++){ + if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0); + else h[i]->mag->selection_color(222); +}; + +//harmonics->redraw(); + +pthread_mutex_lock(&master->mutex); + oscil->prepare(); +pthread_mutex_unlock(&master->mutex); + +oscildisplaygroup->redraw(); +oldosc->redraw();} + xywh {685 310 50 20} box THIN_UP_BOX labelfont 1 labelsize 12 + } + Fl_Group {} { + xywh {145 305 185 30} box ENGRAVED_BOX + } { + Fl_Choice wshbutton { + label {Wsh.} + callback {oscil->Pwaveshapingfunction=(int) o->value(); +basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} open + tooltip {Waveshaping function} xywh {175 310 55 20} down_box BORDER_BOX labelsize 10 textsize 10 + code0 {o->value(oscil->Pwaveshapingfunction);} + } { + menuitem {} { + label None + xywh {25 25 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Atan + xywh {35 35 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Asym1 + xywh {45 45 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Pow + xywh {55 55 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Sine + xywh {65 65 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Qnts + xywh {75 75 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Zigzg + xywh {85 85 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Lmt + xywh {95 95 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label LmtU + xywh {105 105 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label LmtL + xywh {115 115 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label ILmt + xywh {127 127 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Clip + xywh {137 137 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Asym2 + xywh {85 85 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Pow2 + xywh {95 95 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Sgm + xywh {90 90 100 20} labelfont 1 labelsize 10 + } + } + Fl_Value_Slider {} { + callback {oscil->Pwaveshaping=(int)o->value()+64; +//basefuncdisplaygroup->redraw(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Waveshaping Parameter} xywh {230 315 95 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 + code0 {o->value(oscil->Pwaveshaping-64);} + } + } + Fl_Light_Button autoclearbutton { + label {Clr.} + tooltip {Auto clear when using the oscillator as base function} xywh {105 310 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 + } + Fl_Group {} { + xywh {330 305 160 30} box ENGRAVED_BOX + } { + Fl_Choice fltbutton { + label Filter + callback {oscil->Pfiltertype=(int) o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's filter type} xywh {360 310 50 20} down_box BORDER_BOX labelsize 10 textsize 10 + code0 {o->value(oscil->Pfiltertype);} + } { + menuitem {} { + label None + xywh {35 35 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label LP1 + xywh {45 45 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label HP1a + xywh {55 55 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label HP1b + xywh {65 65 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label BP1 + xywh {75 75 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label BS1 + xywh {85 85 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label LP2 + xywh {55 55 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label HP2 + xywh {65 65 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label BP2 + xywh {65 65 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label BS2 + xywh {75 75 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Cos + xywh {75 75 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Sin + xywh {85 85 100 20} labelfont 1 labelsize 10 + } + } + Fl_Dial {} { + callback {oscil->Pfilterpar=(int)o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's filter parameter} xywh {415 310 20 20} maximum 127 step 1 + code0 {o->value(oscil->Pfilterpar);} + class WidgetPDial + } + Fl_Check_Button {} { + label preF + callback {oscil->Pfilterbeforews=(int)o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Apply the filter before the waveshaping} xywh {445 310 35 20} down_box DOWN_BOX labelsize 10 align 24 + code0 {o->value(oscil->Pfilterbeforews);} + } + } + Fl_Scroll _this_has_to_be_the_last { + xywh {15 335 660 250} type HORIZONTAL box ENGRAVED_BOX + } { + Fl_Pack harmonics {open + xywh {20 340 650 225} type HORIZONTAL + code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new ADOscilharmonic(0,0,20,o->h(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,master);}} + } {} + } + Fl_Choice {} { + label Normalize + callback {oscil->Pnormalizemethod=(int) o->value();} + tooltip {Normalize type (harmonic's sum/RMS) of the oscillator} xywh {680 420 60 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10 + code0 {o->value(oscil->Pnormalizemethod);} + } { + menuitem {} { + label Sum + xywh {65 65 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label RMS + xywh {75 75 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label {F.RMS} + xywh {85 85 100 20} labelfont 1 labelsize 10 + } + } + Fl_Group {} { + xywh {490 305 130 30} box ENGRAVED_BOX + } { + Fl_Choice sabutton { + label {Sp.adj.} + callback {oscil->Psatype=(int) o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's spectrum adjust} xywh {530 310 60 20} down_box BORDER_BOX labelsize 10 textsize 10 + code0 {o->value(oscil->Psatype);} + } { + menuitem {} { + label None + xywh {55 55 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label Pow + xywh {65 65 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label ThrsD + xywh {75 75 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label ThrsU + xywh {85 85 100 20} labelfont 1 labelsize 10 + } + } + Fl_Dial {} { + callback {oscil->Psapar=(int)o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Oscillator's spectrum adjust parameter} xywh {595 310 20 20} maximum 127 step 1 + code0 {o->value(oscil->Psapar);} + class WidgetPDial + } + } + Fl_Group {} { + xywh {675 335 70 65} box ENGRAVED_BOX + } { + Fl_Counter harmonicshiftcounter { + label {Harmonic Shift} + callback {oscil->Pharmonicshift=(int)o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + xywh {680 360 60 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10 + code0 {o->value(oscil->Pharmonicshift);} + } + Fl_Check_Button {} { + label preH + callback {oscil->Pharmonicshiftfirst=(int)o->value(); +oscildisplaygroup->redraw(); +oldosc->redraw();} + tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {706 380 35 15} down_box DOWN_BOX labelsize 10 align 24 + code0 {o->value(oscil->Pharmonicshiftfirst);} + } + Fl_Button {} { + label R + callback {oscil->Pharmonicshift=0; +harmonicshiftcounter->value(0); +oscildisplaygroup->redraw(); +oldosc->redraw();} + xywh {680 380 25 15} box THIN_UP_BOX labelfont 1 labelsize 10 + } + } + Fl_Group {} { + xywh {675 445 65 90} box ENGRAVED_FRAME + } { + Fl_Box {} { + label {Adaptive Harmonics} + xywh {680 445 55 25} labelsize 10 align 144 + } + Fl_Choice {} { + callback {oscil->Padaptiveharmonics=(int) o->value();} open + tooltip {The type of the addaptive harmonics} xywh {680 470 55 15} down_box BORDER_BOX labelsize 10 textsize 10 + code0 {o->value(oscil->Padaptiveharmonics);} + } { + menuitem {} { + label OFF + xywh {80 80 100 20} labelfont 1 labelsize 10 + } + menuitem {} { + label On + xywh {90 90 100 20} labelfont 1 labelsize 10 + } + } + Fl_Dial {} { + label pow + callback {oscil->Padaptiveharmonicspower=(int)o->value();} + tooltip {Adaptive harmonics power} xywh {710 495 25 25} labelsize 6 maximum 100 step 1 + code0 {o->value(oscil->Padaptiveharmonicspower);} + class WidgetPDial + } + Fl_Dial {} { + label baseF + callback {oscil->Padaptiveharmonicsbasefreq=(int)o->value();} + tooltip {Adaptive harmonics base frequency} xywh {680 495 25 25} labelsize 9 maximum 255 step 1 + code0 {o->value(oscil->Padaptiveharmonicsbasefreq);} + class WidgetPDial + } + } + } + } + Function {ADOscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Master *master_)} {} { + code {oscil=oscil_; +oldosc=oldosc_; +master=master_; +make_window(); +osceditUI->show();} {} + } + Function {~ADOscilEditor()} {} { + code {osceditUI->hide(); +for (int i=0;i<MAX_AD_HARMONICS;i++) delete (h[i]); +delete (osceditUI);} {} + } + decl {OscilGen *oscil;} {} + decl {Fl_Widget *oldosc;} {} + decl {ADOscilharmonic *h[MAX_AD_HARMONICS];} {} + decl {Master *master;} {} +}