zynaddsubfx

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

commit eacbb689a1a3222ffeb3d1c9a2cbf4148fd022d2
parent 8a12c60425965cd25f333d208a9485355dbe9526
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Sat, 11 Jul 2009 09:52:55 -0400

Naming conventions and adding XML saving for proportional portamento

Diffstat:
Msrc/Params/Controller.cpp | 25++++++++++++++++---------
Msrc/Params/Controller.h | 10+++++-----
Msrc/UI/PartUI.fl | 12++++++------
3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/src/Params/Controller.cpp b/src/Params/Controller.cpp @@ -53,8 +53,8 @@ void Controller::defaults() portamento.portamento=0; portamento.used=0; portamento.proportional=0; - portamento.tmpa=64; - portamento.tmpb=64; + portamento.propRate=80; + portamento.propDepth=90; portamento.receive=1; portamento.time=64; portamento.updowntimestretch=64; @@ -198,12 +198,12 @@ int Controller::initportamento(REALTYPE oldfreq,REALTYPE newfreq,bool legatoflag //If there is a min(float,float) and a max(float,float) then they //could be used here //Linear functors could also make this nicer - if(oldfreq > newfreq) //2 is the center of tmpa - portamentotime *= pow(oldfreq/newfreq/(portamento.tmpa/127.0*3+.05), - (portamento.tmpb/127.0*1.6+.2)); - else //1 is the center of tmpb - portamentotime *= pow(newfreq/oldfreq/(portamento.tmpa/127.0*3+.05), - (portamento.tmpb/127.0*1.6+.2)); + if(oldfreq > newfreq) //2 is the center of propRate + portamentotime *= pow(oldfreq/newfreq/(portamento.propRate/127.0*3+.05), + (portamento.propDepth/127.0*1.6+.2)); + else //1 is the center of propDepth + portamentotime *= pow(newfreq/oldfreq/(portamento.propRate/127.0*3+.05), + (portamento.propDepth/127.0*1.6+.2)); } if ((portamento.updowntimestretch>=64)&&(newfreq<oldfreq)) { @@ -215,7 +215,7 @@ int Controller::initportamento(REALTYPE oldfreq,REALTYPE newfreq,bool legatoflag portamentotime*=pow(0.1,(64.0-portamento.updowntimestretch)/64.0); }; - printf("%f->%f : Time %f\n",oldfreq,newfreq,portamentotime); + //printf("%f->%f : Time %f\n",oldfreq,newfreq,portamentotime); portamento.dx=SOUND_BUFFER_SIZE/(portamentotime*SAMPLE_RATE); portamento.origfreqrap=oldfreq/newfreq; @@ -318,6 +318,9 @@ void Controller::add2XML(XMLwrapper *xml) xml->addpar("portamento_pitchthreshtype",portamento.pitchthreshtype); xml->addpar("portamento_portamento",portamento.portamento); xml->addpar("portamento_updowntimestretch",portamento.updowntimestretch); + xml->addpar("portamento_proportional",portamento.proportional); + xml->addpar("portamento_proprate",portamento.propRate); + xml->addpar("portamento_propdepth",portamento.propDepth); xml->addpar("resonance_center_depth",resonancecenter.depth); xml->addpar("resonance_bandwidth_depth",resonancebandwidth.depth); @@ -344,6 +347,10 @@ void Controller::getfromXML(XMLwrapper *xml) portamento.pitchthreshtype=xml->getpar127("portamento_pitchthreshtype",portamento.pitchthreshtype); portamento.portamento=xml->getpar127("portamento_portamento",portamento.portamento); portamento.updowntimestretch=xml->getpar127("portamento_updowntimestretch",portamento.updowntimestretch); + portamento.proportional=xml->getpar127("portamento_proportional",portamento.proportional); + portamento.propRate=xml->getpar127("portamento_proprate",portamento.propRate); + portamento.propDepth=xml->getpar127("portamento_propdepth",portamento.propDepth); + resonancecenter.depth=xml->getpar127("resonance_center_depth",resonancecenter.depth); resonancebandwidth.depth=xml->getpar127("resonance_bandwidth_depth",resonancebandwidth.depth); diff --git a/src/Params/Controller.h b/src/Params/Controller.h @@ -148,13 +148,13 @@ public: unsigned char time; /**If the portamento is proportinal to the distance spanned * - * 0 - nonproportional (default) + * 0 - constant time(default) * 1 - proportional*/ unsigned char proportional; - /**Should be removed or renamed later*/ - unsigned char tmpa; - /**Should be removed or renamed later*/ - unsigned char tmpb; + /**Rate of proportinal portamento*/ + unsigned char propRate; + /**Depth of proportinal portamento*/ + unsigned char propDepth; /**pitchthresh is the threshold of enabling protamento*/ unsigned char pitchthresh; /**enable the portamento only below(0)/above(1) the threshold*/ diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -457,7 +457,7 @@ if (part->Penabled==0) partgroupui->deactivate(); } Fl_Window ctlwindow { label Controllers - private xywh {4 188 500 130} type Double visible + private xywh {542 212 500 130} type Double hide } { Fl_Check_Button {} { label Expr @@ -540,7 +540,7 @@ if (part->ctl.sustain.receive==0) { xywh {5 105 210 20} box THIN_UP_BOX } Fl_Group {} { - label Portamento selected + label Portamento xywh {280 15 160 90} box ENGRAVED_FRAME labelfont 1 labelsize 10 } { Fl_Check_Button {} { @@ -583,16 +583,16 @@ part->ctl.portamento.updowntimestretch=x;} } Fl_Dial propta { label {Prp.Rate} - callback {part->ctl.portamento.tmpa=(int) o->value();} + callback {part->ctl.portamento.propRate=(int) o->value();} tooltip {Distance required to double change from nonpropotinal portamento time} xywh {405 20 25 25} labelsize 9 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.tmpa);} + code0 {o->value(part->ctl.portamento.propRate);} class WidgetPDial } Fl_Dial proptb { label {Prp.Dpth} - callback {part->ctl.portamento.tmpb=(int) o->value();} + callback {part->ctl.portamento.propDepth=(int) o->value();} selected tooltip {The difference from nonproportinal portamento} xywh {405 60 25 25} labelsize 9 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.tmpb);} + code0 {o->value(part->ctl.portamento.propDepth);} class WidgetPDial } Fl_Check_Button {} {