|
|
@@ -198,7 +198,7 @@ void preparePadSynth(string path, PADnoteParameters *p, rtosc::ThreadLink *uToB) |
|
|
|
* - Load Bank * |
|
|
|
* - Refresh List of Banks * |
|
|
|
*****************************************************************************/ |
|
|
|
void refreshBankView(const Bank &bank, unsigned loc, Fl_Osc_Interface *osc) |
|
|
|
void refreshBankView(const Bank &bank, unsigned loc, std::function<void(const char*)> cb) |
|
|
|
{ |
|
|
|
if(loc >= BANK_SIZE) |
|
|
|
return; |
|
|
@@ -210,15 +210,12 @@ void refreshBankView(const Bank &bank, unsigned loc, Fl_Osc_Interface *osc) |
|
|
|
errx(1, "Failure to handle bank update properly..."); |
|
|
|
|
|
|
|
|
|
|
|
if (osc) |
|
|
|
osc->tryLink(response); |
|
|
|
if(cb) |
|
|
|
cb(response); |
|
|
|
} |
|
|
|
|
|
|
|
void bankList(Bank &bank, Fl_Osc_Interface *osc) |
|
|
|
void bankList(Bank &bank, std::function<void(const char*)> cb) |
|
|
|
{ |
|
|
|
if (! osc) |
|
|
|
return; |
|
|
|
|
|
|
|
char response[2048]; |
|
|
|
int i = 0; |
|
|
|
|
|
|
@@ -226,35 +223,35 @@ void bankList(Bank &bank, Fl_Osc_Interface *osc) |
|
|
|
if(!rtosc_message(response, 2048, "/bank-list", "iss", |
|
|
|
i++, elm.name.c_str(), elm.dir.c_str())) |
|
|
|
errx(1, "Failure to handle bank update properly..."); |
|
|
|
if (osc) |
|
|
|
osc->tryLink(response); |
|
|
|
if(cb) |
|
|
|
cb(response); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void rescanForBanks(Bank &bank, Fl_Osc_Interface *osc) |
|
|
|
void rescanForBanks(Bank &bank, std::function<void(const char*)> cb) |
|
|
|
{ |
|
|
|
bank.rescanforbanks(); |
|
|
|
bankList(bank, osc); |
|
|
|
bankList(bank, cb); |
|
|
|
} |
|
|
|
|
|
|
|
void loadBank(Bank &bank, int pos, Fl_Osc_Interface *osc) |
|
|
|
void loadBank(Bank &bank, int pos, std::function<void(const char*)> cb) |
|
|
|
{ |
|
|
|
if(bank.bankpos != pos) { |
|
|
|
bank.bankpos = pos; |
|
|
|
bank.loadbank(bank.banks[pos].dir); |
|
|
|
for(int i=0; i<BANK_SIZE; ++i) |
|
|
|
refreshBankView(bank, i, osc); |
|
|
|
refreshBankView(bank, i, cb); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void bankPos(Bank &bank, Fl_Osc_Interface *osc) |
|
|
|
void bankPos(Bank &bank, std::function<void(const char *)> cb) |
|
|
|
{ |
|
|
|
char response[2048]; |
|
|
|
|
|
|
|
if(!rtosc_message(response, 2048, "/loadbank", "i", bank.bankpos)) |
|
|
|
errx(1, "Failure to handle bank update properly..."); |
|
|
|
if(osc) |
|
|
|
osc->tryLink(response); |
|
|
|
if(cb) |
|
|
|
cb(response); |
|
|
|
} |
|
|
|
|
|
|
|
/***************************************************************************** |
|
|
@@ -1239,16 +1236,22 @@ void MiddleWareImpl::handleMsg(const char *msg) |
|
|
|
int npart = -1; |
|
|
|
char testchr = 0; |
|
|
|
|
|
|
|
std::function<void(const char*)> bank_cb; |
|
|
|
if(last_url == "GUI") |
|
|
|
bank_cb = [this](const char *msg){if(osc)osc->tryLink(msg);}; |
|
|
|
else |
|
|
|
bank_cb = [this](const char *msg){this->bToUhandle(msg, 1);}; |
|
|
|
|
|
|
|
if(!strcmp(msg, "/refresh_bank") && !strcmp(rtosc_argument_string(msg), "i")) { |
|
|
|
refreshBankView(master->bank, rtosc_argument(msg,0).i, osc); |
|
|
|
refreshBankView(master->bank, rtosc_argument(msg,0).i, bank_cb); |
|
|
|
} else if(!strcmp(msg, "/bank-list") && !strcmp(rtosc_argument_string(msg), "")) { |
|
|
|
bankList(master->bank, osc); |
|
|
|
bankList(master->bank, bank_cb); |
|
|
|
} else if(!strcmp(msg, "/rescanforbanks") && !strcmp(rtosc_argument_string(msg), "")) { |
|
|
|
rescanForBanks(master->bank, osc); |
|
|
|
rescanForBanks(master->bank, bank_cb); |
|
|
|
} else if(!strcmp(msg, "/loadbank") && !strcmp(rtosc_argument_string(msg), "i")) { |
|
|
|
loadBank(master->bank, rtosc_argument(msg, 0).i, osc); |
|
|
|
loadBank(master->bank, rtosc_argument(msg, 0).i, bank_cb); |
|
|
|
} else if(!strcmp(msg, "/loadbank") && !strcmp(rtosc_argument_string(msg), "")) { |
|
|
|
bankPos(master->bank, osc); |
|
|
|
bankPos(master->bank, bank_cb); |
|
|
|
} else if(obj_store.has(obj_rl)) { |
|
|
|
//try some over simplified pattern matching |
|
|
|
if(strstr(msg, "oscilgen/") || strstr(msg, "FMSmp/") || strstr(msg, "OscilSmp/")) { |
|
|
|