@@ -289,6 +289,8 @@ public: | |||||
fMutex(), | fMutex(), | ||||
fMiddleWareThread(new MiddleWareThread()) | fMiddleWareThread(new MiddleWareThread()) | ||||
{ | { | ||||
isPlugin = true; | |||||
sPrograms.initIfNeeded(); | sPrograms.initIfNeeded(); | ||||
fConfig.init(); | fConfig.init(); | ||||
@@ -236,6 +236,7 @@ int main(int argc, const char* argv[]) | |||||
else | else | ||||
{ | { | ||||
// full thing | // full thing | ||||
isPlugin = true; | |||||
MasterUI::menu_mastermenu[11].hide(); // file -> nio settings | MasterUI::menu_mastermenu[11].hide(); // file -> nio settings | ||||
} | } | ||||
@@ -421,19 +421,6 @@ class MiddleWareImpl | |||||
MiddleWare *parent; | MiddleWare *parent; | ||||
private: | private: | ||||
//Detect if the name of the process is 'zynaddsubfx' | |||||
bool isPlugin() const | |||||
{ | |||||
std::string proc_file = "/proc/" + to_s(getpid()) + "/comm"; | |||||
std::ifstream ifs(proc_file); | |||||
if(ifs.good()) { | |||||
std::string comm_name; | |||||
ifs >> comm_name; | |||||
return comm_name != "zynaddsubfx"; | |||||
} | |||||
return true; | |||||
} | |||||
public: | public: | ||||
Config* const config; | Config* const config; | ||||
MiddleWareImpl(MiddleWare *mw, SYNTH_T synth, Config* config, | MiddleWareImpl(MiddleWare *mw, SYNTH_T synth, Config* config, | ||||
@@ -44,6 +44,8 @@ | |||||
#include <rtosc/rtosc.h> | #include <rtosc/rtosc.h> | ||||
bool isPlugin = false; | |||||
prng_t prng_state = 0x1234; | prng_t prng_state = 0x1234; | ||||
/* | /* | ||||
@@ -35,6 +35,8 @@ using std::max; | |||||
//Velocity Sensing function | //Velocity Sensing function | ||||
extern float VelF(float velocity, unsigned char scaling); | extern float VelF(float velocity, unsigned char scaling); | ||||
extern bool isPlugin; | |||||
bool fileexists(const char *filename); | bool fileexists(const char *filename); | ||||
#define N_DETUNE_TYPES 4 //the number of detune types | #define N_DETUNE_TYPES 4 //the number of detune types | ||||
@@ -45,11 +45,10 @@ Envelope::Envelope(EnvelopeParams &pars, float basefreq, float bufferdt) | |||||
if((mode == 2) && linearenvelope) | if((mode == 2) && linearenvelope) | ||||
mode = 1; //change to linear | mode = 1; //change to linear | ||||
for(int i = 0; i < envpoints; ++i) { | |||||
for(int i = 0; i < MAX_ENVELOPE_POINTS; ++i) { | |||||
const float tmp = pars.getdt(i) / 1000.0f * envstretch; | const float tmp = pars.getdt(i) / 1000.0f * envstretch; | ||||
if(tmp > bufferdt) | if(tmp > bufferdt) | ||||
envdt[i] = | |||||
i == envpoints ? bufferdt / tmp : 1 / ceil(tmp / bufferdt); | |||||
envdt[i] = bufferdt / tmp; | |||||
else | else | ||||
envdt[i] = 2.0f; //any value larger than 1 | envdt[i] = 2.0f; //any value larger than 1 | ||||
@@ -68,7 +68,7 @@ class ConfigUI {} { | |||||
Fl_Tabs {} { | Fl_Tabs {} { | ||||
xywh {5 5 500 330} | xywh {5 5 500 330} | ||||
} { | } { | ||||
Fl_Group {} { | |||||
Fl_Group mainsettings { | |||||
label {Main settings} | label {Main settings} | ||||
xywh {5 25 500 310} | xywh {5 25 500 310} | ||||
} { | } { | ||||
@@ -317,6 +317,9 @@ activatebutton_presetdir(true);} | |||||
} | } | ||||
Function {show()} {} { | Function {show()} {} { | ||||
code { | code { | ||||
if (isPlugin) { | |||||
mainsettings->deactivate(); | |||||
} | |||||
rootsbrowse->update(); | rootsbrowse->update(); | ||||
presetbrowse->update(); | presetbrowse->update(); | ||||
configwindow->show(); | configwindow->show(); | ||||
@@ -243,13 +243,9 @@ class MasterUI {open | |||||
} { | } { | ||||
Fl_Window masterwindow { | Fl_Window masterwindow { | ||||
label zynaddsubfx | label zynaddsubfx | ||||
callback {if (( | |||||
\#ifdef PLUGINVERSION | |||||
1 | |||||
\#elif USE_NSM | |||||
(nsm && nsm->is_active()) | |||||
\#else | |||||
0 | |||||
callback {if ((isPlugin | |||||
\#if USE_NSM | |||||
|| (nsm && nsm->is_active()) | |||||
\#endif | \#endif | ||||
|| fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))) { | || fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))) { | ||||
close(); | close(); | ||||
@@ -962,9 +958,8 @@ updatepanel();} | |||||
} | } | ||||
Fl_Window simplemasterwindow { | Fl_Window simplemasterwindow { | ||||
label ZynAddSubFX | label ZynAddSubFX | ||||
callback {\#ifndef PLUGINVERSION | |||||
if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) | |||||
\#endif | |||||
callback { | |||||
if (isPlugin || fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) | |||||
{ | { | ||||
*exitprogram=1; | *exitprogram=1; | ||||
};} open | };} open | ||||
@@ -86,6 +86,7 @@ int Pexitprogram = 0; | |||||
using namespace GUI; | using namespace GUI; | ||||
class MasterUI *ui=0; | class MasterUI *ui=0; | ||||
bool isPlugin = false; | |||||
#ifdef NTK_GUI | #ifdef NTK_GUI | ||||
static Fl_Tiled_Image *module_backdrop; | static Fl_Tiled_Image *module_backdrop; | ||||
@@ -197,6 +198,11 @@ ui_handle_t GUI::createUi(Fl_Osc_Interface *osc, void *exit) | |||||
{ | { | ||||
if (long long winId = atoll(embedId)) | if (long long winId = atoll(embedId)) | ||||
{ | { | ||||
// running embed as plugin | |||||
isPlugin = true; | |||||
MasterUI::menu_mastermenu[11].hide(); // file -> nio settings | |||||
MasterUI::menu_mastermenu[13].hide(); // file -> exit | |||||
MasterUI::menu_mastermenu[26].deactivate(); // misc -> switch interface mode | |||||
fl_embed(ui->masterwindow, winId); | fl_embed(ui->masterwindow, winId); | ||||
ui->masterwindow->show(); | ui->masterwindow->show(); | ||||
} | } | ||||