Browse Source

Update zyn again, fix carla code to match

Closes #318
Closes #323
tags/1.9.7
falkTX 10 years ago
parent
commit
db5fb1cd05
36 changed files with 451 additions and 155 deletions
  1. +9
    -11
      source/native-plugins/zynaddsubfx-ui.cpp
  2. +4
    -9
      source/native-plugins/zynaddsubfx/DSP/FormantFilter.cpp
  3. +2
    -3
      source/native-plugins/zynaddsubfx/Effects/Chorus.cpp
  4. +2
    -1
      source/native-plugins/zynaddsubfx/Effects/EffectLFO.cpp
  5. +4
    -2
      source/native-plugins/zynaddsubfx/Effects/Phaser.cpp
  6. +10
    -4
      source/native-plugins/zynaddsubfx/Misc/Master.cpp
  7. +1
    -1
      source/native-plugins/zynaddsubfx/Misc/Microtonal.cpp
  8. +24
    -2
      source/native-plugins/zynaddsubfx/Misc/MiddleWare.cpp
  9. +20
    -9
      source/native-plugins/zynaddsubfx/Params/EnvelopeParams.cpp
  10. +2
    -2
      source/native-plugins/zynaddsubfx/Params/EnvelopeParams.h
  11. +34
    -4
      source/native-plugins/zynaddsubfx/Params/FilterParams.cpp
  12. +11
    -4
      source/native-plugins/zynaddsubfx/Params/LFOParams.cpp
  13. +3
    -2
      source/native-plugins/zynaddsubfx/Params/PADnoteParameters.cpp
  14. +30
    -1
      source/native-plugins/zynaddsubfx/Synth/LFO.cpp
  15. +4
    -0
      source/native-plugins/zynaddsubfx/Synth/LFO.h
  16. +42
    -18
      source/native-plugins/zynaddsubfx/Synth/OscilGen.cpp
  17. +12
    -1
      source/native-plugins/zynaddsubfx/Synth/Resonance.cpp
  18. +26
    -6
      source/native-plugins/zynaddsubfx/UI/ADnoteUI.fl
  19. +1
    -1
      source/native-plugins/zynaddsubfx/UI/BankUI.fl
  20. +3
    -2
      source/native-plugins/zynaddsubfx/UI/BankView.cpp
  21. +4
    -5
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Dial.cpp
  22. +3
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_DialF.H
  23. +18
    -2
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_DialF.cpp
  24. +2
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Pane.H
  25. +8
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Pane.cpp
  26. +5
    -0
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Slider.H
  27. +38
    -30
      source/native-plugins/zynaddsubfx/UI/Fl_Osc_Slider.cpp
  28. +6
    -3
      source/native-plugins/zynaddsubfx/UI/MasterUI.fl
  29. +8
    -0
      source/native-plugins/zynaddsubfx/UI/Osc_IntModel.h
  30. +11
    -13
      source/native-plugins/zynaddsubfx/UI/OscilGenUI.fl
  31. +47
    -10
      source/native-plugins/zynaddsubfx/UI/PADnoteUI.fl
  32. +19
    -1
      source/native-plugins/zynaddsubfx/UI/PartUI.fl
  33. +5
    -5
      source/native-plugins/zynaddsubfx/UI/SUBnoteUI.fl
  34. +1
    -1
      source/native-plugins/zynaddsubfx/UI/WidgetPDial.cpp
  35. +28
    -1
      source/native-plugins/zynaddsubfx/UI/guimain.cpp
  36. +4
    -1
      source/utils/CarlaPluginUI.cpp

+ 9
- 11
source/native-plugins/zynaddsubfx-ui.cpp View File

@@ -183,8 +183,7 @@ protected:
CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(uiTitle), true); CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(uiTitle), true);


try { try {
MasterUI* const ui((MasterUI*)gui);
ui->masterwindow->label(uiTitle);
GUI::raiseUi(gui, "/ui/title", "s", uiTitle);
} CARLA_SAFE_EXCEPTION("msgReceived uiTitle"); } CARLA_SAFE_EXCEPTION("msgReceived uiTitle");
return true; return true;
} }
@@ -224,29 +223,28 @@ int main(int argc, const char* argv[])
lo_server_add_method(server, NULL, NULL, handler_function, 0); lo_server_add_method(server, NULL, NULL, handler_function, 0);
} }


std::thread lo_watch(watch_lo);
gui = GUI::createUi(new UI_Interface(), &Pexitprogram); gui = GUI::createUi(new UI_Interface(), &Pexitprogram);


if (argc == 1) if (argc == 1)
GUI::raiseUi(gui, "/show", "i", 1); GUI::raiseUi(gui, "/show", "i", 1);


if (uiTitle != nullptr)
{
MasterUI* const ui((MasterUI*)gui);
ui->masterwindow->label(uiTitle);
}
if (uiTitle != nullptr && uiTitle[0] != '\0')
GUI::raiseUi(gui, "/ui/title", "s", uiTitle);


for (; Pexitprogram == 0;) for (; Pexitprogram == 0;)
{ {
if (server != nullptr) {
for (; lo_server_recv_noblock(server, 0);) {}
}

pipe.idlePipe(); pipe.idlePipe();
GUI::tickUi(gui); GUI::tickUi(gui);

for (; lo_buffer.hasNext();)
raiseUi(gui, lo_buffer.read());
} }


GUI::destroyUi(gui); GUI::destroyUi(gui);
gui = nullptr; gui = nullptr;

lo_watch.join();
return 0; return 0;
} }




+ 4
- 9
source/native-plugins/zynaddsubfx/DSP/FormantFilter.cpp View File

@@ -115,21 +115,16 @@ void FormantFilter::setpos(float frequency)
else else
oldinput = input; oldinput = input;


float pos = fmodf(input * sequencestretch, 1.0f);
if(pos < 0.0f)
pos += 1.0f;
float pos = input * sequencestretch;
pos -= floorf(pos);


F2I(pos * sequencesize, p2); F2I(pos * sequencesize, p2);
p1 = p2 - 1; p1 = p2 - 1;
if(p1 < 0) if(p1 < 0)
p1 += sequencesize; p1 += sequencesize;


