Browse Source

Update zyn, should fix dropped messages

tags/1.9.7
falkTX 9 years ago
parent
commit
c6c6b6d3ea
10 changed files with 58 additions and 22 deletions
  1. +4
    -3
      source/native-plugins/zynaddsubfx/Misc/Util.cpp
  2. +0
    -2
      source/native-plugins/zynaddsubfx/Params/ADnoteParameters.h
  3. +5
    -0
      source/native-plugins/zynaddsubfx/Params/PADnoteParameters.cpp
  4. +3
    -0
      source/native-plugins/zynaddsubfx/Params/PADnoteParameters.h
  5. +8
    -7
      source/native-plugins/zynaddsubfx/Synth/OscilGen.cpp
  6. +4
    -0
      source/native-plugins/zynaddsubfx/Synth/PADnote.cpp
  7. +1
    -0
      source/native-plugins/zynaddsubfx/Synth/PADnote.h
  8. +12
    -6
      source/native-plugins/zynaddsubfx/UI/PADnoteUI.fl
  9. +16
    -4
      source/native-plugins/zynaddsubfx/UI/guimain.cpp
  10. +5
    -0
      source/native-plugins/zynaddsubfx/globals.h

+ 4
- 3
source/native-plugins/zynaddsubfx/Misc/Util.cpp View File

@@ -207,9 +207,10 @@ float interpolate(const float *data, size_t len, float pos)

float cinterpolate(const float *data, size_t len, float pos)
{
const int l_pos = ((int)pos) % len,
r_pos = (l_pos + 1) % len;
const float leftness = pos - l_pos;
const unsigned int i_pos = pos,
l_pos = i_pos % len,
r_pos = l_pos + 1 < len ? l_pos + 1 : 0;
const float leftness = pos - i_pos;
return data[l_pos] * leftness + data[r_pos] * (1.0f - leftness);
}



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

@@ -30,8 +30,6 @@ enum FMTYPE {
NONE, MORPH, RING_MOD, PHASE_MOD, FREQ_MOD, PITCH_MOD
};

#define FADEIN_ADJUSTMENT_SCALE 20

/*****************************************************************/
/* GLOBAL PARAMETERS */
/*****************************************************************/


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

@@ -51,6 +51,8 @@ static const rtosc::Ports realtime_ports =
rParamZyn(PVolume, "Synth Volume"),
rParamZyn(PAmpVelocityScaleFunction, "Amplitude Velocity Sensing function"),

rParamZyn(Fadein_adjustment, "Adjustment for anti-pop strategy."),

//Punch
rParamZyn(PPunchStrength, "Punch Strength"),
rParamZyn(PPunchTime, "UNKNOWN"),
@@ -323,6 +325,7 @@ void PADnoteParameters::defaults()
PAmpVelocityScaleFunction = 64;
AmpEnvelope->defaults();
AmpLfo->defaults();
Fadein_adjustment = FADEIN_ADJUSTMENT_SCALE;
PPunchStrength = 0;
PPunchTime = 60;
PPunchStretch = 64;
@@ -947,6 +950,7 @@ void PADnoteParameters::add2XML(XMLwrapper *xml)
xml->addpar("volume", PVolume);
xml->addpar("panning", PPanning);
xml->addpar("velocity_sensing", PAmpVelocityScaleFunction);
xml->addpar("fadein_adjustment", Fadein_adjustment);
xml->addpar("punch_strength", PPunchStrength);
xml->addpar("punch_time", PPunchTime);
xml->addpar("punch_stretch", PPunchStretch);
@@ -1058,6 +1062,7 @@ void PADnoteParameters::getfromXML(XMLwrapper *xml)
PPanning = xml->getpar127("panning", PPanning);
PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing",
PAmpVelocityScaleFunction);
Fadein_adjustment = xml->getpar127("fadein_adjustment", Fadein_adjustment);
PPunchStrength = xml->getpar127("punch_strength", PPunchStrength);
PPunchTime = xml->getpar127("punch_time", PPunchTime);
PPunchStretch = xml->getpar127("punch_stretch", PPunchStretch);


