zynaddsubfx

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

commit a1745920b94762f53a6637974767a9526987cf82
parent 83d179e45ee1faaab92c1a20eb4963d2cc5f6272
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Fri, 23 Oct 2015 14:10:19 -0400

UI: Fix Oscillator Display Based Upon Pextoscil

Adds support for ../ in osc paths to simplify referencing resources

Diffstat:
Msrc/Misc/MiddleWare.cpp | 5+++--
Msrc/UI/ADnoteUI.fl | 29++++++++++++++++++++++-------
Msrc/UI/Connection.cpp | 20++++++++++++++++----
3 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp @@ -136,8 +136,9 @@ static int handler_function(const char *path, const char *types, lo_arg **argv, lo_message_serialise(msg, path, buffer, &size); if(!strcmp(buffer, "/path-search") && !strcmp("ss", rtosc_argument_string(buffer))) { path_search(buffer, mw->activeUrl().c_str()); - } else if(buffer[0]=='/' && rindex(buffer, '/')[1]) - mw->transmitMsg(buffer); + } else if(buffer[0]=='/' && rindex(buffer, '/')[1]) { + mw->transmitMsg(rtosc::Ports::collapsePath(buffer)); + } return 0; } diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -232,6 +232,14 @@ else voicelfofreq->deactivate(); voiceoscil->deactivate(); }; + + ext_oscil = new Osc_IntModel(osc); + ext_oscil->callback = [this](int ext) { + if(ext == -1) + voiceoscil->reext("OscilSmp/"); + else + voiceoscil->reext("../VoicePar"+to_s(ext)+"/OscilSmp/"); + }; nvoice=0;} {} } Function {init(int nvoice_, std::string loc_, Fl_Osc_Interface *osc_)} {open @@ -240,6 +248,7 @@ else assert(!loc_.empty()); voice_phase->doUpdate(loc_ + "Poscilphase"); sound_type->doUpdate(loc_ + "Type"); + ext_oscil->doUpdate(loc_ + "Pextoscil"); nvoice=nvoice_; loc = loc_; @@ -256,8 +265,9 @@ ADnoteVoiceListItem->redraw();} {} } Function {~ADvoicelistitem()} {} { code {ADnoteVoiceListItem->hide(); - osc->removeLink(voice_phase); - osc->removeLink(sound_type); + delete voice_phase; + delete sound_type; + delete ext_oscil; } {} } decl {int nvoice;} {private local @@ -266,6 +276,8 @@ ADnoteVoiceListItem->redraw();} {} } decl {class Osc_IntModel *sound_type;} {private local } + decl {class Osc_IntModel *ext_oscil;} {private local + } decl {Fl_Oscilloscope *oscil;} {private local } decl {std::string loc;} {private local @@ -588,12 +600,11 @@ o->redraw();} Fl_Button changevoiceoscilbutton { label Change callback {delete oscedit; - //if(extoscil->value()>=0) - // nv=extoscil->value(); - - oscedit=new OscilEditor(true,loc+"OscilSmp/", osc_i);} + if(extoscil->value() == 0) + oscedit=new OscilEditor(true,loc+"OscilSmp/", osc_i); + else + oscedit=new OscilEditor(true,loc+"../VoicePar"+to_s(extoscil->value()-1)+"/OscilSmp/", osc_i);} xywh {5 490 65 20} box THIN_UP_BOX labelfont 1 labelsize 11 - code0 {(void)o;/*if (extoscil->value()>=0) o->labelcolor(FL_BLUE);*/} } Fl_Box {} { label {Voice Oscillator} @@ -622,6 +633,10 @@ voiceoscil->redraw();} osc->init(false); changevoiceoscilbutton->labelcolor(FL_BLACK); }; +if(o->value() == 0) +voiceoscil->rebase(loc); +else +voiceoscil->rebase(loc+"../VoicePar"+to_s(o->value()-1)+"/"); voiceparametersgroup->redraw(); voiceonbutton->redraw();} open diff --git a/src/UI/Connection.cpp b/src/UI/Connection.cpp @@ -241,6 +241,9 @@ class UI_Interface:public Fl_Osc_Interface { assert(s!="/Psysefxvol-1/part0"); //Fl_Osc_Interface::requestValue(s); + char *tmp = strdup(s.c_str()); + s = rtosc::Ports::collapsePath(tmp); + free(tmp); if(impl->activeUrl() != "GUI") { impl->transmitMsg("/echo", "ss", "OSC_URL", "GUI"); impl->activeUrl("GUI"); @@ -251,6 +254,9 @@ class UI_Interface:public Fl_Osc_Interface void write(string s, const char *args, ...) override { + char *tmp = strdup(s.c_str()); + s = rtosc::Ports::collapsePath(tmp); + free(tmp); va_list va; va_start(va, args); //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 4 + 30, 0 + 40); @@ -267,7 +273,7 @@ class UI_Interface:public Fl_Osc_Interface ////fprintf(stderr, "."); //fprintf(stderr, "rawWrite(%s:%s)\n", msg, rtosc_argument_string(msg)); //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40); - impl->transmitMsg(msg); + impl->transmitMsg(rtosc::Ports::collapsePath((char*)msg)); } void writeValue(string s, string ss) override @@ -275,7 +281,7 @@ class UI_Interface:public Fl_Osc_Interface //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 4 + 30, 0 + 40); //fprintf(stderr, "writevalue<string>(%s,%s)\n", s.c_str(),ss.c_str()); //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40); - impl->transmitMsg(s.c_str(), "s", ss.c_str()); + write(s, "s", ss.c_str()); } void writeValue(string s, char c) override @@ -283,7 +289,7 @@ class UI_Interface:public Fl_Osc_Interface //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 4 + 30, 0 + 40); //fprintf(stderr, "writevalue<char>(%s,%d)\n", s.c_str(),c); //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40); - impl->transmitMsg(s.c_str(), "c", c); + write(s, "c", c); } void writeValue(string s, float f) override @@ -291,11 +297,14 @@ class UI_Interface:public Fl_Osc_Interface //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 4 + 30, 0 + 40); //fprintf(stderr, "writevalue<float>(%s,%f)\n", s.c_str(),f); //fprintf(stderr, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40); - impl->transmitMsg(s.c_str(), "f", f); + write(s, "f", f); } void createLink(string s, class Fl_Osc_Widget*w) override { + char *tmp = strdup(s.c_str()); + s = rtosc::Ports::collapsePath(tmp); + free(tmp); assert(s.length() != 0); Fl_Osc_Interface::createLink(s,w); assert(!strstr(s.c_str(), "/part0/kit-1")); @@ -312,6 +321,9 @@ class UI_Interface:public Fl_Osc_Interface void removeLink(string s, class Fl_Osc_Widget*w) override { + char *tmp = strdup(s.c_str()); + s = rtosc::Ports::collapsePath(tmp); + free(tmp); for(auto i = map.begin(); i != map.end(); ++i) { if(i->first == s && i->second == w) { map.erase(i);