pos = fmodf(pos * sequencesize, 1.0f);
if(pos < 0.0f)
pos = 0.0f;
else
if(pos > 1.0f)
pos = 1.0f;
pos = pos * sequencesize;
pos -= floorf(pos);
pos = pos =
(atanf((pos * 2.0f (atanf((pos * 2.0f
- 1.0f) - 1.0f)


+ 2
- 3
source/native-plugins/zynaddsubfx/Effects/Chorus.cpp View File

@@ -69,7 +69,6 @@ float Chorus::getdelay(float xlfo)
//Apply the effect //Apply the effect
void Chorus::out(const Stereo<float *> &input) void Chorus::out(const Stereo<float *> &input)
{ {
const float one = 1.0f;
dl1 = dl2; dl1 = dl2;
dr1 = dr2; dr1 = dr2;
lfo.effectlfoout(&lfol, &lfor); lfo.effectlfoout(&lfol, &lfor);
@@ -98,7 +97,7 @@ void Chorus::out(const Stereo<float *> &input)
dlhi %= maxdelay; dlhi %= maxdelay;


float dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; float dlhi2 = (dlhi - 1 + maxdelay) % maxdelay;
float dllo = 1.0f - fmod(tmp, one);
float dllo = 1.0f + floorf(tmp) - tmp;
efxoutl[i] = cinterpolate(delaySample.l, maxdelay, dlhi2) * dllo efxoutl[i] = cinterpolate(delaySample.l, maxdelay, dlhi2) * dllo
+ cinterpolate(delaySample.l, maxdelay, + cinterpolate(delaySample.l, maxdelay,
dlhi) * (1.0f - dllo); dlhi) * (1.0f - dllo);
@@ -116,7 +115,7 @@ void Chorus::out(const Stereo<float *> &input)
dlhi %= maxdelay; dlhi %= maxdelay;


dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; dlhi2 = (dlhi - 1 + maxdelay) % maxdelay;
dllo = 1.0f - fmodf(tmp, one);
dllo = 1.0f + floorf(tmp) - tmp;
efxoutr[i] = cinterpolate(delaySample.r, maxdelay, dlhi2) * dllo efxoutr[i] = cinterpolate(delaySample.r, maxdelay, dlhi2) * dllo
+ cinterpolate(delaySample.r, maxdelay, + cinterpolate(delaySample.r, maxdelay,
dlhi) * (1.0f - dllo); dlhi) * (1.0f - dllo);


+ 2
- 1
source/native-plugins/zynaddsubfx/Effects/EffectLFO.cpp View File

@@ -60,7 +60,8 @@ void EffectLFO::updateparams(void)
if(PLFOtype > 1) if(PLFOtype > 1)
PLFOtype = 1; //this has to be updated if more lfo's are added PLFOtype = 1; //this has to be updated if more lfo's are added
lfotype = PLFOtype; lfotype = PLFOtype;
xr = fmodf(xl + (Pstereo - 64.0f) / 127.0f + 1.0f, 1.0f);
xr = xl + (Pstereo - 64.0f) / 127.0f + 1.0f;
xr -= floorf(xr);
} }






+ 4
- 2
source/native-plugins/zynaddsubfx/Effects/Phaser.cpp View File

@@ -135,8 +135,10 @@ void Phaser::AnalogPhase(const Stereo<float *> &input)
Stereo<float> xn(input.l[i] * pangainL, input.r[i] * pangainR); Stereo<float> xn(input.l[i] * pangainL, input.r[i] * pangainR);


if(barber) { if(barber) {
g.l = fmodf((g.l + 0.25f), ONE_);
g.r = fmodf((g.r + 0.25f), ONE_);
g.l += 0.25;
g.l -= floorf(g.l);
g.r += 0.25;
g.r -= floorf(g.r);
} }


xn.l = applyPhase(xn.l, g.l, fb.l, hpf.l, yn1.l, xn1.l); xn.l = applyPhase(xn.l, g.l, fb.l, hpf.l, yn1.l, xn1.l);


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

@@ -73,10 +73,11 @@ static const Ports sysefxPort =
int ind2 = atoi(m); int ind2 = atoi(m);
Master &mast = *(Master*)d.obj; Master &mast = *(Master*)d.obj;


if(rtosc_narguments(m))
if(rtosc_narguments(m)) {
mast.setPsysefxvol(ind2, ind1, rtosc_argument(m,0).i); mast.setPsysefxvol(ind2, ind1, rtosc_argument(m,0).i);
else
d.reply(d.loc, "i", mast.Psysefxvol[ind2][ind1]);
d.broadcast(d.loc, "i", mast.Psysefxvol[ind1][ind2]);
} else
d.reply(d.loc, "i", mast.Psysefxvol[ind1][ind2]);
}} }}
}; };