+ 3
- 0
source/native-plugins/zynaddsubfx/Params/PADnoteParameters.h View File

@@ -126,6 +126,9 @@ class PADnoteParameters:public Presets

LFOParams *AmpLfo;

/* Adjustment factor for anti-pop fadein */
unsigned char Fadein_adjustment;

unsigned char PPunchStrength, PPunchTime, PPunchStretch,
PPunchVelocitySensing;



+ 8
- 7
source/native-plugins/zynaddsubfx/Synth/OscilGen.cpp View File

@@ -447,7 +447,9 @@ float OscilGen::userfunc(float x)
fft->freqs2smps(basefuncFFTfreqs, cachedbasefunc);
cachedbasevalid = true;
}
return cinterpolate(cachedbasefunc, synth.oscilsize, synth.oscilsize * x);
return cinterpolate(cachedbasefunc,
synth.oscilsize,
synth.oscilsize * (x + 1) - 1);
}

/*
@@ -1344,6 +1346,9 @@ void OscilGen::getfromXML(XMLwrapper *xml)
xml->exitbranch();
}

if(Pcurrentbasefunc != 0)
changebasefunction();

if(xml->enterbranch("BASE_FUNCTION")) {
for(int i = 1; i < synth.oscilsize / 2; ++i)
if(xml->enterbranch("BF_HARMONIC", i)) {
@@ -1354,14 +1359,10 @@ void OscilGen::getfromXML(XMLwrapper *xml)
}
xml->exitbranch();

if(Pcurrentbasefunc != 0)
changebasefunction();

clearDC(basefuncFFTfreqs);
normalize(basefuncFFTfreqs, synth.oscilsize);
} else if(Pcurrentbasefunc != 0)
changebasefunction();
}
cachedbasevalid = false;
}}


//Define basic functions


+ 4
- 0
source/native-plugins/zynaddsubfx/Synth/PADnote.cpp View File

@@ -114,6 +114,9 @@ void PADnote::setup(float freq,
PFilterVelocityScaleFunction) - 1);

if(!legato) {
NoteGlobalPar.Fadein_adjustment =
pars.Fadein_adjustment / (float)FADEIN_ADJUSTMENT_SCALE;
NoteGlobalPar.Fadein_adjustment *= NoteGlobalPar.Fadein_adjustment;
if(pars.PPunchStrength != 0) {
NoteGlobalPar.Punch.Enabled = 1;
NoteGlobalPar.Punch.t = 1.0f; //start from 1.0f and to 0.0f
@@ -206,6 +209,7 @@ inline void PADnote::fadein(float *smps)
float tmp = (synth.buffersize_f - 1.0f) / (zerocrossings + 1) / 3.0f;
if(tmp < 8.0f)
tmp = 8.0f;
tmp *= NoteGlobalPar.Fadein_adjustment;

int n;
F2I(tmp, n); //how many samples is the fade-in


+ 1
- 0
source/native-plugins/zynaddsubfx/Synth/PADnote.h View File

@@ -85,6 +85,7 @@ class PADnote:public SynthNote
Envelope *AmpEnvelope;
LFO *AmpLfo;

float Fadein_adjustment;
struct {
int Enabled;
float initialvalue, dt, t;


+ 12
- 6
source/native-plugins/zynaddsubfx/UI/PADnoteUI.fl View File

@@ -714,27 +714,33 @@ cbwidget->do_callback();}
code0 {o->init("PPanning");}
class Fl_Osc_Dial
}
Fl_Dial {} {
label De-pop selected
tooltip {Pop suppression} xywh {208 238 20 20} type Float labelsize 10 maximum 127 step 1 textfont 1 textsize 11
code0 {o->init("Fadein_adjustment");}
class Fl_Osc_Dial
}
Fl_Dial pstr {
label {P.Str.}
tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
tooltip {Punch Strength} xywh {78 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->init("PPunchStrength");}
class Fl_Osc_Dial
}
Fl_Dial pt {
label {P.t.}
tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
tooltip {Punch Time (duration)} xywh {108 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->init("PPunchTime");}
class Fl_Osc_Dial
}
Fl_Dial pstc {
label {P.Stc.}
tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
tooltip {Punch Stretch} xywh {138 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->init("PPunchStretch");}
class Fl_Osc_Dial
}
Fl_Dial pvel {
label {P.Vel.}
tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
tooltip {Punch Velocity Sensing} xywh {168 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->init("PPunchVelocitySensing");}
class Fl_Osc_Dial
}
@@ -753,7 +759,7 @@ cbwidget->do_callback();}
Fl_Check_Button stereo {
label Stereo
callback {hprofile->redraw();}
xywh {15 245 70 25} down_box DOWN_BOX
xywh {10 245 70 25} down_box DOWN_BOX labelsize 12
code0 {o->init("PStereo");}
class Fl_Osc_Check
}
@@ -776,7 +782,7 @@ cbwidget->do_callback();}
} {}
Fl_Group filterui {
label {PADsynth - Filter} open
xywh {250 55 275 75} box FLAT_BOX color 50 align 144
xywh {250 50 275 75} box FLAT_BOX color 50 align 144
code0 {o->init(location + "PFilter",
osc_i, location, "GlobalFilter/");}
class FilterUI


+ 16
- 4
source/native-plugins/zynaddsubfx/UI/guimain.cpp View File

@@ -19,8 +19,10 @@

*/

