zynaddsubfx

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

commit c886c180052697b4a69023f887984a5f1d0e3861
parent 2d91785b9f4a884e37e7c74480a1705383f93cf4
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Thu,  2 Jul 2009 13:25:47 -0400

Added basic proportional portamento

Diffstat:
Msrc/Params/Controller.cpp | 11+++++++++++
Msrc/Params/Controller.h | 6++++++
Msrc/UI/PartUI.fl | 18++++++++++++------
3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/Params/Controller.cpp b/src/Params/Controller.cpp @@ -52,6 +52,7 @@ void Controller::defaults() portamento.portamento=0; portamento.used=0; + portamento.proportional=0; portamento.receive=1; portamento.time=64; portamento.updowntimestretch=64; @@ -181,6 +182,7 @@ 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 @@ -190,6 +192,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 + //could be used here + if(oldfreq > newfreq) //2 is a proportionality constant + portamentotime *= oldfreq/newfreq/2; + else + portamentotime *= newfreq/oldfreq/2; + } if ((portamento.updowntimestretch>=64)&&(newfreq<oldfreq)) { if (portamento.updowntimestretch==127) return(0); diff --git a/src/Params/Controller.h b/src/Params/Controller.h @@ -146,6 +146,11 @@ public: * Translates in an expontal fashion to 0 Seconds to 1.93 Seconds * of completion time*/ unsigned char time; + /**If the portamento is proportinal to the distance spanned + * + * 0 - nonproportional (default) + * 1 - proportional*/ + unsigned char proportional; /**pitchthresh is the threshold of enabling protamento*/ unsigned char pitchthresh; /**enable the portamento only below(0)/above(1) the threshold*/ @@ -174,6 +179,7 @@ public: /**if a the portamento is used by a note * \todo see if this can be a bool*/ int used; + //Internal data /**x is from 0.0 (start portamento) to 1.0 (finished portamento)*/ diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -42,9 +42,9 @@ decl {\#include "../Misc/Master.h"} {public decl {\#include "../Misc/Part.h"} {public } -class PartSysEffSend {open : {public Fl_Group} +class PartSysEffSend {: {public Fl_Group} } { - Function {make_window()} {open private + Function {make_window()} {private } { Fl_Window syseffsend { private xywh {584 83 90 35} type Double hide @@ -52,7 +52,7 @@ class PartSysEffSend {open : {public Fl_Group} } { Fl_Dial {} { label 01 - callback {master->setPsysefxvol(npart,neff,(int) o->value());} selected + callback {master->setPsysefxvol(npart,neff,(int) o->value());} xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1 code0 {o->size(25,25);} code1 {o->value(master->Psysefxvol[neff][npart]);} @@ -274,9 +274,9 @@ end();} {} decl {PartUI_ *partui;} {} } -class PartUI {open : {public Fl_Group,PartUI_} +class PartUI {: {public Fl_Group,PartUI_} } { - Function {make_window()} {open private + Function {make_window()} {private } { Fl_Window partgroup { private xywh {424 178 385 180} type Double hide @@ -457,7 +457,7 @@ if (part->Penabled==0) partgroupui->deactivate(); } Fl_Window ctlwindow { label Controllers - private xywh {198 472 460 130} type Double hide + private xywh {248 461 460 130} type Double hide } { Fl_Check_Button {} { label Expr @@ -581,6 +581,12 @@ part->ctl.portamento.updowntimestretch=x;} code0 {o->value(part->ctl.portamento.updowntimestretch);} class WidgetPDial } + Fl_Check_Button {} { + label {Proprt.} + callback {part->ctl.portamento.proportional=(int) o->value();} selected + 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