@@ -112,8 +113,13 @@ static const Ports master_ports = {
rRecursp(insefx, 8, "Insertion Effect"),//NUM_INS_EFX rRecursp(insefx, 8, "Insertion Effect"),//NUM_INS_EFX
rRecur(microtonal, "Micrtonal Mapping Functionality"), rRecur(microtonal, "Micrtonal Mapping Functionality"),
rRecur(ctl, "Controller"), rRecur(ctl, "Controller"),
rParamZyn(Pkeyshift, "Global Key Shift"),
rArrayI(Pinsparts, NUM_INS_EFX, "Part to insert part onto"), rArrayI(Pinsparts, NUM_INS_EFX, "Part to insert part onto"),
{"Pkeyshift::i", rProp(parameter) rLinear(0,127) rDoc("Global Key Shift"), 0, [](const char *m, RtData&d) {
if(rtosc_narguments(m)==0) {
d.reply(d.loc, "i", ((Master*)d.obj)->Pkeyshift);
} else if(rtosc_narguments(m)==1 && rtosc_type(m,0)=='i') {
((Master*)d.obj)->setPkeyshift(limit<char>(rtosc_argument(m,0).i,0,127));
d.broadcast(d.loc, "i", ((Master*)d.obj)->Pkeyshift);}}},
{"echo", rDoc("Hidden port to echo messages"), 0, [](const char *m, RtData&d) { {"echo", rDoc("Hidden port to echo messages"), 0, [](const char *m, RtData&d) {
d.reply(m-1);}}, d.reply(m-1);}},
{"get-vu:", rDoc("Grab VU Data"), 0, [](const char *, RtData &d) { {"get-vu:", rDoc("Grab VU Data"), 0, [](const char *, RtData &d) {


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

@@ -655,7 +655,7 @@ void Microtonal::getfromXML(XMLwrapper *xml)
//populate fields for display //populate fields for display
float x = logf(octave[i].tuning) / LOG_2 * 1200.0f; float x = logf(octave[i].tuning) / LOG_2 * 1200.0f;
octave[i].x1 = (int) floor(x); octave[i].x1 = (int) floor(x);
octave[i].x2 = (int) (floor(fmodf(x, 1.0f) * 1e6));
octave[i].x2 = (int) (floor((x-octave[i].x1) * 1.0e6));
} }






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

@@ -324,13 +324,22 @@ struct NonRtObjStore
void handlePad(const char *msg, rtosc::RtData &d) { void handlePad(const char *msg, rtosc::RtData &d) {
string obj_rl(d.message, msg); string obj_rl(d.message, msg);
void *pad = get(obj_rl); void *pad = get(obj_rl);
if(!strcmp(msg, "prepare"))
if(!strcmp(msg, "prepare")) {
preparePadSynth(obj_rl, (PADnoteParameters*)pad, d); preparePadSynth(obj_rl, (PADnoteParameters*)pad, d);
else {
d.matches++;
d.reply((obj_rl+"needPrepare").c_str(), "F");
} else {
assert(pad); assert(pad);
strcpy(d.loc, obj_rl.c_str()); strcpy(d.loc, obj_rl.c_str());
d.obj = pad; d.obj = pad;
PADnoteParameters::non_realtime_ports.dispatch(msg, d); PADnoteParameters::non_realtime_ports.dispatch(msg, d);
if(rtosc_narguments(msg)) {
if(!strcmp(msg, "oscilgen/prepare"))
; //ignore
else {
d.reply((obj_rl+"needPrepare").c_str(), "T");
}
}
} }
} }
}; };
@@ -782,6 +791,7 @@ rtosc::Ports bankPorts = {
int i = 0; int i = 0;
for(auto &elm : impl.banks) for(auto &elm : impl.banks)
d.reply("/bank/bank_select", "iss", i++, elm.name.c_str(), elm.dir.c_str()); d.reply("/bank/bank_select", "iss", i++, elm.name.c_str(), elm.dir.c_str());
d.reply("/bank/bank_select", "i", impl.bankpos);


rEnd}, rEnd},
{"slot#1024:", 0, 0, {"slot#1024:", 0, 0,
@@ -977,6 +987,16 @@ static rtosc::Ports middwareSnoopPorts = {
impl.pending_load[part_id]++; impl.pending_load[part_id]++;
impl.loadPart(part_id, file, impl.master); impl.loadPart(part_id, file, impl.master);
rEnd}, rEnd},
{"load-part:iss", 0, 0,
rBegin;
const int part_id = rtosc_argument(msg,0).i;
const char *file = rtosc_argument(msg,1).s;
const char *name = rtosc_argument(msg,2).s;
impl.pending_load[part_id]++;
impl.loadPart(part_id, file, impl.master);
impl.uToB->write(("/part"+to_s(part_id)+"/Pname").c_str(), "s",
name);
rEnd},
{"setprogram:i:c", 0, 0, {"setprogram:i:c", 0, 0,
rBegin; rBegin;
Bank &bank = impl.master->bank; Bank &bank = impl.master->bank;
@@ -984,6 +1004,7 @@ static rtosc::Ports middwareSnoopPorts = {
if(slot < BANK_SIZE) { if(slot < BANK_SIZE) {
impl.pending_load[0]++; impl.pending_load[0]++;
impl.loadPart(0, impl.master->bank.ins[slot].filename.c_str(), impl.master); impl.loadPart(0, impl.master->bank.ins[slot].filename.c_str(), impl.master);
impl.uToB->write("/part0/Pname", "s", impl.master->bank.ins[slot].name.c_str());
} }
rEnd}, rEnd},
{"part#16/clear:", 0, 0, {"part#16/clear:", 0, 0,
@@ -1039,6 +1060,7 @@ static rtosc::Ports middlewareReplyPorts = {
const int part = rtosc_argument(msg, 0).i; const int part = rtosc_argument(msg, 0).i;
const int program = rtosc_argument(msg, 1).i; const int program = rtosc_argument(msg, 1).i;
impl.loadPart(part, impl.master->bank.ins[program].filename.c_str(), impl.master); impl.loadPart(part, impl.master->bank.ins[program].filename.c_str(), impl.master);
impl.uToB->write(("/part"+to_s(part)+"/Pname").c_str(), "s", impl.master->bank.ins[program].name.c_str());
rEnd}, rEnd},
{"undo_pause:", 0, 0, rBegin; impl.recording_undo = false; rEnd}, {"undo_pause:", 0, 0, rBegin; impl.recording_undo = false; rEnd},
{"undo_resume:", 0, 0, rBegin; impl.recording_undo = true; rEnd}, {"undo_resume:", 0, 0, rBegin; impl.recording_undo = true; rEnd},


+ 20
- 9
source/native-plugins/zynaddsubfx/Params/EnvelopeParams.cpp View File

@@ -127,19 +127,30 @@ EnvelopeParams::EnvelopeParams(unsigned char Penvstretch_,
EnvelopeParams::~EnvelopeParams() EnvelopeParams::~EnvelopeParams()
{} {}


#define COPY(y) this->y = ep.y
void EnvelopeParams::paste(const EnvelopeParams &ep) void EnvelopeParams::paste(const EnvelopeParams &ep)
{ {
//Avoid undefined behavior
if(&ep == this)
return;



char *base = (char*)&this->Pfreemode;
char *end = (char*)&this->DR_val;
assert(end-base > 0);
memcpy((char*)&this->Pfreemode, (const char*)&ep.Pfreemode, 1+end-base);
COPY(Pfreemode);
COPY(Penvpoints);
COPY(Penvsustain);
for(int i=0; i<MAX_ENVELOPE_POINTS; ++i) {
this->Penvdt[i] = ep.Penvdt[i];
this->Penvval[i] = ep.Penvval[i];
}
COPY(Penvstretch);
COPY(Pforcedrelease);
COPY(Plinearenvelope);

COPY(PA_dt);
COPY(PD_dt);
COPY(PR_dt);
COPY(PA_val);
COPY(PD_val);
COPY(PS_val);
COPY(PR_val);
} }
#undef COPY


float EnvelopeParams::getdt(char i) const float EnvelopeParams::getdt(char i) const
{ {


+ 2
- 2
source/native-plugins/zynaddsubfx/Params/EnvelopeParams.h View File

@@ -54,9 +54,9 @@ class EnvelopeParams:public Presets
static float dt(char val); static float dt(char val);


/* MIDI Parameters */ /* MIDI Parameters */
unsigned char Pfreemode; //1 daca este in modul free sau 0 daca este in mod ADSR,ASR,...
unsigned char Pfreemode; //1 for free mode, 0 otherwise
unsigned char Penvpoints; unsigned char Penvpoints;
unsigned char Penvsustain; //127 pentru dezactivat
unsigned char Penvsustain; //127 for disabled
unsigned char Penvdt[MAX_ENVELOPE_POINTS]; unsigned char Penvdt[MAX_ENVELOPE_POINTS];
unsigned char Penvval[MAX_ENVELOPE_POINTS]; unsigned char Penvval[MAX_ENVELOPE_POINTS];
unsigned char Penvstretch; //64=normal stretch (piano-like), 0=no stretch unsigned char Penvstretch; //64=normal stretch (piano-like), 0=no stretch


+ 34
- 4
source/native-plugins/zynaddsubfx/Params/FilterParams.cpp View File

@@ -420,13 +420,43 @@ void FilterParams::getfromXML(XMLwrapper *xml)
} }
} }


#define COPY(y) this->y = x.y
void FilterParams::paste(FilterParams &x) void FilterParams::paste(FilterParams &x)
{ {
//Avoid undefined behavior
if(&x == this)
return;
memcpy((char*)this, (const char*)&x, sizeof(*this));
COPY(Pcategory);
COPY(Ptype);
COPY(Pfreq);
COPY(Pq);
COPY(Pstages);
COPY(Pfreqtrack);
COPY(Pgain);

COPY(Pnumformants);
COPY(Pformantslowness);
COPY(Pvowelclearness);
COPY(Pcenterfreq);
COPY(Poctavesfreq);

for(int i=0; i<FF_MAX_VOWELS; ++i) {
for(int j=0; j<FF_MAX_FORMANTS; ++j) {
auto &a = this->Pvowels[i].formants[j];
auto &b = x.Pvowels[i].formants[j];
a.freq = b.freq;
a.amp = b.amp;
a.q = b.q;
}
}


COPY(Psequencesize);
COPY(Psequencestretch);
COPY(Psequencereversed);
for(int i=0; i<FF_MAX_SEQUENCE; ++i)
this->Psequence[i] = x.Psequence[i];

COPY(changed);
} }
#undef COPY


void FilterParams::pasteArray(FilterParams &x, int nvowel) void FilterParams::pasteArray(FilterParams &x, int nvowel)
{ {


+ 11
- 4
source/native-plugins/zynaddsubfx/Params/LFOParams.cpp View File

@@ -142,10 +142,17 @@ void LFOParams::getfromXML(XMLwrapper *xml)
Pcontinous = xml->getparbool("continous", Pcontinous); Pcontinous = xml->getparbool("continous", Pcontinous);
} }


#define COPY(y) this->y=x.y
void LFOParams::paste(LFOParams &x) void LFOParams::paste(LFOParams &x)
{ {
//Avoid undefined behavior
if(&x == this)
return;
memcpy((char*)this, (const char*)&x, sizeof(*this));
COPY(Pfreq);
COPY(Pintensity);
COPY(Pstartphase);
COPY(PLFOtype);
COPY(Prandomness);
COPY(Pfreqrand);
COPY(Pdelay);
COPY(Pcontinous);
COPY(Pstretch);
} }
#undef COPY

+ 3
- 2
source/native-plugins/zynaddsubfx/Params/PADnoteParameters.cpp View File

@@ -684,8 +684,9 @@ void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum,
const float ibasefreq = realfreq / (synth.samplerate_f * 0.5f) * size; const float ibasefreq = realfreq / (synth.samplerate_f * 0.5f) * size;
for(int i = 0; i < profilesize; ++i) { for(int i = 0; i < profilesize; ++i) {
const float idfreq = (i / (float)profilesize - 0.5f) * ibw; const float idfreq = (i / (float)profilesize - 0.5f) * ibw;
const int spfreq = (int) (idfreq + ibasefreq);
const float fspfreq = fmodf((float)idfreq + ibasefreq, 1.0f);
const float freqsum = idfreq + ibasefreq;
const int spfreq = (int)freqsum;
const float fspfreq = freqsum - spfreq;
if(spfreq <= 0) if(spfreq <= 0)
continue; continue;
if(spfreq >= size - 1) if(spfreq >= size - 1)


+ 30
- 1
source/native-plugins/zynaddsubfx/Synth/LFO.cpp View File

@@ -31,7 +31,9 @@
LFO::LFO(const LFOParams &lfopars, float basefreq, const AbsTime &t) LFO::LFO(const LFOParams &lfopars, float basefreq, const AbsTime &t)
:delayTime(t, lfopars.Pdelay / 127.0f * 4.0f), //0..4 sec :delayTime(t, lfopars.Pdelay / 127.0f * 4.0f), //0..4 sec
waveShape(lfopars.PLFOtype), waveShape(lfopars.PLFOtype),
deterministic(!lfopars.Pfreqrand)
deterministic(!lfopars.Pfreqrand),
dt_(t.dt()),
lfopars_(lfopars), basefreq_(basefreq)
{ {
int stretch = lfopars.Pstretch; int stretch = lfopars.Pstretch;
if(stretch == 0) if(stretch == 0)
@@ -114,6 +116,33 @@ float LFO::baseOut(const char waveShape, const float phase) const


float LFO::lfoout() float LFO::lfoout()
{ {
//update internals XXX TODO cleanup
{
waveShape = lfopars_.PLFOtype;
int stretch = lfopars_.Pstretch;
if(stretch == 0)
stretch = 1;
const float lfostretch = powf(basefreq_ / 440.0f, (stretch - 64.0f) / 63.0f);

float lfofreq =
(powf(2, lfopars_.Pfreq * 10.0f) - 1.0f) / 12.0f * lfostretch;

phaseInc = fabs(lfofreq) * dt_;

switch(lfopars_.fel) {
case 1:
lfointensity = lfopars_.Pintensity / 127.0f;
break;
case 2:
lfointensity = lfopars_.Pintensity / 127.0f * 4.0f;
break; //in octave
default:
lfointensity = powf(2, lfopars_.Pintensity / 127.0f * 11.0f) - 1.0f; //in centi
//x -= 0.25f; //chance the starting phase
break;
}
}

float out = baseOut(waveShape, phase); float out = baseOut(waveShape, phase);


if(waveShape == LFO_SINE || waveShape == LFO_TRIANGLE) if(waveShape == LFO_SINE || waveShape == LFO_TRIANGLE)


+ 4
- 0
source/native-plugins/zynaddsubfx/Synth/LFO.h View File

@@ -64,6 +64,10 @@ class LFO
//If After initialization there are no calls to random number gen. //If After initialization there are no calls to random number gen.
bool deterministic; bool deterministic;


const float dt_;
const LFOParams &lfopars_;
const float basefreq_;

void computeNextFreqRnd(void); void computeNextFreqRnd(void);
}; };




+ 42
- 18
source/native-plugins/zynaddsubfx/Synth/OscilGen.cpp View File

@@ -1177,31 +1177,55 @@ void OscilGen::getcurrentbasefunction(float *smps)
getbasefunction(smps); //the sine case getbasefunction(smps); //the sine case
} }


#define PRESERVE(x) decltype(this->x) x = this->x
#define RESTORE(x) this->x = x
#define COPY(y) this->y = o.y
void OscilGen::paste(OscilGen &o) void OscilGen::paste(OscilGen &o)
{ {
//XXX Figure out a better implementation of this sensitive to RT issues... //XXX Figure out a better implementation of this sensitive to RT issues...
//Preserve Pointer Elements
PRESERVE(oscilFFTfreqs);
PRESERVE(pendingfreqs);
PRESERVE(tmpsmps);
PRESERVE(outoscilFFTfreqs);
PRESERVE(fft);
PRESERVE(basefuncFFTfreqs);
PRESERVE(res);
memcpy((char*)this, (char*)&o, sizeof(*this));
RESTORE(oscilFFTfreqs);
RESTORE(pendingfreqs);
RESTORE(tmpsmps);
RESTORE(outoscilFFTfreqs);
RESTORE(fft);
RESTORE(basefuncFFTfreqs);
RESTORE(res);
for(int i=0; i<MAX_AD_HARMONICS; ++i) {
COPY(Phmag[i]);
COPY(Phphase[i]);
}

COPY(Phmagtype);
COPY(Pcurrentbasefunc);
COPY(Pbasefuncpar);

COPY(Pbasefuncmodulation);
COPY(Pbasefuncmodulationpar1);
COPY(Pbasefuncmodulationpar2);
COPY(Pbasefuncmodulationpar3);

COPY(Pwaveshaping);
COPY(Pwaveshapingfunction);
COPY(Pfiltertype);
COPY(Pfilterpar1);
COPY(Pfilterpar2);
COPY(Pfilterbeforews);
COPY(Psatype);
COPY(Psapar);

COPY(Pharmonicshift);
COPY(Pharmonicshiftfirst);

COPY(Pmodulation);
COPY(Pmodulationpar1);
COPY(Pmodulationpar2);
COPY(Pmodulationpar3);

COPY(Prand);
COPY(Pamprandpower);
COPY(Pamprandtype);
COPY(Padaptiveharmonics);
COPY(Padaptiveharmonicsbasefreq);
COPY(Padaptiveharmonicspower);
COPY(Padaptiveharmonicspar);


if(this->Pcurrentbasefunc) if(this->Pcurrentbasefunc)
changebasefunction(); changebasefunction();
this->prepare(); this->prepare();
} }
#undef COPY


void OscilGen::add2XML(XMLwrapper *xml) void OscilGen::add2XML(XMLwrapper *xml)
{ {


+ 12
- 1
source/native-plugins/zynaddsubfx/Synth/Resonance.cpp View File

@@ -251,10 +251,21 @@ void Resonance::sendcontroller(MidiControllers ctl, float par)
ctlbw = par; ctlbw = par;
} }


#define COPY(y) this->y = r.y
void Resonance::paste(Resonance &r) void Resonance::paste(Resonance &r)
{ {
memcpy((char*)this, (char*)&r, sizeof(r));
COPY(Penabled);
for(int i=0; i<N_RES_POINTS; ++i)
this->Prespoints[i] = r.Prespoints[i];
COPY(PmaxdB);
COPY(Pcenterfreq);
COPY(Poctavesfreq);
COPY(Pprotectthefundamental);

COPY(ctlcenter);
COPY(ctlbw);
} }
#undef COPY


void Resonance::add2XML(XMLwrapper *xml) void Resonance::add2XML(XMLwrapper *xml)
{ {


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

@@ -1181,9 +1181,9 @@ resui->resonancewindow->show();}
class ADvoiceUI class ADvoiceUI
} {} } {}
Fl_Button {} { Fl_Button {} {
label {Close Window}
label {Close}
callback {ADnoteVoice->hide();} callback {ADnoteVoice->hide();}
xywh {305 601 195 25} box THIN_UP_BOX labelfont 1
xywh {700 601 60 25} box THIN_UP_BOX
} }
Fl_Counter currentvoicecounter { Fl_Counter currentvoicecounter {
label {Current Voice} label {Current Voice}
@@ -1195,12 +1195,27 @@ advoice->change_voice(nvoice);}
Fl_Button {} { Fl_Button {} {
label C label C
callback {presetsui->copy(ADnoteVoice->loc(),nvoice);} callback {presetsui->copy(ADnoteVoice->loc(),nvoice);}
xywh {705 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
xywh {630 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
} }
Fl_Button {} { Fl_Button {} {
label P label P
callback {presetsui->paste(ADnoteVoice->loc(),this,nvoice);} callback {presetsui->paste(ADnoteVoice->loc(),this,nvoice);}
xywh {735 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
xywh {660 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
}
Fl_Button {} {
label {Show ADsynth}
callback {ADnoteGlobalParameters->show();}
xywh {280 601 110 25} labelfont 0 labelsize 12
}
Fl_Button {} {
label {Show Voice List}
callback {
for (int i=0;i<NUM_VOICES;i++){
voicelistitem[i]->refreshlist();
}
ADnoteVoiceList->show();
}
xywh {400 601 130 25} labelfont 0 labelsize 12
} }
} }
Fl_Window ADnoteVoiceList { Fl_Window ADnoteVoiceList {
@@ -1237,9 +1252,9 @@ advoice->change_voice(nvoice);}
xywh {285 15 25 10} box NO_BOX labelfont 1 labelsize 11 xywh {285 15 25 10} box NO_BOX labelfont 1 labelsize 11
} }
Fl_Button {} { Fl_Button {} {
label {Hide Voice List}
label {Close}
callback {ADnoteVoiceList->hide();} callback {ADnoteVoiceList->hide();}
xywh {271 237 125 20}
xywh {271 237 80 20}
} }
Fl_Scroll {} {open Fl_Scroll {} {open
xywh {0 15 670 220} type VERTICAL box THIN_UP_BOX xywh {0 15 670 220} type VERTICAL box THIN_UP_BOX
@@ -1249,6 +1264,11 @@ advoice->change_voice(nvoice);}
code0 {o->begin();for (int i=0;i<NUM_VOICES;i++){voicelistitem[i]=new ADvoicelistitem(0,0,670,25,"");voicelistitem[i]->init(i,loc+"VoicePar"+to_s(i)+"/",osc);}o->end();} code0 {o->begin();for (int i=0;i<NUM_VOICES;i++){voicelistitem[i]=new ADvoicelistitem(0,0,670,25,"");voicelistitem[i]->init(i,loc+"VoicePar"+to_s(i)+"/",osc);}o->end();}
} {} } {}
} }
Fl_Button {} {
label {Edit ADsynth}
callback {ui->partui->adnoteui->ADnoteGlobalParameters->show();}
xywh {5 237 106 20} labelsize 12
}
} }
} }
Function {ADnoteUI(std::string loc_, Fl_Osc_Interface *osc_)} {open Function {ADnoteUI(std::string loc_, Fl_Osc_Interface *osc_)} {open


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

@@ -138,7 +138,7 @@ bankview->refresh();} {}
Function {rescan_for_banks()} {open Function {rescan_for_banks()} {open
} { } {
code {banklist->clear(); code {banklist->clear();
osc->write("/rescanforbanks");
osc->write("/bank/rescan");
if (banklist->size() == 0) if (banklist->size() == 0)
banklist->add(" ");} {} banklist->add(" ");} {}
} }


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

@@ -282,8 +282,9 @@ void BankView::react(int event, int nslot)
//Reads from slot //Reads from slot
if ((event==1)&&(mode==1) && !isempty){ if ((event==1)&&(mode==1) && !isempty){
printf("Loading a part #%d with file '%s'\n", nslot, slot.filename()); printf("Loading a part #%d with file '%s'\n", nslot, slot.filename());
osc->write("/load-part", "is", *npart, slot.filename());
osc->writeValue("/part"+to_s(*npart)+"/name", slot.name());
osc->write("/load-part", "iss", *npart, slot.filename(),
slot.name());
osc->writeValue("/part"+to_s(*npart)+"/Pname", slot.name());
if(cbwig_) if(cbwig_)
cbwig_->do_callback(); cbwig_->do_callback();
} }


+ 4
- 5
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Dial.cpp View File

@@ -78,15 +78,14 @@ int Fl_Osc_Dial::handle(int ev)


void Fl_Osc_Dial::OSC_value(int v) void Fl_Osc_Dial::OSC_value(int v)
{ {
if(64 != (int)minimum())
value(v+minimum()+fmodf(value(), 1));
else
value(v+fmodf(value(), 1));
value(v + value() - floorf(value()) +
(minimum() == 64 ? 0 : minimum()));
} }


void Fl_Osc_Dial::OSC_value(char v) void Fl_Osc_Dial::OSC_value(char v)
{ {
value(v+minimum()+fmodf(value(), 1));
value(v + value() - floorf(value()) +
minimum());
} }


void Fl_Osc_Dial::update(void) void Fl_Osc_Dial::update(void)


+ 3
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Osc_DialF.H View File

@@ -17,6 +17,9 @@ class Fl_Osc_DialF:public WidgetPDial, public Fl_Osc_Widget
void update(void); void update(void);
void callback(Fl_Callback *cb, void *p = NULL); void callback(Fl_Callback *cb, void *p = NULL);


//Midi learn handler
int handle(int);

void cb(void); void cb(void);
private: private:
std::pair<Fl_Callback*, void*> cb_data; std::pair<Fl_Callback*, void*> cb_data;


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

@@ -51,11 +51,27 @@ void Fl_Osc_DialF::callback(Fl_Callback *cb, void *p)
cb_data.second = p; cb_data.second = p;
} }


