Browse Source

Update zynaddsubfx

tags/1.9.7
falkTX 10 years ago
parent
commit
e4fffbc34f
19 changed files with 240 additions and 91 deletions
  1. +1
    -1
      source/native-plugins/zynaddsubfx/Misc/Master.cpp
  2. +8
    -8
      source/native-plugins/zynaddsubfx/Misc/MiddleWare.cpp
  3. +1
    -1
      source/native-plugins/zynaddsubfx/Misc/MiddleWare.h
  4. +1
    -1
      source/native-plugins/zynaddsubfx/Misc/XMLwrapper.cpp
  5. +4
    -0
      source/native-plugins/zynaddsubfx/Params/EnvelopeParams.cpp
  6. +7
    -7
      source/native-plugins/zynaddsubfx/UI/ADnoteUI.fl
  7. +1
    -1
      source/native-plugins/zynaddsubfx/UI/BankView.cpp
  8. +22
    -6
      source/native-plugins/zynaddsubfx/UI/ConfigUI.fl
  9. +6
    -3
      source/native-plugins/zynaddsubfx/UI/EnvelopeFreeEdit.cpp
  10. +57
    -55
      source/native-plugins/zynaddsubfx/UI/EnvelopeUI.fl
  11. +17
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Numeric_Input.H
  12. +36
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Numeric_Input.cpp
  13. +1
    -2
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Output.H
  14. +3
    -3
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Output.cpp
  15. +3
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Oscilloscope.h
  16. +2
    -2
      source/native-plugins/zynaddsubfx/UI/NioUI.cpp
  17. +45
    -0
      source/native-plugins/zynaddsubfx/UI/Osc_IntModel.h
  18. +7
    -1
      source/native-plugins/zynaddsubfx/UI/OscilGenUI.fl
  19. +18
    -0
      source/native-plugins/zynaddsubfx/main.cpp

+ 1
- 1
source/native-plugins/zynaddsubfx/Misc/Master.cpp View File

@@ -667,7 +667,7 @@ void Master::AudioOut(float *outl, float *outr)
} }
if(events>1 && false) if(events>1 && false)
fprintf(stderr, "backend: %d events per cycle\n",events); fprintf(stderr, "backend: %d events per cycle\n",events);


//Swaps the Left channel with Right Channel //Swaps the Left channel with Right Channel
if(swaplr) if(swaplr)


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