#include <rtosc/thread-link.h>
#include <lo/lo.h>
#include <string>
#include <thread>

//GUI System
#include "Connection.h"
@@ -509,6 +511,8 @@ Fl_Osc_Interface *GUI::genOscInterface(MiddleWare *)
return new UI_Interface();
}

rtosc::ThreadLink lo_buffer(4096, 1000);

static void liblo_error_cb(int i, const char *m, const char *loc)
{
fprintf(stderr, "liblo :-( %d-%s@%s\n",i,m,loc);
@@ -527,11 +531,17 @@ static int handler_function(const char *path, const char *types, lo_arg **argv,
assert(lo_message_length(msg, path) <= sizeof(buffer));
lo_message_serialise(msg, path, buffer, &size);
assert(size <= sizeof(buffer));
raiseUi(gui, buffer);
lo_buffer.raw_write(buffer);

return 0;
}

void watch_lo(void)
{
while(server && Pexitprogram == 0)
lo_server_recv_noblock(server, 100);
}

#ifndef CARLA_VERSION_STRING
int main(int argc, char *argv[])
{
@@ -542,17 +552,19 @@ int main(int argc, char *argv[])
sendtourl = argv[1];
}
fprintf(stderr, "ext client running on %d\n", lo_server_get_port(server));
std::thread lo_watch(watch_lo);

gui = GUI::createUi(new UI_Interface(), &Pexitprogram);

GUI::raiseUi(gui, "/show", "i", 1);
while(Pexitprogram == 0) {
if(server)
while(lo_server_recv_noblock(server, 0));
GUI::tickUi(gui);
while(lo_buffer.hasNext())
raiseUi(gui, lo_buffer.read());
}

exitprogram();
lo_watch.join();
return 0;
}
#endif

+ 5
- 0
source/native-plugins/zynaddsubfx/globals.h View File

@@ -179,6 +179,11 @@ typedef std::complex<fftw_real> fft_t;
#define PI 3.1415926536f
#define LOG_10 2.302585093f

/*
* For de-pop adjustment
*/
#define FADEIN_ADJUSTMENT_SCALE 20

/*
* Envelope Limits
*/


Loading…
Cancel
Save