int Fl_Osc_DialF::handle(int ev)
{
bool middle_mouse = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && !Fl::event_shift());
bool ctl_click = (ev == FL_PUSH && Fl::event_state(FL_BUTTON1) && Fl::event_ctrl());
bool shift_middle = (ev == FL_PUSH && Fl::event_state(FL_BUTTON2) && Fl::event_shift());
if(middle_mouse || ctl_click) {
printf("Trying to learn...\n");
osc->write("/learn", "s", (loc+ext).c_str());
return 1;
} else if(shift_middle) {
osc->write("/unlearn", "s", (loc+ext).c_str());
return 1;
}
return WidgetPDial::handle(ev);
}

void Fl_Osc_DialF::OSC_value(float v) void Fl_Osc_DialF::OSC_value(float v)
{ {
value(v); value(v);
} }
void Fl_Osc_DialF::update(void) void Fl_Osc_DialF::update(void)
{ {
oscWrite(ext); oscWrite(ext);
@@ -66,7 +82,7 @@ void Fl_Osc_DialF::cb(void)
assert(osc); assert(osc);


oscWrite(ext, "f", (float)value()); oscWrite(ext, "f", (float)value());
if(cb_data.first) if(cb_data.first)
cb_data.first(this, cb_data.second); cb_data.first(this, cb_data.second);
// label_str = string_cast<float,string>(val); // label_str = string_cast<float,string>(val);


+ 2
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Pane.H View File

@@ -18,6 +18,7 @@ class Fl_Osc_Pane
class Fl_Osc_Window:public Fl_Double_Window, public Fl_Osc_Pane class Fl_Osc_Window:public Fl_Double_Window, public Fl_Osc_Pane
{ {
Osc_DataModel *title_ext; Osc_DataModel *title_ext;
std::string rewrite_rule;
std::string title_orig; std::string title_orig;
std::string title_new; std::string title_new;
public: public:
@@ -28,6 +29,7 @@ class Fl_Osc_Window:public Fl_Double_Window, public Fl_Osc_Pane
virtual std::string loc(void) const; virtual std::string loc(void) const;
virtual void rebase(std::string new_base); virtual void rebase(std::string new_base);
void update(); void update();
void update_title();
}; };






+ 8
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Pane.cpp View File

@@ -17,6 +17,7 @@ void Fl_Osc_Window::init(Fl_Osc_Interface *osc_, std::string loc_)
title_ext = new Osc_DataModel(osc_); title_ext = new Osc_DataModel(osc_);
title_ext->doUpdate("/ui/title"); title_ext->doUpdate("/ui/title");
title_ext->callback = [this](string next) { title_ext->callback = [this](string next) {
rewrite_rule = next;
//printf("old: %s\n", title_orig.c_str()); //printf("old: %s\n", title_orig.c_str());
const char *orig = title_orig.c_str(); const char *orig = title_orig.c_str();
// 12345678901 // 12345678901
@@ -77,6 +78,12 @@ void Fl_Osc_Window::update(void)
} }
} }