@@ -347,14 +347,14 @@ struct NonRtObjStore
{ {
std::string base = "/part"+to_s(i)+"/kit"+to_s(j)+"/"; std::string base = "/part"+to_s(i)+"/kit"+to_s(j)+"/";
for(int k=0; k<NUM_VOICES; ++k) { for(int k=0; k<NUM_VOICES; ++k) {
std::string nbase = base+"adpars/voice"+to_s(k)+"/";
std::string nbase = base+"adpars/VoicePar"+to_s(k)+"/";
if(adpars) { if(adpars) {
auto &nobj = adpars->VoicePar[k]; auto &nobj = adpars->VoicePar[k];
objmap[nbase+"oscil/"] = nobj.OscilSmp;
objmap[nbase+"mod-oscil/"] = nobj.FMSmp;
objmap[nbase+"OscilSmp/"] = nobj.OscilSmp;
objmap[nbase+"FMSmp/"] = nobj.FMSmp;
} else { } else {
objmap[nbase+"oscil/"] = nullptr;
objmap[nbase+"mod-oscil/"] = nullptr;
objmap[nbase+"OscilSmp/"] = nullptr;
objmap[nbase+"FMSmp/"] = nullptr;
} }
} }
} }
@@ -365,10 +365,10 @@ struct NonRtObjStore
for(int k=0; k<NUM_VOICES; ++k) { for(int k=0; k<NUM_VOICES; ++k) {
if(padpars) { if(padpars) {
objmap[base+"padpars/"] = padpars; objmap[base+"padpars/"] = padpars;
objmap[base+"padpars/oscil/"] = padpars->oscilgen;
objmap[base+"padpars/oscilgen/"] = padpars->oscilgen;
} else { } else {
objmap[base+"padpars/"] = nullptr; objmap[base+"padpars/"] = nullptr;
objmap[base+"padpars/oscil/"] = nullptr;
objmap[base+"padpars/oscilgen/"] = nullptr;
} }
} }
} }
@@ -1214,8 +1214,8 @@ void MiddleWareImpl::kitEnable(int part, int kit, int type)
*/ */
void MiddleWareImpl::handleMsg(const char *msg) void MiddleWareImpl::handleMsg(const char *msg)
{ {
assert(!strstr(msg,"free"));
assert(msg && *msg && rindex(msg, '/')[1]); assert(msg && *msg && rindex(msg, '/')[1]);
assert(strstr(msg,"free") == NULL || strstr(rtosc_argument_string(msg), "b") == NULL);
assert(strcmp(msg, "/part0/Psysefxvol")); assert(strcmp(msg, "/part0/Psysefxvol"));
assert(strcmp(msg, "/Penabled")); assert(strcmp(msg, "/Penabled"));
assert(strcmp(msg, "part0/part0/Ppanning")); assert(strcmp(msg, "part0/part0/Ppanning"));


+ 1
- 1
source/native-plugins/zynaddsubfx/Misc/MiddleWare.h View File

@@ -4,7 +4,7 @@
#include <string> #include <string>


struct SYNTH_T; struct SYNTH_T;
class Master;
class Master;
//Link between realtime and non-realtime layers //Link between realtime and non-realtime layers
class MiddleWare class MiddleWare
{ {


+ 1
- 1
source/native-plugins/zynaddsubfx/Misc/XMLwrapper.cpp View File

@@ -98,7 +98,7 @@ XMLwrapper::XMLwrapper()
{ {
version.Major = 2; version.Major = 2;
version.Minor = 5; version.Minor = 5;
version.Revision = 0;
version.Revision = 1;


minimal = true; minimal = true;




+ 4
- 0
source/native-plugins/zynaddsubfx/Params/EnvelopeParams.cpp View File

@@ -34,7 +34,11 @@ using namespace rtosc;
static const rtosc::Ports localPorts = { static const rtosc::Ports localPorts = {
rSelf(EnvelopeParams), rSelf(EnvelopeParams),
rPaste, rPaste,
#undef rChangeCb
#define rChangeCb if(!obj->Pfreemode) obj->converttofree();
rToggle(Pfreemode, "Complex Envelope Definitions"), rToggle(Pfreemode, "Complex Envelope Definitions"),
#undef rChangeCb
#define rChangeCb
rParamZyn(Penvpoints, rProp(internal), "Number of points in complex definition"), rParamZyn(Penvpoints, rProp(internal), "Number of points in complex definition"),
rParamZyn(Penvsustain, rProp(internal), "Location of the sustain point"), rParamZyn(Penvsustain, rProp(internal), "Location of the sustain point"),
rParams(Penvdt, MAX_ENVELOPE_POINTS, "Envelope Delay Times"), rParams(Penvdt, MAX_ENVELOPE_POINTS, "Envelope Delay Times"),


+ 7
- 7
source/native-plugins/zynaddsubfx/UI/ADnoteUI.fl View File

@@ -119,7 +119,7 @@ class ADvoicelistitem {open : {public Fl_Osc_Group}
class Fl_Osc_Output class Fl_Osc_Output
} }
Fl_Slider voicedetune { Fl_Slider voicedetune {
callback {//detunevalueoutput->do_callback();}
callback {detunevalueoutput->update();}
tooltip {Fine Detune (cents)} xywh {315 5 185 20} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 tooltip {Fine Detune (cents)} xywh {315 5 185 20} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
code0 {o->init("PDetune",'i');} code0 {o->init("PDetune",'i');}
class Fl_Osc_Slider class Fl_Osc_Slider
@@ -253,7 +253,7 @@ o->redraw();}
class Fl_Osc_Counter class Fl_Osc_Counter
} }
Fl_Slider {} { Fl_Slider {} {
callback {o->oscWrite("detunevalue");}
callback {fmdetunevalueoutput->update();}
tooltip {Fine Detune (cents)} xywh {590 245 155 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 tooltip {Fine Detune (cents)} xywh {590 245 155 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
code0 {o->init("PFMDetune", 'i');} code0 {o->init("PFMDetune", 'i');}
class Fl_Osc_Slider class Fl_Osc_Slider
@@ -266,7 +266,7 @@ o->redraw();}
} }
Fl_Choice {} { Fl_Choice {} {
label {Detune Type} label {Detune Type}
callback {fmdetunevalueoutput->do_callback();} open
callback {fmdetunevalueoutput->update();} open
xywh {540 280 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 xywh {540 280 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
code1 {o->init("PFMDetuneType");} code1 {o->init("PFMDetuneType");}
@@ -466,7 +466,7 @@ o->redraw();}
class Fl_Osc_Counter class Fl_Osc_Counter
} }
Fl_Slider {} { Fl_Slider {} {
callback {detunevalueoutput->do_callback();}
callback {detunevalueoutput->update();}
tooltip {Fine Detune (cents)} xywh {58 287 392 13} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 tooltip {Fine Detune (cents)} xywh {58 287 392 13} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
code0 {o->init("PDetune", 'i');} code0 {o->init("PDetune", 'i');}
class Fl_Osc_Slider class Fl_Osc_Slider
@@ -493,7 +493,7 @@ o->redraw();}
} }
Fl_Choice {} { Fl_Choice {} {
label {Detune Type} label {Detune Type}
callback {detunevalueoutput->do_callback();} open
callback {detunevalueoutput->update();} open
xywh {455 320 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 xywh {455 320 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
code1 {o->init("PDetuneType");} code1 {o->init("PDetuneType");}
@@ -866,7 +866,7 @@ class ADnoteUI {open : {public PresetsUI_}
class LFOUI class LFOUI
} {} } {}
Fl_Slider detune { Fl_Slider detune {
callback {o->oscWrite("detunevalue");}
callback {detunevalueoutput->update();}
tooltip {Fine Detune (cents)} xywh {60 300 385 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 tooltip {Fine Detune (cents)} xywh {60 300 385 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
code0 {o->init("PDetune", 'i');} code0 {o->init("PDetune", 'i');}
class Fl_Osc_Slider class Fl_Osc_Slider
@@ -879,7 +879,7 @@ class ADnoteUI {open : {public PresetsUI_}
} }
Fl_Choice detunetype { Fl_Choice detunetype {
label {Detune Type} label {Detune Type}
callback {o->oscWrite("detunevalue");} open
callback {detunevalueoutput->update();} open
xywh {455 340 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 xywh {455 340 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
code1 {o->init("PDetuneType",1);} code1 {o->init("PDetuneType",1);}


+ 1
- 1
source/native-plugins/zynaddsubfx/UI/BankView.cpp View File

@@ -15,8 +15,8 @@ BankList::BankList(int x,int y, int w, int h, const char *label)
void BankList::init(std::string path) void BankList::init(std::string path)
{ {
ext = path; ext = path;
oscRegister("bank-list");
oscRegister(path.c_str()); oscRegister(path.c_str());
osc->createLink("/bank-list", this);
} }


void BankList::OSC_raw(const char *msg) void BankList::OSC_raw(const char *msg)


+ 22
- 6
source/native-plugins/zynaddsubfx/UI/ConfigUI.fl View File

@@ -29,12 +29,18 @@ decl {\#include "Fl_Osc_Counter.H"} {public local
decl {\#include "Fl_Osc_Choice.H"} {public local decl {\#include "Fl_Osc_Choice.H"} {public local
} }


decl {\#include "Osc_IntModel.h"} {public local
}

decl {\#include "Fl_Osc_Check.H"} {public local decl {\#include "Fl_Osc_Check.H"} {public local
} }


decl {\#include "Fl_Osc_Input.H"} {public local decl {\#include "Fl_Osc_Input.H"} {public local
} }


decl {\#include "Fl_Osc_Numeric_Input.H"} {public local
}

decl {\#include "Fl_Osc_ListView.H"} {public local decl {\#include "Fl_Osc_ListView.H"} {public local
} }


@@ -71,14 +77,14 @@ class ConfigUI {} {
Fl_Input samplerateinput { Fl_Input samplerateinput {
xywh {115 50 60 20} type Int textfont 1 xywh {115 50 60 20} type Int textfont 1
code0 {o->init("cfg.SampleRate");} code0 {o->init("cfg.SampleRate");}
class Fl_Osc_Input
class Fl_Osc_Numeric_Input
} }
} }
Fl_Input {} { Fl_Input {} {
label {Buffer Size} label {Buffer Size}
tooltip {Internal Sound Buffer Size (samples)} xywh {190 45 60 20} type Int labelsize 11 align 129 textfont 1 tooltip {Internal Sound Buffer Size (samples)} xywh {190 45 60 20} type Int labelsize 11 align 129 textfont 1
code0 {o->init("cfg.SoundBufferSize");} code0 {o->init("cfg.SoundBufferSize");}
class Fl_Osc_Input
class Fl_Osc_Numeric_Input
} }
Fl_Check_Button {} { Fl_Check_Button {} {
label {Swap Stereo } label {Swap Stereo }
@@ -86,11 +92,12 @@ class ConfigUI {} {
code0 {o->init("cfg.SwapStereo");} code0 {o->init("cfg.SwapStereo");}
class Fl_Osc_Check class Fl_Osc_Check
} }
Fl_Choice {} {
Fl_Choice oscilsize_widget {
label OscilSize label OscilSize
callback{
oscilsize->updateVal((int)(o->value()+7));
}
tooltip {ADSynth Oscillator Size (samples)} xywh {175 80 75 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 10 tooltip {ADSynth Oscillator Size (samples)} xywh {175 80 75 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 10
code0 {o->init("cfg.OscilPower");}
class Fl_Osc_Choice
} { } {
MenuItem {} { MenuItem {} {
label 128 label 128
@@ -279,7 +286,14 @@ activatebutton_presetdir(true);}
Function {ConfigUI(Fl_Osc_Interface *osc_)} {} { Function {ConfigUI(Fl_Osc_Interface *osc_)} {} {
code { code {
osc = osc_; osc = osc_;
make_window();} {}
make_window();
oscilsize = new Osc_IntModel(osc);
oscilsize->callback = [this](int i){
oscilsize_widget->value(i-7);
};
oscilsize->update("/config/cfg.OscilPower");
} {}
} }
Function {activatebutton_rootdir(bool active)} {} { Function {activatebutton_rootdir(bool active)} {} {
code {if (active) { code {if (active) {
@@ -308,4 +322,6 @@ activatebutton_presetdir(true);}
} }
decl {class Fl_Osc_Interface *osc;} {public local decl {class Fl_Osc_Interface *osc;} {public local
} }
decl {class Osc_IntModel *oscilsize;} {public local
}
} }

+ 6
- 3
source/native-plugins/zynaddsubfx/UI/EnvelopeFreeEdit.cpp View File

@@ -26,7 +26,7 @@ void EnvelopeFreeEdit::init(void)
void EnvelopeFreeEdit::OSC_raw(const char *msg) void EnvelopeFreeEdit::OSC_raw(const char *msg)
{ {
const char *args = rtosc_argument_string(msg); const char *args = rtosc_argument_string(msg);
if(strstr(msg,"Penvpoints") && !strcmp(args, "c")) {
if(strstr(msg,"Penvpoints") && !strcmp(args, "i")) {
Penvpoints = rtosc_argument(msg, 0).i; Penvpoints = rtosc_argument(msg, 0).i;
} else if(strstr(msg,"Penvdt") && !strcmp(args, "b")) { } else if(strstr(msg,"Penvdt") && !strcmp(args, "b")) {
rtosc_blob_t b = rtosc_argument(msg, 0).b; rtosc_blob_t b = rtosc_argument(msg, 0).b;
@@ -36,7 +36,7 @@ void EnvelopeFreeEdit::OSC_raw(const char *msg)
rtosc_blob_t b = rtosc_argument(msg, 0).b; rtosc_blob_t b = rtosc_argument(msg, 0).b;
assert(b.len == MAX_ENVELOPE_POINTS); assert(b.len == MAX_ENVELOPE_POINTS);
memcpy(Penvval, b.data, MAX_ENVELOPE_POINTS); memcpy(Penvval, b.data, MAX_ENVELOPE_POINTS);
} else if(strstr(msg,"Penvsustain") && !strcmp(args, "c")) {
} else if(strstr(msg,"Penvsustain") && !strcmp(args, "i")) {
Penvsustain = rtosc_argument(msg, 0).i; Penvsustain = rtosc_argument(msg, 0).i;
} }
redraw(); redraw();
@@ -202,7 +202,10 @@ int EnvelopeFreeEdit::handle(int event)
else else
Penvdt[currentpoint]=0; Penvdt[currentpoint]=0;


oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt);
oscWrite(to_s("Penvval")+to_s(currentpoint), "c", ny);
oscWrite(to_s("Penvdt")+to_s(currentpoint), "c", newdt);
oscWrite("Penvdt","");
oscWrite("Penvval","");
redraw(); redraw();


if(pair) if(pair)


+ 57
- 55
source/native-plugins/zynaddsubfx/UI/EnvelopeUI.fl View File

@@ -126,11 +126,15 @@ sustaincounter->update();
} }
Fl_Check_Button freemodebutton { Fl_Check_Button freemodebutton {
label FreeMode label FreeMode
callback {reinit();
callback {
o->oscWrite("Pfreemode", o->value() ? "T" : "F");
reinit(o->value());


freeedit->lastpoint=-1; freeedit->lastpoint=-1;
freeedit->redraw();} freeedit->redraw();}
tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11 tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11
code0{o->init("Pfreemode");}
class Fl_Osc_Check
} }
Fl_Check_Button forcedreleasecheck { Fl_Check_Button forcedreleasecheck {
label frcR label frcR
@@ -503,7 +507,6 @@ envfree->redraw();}
base = base_; base = base_;
ext = ext_; ext = ext_;
Envmode = env_type; Envmode = env_type;
Pfreemode = false;
Penvsustain = false; Penvsustain = false;
Penvpoints = 3; Penvpoints = 3;
Penvstretch = 0; Penvstretch = 0;
@@ -537,59 +540,60 @@ refresh();} {}
code {Fl_Osc_Group::rebase(new_base); code {Fl_Osc_Group::rebase(new_base);
freemodeeditwindow->rebase(new_base+ext);} {} freemodeeditwindow->rebase(new_base+ext);} {}
} }
Function {reinit()} {open
Function {reinit(bool Pfreemode)} {open
} { } {
code {if(Pfreemode){
int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
freemodebutton->value(Pfreemode);
if (answer==0)
return;
};

Pfreemode = !Pfreemode;

hide();
const int winx=freemodeeditwindow->x();
const int winy=freemodeeditwindow->y();

freemodeeditwindow->hide();

envwindow->hide();
Fl_Group *par=envwindow->parent();
par->hide();


refresh();
envwindow->show();
par->redraw();

par->show();
show();
freemodeeditwindow->position(winx,winy);
freemodeeditwindow->show();

if (Pfreemode) {
freemodebutton->value(1);
addpoint->show();
deletepoint->show();
forcedreleasecheck->show();
sustaincounter->show();
envstretchdial->show();
} else{
freemodebutton->value(0);
addpoint->hide();
deletepoint->hide();
forcedreleasecheck->hide();
sustaincounter->hide();
envstretchdial->hide();
};
code {
//if(!Pfreemode){
// int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
// freemodebutton->value(Pfreemode);
// if (answer==0)
// return;
//};
freeedit->update();

hide();
const int winx=freemodeeditwindow->x();
const int winy=freemodeeditwindow->y();

bool reshow = freemodeeditwindow->visible();
freemodeeditwindow->hide();

envwindow->hide();
Fl_Group *par=envwindow->parent();
par->hide();


refresh();
envwindow->show();
par->redraw();

par->show();
show();
freemodeeditwindow->position(winx,winy);
if(reshow)
freemodeeditwindow->show();

if (Pfreemode) {
freemodebutton->value(1);
addpoint->show();
deletepoint->show();
forcedreleasecheck->show();
sustaincounter->show();
envstretchdial->show();
} else{
freemodebutton->value(0);
addpoint->hide();
deletepoint->hide();
forcedreleasecheck->hide();
sustaincounter->hide();
envstretchdial->hide();
};
} {selected } {selected
} }
} }
Function {refresh()} {open Function {refresh()} {open
} { } {
code {freemodebutton->value(Pfreemode);

code {
sustaincounter->value(Penvsustain); sustaincounter->value(Penvsustain);
sustaincounter->maximum(Penvpoints-2); sustaincounter->maximum(Penvpoints-2);


@@ -598,7 +602,7 @@ if (Pfreemode) {
linearenvelopecheck->value(Plinearenvelope); linearenvelopecheck->value(Plinearenvelope);


//Conditionally display widgets //Conditionally display widgets
if(Pfreemode) {
if(freemodebutton->value()) {
freemodebutton->value(1); freemodebutton->value(1);
addpoint->show(); addpoint->show();
deletepoint->show(); deletepoint->show();
@@ -614,14 +618,14 @@ linearenvelopecheck->value(Plinearenvelope);
envstretchdial->hide(); envstretchdial->hide();
} }


if(Pfreemode || Envmode>2)
if(freemodebutton->value() || Envmode>2)
linearenvelopecheck->hide(); linearenvelopecheck->hide();
else else
linearenvelopecheck->show(); linearenvelopecheck->show();


forcedreleasecheck->value(Pforcedrelease); forcedreleasecheck->value(Pforcedrelease);


if (Pfreemode==0){
if (freemodebutton->value()==0){
addpoint->hide(); addpoint->hide();
deletepoint->hide(); deletepoint->hide();
} else { } else {
@@ -635,7 +639,7 @@ envADSRfilter->hide();
envASRbw->hide(); envASRbw->hide();
envfree->hide(); envfree->hide();


if (Pfreemode==0){
if (freemodebutton->value()==0){
switch(Envmode){ switch(Envmode){
case 1: case 1:
case 2: case 2:
@@ -664,8 +668,6 @@ envwindow->show();} {}
} }
decl {int Envmode;} {private local decl {int Envmode;} {private local
} }
decl {int Pfreemode;} {private local
}
decl {int Penvsustain;} {private local decl {int Penvsustain;} {private local
} }
decl {int Penvpoints;} {private local decl {int Penvpoints;} {private local


+ 17
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Numeric_Input.H View File

@@ -0,0 +1,17 @@
#pragma once
#include <FL/Fl_Input.H>
#include "Fl_Osc_Widget.H"

class Fl_Osc_Numeric_Input: public Fl_Input, public Fl_Osc_Widget
{
public:
Fl_Osc_Numeric_Input(int X, int Y, int W, int H, const char *label = NULL);
virtual ~Fl_Osc_Numeric_Input(void);
//Normal Initialization
void init(const char *path);

virtual void OSC_value(int i) override;
virtual void OSC_value(float f) override;
static void numeric_callback(Fl_Widget *w);
};

+ 36
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Numeric_Input.cpp View File

@@ -0,0 +1,36 @@
#include "Fl_Osc_Numeric_Input.H"

Fl_Osc_Numeric_Input::Fl_Osc_Numeric_Input(int X, int Y, int W, int H, const char *label)
:Fl_Input(X,Y,W,H, label), Fl_Osc_Widget(this)
{
callback(numeric_callback);
}

Fl_Osc_Numeric_Input::~Fl_Osc_Numeric_Input(void)
{}

void Fl_Osc_Numeric_Input::init(const char *path)
{
ext = path;
oscRegister(path);
}

void Fl_Osc_Numeric_Input::OSC_value(float f)
{
OSC_value((int)f);
}

void Fl_Osc_Numeric_Input::OSC_value(int i)
{
char buf[128];
snprintf(buf, 128, "%d", i);
value(buf);
}

void Fl_Osc_Numeric_Input::numeric_callback(Fl_Widget *w)
{
auto &ww = *(Fl_Osc_Numeric_Input *)w;
int x = atoi(ww.value());
if(x)
ww.oscWrite(ww.ext, "i", x);
}

+ 1
- 2
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Output.H View File

@@ -2,7 +2,7 @@
#include <FL/Fl_Value_Output.H> #include <FL/Fl_Value_Output.H>
#include "Fl_Osc_Widget.H" #include "Fl_Osc_Widget.H"


class Fl_Osc_Output:public Fl_Value_Output, Fl_Osc_Widget
class Fl_Osc_Output:public Fl_Value_Output, public Fl_Osc_Widget
{ {
public: public:
Fl_Osc_Output(int x, int y, int w, int h, const char *label = NULL); Fl_Osc_Output(int x, int y, int w, int h, const char *label = NULL);
@@ -19,6 +19,5 @@ class Fl_Osc_Output:public Fl_Value_Output, Fl_Osc_Widget
void cb(void); void cb(void);
private: private:
float newvalue_; float newvalue_;
std::string name;
std::pair<Fl_Callback*, void*> cb_data; std::pair<Fl_Callback*, void*> cb_data;
}; };

+ 3
- 3
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Output.cpp View File

@@ -19,7 +19,7 @@ Fl_Osc_Output::Fl_Osc_Output(int X, int Y, int W, int H, const char *label)


void Fl_Osc_Output::init(const char *path) void Fl_Osc_Output::init(const char *path)
{ {
name = path;
ext = path;
oscRegister(path); oscRegister(path);
}; };


@@ -51,7 +51,7 @@ void Fl_Osc_Output::OSC_value(float v)
void Fl_Osc_Output::update(void) void Fl_Osc_Output::update(void)
{ {
oscWrite(name);
oscWrite(ext);
} }


float Fl_Osc_Output::newvalue(void) const float Fl_Osc_Output::newvalue(void) const
@@ -61,5 +61,5 @@ float Fl_Osc_Output::newvalue(void) const


void Fl_Osc_Output::cb(void) void Fl_Osc_Output::cb(void)
{ {
oscWrite(name);
oscWrite(ext);
} }

+ 3
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Oscilloscope.h View File

@@ -54,6 +54,9 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget


virtual void OSC_value(unsigned N, void *data) override virtual void OSC_value(unsigned N, void *data) override
{ {
if(oscilsize == 0)
OSC_value((int)N/4);

assert(N==(unsigned)(oscilsize*4)); assert(N==(unsigned)(oscilsize*4));


memcpy(smps, data, N); memcpy(smps, data, N);


+ 2
- 2
source/native-plugins/zynaddsubfx/UI/NioUI.cpp View File

@@ -56,7 +56,7 @@ class Fl_Osc_StrChoice:public Fl_Choice, public Fl_Osc_Widget
cb_data.first = cb; cb_data.first = cb;
cb_data.second = p; cb_data.second = p;
} }
void cb(void) void cb(void)
{ {
assert(osc); assert(osc);
@@ -110,7 +110,7 @@ NioUI::NioUI(Fl_Osc_Interface *osc)
for(auto io:list) for(auto io:list)
audio->add(io.c_str()); audio->add(io.c_str());
}; };
midi_opt->update("/io/source-list"); midi_opt->update("/io/source-list");
audio_opt->update("/io/sink-list"); audio_opt->update("/io/sink-list");




+ 45
- 0
source/native-plugins/zynaddsubfx/UI/Osc_IntModel.h View File

@@ -0,0 +1,45 @@
#pragma once
#include "Fl_Osc_Widget.H"
#include <functional>
#include <vector>
#include <rtosc/rtosc.h>

class Osc_IntModel:public Fl_Osc_Widget
{
public:
Osc_IntModel(Fl_Osc_Interface *osc_)
:Fl_Osc_Widget("", osc_), value(0)
{
assert(osc);
}

typedef int value_t;
value_t value;
std::function<void(value_t)> callback;

void updateVal(value_t v)
{
value = v;
oscWrite(ext, "i", v);
}

void update(std::string url)
{
if(!ext.empty())
osc->removeLink(this);
ext = url;

oscRegister(ext.c_str());
}
//Raw messages
virtual void OSC_raw(const char *msg)
{
std::string args = rtosc_argument_string(msg);
if(args == "i") {
value = rtosc_argument(msg, 0).i;
if(callback)
callback(value);
}
}
};

+ 7
- 1
source/native-plugins/zynaddsubfx/UI/OscilGenUI.fl View File

@@ -119,7 +119,7 @@ class Oscilharmonic {: {public Fl_Group}
Fl_Slider mag { Fl_Slider mag {
callback {int x=64; callback {int x=64;
if (Fl::event_button3()) o->value(x); if (Fl::event_button3()) o->value(x);
else x=127-(int)o->value();
else x=128-(int)o->value();
if (x==64) o->selection_color(0); if (x==64) o->selection_color(0);
else o->selection_color(222); else o->selection_color(222);


@@ -496,12 +496,15 @@ redrawoscil();}
if (autoclearbutton->value()){ if (autoclearbutton->value()){
for (int i=0;i<MAX_AD_HARMONICS;i++){ for (int i=0;i<MAX_AD_HARMONICS;i++){
h[i]->mag->value(64); h[i]->mag->value(64);
h[i]->mag->do_callback();
h[i]->phase->value(64); h[i]->phase->value(64);
h[i]->phase->do_callback();
}; };


harmonicshiftcounter->value(0); harmonicshiftcounter->value(0);


h[0]->mag->value(0); h[0]->mag->value(0);
h[0]->mag->do_callback();
wshbutton->value(0); wshbutton->value(0);
wshbutton->do_callback(); wshbutton->do_callback();
fltbutton->value(0); fltbutton->value(0);
@@ -527,9 +530,12 @@ redrawoscil();}


for (int i=0;i<MAX_AD_HARMONICS;i++){ for (int i=0;i<MAX_AD_HARMONICS;i++){
h[i]->mag->value(64); h[i]->mag->value(64);
h[i]->mag->do_callback();
h[i]->phase->value(64); h[i]->phase->value(64);
h[i]->phase->do_callback();
}; };
h[0]->mag->value(0); h[0]->mag->value(0);
h[0]->mag->do_callback();


//for (int i=0;i<MAX_AD_HARMONICS;i++){ //for (int i=0;i<MAX_AD_HARMONICS;i++){
// if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0); // if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0);


+ 18
- 0
source/native-plugins/zynaddsubfx/main.cpp View File

@@ -429,11 +429,29 @@ int main(int argc, char *argv[])




gui = NULL; gui = NULL;

//Capture Startup Responses
typedef std::vector<const char *> wait_t;
wait_t msg_waitlist;
middleware->setUiCallback([](void*v,const char*msg) {
wait_t &wait = *(wait_t*)v;
size_t len = rtosc_message_length(msg, -1);
char *copy = new char[len];
memcpy(copy, msg, len);
wait.push_back(copy);
}, &msg_waitlist);

if(!noui) if(!noui)
gui = GUI::createUi(middleware->spawnUiApi(), &Pexitprogram); gui = GUI::createUi(middleware->spawnUiApi(), &Pexitprogram);
middleware->setUiCallback(GUI::raiseUi, gui); middleware->setUiCallback(GUI::raiseUi, gui);
middleware->setIdleCallback([](void*){GUI::tickUi(gui);}, NULL); middleware->setIdleCallback([](void*){GUI::tickUi(gui);}, NULL);


//Replay Startup Responses
for(auto msg:msg_waitlist) {
GUI::raiseUi(gui, msg);
delete [] msg;
}

if(!noui) if(!noui)
{ {
GUI::raiseUi(gui, "/show", "i", config.cfg.UserInterfaceMode); GUI::raiseUi(gui, "/show", "i", config.cfg.UserInterfaceMode);


Loading…
Cancel
Save