commit 3d6133f94bed83c56f7ca34f322dafbb16820102
parent e34c08c8b66e1065b1bd440344ce106f7c4f8d2e
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Sat, 15 Feb 2014 13:26:46 -0500
More GUI/OSC Bughunting
- Replaced O(n) time UI dispatch with O(log n)
- Fixed shadowed variables in PSlider class which resulted in a segfault
- Fixed deallocation of padsyth UI elements
- Fixed allocation of synth editing windows when enable flags are changed
Diffstat:
4 files changed, 50 insertions(+), 52 deletions(-)
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -498,7 +498,7 @@ struct MiddleWareImpl
void bToUhandle(const char *rtmsg)
{
- printf("return: got a '%s'\n", rtmsg);
+ printf(".");fflush(stdout);//return: got a '%s'\n", rtmsg);
if(!strcmp(rtmsg, "/echo")
&& !strcmp(rtosc_argument_string(rtmsg),"ss")
&& !strcmp(rtosc_argument(rtmsg,0).s, "OSC_URL"))
@@ -740,7 +740,8 @@ class UI_Interface:public Fl_Osc_Interface
void writeRaw(const char *msg) override
{
fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 4 + 30, 0 + 40);
- fprintf(stderr, "write(%s)\n", msg);
+ fprintf(stderr, ".");
+ //fprintf(stderr, "write(%s)\n", msg);
fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40);
impl->handleMsg(msg);
}
@@ -836,33 +837,33 @@ class UI_Interface:public Fl_Osc_Interface
int found_count = 0;
- for(auto pair:map) {
- if(pair.first == msg) {
- found_count++;
- const char *arg_str = rtosc_argument_string(msg);
-
- //Always provide the raw message
- pair.second->OSC_raw(msg);
-
- if(!strcmp(arg_str, "b")) {
- pair.second->OSC_value(rtosc_argument(msg,0).b.len,
- rtosc_argument(msg,0).b.data,
- handle);
- } else if(!strcmp(arg_str, "c")) {
- pair.second->OSC_value((char)rtosc_argument(msg,0).i,
- handle);
- } else if(!strcmp(arg_str, "s")) {
- pair.second->OSC_value((const char*)rtosc_argument(msg,0).s,
- handle);
- } else if(!strcmp(arg_str, "i")) {
- pair.second->OSC_value((int)rtosc_argument(msg,0).i,
- handle);
- } else if(!strcmp(arg_str, "f")) {
- pair.second->OSC_value((float)rtosc_argument(msg,0).f,
- handle);
- } else if(!strcmp(arg_str, "T") || !strcmp(arg_str, "F")) {
- pair.second->OSC_value((bool)rtosc_argument(msg,0).T, handle);
- }
+ auto range = map.equal_range(msg);
+ for(auto itr = range.first; itr != range.second; ++itr) {
+ auto widget = itr->second;
+ found_count++;
+ const char *arg_str = rtosc_argument_string(msg);
+
+ //Always provide the raw message
+ widget->OSC_raw(msg);
+
+ if(!strcmp(arg_str, "b")) {
+ widget->OSC_value(rtosc_argument(msg,0).b.len,
+ rtosc_argument(msg,0).b.data,
+ handle);
+ } else if(!strcmp(arg_str, "c")) {
+ widget->OSC_value((char)rtosc_argument(msg,0).i,
+ handle);
+ } else if(!strcmp(arg_str, "s")) {
+ widget->OSC_value((const char*)rtosc_argument(msg,0).s,
+ handle);
+ } else if(!strcmp(arg_str, "i")) {
+ widget->OSC_value((int)rtosc_argument(msg,0).i,
+ handle);
+ } else if(!strcmp(arg_str, "f")) {
+ widget->OSC_value((float)rtosc_argument(msg,0).f,
+ handle);
+ } else if(!strcmp(arg_str, "T") || !strcmp(arg_str, "F")) {
+ widget->OSC_value((bool)rtosc_argument(msg,0).T, handle);
}
}
diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl
@@ -91,10 +91,6 @@ if (!Fl::event_inside(X,Y,W,H)) {
return(1);} {}
}
- decl {std::string loc;} {public local
- }
- decl {Fl_Osc_Interface *osc} {public local
- }
Function {OSC_value(char c)} {open return_type void
} {
code {if(phase)
diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl
@@ -875,7 +875,7 @@ applybutton->parent()->redraw();} {}
delete(resui);
padnotewindow->hide();
-delete(padnotewindow);} {}
+delete padnotewindow;} {}
}
decl {OscilEditor *oscui;} {public local
}
diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl
@@ -823,10 +823,8 @@ if (x==2) part->partefx[ninseff]->setdryonly(true);
}
Fl_Check_Button padsynenabledcheck {
label Enabled
- callback {if (o->value()==0){ delete padnoteui; padnoteui = NULL; padeditbutton->deactivate();}
-else {
- padnoteui=new PADnoteUI(loc+"kit0/padpars/", osc);
- padeditbutton->activate();}}
+ callback {if (o->value()==0) padeditbutton->deactivate();
+ else padeditbutton->activate();}
tooltip {enable/disable PADsynth} xywh {215 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 51 labelfont 1 labelsize 11
code1 {o->init("Ppadenabled");}
class Fl_Osc_Check
@@ -1028,32 +1026,35 @@ keylimitlist->value(val);} {}
}
Function {showparameters(int kititem,int engine)} {open
} {
- code {if (engine==-1){//this is used if I want to clear the engine from the part
- if (kititem==lastkititem) kititem=-1;
- else kititem=lastkititem;
-};
+ code {
+if (engine==-1){//this is used if I want to clear the engine from the part
+ if (kititem==lastkititem) kititem=-1;
+ else kititem=lastkititem;
+}
if (kititem!=lastkititem){
delete adnoteui;
delete subnoteui;
- adnoteui=NULL;subnoteui=NULL;
+ delete padnoteui;
+ adnoteui=NULL;subnoteui=NULL;padnoteui=NULL;
lastkititem=kititem;
if(kititem>=NUM_KIT_ITEMS) return;//bad kit item
if(kititem<0) return;
+}
- if(adsynenabledcheck->value())
- adnoteui=new ADnoteUI(loc+"kit"+to_s(kititem)+"/adpars/", osc);
-
- if(subsynenabledcheck->value())
- subnoteui=new SUBnoteUI(osc, loc+"kit"+to_s(kititem)+"/subpars/");
-};
+if(!adnoteui && adsynenabledcheck->value())
+ adnoteui=new ADnoteUI(loc+"kit"+to_s(kititem)+"/adpars/", osc);
+if(!subnoteui && subsynenabledcheck->value())
+ subnoteui=new SUBnoteUI(osc, loc+"kit"+to_s(kititem)+"/subpars/");
+if(!padnoteui && padsynenabledcheck->value())
+ padnoteui=new PADnoteUI(loc+"kit"+to_s(kititem)+"/padpars/", osc);
-if ((engine==0)&&adnoteui) adnoteui->ADnoteGlobalParameters->show();
-if ((engine==1)&&subnoteui) subnoteui->SUBparameters->show();
-if ((engine==2)&&padnoteui) padnoteui->padnotewindow->show();} {}
+if (engine==0&&adnoteui) adnoteui->ADnoteGlobalParameters->show();
+if (engine==1&&subnoteui) subnoteui->SUBparameters->show();
+if (engine==2&&padnoteui) padnoteui->padnotewindow->show();} {}
}
Function {~PartUI()} {} {
code {delete adnoteui;