void Fl_Osc_Window::update_title(void)
{
title_orig = label();
title_ext->callback(rewrite_rule);
}

static void nested_rebase(Fl_Group *g, std::string new_base) static void nested_rebase(Fl_Group *g, std::string new_base)
{ {
unsigned nchildren = g->children(); unsigned nchildren = g->children();
@@ -106,6 +113,7 @@ void Fl_Osc_Window::rebase(std::string new_base)
else if(dynamic_cast<Fl_Group*>(widget)) else if(dynamic_cast<Fl_Group*>(widget))
nested_rebase(dynamic_cast<Fl_Group*>(widget), new_base); nested_rebase(dynamic_cast<Fl_Group*>(widget), new_base);
} }
base = new_base;
} }


static Fl_Osc_Pane *find_osc_pane(Fl_Widget *root) static Fl_Osc_Pane *find_osc_pane(Fl_Widget *root)


+ 5
- 0
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Slider.H View File

@@ -30,4 +30,9 @@ class Fl_Osc_Slider:public Fl_Slider, public Fl_Osc_Widget
protected: protected:
char osc_type; char osc_type;
std::pair<Fl_Callback*, void*> cb_data; std::pair<Fl_Callback*, void*> cb_data;

private:
float old_value;
int start_pos;
float denominator;
}; };

