commit be38d28dbb3c0b7c305b964a49b899d3878b10e8
parent c886c180052697b4a69023f887984a5f1d0e3861
Author: fundamental <[email protected]>
Date: Thu, 2 Jul 2009 18:28:35 -0400
Added new proportional portamento controls
Diffstat:
3 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/src/Params/Controller.cpp b/src/Params/Controller.cpp
@@ -53,6 +53,8 @@ void Controller::defaults()
portamento.portamento=0;
portamento.used=0;
portamento.proportional=0;
+ portamento.tmpa=64;
+ portamento.tmpb=64;
portamento.receive=1;
portamento.time=64;
portamento.updowntimestretch=64;
@@ -182,7 +184,6 @@ void Controller::setportamento(int value)
int Controller::initportamento(REALTYPE oldfreq,REALTYPE newfreq,bool legatoflag)
{
- printf("%f %f\n",oldfreq,newfreq);
portamento.x=0.0;
if (legatoflag) { // Legato in progress
@@ -194,12 +195,15 @@ int Controller::initportamento(REALTYPE oldfreq,REALTYPE newfreq,bool legatoflag
REALTYPE portamentotime=pow(100.0,portamento.time/127.0)/50.0;//portamento time in seconds
if (portamento.proportional) {
- //If there is a min(float,float) and max(float,float) then they
+ //If there is a min(float,float) and a max(float,float) then they
//could be used here
- if(oldfreq > newfreq) //2 is a proportionality constant
- portamentotime *= oldfreq/newfreq/2;
- else
- portamentotime *= newfreq/oldfreq/2;
+ //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 ((portamento.updowntimestretch>=64)&&(newfreq<oldfreq)) {
@@ -211,6 +215,8 @@ 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);
+
portamento.dx=SOUND_BUFFER_SIZE/(portamentotime*SAMPLE_RATE);
portamento.origfreqrap=oldfreq/newfreq;
diff --git a/src/Params/Controller.h b/src/Params/Controller.h
@@ -151,6 +151,10 @@ public:
* 0 - nonproportional (default)
* 1 - proportional*/
unsigned char proportional;
+ /**Should be removed or renamed later*/
+ unsigned char tmpa;
+ /**Should be removed or renamed later*/
+ unsigned char tmpb;
/**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 {248 461 460 130} type Double hide
+ private xywh {254 346 530 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 open
+ label Portamento
xywh {280 15 120 85} box ENGRAVED_FRAME labelfont 1 labelsize 10
} {
Fl_Check_Button {} {
@@ -583,13 +583,13 @@ part->ctl.portamento.updowntimestretch=x;}
}
Fl_Check_Button {} {
label {Proprt.}
- callback {part->ctl.portamento.proportional=(int) o->value();} selected
+ callback {part->ctl.portamento.proportional=(int) o->value();}
tooltip {Enable Proportinal Portamento (over fixed Portamento)} xywh {285 40 50 15} box THIN_UP_BOX down_box DOWN_BOX labelsize 9
code0 {o->value(part->ctl.portamento.proportional);}
}
}
Fl_Group {} {
- label Resonance open
+ label Resonance
xywh {400 15 45 85} box ENGRAVED_BOX labelfont 1 labelsize 10
} {
Fl_Dial {} {
@@ -619,6 +619,20 @@ part->ctl.portamento.updowntimestretch=x;}
tooltip {Exponential BandWidth Controller} xywh {85 15 35 25} down_box DOWN_BOX labelsize 10 align 148
code0 {o->value(part->ctl.bandwidth.exponential);}
}
+ Fl_Dial {} {
+ label {Temp A}
+ callback {part->ctl.portamento.tmpa=(int) o->value();}
+ tooltip {Distance required to double change from nonpropotinal portamento time} xywh {465 15 35 35} maximum 127 step 1
+ code0 {o->value(part->ctl.portamento.tmpa);}
+ class WidgetPDial
+ }
+ Fl_Dial {} {
+ label {Temp B}
+ callback {part->ctl.portamento.tmpb=(int) o->value();} selected
+ tooltip {The difference from nonproportinal portamento} xywh {465 70 30 30} maximum 127 step 1
+ code0 {o->value(part->ctl.portamento.tmpb);}
+ class WidgetPDial
+ }
}
Fl_Window partfx {
label {Part's Insert Effects}