Browse Source

Update zyn again

tags/1.9.7
falkTX 9 years ago
parent
commit
88c19032cf
3 changed files with 41 additions and 21 deletions
  1. +12
    -0
      source/native-plugins/zynaddsubfx-src.cpp
  2. +5
    -0
      source/native-plugins/zynaddsubfx-ui.cpp
  3. +24
    -21
      source/native-plugins/zynaddsubfx/Misc/MiddleWare.cpp

+ 12
- 0
source/native-plugins/zynaddsubfx-src.cpp View File

@@ -38,6 +38,18 @@ using std::isnan;
// C-code includes
extern "C" {
#include "zynaddsubfx/tlsf/tlsf.c"
#undef TLSF_64BIT
#undef tlsf_decl
#undef tlsf_fls_sizet
#undef tlsf_cast
#undef tlsf_min
#undef tlsf_max
#undef tlsf_assert
#undef _tlsf_glue2
#undef _tlsf_glue
#undef tlsf_static_assert
#undef tlsf_insist

#include "zynaddsubfx/rtosc/dispatch.c"
#include "zynaddsubfx/rtosc/rtosc.c"
}


+ 5
- 0
source/native-plugins/zynaddsubfx-ui.cpp View File

@@ -55,9 +55,14 @@ extern "C" {
// rtosc c++ includes
#include "zynaddsubfx/rtosc/cpp/midimapper.cpp"
#include "zynaddsubfx/rtosc/cpp/miditable.cpp"
#undef RTOSC_INVALID_MIDI
#undef MAX_UNHANDLED_PATH
#include "zynaddsubfx/rtosc/cpp/ports.cpp"
#undef __builtin_expect
#include "zynaddsubfx/rtosc/cpp/subtree-serialize.cpp"
#include "zynaddsubfx/rtosc/cpp/thread-link.cpp"
#undef off_t
#undef static
#include "zynaddsubfx/rtosc/cpp/undo-history.cpp"

// zynaddsubfx ui includes


+ 24
- 21
source/native-plugins/zynaddsubfx/Misc/MiddleWare.cpp View File

@@ -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/")) {


Loading…
Cancel
Save