+ 38
- 30
source/native-plugins/zynaddsubfx/UI/Fl_Osc_Slider.cpp View File

@@ -35,7 +35,7 @@ Fl_Osc_Slider::~Fl_Osc_Slider(void)
void Fl_Osc_Slider::OSC_value(int v) void Fl_Osc_Slider::OSC_value(int v)
{ {
const float min_ = min__(minimum(), maximum());//flipped sliders const float min_ = min__(minimum(), maximum());//flipped sliders
Fl_Slider::value(v+min_+fmodf(value(),1.0));
Fl_Slider::value(v+min_+value()-floorf(value()));
} }


void Fl_Osc_Slider::OSC_value(float v) void Fl_Osc_Slider::OSC_value(float v)
@@ -47,7 +47,7 @@ void Fl_Osc_Slider::OSC_value(float v)
void Fl_Osc_Slider::OSC_value(char v) void Fl_Osc_Slider::OSC_value(char v)
{ {
const float min_ = min__(minimum(), maximum());//flipped sliders const float min_ = min__(minimum(), maximum());//flipped sliders
Fl_Slider::value(v+min_+fmodf(value(),1.0));
Fl_Slider::value(v+min_+value()-floorf(value()));
} }


void Fl_Osc_Slider::cb(void) void Fl_Osc_Slider::cb(void)
@@ -88,9 +88,27 @@ int Fl_Osc_Slider::handle(int ev, int X, int Y, int W, int H)
return 1; return 1;
} }


int handled, rounded;
bool reset_requested = false;
int handled;
float rounded;

if (ev != FL_MOUSEWHEEL)
handled = Fl_Slider::handle(ev, X, Y, W, H);

switch (ev) { switch (ev) {
case FL_PUSH:
denominator = 2.0;
old_value = value();
start_pos = horizontal() ? Fl::event_x() : Fl::event_y();
{
float range = maximum() - minimum();
float absrng = range > 0 ? range : -range;

if (absrng / W / step() > 32 && Fl::event_button1())
denominator = 0.25;
if (range < 0)
denominator *= -1;
}
break;
case FL_MOUSEWHEEL: case FL_MOUSEWHEEL:
if (this == Fl::belowmouse() && Fl::e_dy != 0) { if (this == Fl::belowmouse() && Fl::e_dy != 0) {
int step = 1, divisor = 16; int step = 1, divisor = 16;
@@ -108,42 +126,32 @@ int Fl_Osc_Slider::handle(int ev, int X, int Y, int W, int H)
} }
int dy = minimum() <= maximum() ? -Fl::e_dy : Fl::e_dy; int dy = minimum() <= maximum() ? -Fl::e_dy : Fl::e_dy;
// Flip sense for vertical sliders. // Flip sense for vertical sliders.
dy = (this->type() & 1) ? dy : -dy;
dy = this->horizontal() ? dy : -dy;
handle_drag(clamp(value() + step * dy)); handle_drag(clamp(value() + step * dy));
} }
return 1; return 1;
case FL_RELEASE: case FL_RELEASE:
rounded = value() + 0.5;
value(clamp((double)rounded));
if (Fl::event_clicks() == 1) { if (Fl::event_clicks() == 1) {
Fl::event_clicks(0); Fl::event_clicks(0);
reset_requested = true;
value(reset_value);
} else {
rounded = floorf(value() + 0.5);
value(clamp(rounded));
} }
}
if (!Fl::event_shift()) {
handled = Fl_Slider::handle(ev, X, Y, W, H);
if (reset_requested) {
value(reset_value);
value_damage(); value_damage();
if (this->when() != 0)
do_callback();
break;
case FL_DRAG:
if (Fl::event_shift()) {
int delta = (horizontal() ? Fl::event_x() : Fl::event_y()) -
start_pos;
rounded = floor(clamp(old_value + delta/denominator) + 0.5);
value(rounded);
value_damage();
do_callback(); do_callback();
}
return handled;
}

// Slow down the drag.
// Handy if the slider has a large delta bigger than a mouse quantum.
// Somewhat tricky to use with OSC feedback.
// To change direction of movement, one must reclick the handle.
int old_value = value();
handled = Fl_Slider::handle(ev, X, Y, W, H);
int delta = value() - old_value;
if (ev == FL_DRAG && (delta < -1 || delta > 1)) {
value(clamp((old_value + (delta > 0 ? 1 : -1))));
value_damage();
do_callback();
}
} }
return handled; return handled;
} }




+ 6
- 3
source/native-plugins/zynaddsubfx/UI/MasterUI.fl View File

@@ -1493,7 +1493,7 @@ virkeys->take_focus();}
Fl_Button {} { Fl_Button {} {
label Advanced label Advanced
callback { callback {
osc->write("/cfg.UserInterfaceMode", "i", 1);
osc->write("/config/cfg.UserInterfaceMode", "i", 1);
masterwindow->show(); masterwindow->show();
selectuiwindow->hide();} selectuiwindow->hide();}
xywh {10 165 100 35} color 229 labelfont 1 labelsize 16 xywh {10 165 100 35} color 229 labelfont 1 labelsize 16
@@ -1506,7 +1506,7 @@ selectuiwindow->hide();}
label Beginner label Beginner
callback {simplemasterwindow->show(); callback {simplemasterwindow->show();
selectuiwindow->hide(); selectuiwindow->hide();
osc->write("/cfg.UserInterfaceMode", "i", 2);}
osc->write("/config/cfg.UserInterfaceMode", "i", 2);}
xywh {10 80 100 65} color 238 labelfont 1 labelsize 16 xywh {10 80 100 65} color 238 labelfont 1 labelsize 16
} }
Fl_Box {} { Fl_Box {} {
@@ -1534,7 +1534,10 @@ osc->write("/cfg.UserInterfaceMode", "i", 2);}
else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX"); else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX");
masterwindowlabel[99]='\\0'; masterwindowlabel[99]='\\0';
masterwindow->label(&masterwindowlabel[0]); masterwindow->label(&masterwindowlabel[0]);
simplemasterwindow->label(&masterwindowlabel[0]);} {}
simplemasterwindow->label(&masterwindowlabel[0]);
masterwindow->update_title();
simplemasterwindow->update_title();
} {}
} }
Function {MasterUI(int *exitprogram_, class Fl_Osc_Interface *osc_):nioui(osc_)} {open Function {MasterUI(int *exitprogram_, class Fl_Osc_Interface *osc_):nioui(osc_)} {open
} { } {


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

@@ -40,6 +40,14 @@ class Osc_IntModel:public Fl_Osc_Widget
value = rtosc_argument(msg, 0).i; value = rtosc_argument(msg, 0).i;
if(callback) if(callback)
callback(value); callback(value);
} else if(args == "T") {
value = 1;
if(callback)
callback(value);
} else if(args == "F") {
value = 0;
if(callback)
callback(value);
} }
} }
}; };

+ 11
- 13
source/native-plugins/zynaddsubfx/UI/OscilGenUI.fl View File

