commit e4639d83eb2e3a1ca2f3a41ded18986a53d1af2d
parent 51b78a8500059c1f6e324b59dd76aa1ccfb373d6
Author: fundamental <[email protected]>
Date: Sat, 13 Jun 2015 14:18:01 -0400
UI: Fix Free Envelope Editing
Diffstat:
4 files changed, 68 insertions(+), 59 deletions(-)
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -1214,8 +1214,8 @@ void MiddleWareImpl::kitEnable(int part, int kit, int type)
*/
void MiddleWareImpl::handleMsg(const char *msg)
{
- assert(!strstr(msg,"free"));
assert(msg && *msg && rindex(msg, '/')[1]);
+ assert(strstr(msg,"free") == NULL || strstr(rtosc_argument_string(msg), "b") == NULL);
assert(strcmp(msg, "/part0/Psysefxvol"));
assert(strcmp(msg, "/Penabled"));
assert(strcmp(msg, "part0/part0/Ppanning"));
diff --git a/src/Params/EnvelopeParams.cpp b/src/Params/EnvelopeParams.cpp
@@ -34,7 +34,11 @@ using namespace rtosc;
static const rtosc::Ports localPorts = {
rSelf(EnvelopeParams),
rPaste,
+#undef rChangeCb
+#define rChangeCb if(!obj->Pfreemode) obj->converttofree();
rToggle(Pfreemode, "Complex Envelope Definitions"),
+#undef rChangeCb
+#define rChangeCb
rParamZyn(Penvpoints, rProp(internal), "Number of points in complex definition"),
rParamZyn(Penvsustain, rProp(internal), "Location of the sustain point"),
rParams(Penvdt, MAX_ENVELOPE_POINTS, "Envelope Delay Times"),
diff --git a/src/UI/EnvelopeFreeEdit.cpp b/src/UI/EnvelopeFreeEdit.cpp
@@ -26,7 +26,7 @@ void EnvelopeFreeEdit::init(void)
void EnvelopeFreeEdit::OSC_raw(const char *msg)
{
const char *args = rtosc_argument_string(msg);
- if(strstr(msg,"Penvpoints") && !strcmp(args, "c")) {
+ if(strstr(msg,"Penvpoints") && !strcmp(args, "i")) {
Penvpoints = rtosc_argument(msg, 0).i;
} else if(strstr(msg,"Penvdt") && !strcmp(args, "b")) {
rtosc_blob_t b = rtosc_argument(msg, 0).b;
@@ -36,7 +36,7 @@ void EnvelopeFreeEdit::OSC_raw(const char *msg)
rtosc_blob_t b = rtosc_argument(msg, 0).b;
assert(b.len == MAX_ENVELOPE_POINTS);
memcpy(Penvval, b.data, MAX_ENVELOPE_POINTS);
- } else if(strstr(msg,"Penvsustain") && !strcmp(args, "c")) {
+ } else if(strstr(msg,"Penvsustain") && !strcmp(args, "i")) {
Penvsustain = rtosc_argument(msg, 0).i;
}
redraw();
@@ -202,7 +202,10 @@ int EnvelopeFreeEdit::handle(int event)
else
Penvdt[currentpoint]=0;
- oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt);
+ oscWrite(to_s("Penvval")+to_s(currentpoint), "c", ny);
+ oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt);
+ oscWrite("Penvdt","");
+ oscWrite("Penvval","");
redraw();
if(pair)
diff --git a/src/UI/EnvelopeUI.fl b/src/UI/EnvelopeUI.fl
@@ -126,11 +126,15 @@ sustaincounter->update();
}
Fl_Check_Button freemodebutton {
label FreeMode
- callback {reinit();
+ callback {
+ o->oscWrite("Pfreemode", o->value() ? "T" : "F");
+ reinit(o->value());
freeedit->lastpoint=-1;
freeedit->redraw();}
tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11
+ code0{o->init("Pfreemode");}
+ class Fl_Osc_Check
}
Fl_Check_Button forcedreleasecheck {
label frcR
@@ -503,7 +507,6 @@ envfree->redraw();}
base = base_;
ext = ext_;
Envmode = env_type;
- Pfreemode = false;
Penvsustain = false;
Penvpoints = 3;
Penvstretch = 0;
@@ -537,59 +540,60 @@ refresh();} {}
code {Fl_Osc_Group::rebase(new_base);
freemodeeditwindow->rebase(new_base+ext);} {}
}
- Function {reinit()} {open
+ Function {reinit(bool Pfreemode)} {open
} {
- code {if(Pfreemode){
- int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
- freemodebutton->value(Pfreemode);
- if (answer==0)
- return;
-};
-
-Pfreemode = !Pfreemode;
-
-hide();
-const int winx=freemodeeditwindow->x();
-const int winy=freemodeeditwindow->y();
-
-freemodeeditwindow->hide();
-
-envwindow->hide();
-Fl_Group *par=envwindow->parent();
-par->hide();
-
-
-refresh();
-envwindow->show();
-par->redraw();
-
-par->show();
-show();
-freemodeeditwindow->position(winx,winy);
-freemodeeditwindow->show();
-
-if (Pfreemode) {
- freemodebutton->value(1);
- addpoint->show();
- deletepoint->show();
- forcedreleasecheck->show();
- sustaincounter->show();
- envstretchdial->show();
-} else{
- freemodebutton->value(0);
- addpoint->hide();
- deletepoint->hide();
- forcedreleasecheck->hide();
- sustaincounter->hide();
- envstretchdial->hide();
-};
+ code {
+ //if(!Pfreemode){
+ // int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
+ // freemodebutton->value(Pfreemode);
+ // if (answer==0)
+ // return;
+ //};
+ freeedit->update();
+
+ hide();
+ const int winx=freemodeeditwindow->x();
+ const int winy=freemodeeditwindow->y();
+
+ bool reshow = freemodeeditwindow->visible();
+ freemodeeditwindow->hide();
+
+ envwindow->hide();
+ Fl_Group *par=envwindow->parent();
+ par->hide();
+
+
+ refresh();
+ envwindow->show();
+ par->redraw();
+
+ par->show();
+ show();
+ freemodeeditwindow->position(winx,winy);
+ if(reshow)
+ freemodeeditwindow->show();
+
+ if (Pfreemode) {
+ freemodebutton->value(1);
+ addpoint->show();
+ deletepoint->show();
+ forcedreleasecheck->show();
+ sustaincounter->show();
+ envstretchdial->show();
+ } else{
+ freemodebutton->value(0);
+ addpoint->hide();
+ deletepoint->hide();
+ forcedreleasecheck->hide();
+ sustaincounter->hide();
+ envstretchdial->hide();
+ };
} {selected
}
}
Function {refresh()} {open
} {
- code {freemodebutton->value(Pfreemode);
-
+ code {
sustaincounter->value(Penvsustain);
sustaincounter->maximum(Penvpoints-2);
@@ -598,7 +602,7 @@ if (Pfreemode) {
linearenvelopecheck->value(Plinearenvelope);
//Conditionally display widgets
- if(Pfreemode) {
+ if(freemodebutton->value()) {
freemodebutton->value(1);
addpoint->show();
deletepoint->show();
@@ -614,14 +618,14 @@ linearenvelopecheck->value(Plinearenvelope);
envstretchdial->hide();
}
- if(Pfreemode || Envmode>2)
+ if(freemodebutton->value() || Envmode>2)
linearenvelopecheck->hide();
else
linearenvelopecheck->show();
forcedreleasecheck->value(Pforcedrelease);
-if (Pfreemode==0){
+if (freemodebutton->value()==0){
addpoint->hide();
deletepoint->hide();
} else {
@@ -635,7 +639,7 @@ envADSRfilter->hide();
envASRbw->hide();
envfree->hide();
-if (Pfreemode==0){
+if (freemodebutton->value()==0){
switch(Envmode){
case 1:
case 2:
@@ -664,8 +668,6 @@ envwindow->show();} {}
}
decl {int Envmode;} {private local
}
- decl {int Pfreemode;} {private local
- }
decl {int Penvsustain;} {private local
}
decl {int Penvpoints;} {private local