zynaddsubfx

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

commit a47294335ae2f8f8291500eef1b4617127943173
parent 6a5f2f3f08f33eb78f574a293808de7fd7458408
Author: paulnasca <paulnasca>
Date:   Mon, 14 Jun 2004 19:36:40 +0000

*** empty log message ***

Diffstat:
Msrc/Misc/Config.C | 2+-
Msrc/Synth/OscilGen.C | 28+++++++++++++++++-----------
Msrc/Synth/OscilGen.h | 4++--
Msrc/UI/ADnoteUI.fl | 43+++++++++++++++++++++++++++++--------------
Msrc/UI/PartUI.fl | 38+++++++++++++++++---------------------
5 files changed, 66 insertions(+), 49 deletions(-)

diff --git a/src/Misc/Config.C b/src/Misc/Config.C @@ -79,7 +79,7 @@ Config::Config(){ cfg.bankRootDirList=new char[MAX_STRING_SIZE]; #if defined(OS_LINUX) - sprintf(cfg.bankRootDirList,"./\n/usr/share/zynaddsubfx/banks\n/usr/local/share/zynaddsubfx/banks\n~/banks"); + sprintf(cfg.bankRootDirList,"~/banks\n./\n/usr/share/zynaddsubfx/banks\n/usr/local/share/zynaddsubfx/banks\n"); #else sprintf(cfg.bankRootDirList,"./"); #endif diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C @@ -49,7 +49,7 @@ OscilGen::~OscilGen(){ void OscilGen::defaults(){ oldbasefunc=0;oldbasepar=64;oldhmagtype=0;oldwaveshapingfunction=0;oldwaveshaping=64,oldnormalizemethod=0; - oldbasefuncmodulation=0;oldharmonicshift=0;oldbasefuncmodulationpar1=0;oldbasefuncmodulationpar2=0; + oldbasefuncmodulation=0;oldharmonicshift=0;oldbasefuncmodulationpar1=0;oldbasefuncmodulationpar2=0;oldbasefuncmodulationpar3=0; for (int i=0;i<MAX_AD_HARMONICS;i++){ hmag[i]=0.0; hphase[i]=0.0; @@ -66,6 +66,7 @@ void OscilGen::defaults(){ Pbasefuncmodulation=0; Pbasefuncmodulationpar1=64; Pbasefuncmodulationpar2=0; + Pbasefuncmodulationpar3=0; Pwaveshapingfunction=0; Pwaveshaping=64; @@ -205,25 +206,26 @@ void OscilGen::getbasefunction(REALTYPE *smps){ if (Pbasefuncpar==64) par=0.5; REALTYPE basefuncmodulationpar1=Pbasefuncmodulationpar1/127.0, - basefuncmodulationpar2=Pbasefuncmodulationpar2/127.0; + basefuncmodulationpar2=Pbasefuncmodulationpar2/127.0, + basefuncmodulationpar3=Pbasefuncmodulationpar3/127.0; switch(Pbasefuncmodulation){ case 1:basefuncmodulationpar1=(pow(2,basefuncmodulationpar1*5.0)-1.0)/10.0; - basefuncmodulationpar2=floor((pow(2,basefuncmodulationpar2*5.0)-1.0)); - if (basefuncmodulationpar2<0.9999) basefuncmodulationpar2=-1.0; + basefuncmodulationpar3=floor((pow(2,basefuncmodulationpar3*5.0)-1.0)); + if (basefuncmodulationpar3<0.9999) basefuncmodulationpar3=-1.0; break; case 2:basefuncmodulationpar1=(pow(2,basefuncmodulationpar1*5.0)-1.0)/10.0; - basefuncmodulationpar2=1.0+floor((pow(2,basefuncmodulationpar2*5.0)-1.0)); + basefuncmodulationpar3=1.0+floor((pow(2,basefuncmodulationpar3*5.0)-1.0)); break; - }; + }; for (i=0;i<OSCIL_SIZE;i++) { REALTYPE t=i*1.0/OSCIL_SIZE; switch(Pbasefuncmodulation){ - case 1:t=t*basefuncmodulationpar2+sin(t*2.0*PI)*basefuncmodulationpar1;//rev + case 1:t=t*basefuncmodulationpar3+sin((t+basefuncmodulationpar2)*2.0*PI)*basefuncmodulationpar1;//rev break; - case 2:t=t+sin(t*2.0*PI*basefuncmodulationpar2)*basefuncmodulationpar1;//sine + case 2:t=t+sin((t*basefuncmodulationpar3+basefuncmodulationpar2)*2.0*PI)*basefuncmodulationpar1;//sine break; }; @@ -339,7 +341,7 @@ void OscilGen::changebasefunction(){ oldbasefuncmodulation=Pbasefuncmodulation; oldbasefuncmodulationpar1=Pbasefuncmodulationpar1; oldbasefuncmodulationpar2=Pbasefuncmodulationpar2; - + oldbasefuncmodulationpar3=Pbasefuncmodulationpar3; }; /* @@ -465,7 +467,8 @@ void OscilGen::prepare(){ if ((oldbasepar!=Pbasefuncpar)||(oldbasefunc!=Pcurrentbasefunc)|| (oldbasefuncmodulation!=Pbasefuncmodulation)|| (oldbasefuncmodulationpar1!=Pbasefuncmodulationpar1)|| - (oldbasefuncmodulationpar2!=Pbasefuncmodulationpar2)) + (oldbasefuncmodulationpar2!=Pbasefuncmodulationpar2)|| + (oldbasefuncmodulationpar3!=Pbasefuncmodulationpar3)) changebasefunction(); for (i=0;i<MAX_AD_HARMONICS;i++) hphase[i]=(Phphase[i]-64.0)/64.0*PI/(i+1); @@ -582,7 +585,8 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){ if ((oldbasefuncmodulation!=Pbasefuncmodulation)|| (oldbasefuncmodulationpar1!=Pbasefuncmodulationpar1)|| - (oldbasefuncmodulationpar2!=Pbasefuncmodulationpar2)) + (oldbasefuncmodulationpar2!=Pbasefuncmodulationpar2)|| + (oldbasefuncmodulationpar3!=Pbasefuncmodulationpar3)) oscilprepared=0; if (oldharmonicshift!=Pharmonicshift+Pharmonicshiftfirst*256) oscilprepared=0; @@ -946,6 +950,7 @@ void OscilGen::add2XML(XMLwrapper *xml){ xml->addpar("base_function_modulation",Pbasefuncmodulation); xml->addpar("base_function_modulation_par1",Pbasefuncmodulationpar1); xml->addpar("base_function_modulation_par2",Pbasefuncmodulationpar2); + xml->addpar("base_function_modulation_par3",Pbasefuncmodulationpar3); xml->addpar("wave_shaping",Pwaveshaping); xml->addpar("wave_shaping_function",Pwaveshapingfunction); @@ -1007,6 +1012,7 @@ void OscilGen::getfromXML(XMLwrapper *xml){ Pbasefuncmodulation=xml->getpar127("base_function_modulation",Pbasefuncmodulation); Pbasefuncmodulationpar1=xml->getpar127("base_function_modulation_par1",Pbasefuncmodulationpar1); Pbasefuncmodulationpar2=xml->getpar127("base_function_modulation_par2",Pbasefuncmodulationpar2); + Pbasefuncmodulationpar3=xml->getpar127("base_function_modulation_par3",Pbasefuncmodulationpar3); Pwaveshaping=xml->getpar127("wave_shaping",Pwaveshaping); diff --git a/src/Synth/OscilGen.h b/src/Synth/OscilGen.h @@ -76,7 +76,7 @@ class OscilGen{ unsigned char Pbasefuncpar;//the parameter of the base function unsigned char Pbasefuncmodulation;//what modulation is applied to the basefunc - unsigned char Pbasefuncmodulationpar1,Pbasefuncmodulationpar2;//the parameter of the base functions + unsigned char Pbasefuncmodulationpar1,Pbasefuncmodulationpar2,Pbasefuncmodulationpar3;//the parameter of the base functions /*the Randomness: 64=no randomness @@ -132,7 +132,7 @@ class OscilGen{ //Internal Data unsigned char oldbasefunc,oldbasepar,oldhmagtype,oldwaveshapingfunction,oldwaveshaping,oldnormalizemethod; - int oldfilterpars,oldsapars,oldbasefuncmodulation,oldbasefuncmodulationpar1,oldbasefuncmodulationpar2,oldharmonicshift; + int oldfilterpars,oldsapars,oldbasefuncmodulation,oldbasefuncmodulationpar1,oldbasefuncmodulationpar2,oldbasefuncmodulationpar3,oldharmonicshift; /* The frequencies of wavefroms are stored like this: c[0],c[1],....,c[OSCIL_SIZE/2],s[OSCIL_SIZE/2-1],...,s[2],s[1] diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -358,6 +358,16 @@ oldosc->redraw();} 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(); @@ -428,20 +438,16 @@ if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodula label {Base Func.} xywh {490 10 110 20} box FLAT_BOX labelfont 1 } - Fl_Value_Slider {} { - label {par.} - callback {oscil->Pbasefuncpar=(int)o->value()+64; -basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Base Function Parameter} xywh {475 285 135 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(oscil->Pbasefuncpar-64);} - } 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_Choice {} { label {Mag.Type} @@ -713,16 +719,16 @@ oldosc->redraw();} } {} } Fl_Group basefuncmodulation { - xywh {615 278 115 25} box ENGRAVED_BOX + xywh {580 278 150 25} box ENGRAVED_BOX code0 {if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();} } { Fl_Choice {} { - label {M.} + label {Mod.} callback {oscil->Pbasefuncmodulation=(int) o->value(); basefuncdisplaygroup->redraw(); oscildisplaygroup->redraw(); oldosc->redraw();} open - tooltip {Oscillator's modulation} xywh {635 283 50 15} down_box BORDER_BOX labelsize 10 textsize 10 + tooltip {Base function modulation} xywh {610 283 50 15} down_box BORDER_BOX labelsize 10 textsize 10 code0 {o->value(oscil->Pbasefuncmodulation);} } { menuitem {} { @@ -743,7 +749,7 @@ oldosc->redraw();} open basefuncdisplaygroup->redraw(); oscildisplaygroup->redraw(); oldosc->redraw();} - tooltip {Oscillator's modulation parameter 1} xywh {690 283 15 15} maximum 127 step 1 + tooltip {Oscillator's modulation parameter 1} xywh {670 283 15 15} maximum 127 step 1 code0 {o->value(oscil->Pbasefuncmodulationpar1);} class WidgetPDial } @@ -752,10 +758,19 @@ oldosc->redraw();} basefuncdisplaygroup->redraw(); oscildisplaygroup->redraw(); oldosc->redraw();} - tooltip {Oscillator's modulation parameter 1} xywh {710 283 15 15} maximum 127 step 1 + tooltip {Oscillator's modulation parameter 2} xywh {690 283 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();} selected + tooltip {Oscillator's modulation parameter 3} xywh {710 283 15 15} maximum 127 step 1 + code0 {o->value(oscil->Pbasefuncmodulationpar3);} + class WidgetPDial + } } Fl_Choice {} { label Normalize diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -827,89 +827,89 @@ subsynenabledcheck->value(part->kit[0].Psubenabled);} xywh {60 156 395 465} type Double hide } { Fl_Group {} { - xywh {0 5 395 110} box ENGRAVED_FRAME + xywh {0 320 395 110} box ENGRAVED_FRAME } { Fl_Group {} { label PADsynth - xywh {205 30 100 80} box ENGRAVED_FRAME labelfont 1 + xywh {205 345 100 80} box ENGRAVED_FRAME labelfont 1 } { Fl_Button {} { label Edit callback {//showparameters(0,1); fl_alert("Oops... try again...")} - xywh {215 65 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128 + xywh {215 380 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128 } Fl_Check_Button padsynenabledcheck { label Enabled callback {//part->kit[0].Padenabled=(int) o->value();} - tooltip {enable/disable PADsynth} xywh {215 40 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 + tooltip {enable/disable PADsynth} xywh {215 355 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 code1 {//o->value(part->kit[0].Padenabled);} } } Fl_Group {} { label ADDsynth - xywh {5 30 100 80} box ENGRAVED_FRAME labelfont 1 + xywh {5 345 100 80} box ENGRAVED_FRAME labelfont 1 } { Fl_Check_Button adsynenabledcheck { label Enabled callback {part->kit[0].Padenabled=(int) o->value();} - tooltip {enable/disable ADsynth} xywh {15 40 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 + tooltip {enable/disable ADsynth} xywh {15 355 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 code1 {o->value(part->kit[0].Padenabled);} } Fl_Button {} { label Edit callback {showparameters(0,0);} - xywh {15 66 80 34} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128 + xywh {15 381 80 34} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128 } } Fl_Group {} { label SUBsynth - xywh {105 30 100 80} box ENGRAVED_FRAME labelfont 1 + xywh {105 345 100 80} box ENGRAVED_FRAME labelfont 1 } { Fl_Check_Button subsynenabledcheck { label Enabled callback {part->kit[0].Psubenabled=(int) o->value();} - tooltip {enable/disable SUBsynth} xywh {115 40 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 + tooltip {enable/disable SUBsynth} xywh {115 355 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 code1 {o->value(part->kit[0].Psubenabled);} } Fl_Button {} { label Edit callback {showparameters(0,1);} - xywh {115 65 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128 + xywh {115 380 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128 } } Fl_Button {} { label {Kit Edit} callback {instrumentkitlist->show();} - xywh {310 30 80 35} box PLASTIC_UP_BOX color 238 selection_color 220 labelfont 1 align 128 + xywh {310 345 80 35} box PLASTIC_UP_BOX color 238 selection_color 220 labelfont 1 align 128 } Fl_Button {} { label Effects callback {partfx->show();} - xywh {310 75 80 35} box PLASTIC_UP_BOX labelfont 1 labelsize 16 + xywh {310 390 80 35} box PLASTIC_UP_BOX labelfont 1 labelsize 16 } } - Fl_Group {} { - xywh {0 115 395 315} box ENGRAVED_FRAME + Fl_Group {} {selected + xywh {0 5 395 315} box ENGRAVED_FRAME } { Fl_Input {} { label {Author and Copyright} callback {snprintf((char *)part->info.Pauthor,MAX_INFO_TEXT_SIZE,"%s",o->value());} - xywh {5 170 385 100} type Multiline labelsize 10 align 5 + xywh {5 60 385 100} type Multiline labelsize 10 align 5 code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} code1 {o->value((char *) &part->info.Pauthor);} } Fl_Input {} { label Comments callback {snprintf((char *)part->info.Pcomments,MAX_INFO_TEXT_SIZE,"%s",o->value());} - xywh {5 285 385 140} type Multiline labelsize 12 align 5 + xywh {5 175 385 140} type Multiline labelsize 12 align 5 code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} code1 {o->value((char *) &part->info.Pcomments);} } Fl_Choice {} { label {Type:} callback {part->info.Ptype=o->value();} - xywh {235 135 155 20} down_box BORDER_BOX labelfont 1 labelsize 12 align 5 textsize 11 + xywh {5 25 155 20} down_box BORDER_BOX labelfont 1 labelsize 12 align 5 textsize 11 code0 {o->value(part->info.Ptype);} } { menuitem {} { @@ -981,10 +981,6 @@ fl_alert("Oops... try again...")} xywh {160 160 100 20} labelfont 1 labelsize 12 } } - Fl_Box {} { - label {About Instrument} - xywh {5 120 130 25} labelfont 1 align 20 - } } Fl_Button {} { label Close