Browse Source

Update ZynAddSubFX

tags/1.9.7
falkTX 8 years ago
parent
commit
15bec22636
9 changed files with 24 additions and 27 deletions
  1. +2
    -0
      source/native-plugins/zynaddsubfx-synth.cpp
  2. +1
    -0
      source/native-plugins/zynaddsubfx-ui.cpp
  3. +0
    -13
      source/native-plugins/zynaddsubfx/Misc/MiddleWare.cpp
  4. +2
    -0
      source/native-plugins/zynaddsubfx/Misc/Util.cpp
  5. +2
    -0
      source/native-plugins/zynaddsubfx/Misc/Util.h
  6. +2
    -3
      source/native-plugins/zynaddsubfx/Synth/Envelope.cpp
  7. +4
    -1
      source/native-plugins/zynaddsubfx/UI/ConfigUI.fl
  8. +5
    -10
      source/native-plugins/zynaddsubfx/UI/MasterUI.fl
  9. +6
    -0
      source/native-plugins/zynaddsubfx/UI/guimain.cpp

+ 2
- 0
source/native-plugins/zynaddsubfx-synth.cpp View File

@@ -289,6 +289,8 @@ public:
fMutex(), fMutex(),
fMiddleWareThread(new MiddleWareThread()) fMiddleWareThread(new MiddleWareThread())
{ {
isPlugin = true;

sPrograms.initIfNeeded(); sPrograms.initIfNeeded();
fConfig.init(); fConfig.init();




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

@@ -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
} }




+ 0
- 13
source/native-plugins/zynaddsubfx/Misc/MiddleWare.cpp View File

@@ -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,


+ 2
- 0
source/native-plugins/zynaddsubfx/Misc/Util.cpp View File

@@ -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;


/* /*


+ 2
- 0
source/native-plugins/zynaddsubfx/Misc/Util.h View File

@@ -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


+ 2
- 3
source/native-plugins/zynaddsubfx/Synth/Envelope.cpp View File

@@ -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




+ 4
- 1
source/native-plugins/zynaddsubfx/UI/ConfigUI.fl View File

@@ -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();


+ 5
- 10
source/native-plugins/zynaddsubfx/UI/MasterUI.fl View File

@@ -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


+ 6
- 0
source/native-plugins/zynaddsubfx/UI/guimain.cpp View File

@@ -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();
} }


Loading…
Cancel
Save