@@ -247,13 +247,8 @@ class OscilEditor {open : {public PresetsUI_}
} { } {
Fl_Button applybutton { Fl_Button applybutton {
label Apply label Apply
callback {//applybutton->color(FL_GRAY);
//applybutton->redraw();
//if (cbapplywidget!=NULL) {
// cbapplywidget->do_callback();
// cbapplywidget->color(FL_GRAY);
// cbapplywidget->redraw();
//};}
callback {
dummy->osc->requestValue(loc+"../prepare");}
xywh {305 285 60 20} box THIN_UP_BOX labelfont 1 xywh {305 285 60 20} box THIN_UP_BOX labelfont 1
code0 {if(adnotep) o->hide();} code0 {if(adnotep) o->hide();}
code1 {dummy->base = loc;} code1 {dummy->base = loc;}
@@ -354,7 +349,7 @@ class OscilEditor {open : {public PresetsUI_}
code1 {oscilo_base->parent(o);oscilo_base->init(true);} code1 {oscilo_base->parent(o);oscilo_base->init(true);}
} {} } {}
Fl_Dial bfpar { Fl_Dial bfpar {
callback {redrawoscil(); bfparval->value(o->value());}
callback {redrawoscil(); if(bfparval){bfparval->value(o->value());}}
tooltip {Base Function Parameter} xywh {525 285 20 20} minimum -64 maximum 63 step 1 tooltip {Base Function Parameter} xywh {525 285 20 20} minimum -64 maximum 63 step 1
code0 {o->init("Pbasefuncpar");} code0 {o->init("Pbasefuncpar");}
class Fl_Osc_Dial class Fl_Osc_Dial
@@ -451,6 +446,8 @@ setbfmodstatus(o->value());
Fl_Value_Output bfparval { Fl_Value_Output bfparval {
label {Par.} label {Par.}
xywh {495 290 25 15} labelsize 12 minimum -63 maximum 63 step 1 xywh {495 290 25 15} labelsize 12 minimum -63 maximum 63 step 1
code0 {o->value(bfpar->value());}

} }
Fl_Group basefuncmodulation {open Fl_Group basefuncmodulation {open
xywh {555 281 169 25} box UP_FRAME xywh {555 281 169 25} box UP_FRAME
@@ -637,13 +634,14 @@ redrawoscil();}
} }
} }
Fl_Dial wshpar { Fl_Dial wshpar {
callback {redrawoscil(); wsparval->value(o->value());}
callback {redrawoscil();if(wsparval){wsparval->value(o->value());}}
tooltip {Waveshaping Parameter} xywh {265 318 20 20} minimum -64 maximum 63 step 1 tooltip {Waveshaping Parameter} xywh {265 318 20 20} minimum -64 maximum 63 step 1
code0 {o->init("Pwaveshaping");} code0 {o->init("Pwaveshaping");}
class Fl_Osc_Dial class Fl_Osc_Dial
} }
Fl_Value_Output wsparval { Fl_Value_Output wsparval {
xywh {233 321 25 15} labelsize 12 minimum -63 maximum 63 step 1 xywh {233 321 25 15} labelsize 12 minimum -63 maximum 63 step 1
code0 {o->value(wshpar->value());}
} }
} }
Fl_Light_Button autoclearbutton { Fl_Light_Button autoclearbutton {
@@ -1009,23 +1007,23 @@ oscils->update();
oscilo_base->update(); oscilo_base->update();
oscils_base->update();} {} oscils_base->update();} {}
} }
Function {setbfmodstatus(int menuentry)} {open public
Function {setbfmodstatus(int menuentry)} {open
} { } {
code { code {
switch (menuentry){ switch (menuentry){
case 0: case 0:
bfpar->deactivate(); bfpar->deactivate();
bfparval->deactivate();
bfparval->deactivate();
basefuncmodulation->deactivate(); basefuncmodulation->deactivate();
break; break;
case 127: case 127:
bfpar->deactivate(); bfpar->deactivate();
bfparval->deactivate();
bfparval->deactivate();
basefuncmodulation->activate(); basefuncmodulation->activate();
break; break;
default: default:
bfpar->activate(); bfpar->activate();
bfparval->activate();
bfparval->activate();
basefuncmodulation->activate(); basefuncmodulation->activate();
} }
} {} } } {} }


+ 47
- 10
source/native-plugins/zynaddsubfx/UI/PADnoteUI.fl View File

@@ -32,6 +32,9 @@ decl {\#include <string.h>} {private local
decl {\#include <string>} {public local decl {\#include <string>} {public local
} }


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

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


@@ -71,19 +74,47 @@ oscui=NULL;
osc_i = osc_; osc_i = osc_;
resui=new ResonanceUI(osc_i, location+"resonance/"); resui=new ResonanceUI(osc_i, location+"resonance/");
initialized = false; initialized = false;
applybutton = NULL;
make_window(); make_window();
initialized = true;} {selected
apply_watcher = new Osc_IntModel(osc_i);
apply_watcher->callback=[this](int needsPrepare) {
if(needsPrepare) {
applybutton->color(FL_RED);
applybutton->redraw();
if(oscui) {
oscui->applybutton->color(FL_RED);
oscui->applybutton->redraw();
}
if(resui) {
resui->applybutton->color(FL_RED);
resui->applybutton->redraw();
}
} else {
applybutton->color(FL_GRAY);
applybutton->redraw();
if(oscui) {
oscui->applybutton->color(FL_GRAY);
oscui->applybutton->redraw();
}
if(resui) {
resui->applybutton->color(FL_GRAY);
resui->applybutton->redraw();
}
} }
};
apply_watcher->doUpdate(location+"needPrepare");
initialized = true;} {}
} }
Function {make_window()} {open Function {make_window()} {open
} { } {
Fl_Window padnotewindow { Fl_Window padnotewindow {
label {PAD synth Parameters} open label {PAD synth Parameters} open
xywh {52 324 535 435} type Double hide
xywh {52 324 535 430} type Double hide
class Fl_Osc_Window class Fl_Osc_Window
} { } {


Fl_Box dummy { Fl_Box dummy {
xywh {25 25 25 25}
code0 {padnotewindow->init(osc_i, location);} code0 {padnotewindow->init(osc_i, location);}
} }
Fl_Tabs {} { Fl_Tabs {} {
@@ -281,8 +312,9 @@ oscui=new OscilEditor(false, location+"oscilgen/",osc_i);}
Fl_Box cbwidget { Fl_Box cbwidget {
label {Harmonic Content} label {Harmonic Content}
callback {opui->update(); callback {opui->update();
applybutton->color(FL_RED);
applybutton->redraw();}
if(applybutton) {
applybutton->color(FL_RED);
applybutton->redraw();}}
xywh {125 135 205 20} align 16 xywh {125 135 205 20} align 16
} }
Fl_Button {} { Fl_Button {} {
@@ -803,23 +835,23 @@ if (resui!=NULL) {
resui->applybutton->color(FL_GRAY); resui->applybutton->color(FL_GRAY);
resui->applybutton->redraw(); resui->applybutton->redraw();
};} };}
xywh {300 400 135 30} box THIN_UP_BOX
xywh {200 400 135 25} box THIN_UP_BOX
code0 {o->color(FL_RED);} code0 {o->color(FL_RED);}
} }
Fl_Button {} { Fl_Button {} {
label Close label Close
callback {padnotewindow->hide();} callback {padnotewindow->hide();}
xywh {440 400 90 30} box THIN_UP_BOX
xywh {470 400 60 25} box THIN_UP_BOX
} }
Fl_Button {} { Fl_Button {} {
label C label C
callback {presetsui->copy(padnotewindow->loc());} callback {presetsui->copy(padnotewindow->loc());}
xywh {65 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
xywh {400 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
} }
Fl_Button {} { Fl_Button {} {
label P label P
callback {presetsui->paste(padnotewindow->loc(),this);} callback {presetsui->paste(padnotewindow->loc(),this);}
xywh {95 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
xywh {430 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
} }
Fl_Button {} { Fl_Button {} {
label export label export
@@ -828,7 +860,7 @@ filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0);
if (filename==NULL) return; if (filename==NULL) return;
fl_filename_setext(filename,""); fl_filename_setext(filename,"");
o->oscWrite("export2wav", "s", filename);} o->oscWrite("export2wav", "s", filename);}
tooltip {export samples as wav file} xywh {5 400 55 30} box THIN_UP_BOX color 51 labelsize 11 align 128
tooltip {export samples as wav file} xywh {5 400 55 25} box THIN_UP_BOX color 51 labelsize 11 align 128
class Fl_Osc_Button class Fl_Osc_Button
} }
} }
@@ -875,9 +907,12 @@ applybutton->color(FL_GRAY);
applybutton->parent()->redraw();} {} applybutton->parent()->redraw();} {}
} }
Function {~PADnoteUI()} {} { Function {~PADnoteUI()} {} {
code {delete(oscui);
code {
delete apply_watcher;
delete(oscui);
delete(resui); delete(resui);



padnotewindow->hide(); padnotewindow->hide();
delete padnotewindow;} {} delete padnotewindow;} {}
} }
@@ -897,4 +932,6 @@ delete padnotewindow;} {}
} }
decl {PADnoteOvertonePosition *opui;} {private local decl {PADnoteOvertonePosition *opui;} {private local
} }
decl {class Osc_IntModel *apply_watcher;} {private local
}
} }

