zynaddsubfx

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

commit 95c635e9ccdc91265d9f57050354a34d584db7f8
parent 72ff679d90861283e3f353d25fd10c3d130ed07b
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Sun,  1 Nov 2015 12:10:16 -0500

BankUI: Fix Invalid OSC Connections

Diffstat:
Msrc/Misc/MiddleWare.cpp | 8++++----
Msrc/UI/BankUI.fl | 2+-
Msrc/UI/BankView.cpp | 31+++++++++++++++++++++----------
3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp @@ -756,7 +756,7 @@ rtosc::Ports bankPorts = { //Send updated banks int i = 0; for(auto &elm : impl.banks) - d.reply("/bank-list", "iss", i++, elm.name.c_str(), elm.dir.c_str()); + d.reply("/bank/bank_select", "iss", i++, elm.name.c_str(), elm.dir.c_str()); rEnd}, {"slot#1024:", 0, 0, @@ -769,11 +769,11 @@ rtosc::Ports bankPorts = { loc, impl.ins[loc].name.c_str(), impl.ins[loc].filename.c_str()); rEnd}, - {"slots:", 0, 0, + {"banks:", 0, 0, rBegin; int i = 0; for(auto &elm : impl.banks) - d.reply("/bank-list", "iss", i++, elm.name.c_str(), elm.dir.c_str()); + d.reply("/bank/bank_select", "iss", i++, elm.name.c_str(), elm.dir.c_str()); rEnd}, {"bank_select::i", 0, 0, rBegin @@ -791,7 +791,7 @@ rtosc::Ports bankPorts = { impl.ins[i].filename.c_str()); } } else - d.reply("/bank_select", "i", impl.bankpos); + d.reply("/bank/bank_select", "i", impl.bankpos); rEnd}, {"save_to_slot:ii", 0, 0, rBegin; diff --git a/src/UI/BankUI.fl b/src/UI/BankUI.fl @@ -89,7 +89,7 @@ refreshmainwindow();} callback {refreshmainwindow();} xywh {5 8 220 20} down_box BORDER_BOX labelfont 1 align 0 textfont 1 textsize 11 code0 {bankview->init(osc, modeselect, npart);} - code1 {o->init("loadbank");} + code1 {o->init("bank/bank_select");} class BankList } {} Fl_Button {} { diff --git a/src/UI/BankView.cpp b/src/UI/BankView.cpp @@ -15,8 +15,9 @@ BankList::BankList(int x,int y, int w, int h, const char *label) void BankList::init(std::string path) { ext = path; - oscRegister("bank-list"); + oscRegister("bank/bank_select"); oscRegister(path.c_str()); + oscWrite("bank/banks", ""); } void BankList::OSC_raw(const char *msg) @@ -245,6 +246,9 @@ void BankView::init(Fl_Osc_Interface *osc_, BankViewControls *bvc_, int *npart_) for(int i=0; i<160; ++i) slots[i]->init(i, this); + //Create Slot Listeners + for(int i=0; i<160; ++i) + osc->createLink("/bank/slot"+to_s(i), this); //Request Values for(int i=0; i<160; ++i) osc->write("/bank/slot"+to_s(i), ""); @@ -320,15 +324,22 @@ void BankView::react(int event, int nslot) void BankView::OSC_raw(const char *msg) { - if(strcmp(rtosc_argument_string(msg), "iss")) - return; - - int nslot = rtosc_argument(msg,0).i; - const char *name = rtosc_argument(msg,1).s; - const char *fname = rtosc_argument(msg,2).s; - - if(0 <= nslot && nslot < 160) - slots[nslot]->update(name, fname); + if(!strcmp(rtosc_argument_string(msg), "iss")) { + int nslot = rtosc_argument(msg,0).i; + const char *name = rtosc_argument(msg,1).s; + const char *fname = rtosc_argument(msg,2).s; + + if(0 <= nslot && nslot < 160) + slots[nslot]->update(name, fname); + } if(!strcmp(rtosc_argument_string(msg), "ss")) { + while(*msg && !isdigit(*msg)) msg++; + int nslot = atoi(msg); + const char *name = rtosc_argument(msg,0).s; + const char *fname = rtosc_argument(msg,1).s; + + if(0 <= nslot && nslot < 160) + slots[nslot]->update(name, fname); + } } void BankView::cbwig(Fl_Widget *w)