+ 19
- 1
source/native-plugins/zynaddsubfx/UI/PartUI.fl View File

@@ -61,7 +61,7 @@ class PartSysEffSend {open : {public Fl_Group}
private xywh {604 244 100 100} type Double box NO_BOX private xywh {604 244 100 100} type Double box NO_BOX
class Fl_Group visible class Fl_Group visible
} { } {
Fl_Dial {} {
Fl_Dial widget {
label 01 label 01
xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1 xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1
code0 {o->size(25,25);} code0 {o->size(25,25);}
@@ -83,6 +83,18 @@ make_window();
syseffsend->show(); syseffsend->show();
end();} {} end();} {}
} }
Function {rebase(int part)} {} {
code {
auto *osc = widget->osc;
std::string old = "Psysefxvol"+to_s(neff)+"/part"+to_s(npart);
std::string next = "Psysefxvol"+to_s(neff)+"/part"+to_s(part);
widget->ext = next;
osc->renameLink("/"+old, "/"+next, widget);
osc->requestValue("/"+next);
npart = part;
} {}
}

Function {~PartSysEffSend()} {} { Function {~PartSysEffSend()} {} {
code {syseffsend->hide(); code {syseffsend->hide();
//delete(syseffsend);} {} //delete(syseffsend);} {}
@@ -1186,6 +1198,12 @@ partfx->rebase(new_loc);
instrumentkitlist->rebase(new_loc); instrumentkitlist->rebase(new_loc);
instrumenteditwindow->rebase(new_loc); instrumenteditwindow->rebase(new_loc);
partenablebutton->rebase(new_loc); partenablebutton->rebase(new_loc);
int next_part = 0;
const char *tmp = new_loc.c_str();
while(*tmp && !isdigit(*tmp)) tmp++;
next_part = atoi(tmp);
for (int i=0;i<NUM_SYS_EFX;i++)
psyef[i]->rebase(next_part);
} {selected } {selected
} }
} }


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

@@ -136,7 +136,7 @@ class SUBnoteUI {open : {public PresetsUI_}
} { } {
Fl_Window SUBparameters { Fl_Window SUBparameters {
label {SUBsynth Parameters} open label {SUBsynth Parameters} open
xywh {542 511 735 470} type Double
xywh {542 511 735 475} type Double
class Fl_Osc_Window visible class Fl_Osc_Window visible
} { } {
Fl_Box {} { Fl_Box {} {
@@ -155,7 +155,7 @@ class SUBnoteUI {open : {public PresetsUI_}
Fl_Button {} { Fl_Button {} {
label Close label Close
callback {SUBparameters->hide();} callback {SUBparameters->hide();}
xywh {625 446 105 20} box THIN_UP_BOX labelfont 1 labelsize 11
xywh {670 446 60 25} box THIN_UP_BOX
} }
Fl_Group {} { Fl_Group {} {
label AMPLITUDE open label AMPLITUDE open
@@ -326,7 +326,7 @@ freqsettingsui->redraw();}
h[0]->mag->oscWrite(h[0]->mag->ext, "c", 127); h[0]->mag->oscWrite(h[0]->mag->ext, "c", 127);
h[0]->bw->oscWrite(h[0]->bw->ext, "c", 64); h[0]->bw->oscWrite(h[0]->bw->ext, "c", 64);
SUBparameters->redraw();} SUBparameters->redraw();}
tooltip {Clear the harmonics} xywh {445 446 70 20} box THIN_UP_BOX labelfont 1 labelsize 11
tooltip {Clear the harmonics} xywh {445 446 70 25} box THIN_UP_BOX
class Fl_Osc_Button class Fl_Osc_Button
} }
Fl_Group bandwidthsettingsui { Fl_Group bandwidthsettingsui {
@@ -392,12 +392,12 @@ globalfiltergroup->redraw();}
Fl_Button {} { Fl_Button {} {
label C label C
callback {presetsui->copy(loc);} callback {presetsui->copy(loc);}
xywh {540 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
xywh {600 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
} }
Fl_Button {} { Fl_Button {} {
label P label P
callback {presetsui->paste(loc,this);} callback {presetsui->paste(loc,this);}
xywh {570 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
xywh {630 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
} }
Fl_Group {} { Fl_Group {} {
label OVERTONES open label OVERTONES open


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

@@ -113,7 +113,7 @@ int WidgetPDial::handle(int event)
break; break;
case FL_RELEASE: case FL_RELEASE:
if (integer_step) { if (integer_step) {
int rounded = value() + 0.5;
float rounded = floorf(value() + 0.5);
value(clamp(rounded)); value(clamp(rounded));
} }
tipwin->hide(); tipwin->hide();


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

@@ -542,11 +542,38 @@ void watch_lo(void)
lo_server_recv_noblock(server, 100); lo_server_recv_noblock(server, 100);
} }


const char *help_message =
"zynaddsubfx-ext-gui [options] uri - Connect to remote ZynAddSubFX\n"
" --help print this help message\n"
" --no-uri run without a remote ZynAddSubFX\n"
"\n"
" example: zynaddsubfx-ext-gui osc.udp://localhost:1234/\n"
" use the -P option for zynaddsubfx to specify the port of the backend\n";

#ifndef CARLA_VERSION_STRING #ifndef CARLA_VERSION_STRING
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const char *uri = NULL;
bool help = false;
bool no_uri = false;
for(int i=1; i<argc; ++i) {
if(!strcmp("--help", argv[i]))
help = true;
else if(!strcmp("--no-uri", argv[i]))
no_uri = true;
else
uri = argv[i];
}
if(uri == NULL && no_uri == false)
help = true;

if(help) {
printf(help_message);
return 1;
}

//Startup Liblo Link //Startup Liblo Link
if(argc == 2) {
if(uri) {
server = lo_server_new_with_proto(NULL, LO_UDP, liblo_error_cb); server = lo_server_new_with_proto(NULL, LO_UDP, liblo_error_cb);
lo_server_add_method(server, NULL, NULL, handler_function, 0); lo_server_add_method(server, NULL, NULL, handler_function, 0);
sendtourl = argv[1]; sendtourl = argv[1];


+ 4
- 1
source/utils/CarlaPluginUI.cpp View File

@@ -665,7 +665,10 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons
const ScopedFreeData sfd2(nameData); const ScopedFreeData sfd2(nameData);


CARLA_SAFE_ASSERT_CONTINUE(status == Success); CARLA_SAFE_ASSERT_CONTINUE(status == Success);
CARLA_SAFE_ASSERT_CONTINUE(nameSize != 0);

if (nameSize == 0)
// nameless window
continue;


if (std::strstr((const char*)nameData, uiTitle) != nullptr) if (std::strstr((const char*)nameData, uiTitle) != nullptr)
{ {


Loading…
Cancel
Save