diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mdaBandisto.cpp | 6 | ||||
-rw-r--r-- | src/mdaBeatBox.cpp | 10 | ||||
-rw-r--r-- | src/mdaBeatBox.h | 2 | ||||
-rw-r--r-- | src/mdaDX10.cpp | 131 | ||||
-rw-r--r-- | src/mdaDX10.h | 9 | ||||
-rw-r--r-- | src/mdaDeEss.cpp | 7 | ||||
-rw-r--r-- | src/mdaDetune.h | 2 | ||||
-rw-r--r-- | src/mdaDynamics.cpp | 3 | ||||
-rw-r--r-- | src/mdaEPiano.cpp | 122 | ||||
-rw-r--r-- | src/mdaEPiano.h | 11 | ||||
-rw-r--r-- | src/mdaImage.cpp | 2 | ||||
-rw-r--r-- | src/mdaJX10.cpp | 219 | ||||
-rw-r--r-- | src/mdaJX10.h | 8 | ||||
-rw-r--r-- | src/mdaLeslie.cpp | 6 | ||||
-rw-r--r-- | src/mdaMultiBand.cpp | 27 | ||||
-rw-r--r-- | src/mdaPiano.cpp | 108 | ||||
-rw-r--r-- | src/mdaPiano.h | 9 | ||||
-rw-r--r-- | src/mdaRePsycho.cpp | 8 | ||||
-rw-r--r-- | src/mdaRezFilter.cpp | 4 | ||||
-rw-r--r-- | src/mdaSplitter.cpp | 4 | ||||
-rw-r--r-- | src/mdaSplitter.h | 2 | ||||
-rw-r--r-- | src/mdaTestTone.cpp | 2 | ||||
-rw-r--r-- | src/mdaTracker.cpp | 4 | ||||
-rw-r--r-- | src/mdaTransient.cpp | 2 | ||||
-rw-r--r-- | src/mdaVocInput.cpp | 7 | ||||
-rw-r--r-- | src/mdaVocoder.cpp | 8 |
26 files changed, 155 insertions, 568 deletions
diff --git a/src/mdaBandisto.cpp b/src/mdaBandisto.cpp index 64d893c..50d5a2a 100644 --- a/src/mdaBandisto.cpp +++ b/src/mdaBandisto.cpp @@ -70,7 +70,7 @@ mdaBandisto::mdaBandisto(audioMasterCallback audioMaster) : AudioEffectX(audioMa trim2 = (float)(trim2 * pow(10.0, 2.0 * fParam8 - 1.0)); trim3 = (float)(trim3 * pow(10.0, 2.0 * fParam9 - 1.0)); - switch(int(fParam1*5.0)) + switch(int(fParam1*3.9)) { case 0: trim2=0.0; trim3=0.0; slev=0.0; break; case 1: trim1=0.0; trim3=0.0; slev=0.0; break; @@ -148,7 +148,7 @@ void mdaBandisto::setParameter(int32_t index, float value) trim2 = (float)(trim2 * pow(10.0, 2.0 * fParam8 - 1.0)); trim3 = (float)(trim3 * pow(10.0, 2.0 * fParam9 - 1.0)); - switch(int(fParam1*5.0)) + switch(int(fParam1*3.9)) { case 0: trim2=0.0; trim3=0.0; slev=0.0; break; case 1: trim1=0.0; trim3=0.0; slev=0.0; break; @@ -200,7 +200,7 @@ void mdaBandisto::getParameterDisplay(int32_t index, char *text) { switch(index) { - case 0: switch(int(fParam1*5.0)) + case 0: switch(int(fParam1*3.9)) { case 0: strcpy(text, "Low"); break; case 1: strcpy(text, "Mid"); break; case 2: strcpy(text, "High"); break; diff --git a/src/mdaBeatBox.cpp b/src/mdaBeatBox.cpp index 747f5b0..96d89cd 100644 --- a/src/mdaBeatBox.cpp +++ b/src/mdaBeatBox.cpp @@ -46,6 +46,16 @@ mdaBeatBox::mdaBeatBox(audioMasterCallback audioMaster) : AudioEffectX(audioMast sbuflen = 60000; if(getSampleRate()>49000) { hbuflen*=2; kbuflen*=2; sbuflen*=2; } + hbufpos = 0; + kbufpos = 0; + sbufpos = 0; + hfil = 0; + sb1 = 0; + sb2 = 0; + ksb1 = 0; + ksb2 = 0; + wwx = 0; + hbuf = new float[hbuflen]; sbuf = new float[sbuflen]; sbuf2 = new float[sbuflen]; kbuf = new float[kbuflen]; diff --git a/src/mdaBeatBox.h b/src/mdaBeatBox.h index f14426a..c984d5a 100644 --- a/src/mdaBeatBox.h +++ b/src/mdaBeatBox.h @@ -58,7 +58,7 @@ protected: float fParam10; float fParam11; float fParam12; - float hthr, hfil, sthr, kthr, kfil1, kfil2, mix; + float hthr, hfil, sthr, kthr, mix; float klev, hlev, slev; float ww, wwx, sb1, sb2, sf1, sf2, sf3; float kww, kwwx, ksb1, ksb2, ksf1, ksf2; diff --git a/src/mdaDX10.cpp b/src/mdaDX10.cpp index bc4c8d1..8e8a5ca 100644 --- a/src/mdaDX10.cpp +++ b/src/mdaDX10.cpp @@ -18,6 +18,8 @@ #include "mdaDX10.h" +#include "lv2/lv2plug.in/ns/ext/atom/util.h" + #include <stdio.h> #include <stdlib.h> //rand() #include <math.h> @@ -90,7 +92,6 @@ mdaDX10::mdaDX10(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NP voice[i].mod0 = voice[i].mod1 = voice[i].dmod = 0.0f; voice[i].cdec = 0.99f; //all notes off } - notes[0] = EVENTS_DONE; lfo0 = dlfo = modwhl = 0.0f; lfo1 = pbend = 1.0f; volume = 0.0035f; @@ -240,7 +241,7 @@ bool mdaDX10::copyProgram(int32_t destination) } -int32_t mdaDX10::canDo(char* text) +int32_t mdaDX10::canDo(const char* text) { if(strcmp(text, "receiveLvzEvents") == 0) return 1; if(strcmp(text, "receiveLvzMidiEvent") == 0) return 1; @@ -304,101 +305,22 @@ void mdaDX10::getParameterLabel(int32_t index, char *label) } } - -void mdaDX10::process(float **inputs, float **outputs, int32_t sampleFrames) -{ - float* out1 = outputs[0]; - float* out2 = outputs[1]; - int32_t event=0, frame=0, frames, v; - float o, x, e, mw=MW, w=rich, m=modmix; - int32_t k=K; - - if(activevoices>0 || notes[event]<sampleFrames) //detect & bypass completely empty blocks - { - while(frame<sampleFrames) - { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; - frames -= frame; - frame += frames; - - while(--frames>=0) //would be faster with voice loop outside frame loop! - { //but then each voice would need it's own LFO... - VOICE *V = voice; - o = 0.0f; - - if(--k<0) - { - lfo0 += dlfo * lfo1; //sine LFO - lfo1 -= dlfo * lfo0; - mw = lfo1 * (modwhl + vibrato); - k=100; - } - - for(v=0; v<NVOICES; v++) //for each voice - { - e = V->env; - if(e > SILENCE) //**** this is the synth **** - { - V->env = e * V->cdec; //decay & release - V->cenv += V->catt * (e - V->cenv); //attack - - x = V->dmod * V->mod0 - V->mod1; //could add more modulator blocks like - V->mod1 = V->mod0; //this for a wider range of FM sounds - V->mod0 = x; - V->menv += V->mdec * (V->mlev - V->menv); - - x = V->car + V->dcar + x * V->menv + mw; //carrier phase - while(x > 1.0f) x -= 2.0f; //wrap phase - while(x < -1.0f) x += 2.0f; - V->car = x; - o += V->cenv * (m * V->mod1 + (x + x * x * x * (w * x * x - 1.0f - w))); - } //amp env //mod thru-mix //5th-order sine approximation - V++; - } - *out1++ += o; - *out2++ += o; - } - - if(frame<sampleFrames) //next note on/off - { - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); - } - } - - activevoices = NVOICES; - for(v=0; v<NVOICES; v++) - { - if(voice[v].env < SILENCE) //choke voices that have finished - { - voice[v].env = voice[v].cenv = 0.0f; - activevoices--; - } - if(voice[v].menv < SILENCE) voice[v].menv = voice[v].mlev = 0.0f; - } - } - - K=k; MW=mw; //remember these so vibrato speed not buffer size dependant! - notes[0] = EVENTS_DONE; -} - - void mdaDX10::processReplacing(float **inputs, float **outputs, int32_t sampleFrames) { float* out1 = outputs[0]; float* out2 = outputs[1]; - int32_t event=0, frame=0, frames, v; + int32_t frame=0, frames, v; float o, x, e, mw=MW, w=rich, m=modmix; int32_t k=K; - if(activevoices>0 || notes[event]<sampleFrames) //detect & bypass completely empty blocks + LV2_Atom_Event* ev = lv2_atom_sequence_begin(&eventInput->body); + bool end = lv2_atom_sequence_is_end(&eventInput->body, eventInput->atom.size, ev); + if(activevoices>0 || !end) //detect & bypass completely empty blocks { while(frame<sampleFrames) { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; + end = lv2_atom_sequence_is_end(&eventInput->body, eventInput->atom.size, ev); + frames = end ? sampleFrames : ev->time.frames; frames -= frame; frame += frames; @@ -444,11 +366,10 @@ void mdaDX10::processReplacing(float **inputs, float **outputs, int32_t sampleFr *out2++ = o; } - if(frame<sampleFrames) //next note on/off + if(!end) //next note on/off { - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); + processEvent(ev); + ev = lv2_atom_sequence_next(ev); } } @@ -472,7 +393,6 @@ void mdaDX10::processReplacing(float **inputs, float **outputs, int32_t sampleFr } } K=k; MW=mw; //remember these so vibrato speed not buffer size dependant! - notes[0] = EVENTS_DONE; } @@ -528,28 +448,21 @@ void mdaDX10::noteOn(int32_t note, int32_t velocity) } -int32_t mdaDX10::processEvents(LvzEvents* ev) +int32_t mdaDX10::processEvent(const LV2_Atom_Event* ev) { - int32_t npos=0; + if (ev->body.type != midiEventType) + return 0; - for (int32_t i=0; i<ev->numEvents; i++) - { - if((ev->events[i])->type != kLvzMidiType) continue; - LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i]; - char* midiData = event->midiData; + const uint8_t* midiData = (const uint8_t*)LV2_ATOM_BODY(&ev->body); switch(midiData[0] & 0xf0) //status byte (all channels) { case 0x80: //note off - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = 0; //vel + noteOn(midiData[1] & 0x7F, 0); break; case 0x90: //note on - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = midiData[2] & 0x7F; //vel + noteOn(midiData[1] & 0x7F, midiData[2] & 0x7F); break; case 0xB0: //controller @@ -567,9 +480,7 @@ int32_t mdaDX10::processEvents(LvzEvents* ev) sustain = midiData[2] & 0x40; if(sustain==0) { - notes[npos++] = event->deltaFrames; - notes[npos++] = SUSTAIN; //end all sustained notes - notes[npos++] = 0; + noteOn(SUSTAIN, 0); } break; @@ -596,10 +507,6 @@ int32_t mdaDX10::processEvents(LvzEvents* ev) default: break; } - if(npos>EVENTBUFFER) npos -= 3; //discard events if buffer full!! - event++; - } - notes[npos] = EVENTS_DONE; return 1; } diff --git a/src/mdaDX10.h b/src/mdaDX10.h index 02cfe38..8b3ab64 100644 --- a/src/mdaDX10.h +++ b/src/mdaDX10.h @@ -62,9 +62,7 @@ public: mdaDX10(audioMasterCallback audioMaster); ~mdaDX10(); - virtual void process(float **inputs, float **outputs, int32_t sampleframes); virtual void processReplacing(float **inputs, float **outputs, int32_t sampleframes); - virtual int32_t processEvents(LvzEvents* events); virtual void setProgram(int32_t program); virtual void setProgramName(char *name); @@ -85,11 +83,12 @@ public: virtual bool getVendorString (char* text); virtual bool getProductString (char* text); virtual int32_t getVendorVersion () {return 1;} - virtual int32_t canDo (char* text); + virtual int32_t canDo (const char* text); virtual int32_t getNumMidiInputChannels () { return 1; } private: + int32_t processEvent(const LV2_Atom_Event* ev); void update(); //my parameter update void noteOn(int32_t note, int32_t velocity); void fillpatch(int32_t p, const char *name, @@ -100,10 +99,6 @@ private: mdaDX10Program* programs; float Fs; - #define EVENTBUFFER 120 - #define EVENTS_DONE 99999999 - int32_t notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block - ///global internal variables VOICE voice[NVOICES]; #define SUSTAIN 128 diff --git a/src/mdaDeEss.cpp b/src/mdaDeEss.cpp index f3cbad1..18a8096 100644 --- a/src/mdaDeEss.cpp +++ b/src/mdaDeEss.cpp @@ -32,6 +32,13 @@ mdaDeEss::mdaDeEss(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, fParam1 = (float)0.15f; //thresh fParam2 = (float)0.60f; //f fParam3 = (float)0.50f; //drive + fbuf1 = 0.0f; + fbuf2 = 0.0f; + gai = 0.0f; + thr = 0.0f; + att = 0.0f; + rel = 0.0f; + fil = 0.0f; setNumInputs(2); setNumOutputs(2); setUniqueID("mdaDeEss"); //identify here diff --git a/src/mdaDetune.h b/src/mdaDetune.h index 08741e6..1ae151e 100644 --- a/src/mdaDetune.h +++ b/src/mdaDetune.h @@ -17,7 +17,7 @@ */ #define NPARAMS 4 ///number of parameters -#define NPROGS 4 ///number of programs +#define NPROGS 3 ///number of programs #define BUFMAX 4096 #ifndef __mdaDetune_H diff --git a/src/mdaDynamics.cpp b/src/mdaDynamics.cpp index 2c7d644..65f7ce2 100644 --- a/src/mdaDynamics.cpp +++ b/src/mdaDynamics.cpp @@ -37,6 +37,9 @@ mdaDynamics::mdaDynamics(audioMasterCallback audioMaster) : AudioEffectX(audioMa fParam8 = (float)0.10; //gate attack fParam9 = (float)0.50; //gate decay fParam10= (float)1.00; //fx mix + thr = rat = env = env2 = att = rel = trim = lthr = xthr = xrat = dry = 0.0f; + genv = gatt = irel = 0.0f; + mode = 0; setNumInputs(2); // stereo in setNumOutputs(2); // stereo out diff --git a/src/mdaEPiano.cpp b/src/mdaEPiano.cpp index a1866bd..3aa101a 100644 --- a/src/mdaEPiano.cpp +++ b/src/mdaEPiano.cpp @@ -19,6 +19,8 @@ #include "mdaEPianoData.h" #include "mdaEPiano.h" +#include "lv2/lv2plug.in/ns/ext/atom/util.h" + #include <stdio.h> #include <math.h> @@ -43,9 +45,6 @@ mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster fillpatch(i++, "Mellow", 0.500f, 0.500f, 0.000f, 0.000f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.246f, 0.000f); fillpatch(i++, "Autopan", 0.500f, 0.500f, 0.500f, 0.500f, 0.250f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.246f, 0.000f); fillpatch(i++, "Tremolo", 0.500f, 0.500f, 0.500f, 0.500f, 0.750f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.246f, 0.000f); - fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); - fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); - fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); setProgram(0); } @@ -132,7 +131,6 @@ mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster voice[v].env = 0.0f; voice[v].dec = 0.99f; //all notes off } - notes[0] = EVENTS_DONE; volume = 0.2f; muff = 160.0f; sustain = activevoices = 0; @@ -263,7 +261,7 @@ bool mdaEPiano::copyProgram(int32_t destination) } -int32_t mdaEPiano::canDo(char* text) +int32_t mdaEPiano::canDo(const char* text) { if(strcmp(text, "receiveLvzEvents") == 0) return 1; if(strcmp(text, "receiveLvzMidiEvent") == 0) return 1; @@ -344,87 +342,19 @@ void mdaEPiano::guiGetDisplay(int32_t index, char *label) } -void mdaEPiano::process(float **inputs, float **outputs, int32_t sampleFrames) -{ - float* out0 = outputs[0]; - float* out1 = outputs[1]; - int32_t event=0, frame=0, frames, v; - float x, l, r, od=overdrive; - int32_t i; - - while(frame<sampleFrames) - { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; - frames -= frame; - frame += frames; - - while(--frames>=0) - { - VOICE *V = voice; - l = r = 0.0f; - - for(v=0; v<activevoices; v++) - { - V->frac += V->delta; //integer-based linear interpolation - V->pos += V->frac >> 16; - V->frac &= 0xFFFF; - if(V->pos > V->end) V->pos -= V->loop; - i = waves[V->pos]; - i = (i << 7) + (V->frac >> 9) * (waves[V->pos + 1] - i) + 0x40400000; - x = V->env * (*(float *)&i - 3.0f); //fast int->float - V->env = V->env * V->dec; //envelope - - if(x>0.0f) { x -= od * x * x; if(x < -V->env) x = -V->env; } //+= 0.5f * x * x; } //overdrive - - l += V->outl * x; - r += V->outr * x; - - V++; - } - tl += tfrq * (l - tl); //treble boost - tr += tfrq * (r - tr); - r += treb * (r - tr); - l += treb * (l - tl); - - lfo0 += dlfo * lfo1; //LFO for tremolo and autopan - lfo1 -= dlfo * lfo0; - l += l * lmod * lfo1; - r += r * rmod * lfo1; //worth making all these local variables? - - *out0++ += l; - *out1++ += r; - } - - if(frame<sampleFrames) - { - if(activevoices == 0 && programs[curProgram].param[4] > 0.5f) - { lfo0 = -0.7071f; lfo1 = 0.7071f; } //reset LFO phase - good idea? - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); - } - } - if(fabs(tl)<1.0e-10) tl = 0.0f; //anti-denormal - if(fabs(tr)<1.0e-10) tr = 0.0f; - - for(v=0; v<activevoices; v++) if(voice[v].env < SILENCE) voice[v] = voice[--activevoices]; - notes[0] = EVENTS_DONE; //mark events buffer as done -} - - void mdaEPiano::processReplacing(float **inputs, float **outputs, int32_t sampleFrames) { float* out0 = outputs[0]; float* out1 = outputs[1]; - int32_t event=0, frame=0, frames, v; + int32_t frame=0, frames, v; float x, l, r, od=overdrive; int32_t i; + LV2_Atom_Event* ev = lv2_atom_sequence_begin(&eventInput->body); while(frame<sampleFrames) { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; + bool end = lv2_atom_sequence_is_end(&eventInput->body, eventInput->atom.size, ev); + frames = end ? sampleFrames : ev->time.frames; frames -= frame; frame += frames; @@ -473,16 +403,18 @@ void mdaEPiano::processReplacing(float **inputs, float **outputs, int32_t sample { if(activevoices == 0 && programs[curProgram].param[4] > 0.5f) { lfo0 = -0.7071f; lfo1 = 0.7071f; } //reset LFO phase - good idea? - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); + + if (!end) { + processEvent(ev); + ev = lv2_atom_sequence_next(ev); + } + } } if(fabs(tl)<1.0e-10) tl = 0.0f; //anti-denormal if(fabs(tr)<1.0e-10) tr = 0.0f; for(v=0; v<activevoices; v++) if(voice[v].env < SILENCE) voice[v] = voice[--activevoices]; - notes[0] = EVENTS_DONE; //mark events buffer as done } @@ -561,29 +493,23 @@ void mdaEPiano::noteOn(int32_t note, int32_t velocity) } -int32_t mdaEPiano::processEvents(LvzEvents* ev) +int32_t mdaEPiano::processEvent(const LV2_Atom_Event* ev) { float * param = programs[curProgram].param; - int32_t npos=0; - for (int32_t i=0; i<ev->numEvents; i++) - { - if((ev->events[i])->type != kLvzMidiType) continue; - LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i]; - char* midiData = event->midiData; + if (ev->body.type != midiEventType) + return 0; + + const uint8_t* midiData = (const uint8_t*)LV2_ATOM_BODY(&ev->body); switch(midiData[0] & 0xf0) //status byte (all channels) { case 0x80: //note off - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = 0; //vel + noteOn(midiData[1] & 0x7F, 0); break; case 0x90: //note on - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = midiData[2] & 0x7F; //vel + noteOn(midiData[1] & 0x7F, midiData[2] & 0x7F); break; case 0xB0: //controller @@ -608,9 +534,7 @@ int32_t mdaEPiano::processEvents(LvzEvents* ev) sustain = midiData[2] & 0x40; if(sustain==0) { - notes[npos++] = event->deltaFrames; - notes[npos++] = SUSTAIN; //end all sustained notes - notes[npos++] = 0; + noteOn(SUSTAIN, 0); //end all sustained notes } break; @@ -632,10 +556,6 @@ int32_t mdaEPiano::processEvents(LvzEvents* ev) default: break; } - if(npos>EVENTBUFFER) npos -= 3; //discard events if buffer full!! - event++; //? - } - notes[npos] = EVENTS_DONE; return 1; } diff --git a/src/mdaEPiano.h b/src/mdaEPiano.h index b24c7ce..41d0fb0 100644 --- a/src/mdaEPiano.h +++ b/src/mdaEPiano.h @@ -24,7 +24,7 @@ #include "audioeffectx.h" #define NPARAMS 12 //number of parameters -#define NPROGS 8 //number of programs +#define NPROGS 5 //number of programs #define NOUTS 2 //number of outputs #define NVOICES 32 //max polyphony #define SUSTAIN 128 @@ -76,9 +76,7 @@ public: mdaEPiano(audioMasterCallback audioMaster); ~mdaEPiano(); - virtual void process(float **inputs, float **outputs, int32_t sampleframes); virtual void processReplacing(float **inputs, float **outputs, int32_t sampleframes); - virtual int32_t processEvents(LvzEvents* events); virtual void setProgram(int32_t program); virtual void setProgramName(char *name); @@ -98,7 +96,7 @@ public: virtual bool getVendorString (char* text); virtual bool getProductString (char* text); virtual int32_t getVendorVersion () {return 1;} - virtual int32_t canDo (char* text); + virtual int32_t canDo (const char* text); virtual int32_t getNumMidiInputChannels () { return 1; } @@ -106,6 +104,7 @@ public: void guiGetDisplay(int32_t index, char *label); private: + int32_t processEvent(const LV2_Atom_Event* ev); void update(); //my parameter update void noteOn(int32_t note, int32_t velocity); void fillpatch(int32_t p, const char *name, float p0, float p1, float p2, float p3, float p4, @@ -114,10 +113,6 @@ private: mdaEPianoProgram* programs; float Fs, iFs; - #define EVENTBUFFER 120 - #define EVENTS_DONE 99999999 - int32_t notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block - ///global internal variables KGRP kgrp[34]; VOICE voice[NVOICES]; diff --git a/src/mdaImage.cpp b/src/mdaImage.cpp index 06799b6..50d2ffa 100644 --- a/src/mdaImage.cpp +++ b/src/mdaImage.cpp @@ -28,7 +28,7 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster) mdaImage::mdaImage(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 6) // programs, parameters { - fParam1 = 0.6f; //mode + fParam1 = 0.0f; //mode fParam2 = 0.75f; //width fParam3 = 0.5f; //skew fParam4 = 0.75f; //centre diff --git a/src/mdaJX10.cpp b/src/mdaJX10.cpp index 2432fae..c51c946 100644 --- a/src/mdaJX10.cpp +++ b/src/mdaJX10.cpp @@ -18,6 +18,8 @@ #include "mdaJX10.h" +#include "lv2/lv2plug.in/ns/ext/atom/util.h" + #include <stdio.h> #include <stdlib.h> //rand() #include <math.h> @@ -154,7 +156,6 @@ mdaJX10::mdaJX10(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NP voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f; voice[v].note = 0; } - notes[0] = EVENTS_DONE; lfo = modwhl = filtwhl = press = fzip = 0.0f; rezwhl = pbend = ipbend = 1.0f; volume = 0.0005f; @@ -332,7 +333,7 @@ bool mdaJX10::copyProgram(int32_t destination) } -int32_t mdaJX10::canDo(char* text) +int32_t mdaJX10::canDo(const char* text) { if(!strcmp (text, "receiveLvzEvents")) return 1; if(!strcmp (text, "receiveLvzMidiEvent")) return 1; @@ -430,178 +431,11 @@ void mdaJX10::getParameterLabel(int32_t index, char *label) } } - -void mdaJX10::process(float **inputs, float **outputs, int32_t sampleFrames) -{ - float* out1 = outputs[0]; - float* out2 = outputs[1]; - int32_t event=0, frame=0, frames, v; - float o, e, vib, pwm, pb=pbend, ipb=ipbend, gl=glide; - float x, y, hpf=0.997f, min=1.0f, w=0.0f, ww=noisemix; - float ff, fe=filtenv, fq=filtq * rezwhl, fx=1.97f-0.85f*fq, fz=fzip; - int32_t k=K; - unsigned int r; - - vib = (float)sin(lfo); - ff = filtf + filtwhl + (filtlfo + press) * vib; //have to do again here as way that - pwm = 1.0f + vib * (modwhl + pwmdep); //below triggers on k was too cheap! - vib = 1.0f + vib * (modwhl + vibrato); - - if(activevoices>0 || notes[event]<sampleFrames) - { - while(frame<sampleFrames) - { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; - frames -= frame; - frame += frames; - - while(--frames>=0) - { - VOICE *V = voice; - o = 0.0f; - - noise = (noise * 196314165) + 907633515; - r = (noise & 0x7FFFFF) + 0x40000000; //generate noise + fast convert to float - w = *(float *)&r; - w = ww * (w - 3.0f); - - if(--k<0) - { - lfo += dlfo; - if(lfo>PI) lfo -= TWOPI; - vib = (float)sin(lfo); - ff = filtf + filtwhl + (filtlfo + press) * vib; - pwm = 1.0f + vib * (modwhl + pwmdep); - vib = 1.0f + vib * (modwhl + vibrato); - k = KMAX; - } - - for(v=0; v<NVOICES; v++) //for each voice - { - e = V->env; - if(e > SILENCE) - { //Sinc-Loop Oscillator - x = V->p + V->dp; - if(x > min) - { - if(x > V->pmax) - { - x = V->pmax + V->pmax - x; - V->dp = -V->dp; - } - V->p = x; - x = V->sin0 * V->sinx - V->sin1; //sine osc - V->sin1 = V->sin0; - V->sin0 = x; - x = x / V->p; - } - else - { - V->p = x = - x; - V->dp = V->period * vib * pb; //set period for next cycle - V->pmax = (float)floor(0.5f + V->dp) - 0.5f; - V->dc = -0.5f * V->lev / V->pmax; - V->pmax *= PI; - V->dp = V->pmax / V->dp; - V->sin0 = V->lev * (float)sin(x); - V->sin1 = V->lev * (float)sin(x - V->dp); - V->sinx = 2.0f * (float)cos(V->dp); - if(x*x > .1f) x = V->sin0 / x; else x = V->lev; //was 0.01f; - } - - y = V->p2 + V->dp2; //osc2 - if(y > min) - { - if(y > V->pmax2) - { - y = V->pmax2 + V->pmax2 - y; - V->dp2 = -V->dp2; - } - V->p2 = y; - y = V->sin02 * V->sinx2 - V->sin12; - V->sin12 = V->sin02; - V->sin02 = y; - y = y / V->p2; - } - else - { - V->p2 = y = - y; - V->dp2 = V->period * V->detune * pwm * pb; - V->pmax2 = (float)floor(0.5f + V->dp2) - 0.5f; - V->dc2 = -0.5f * V->lev2 / V->pmax2; - V->pmax2 *= PI; - V->dp2 = V->pmax2 / V->dp2; - V->sin02 = V->lev2 * (float)sin(y); - V->sin12 = V->lev2 * (float)sin(y - V->dp2); - V->sinx2 = 2.0f * (float)cos(V->dp2); - if(y*y > .1f) y = V->sin02 / y; else y = V->lev2; - } - V->saw = V->saw * hpf + V->dc + x - V->dc2 - y; //integrated sinc = saw - x = V->saw + w; - V->env += V->envd * (V->envl - V->env); - - if(k==KMAX) //filter freq update at LFO rate - { - if((V->env+V->envl)>3.0f) { V->envd=dec; V->envl=sus; } //envelopes - V->fenv += V->fenvd * (V->fenvl - V->fenv); - if((V->fenv+V->fenvl)>3.0f) { V->fenvd=fdec; V->fenvl=fsus; } - - fz += 0.005f * (ff - fz); //filter zipper noise filter - y = V->fc * (float)exp(fz + fe * V->fenv) * ipb; //filter cutoff - if(y<0.005f) y=0.005f; - V->ff = y; - - V->period += gl * (V->target - V->period); //glide - if(V->target < V->period) V->period += gl * (V->target - V->period); - } - - if(V->ff > fx) V->ff = fx; //stability limit - - V->f0 += V->ff * V->f1; //state-variable filter - V->f1 -= V->ff * (V->f0 + fq * V->f1 - x - V->f2); - V->f1 -= 0.2f * V->f1 * V->f1 * V->f1; //soft limit //was 0.08f - V->f2 = x; - - o += V->env * V->f0; - } - V++; - } - - *out1++ += o; - *out2++ += o; - } - - if(frame<sampleFrames) - { - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); - } - } - - activevoices = NVOICES; - for(v=0; v<NVOICES; v++) - { - if(voice[v].env<SILENCE) //choke voices - { - voice[v].env = voice[v].envl = 0.0f; - voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f; - activevoices--; - } - } - } - notes[0] = EVENTS_DONE; //mark events buffer as done - fzip = fz; - K = k; -} - - void mdaJX10::processReplacing(float **inputs, float **outputs, int32_t sampleFrames) { float* out1 = outputs[0]; float* out2 = outputs[1]; - int32_t event=0, frame=0, frames, v; + int32_t frame=0, frames, v; float o, e, vib, pwm, pb=pbend, ipb=ipbend, gl=glide; float x, y, hpf=0.997f, min=1.0f, w=0.0f, ww=noisemix; float ff, fe=filtenv, fq=filtq * rezwhl, fx=1.97f-0.85f*fq, fz=fzip; @@ -613,12 +447,14 @@ void mdaJX10::processReplacing(float **inputs, float **outputs, int32_t sampleFr pwm = 1.0f + vib * (modwhl + pwmdep); //below triggers on k was too cheap! vib = 1.0f + vib * (modwhl + vibrato); - if(activevoices>0 || notes[event]<sampleFrames) + LV2_Atom_Event* ev = lv2_atom_sequence_begin(&eventInput->body); + bool end = lv2_atom_sequence_is_end(&eventInput->body, eventInput->atom.size, ev); + if(activevoices>0 || !end) { while(frame<sampleFrames) { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; + end = lv2_atom_sequence_is_end(&eventInput->body, eventInput->atom.size, ev); + frames = end ? sampleFrames : ev->time.frames; frames -= frame; frame += frames; @@ -739,11 +575,10 @@ void mdaJX10::processReplacing(float **inputs, float **outputs, int32_t sampleFr *out2++ = o; } - if(frame<sampleFrames) + if(!end) { - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); + processEvent(ev); + ev = lv2_atom_sequence_next(ev); } } @@ -766,7 +601,6 @@ void mdaJX10::processReplacing(float **inputs, float **outputs, int32_t sampleFr *out2++ = 0.0f; } } - notes[0] = EVENTS_DONE; //mark events buffer as done fzip = fz; K = k; } @@ -912,28 +746,21 @@ void mdaJX10::noteOn(int32_t note, int32_t velocity) } -int32_t mdaJX10::processEvents(LvzEvents* ev) +int32_t mdaJX10::processEvent(const LV2_Atom_Event* ev) { - int32_t npos=0; - - for (int32_t i=0; i<ev->numEvents; i++) - { - if((ev->events[i])->type != kLvzMidiType) continue; - LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i]; - char* midiData = event->midiData; + if (ev->body.type != midiEventType) + return 0; + + const uint8_t* midiData = (const uint8_t*)LV2_ATOM_BODY(&ev->body); switch(midiData[0] & 0xf0) //status byte (all channels) { case 0x80: //note off - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = 0; //vel + noteOn(midiData[1] & 0x7F, 0); break; case 0x90: //note on - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = midiData[2] & 0x7F; //vel + noteOn(midiData[1] & 0x7F, midiData[2] & 0x7F); break; case 0xB0: //controller @@ -963,9 +790,7 @@ int32_t mdaJX10::processEvents(LvzEvents* ev) sustain = midiData[2] & 0x40; if(sustain==0) { - notes[npos++] = event->deltaFrames; - notes[npos++] = SUSTAIN; //end all sustained notes - notes[npos++] = 0; + noteOn(SUSTAIN, 0); } break; @@ -1001,10 +826,6 @@ int32_t mdaJX10::processEvents(LvzEvents* ev) default: break; } - if(npos>EVENTBUFFER) npos -= 3; //discard events if buffer full!! - event++; - } - notes[npos] = EVENTS_DONE; return 1; } diff --git a/src/mdaJX10.h b/src/mdaJX10.h index 932ca6d..b918115 100644 --- a/src/mdaJX10.h +++ b/src/mdaJX10.h @@ -94,9 +94,7 @@ public: mdaJX10(audioMasterCallback audioMaster); ~mdaJX10(); - virtual void process(float **inputs, float **outputs, int32_t sampleframes); virtual void processReplacing(float **inputs, float **outputs, int32_t sampleframes); - virtual int32_t processEvents(LvzEvents* events); virtual void setProgram(int32_t program); virtual void setProgramName(char *name); @@ -118,9 +116,10 @@ public: virtual bool getVendorString (char* text); virtual bool getProductString (char* text); virtual int32_t getVendorVersion () {return 1;} - virtual int32_t canDo (char* text); + virtual int32_t canDo (const char* text); private: + int32_t processEvent(const LV2_Atom_Event* ev); void update(); //my parameter update void noteOn(int32_t note, int32_t velocity); void fillpatch(int32_t p, const char *name, @@ -132,9 +131,6 @@ private: mdaJX10Program* programs; float Fs; - #define EVENTBUFFER 120 - #define EVENTS_DONE 99999999 - int32_t notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block #define KMAX 32 ///global internal variables diff --git a/src/mdaLeslie.cpp b/src/mdaLeslie.cpp index 745936f..865133b 100644 --- a/src/mdaLeslie.cpp +++ b/src/mdaLeslie.cpp @@ -31,7 +31,7 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster) mdaLeslieProgram::mdaLeslieProgram() { - param[0] = 0.66f; + param[0] = 0.5f; param[1] = 0.50f; param[2] = 0.48f; param[3] = 0.70f; @@ -60,11 +60,11 @@ mdaLeslie::mdaLeslie(audioMasterCallback audioMaster) : AudioEffectX(audioMaster programs = new mdaLeslieProgram[numPrograms]; if(programs) { - programs[1].param[0] = 0.33f; + programs[1].param[0] = 0.5f; programs[1].param[4] = 0.75f; programs[1].param[5] = 0.57f; strcpy(programs[1].name,"Slow"); - programs[2].param[0] = 0.66f; + programs[2].param[0] = 1.0f; programs[2].param[4] = 0.60f; programs[2].param[5] = 0.70f; strcpy(programs[2].name,"Fast"); diff --git a/src/mdaMultiBand.cpp b/src/mdaMultiBand.cpp index 9998148..984e3b4 100644 --- a/src/mdaMultiBand.cpp +++ b/src/mdaMultiBand.cpp @@ -41,7 +41,7 @@ mdaMultiBand::mdaMultiBand(audioMasterCallback audioMaster) : AudioEffectX(audio fParam10 = (float)0.22; //attack (3) fParam11 = (float)0.602; //release (4) fParam12 = (float)0.55; //width - fParam13 = (float)0.40; //MS swap + fParam13 = (float)0.00; //MS swap /* fParam1 = (float)1.00; //Listen: L/M/H/out fParam2 = (float)0.50; //xover1 fParam3 = (float)0.50; //xover2 @@ -85,17 +85,16 @@ mdaMultiBand::mdaMultiBand(audioMasterCallback audioMaster) : AudioEffectX(audio att3 = (float)pow(10.0, -0.05 -(1.5 * fParam10)); rel3 = (float)pow(10.0, -2.0 - (2.5 * fParam11)); - switch(int(fParam1*10.0)) + switch(int(fParam1*3.9)) { case 0: trim2=0.0; trim3=0.0; slev=0.0; break; - case 1: - case 2: trim1=0.0; trim3=0.0; slev=0.0; break; - case 3: - case 4: trim1=0.0; trim2=0.0; slev=0.0; break; + case 1: trim1=0.0; trim3=0.0; slev=0.0; break; + case 2: trim1=0.0; trim2=0.0; slev=0.0; break; default: slev=fParam12; break; } fi1 = (float)pow(10.0,fParam2 - 1.70); fo1=(float)(1.0 - fi1); fi2 = (float)pow(10.0,fParam3 - 1.05); fo2=(float)(1.0 - fi2); + fb1 = fb2 = fb3 = 0.0f; mswap = 0; } @@ -165,19 +164,17 @@ void mdaMultiBand::setParameter(int32_t index, float value) att3 = (float)pow(10.0, -0.05 -(1.5 * fParam10)); rel3 = (float)pow(10.0, -2.0 - (2.5 * fParam11)); - switch(int(fParam1*10.0)) + switch(int(fParam1*3.9)) { case 0: trim2=0.0; trim3=0.0; slev=0.0; break; - case 1: - case 2: trim1=0.0; trim3=0.0; slev=0.0; break; - case 3: - case 4: trim1=0.0; trim2=0.0; slev=0.0; break; + case 1: trim1=0.0; trim3=0.0; slev=0.0; break; + case 2: trim1=0.0; trim2=0.0; slev=0.0; break; default: slev=fParam12; break; } fi1 = (float)pow(10.0,fParam2 - 1.70); fo1=(float)(1.0 - fi1); fi2 = (float)pow(10.0,fParam3 - 1.05); fo2=(float)(1.0 - fi2); - if(fParam13>0.5) mswap=1; else mswap=0; + if(fParam13>0.0) mswap=1; else mswap=0; } float mdaMultiBand::getParameter(int32_t index) @@ -230,10 +227,10 @@ void mdaMultiBand::getParameterDisplay(int32_t index, char *text) { switch(index) { - case 0: switch(int(fParam1*10.0)) + case 0: switch(int(fParam1*3.9)) { case 0: strcpy(text, "Low"); break; - case 1: case 2: strcpy(text, "Mid"); break; - case 3: case 4: strcpy(text, "High"); break; + case 1: strcpy(text, "Mid"); break; + case 2: strcpy(text, "High"); break; default: strcpy(text, "Output"); break; } break; case 1: int2strng((int32_t)(getSampleRate() * fi1 * (0.098 + 0.09*fi1 + 0.5*(float)pow(fi1,8.2f))), text); break; case 2: int2strng((int32_t)(getSampleRate() * fi2 * (0.015 + 0.15*fi2 + 0.9*(float)pow(fi2,8.2f))), text); break; diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp index 8f4fd76..f207079 100644 --- a/src/mdaPiano.cpp +++ b/src/mdaPiano.cpp @@ -19,6 +19,8 @@ #include "mdaPianoData.h" #include "mdaPiano.h" +#include "lv2/lv2plug.in/ns/ext/atom/util.h" + #include <stdio.h> #include <math.h> @@ -109,7 +111,6 @@ mdaPiano::mdaPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, voice[v].env = 0.0f; voice[v].dec = 0.99f; //all notes off } - notes[0] = EVENTS_DONE; volume = 0.2f; muff = 160.0f; cpos = sustain = activevoices = 0; @@ -240,7 +241,7 @@ bool mdaPiano::copyProgram(int32_t destination) } -int32_t mdaPiano::canDo(char* text) +int32_t mdaPiano::canDo(const char* text) { if(strcmp(text, "receiveLvzEvents") == 0) return 1; if(strcmp(text, "receiveLvzMidiEvent") == 0) return 1; @@ -313,79 +314,19 @@ void mdaPiano::guiGetDisplay(int32_t index, char *label) getParameterLabel(index, label + strlen(label)); } - - -void mdaPiano::process(float **inputs, float **outputs, int32_t sampleFrames) -{ - float* out0 = outputs[0]; - float* out1 = outputs[1]; - int32_t event=0, frame=0, frames, v; - float x, l, r; - int32_t i; - - while(frame<sampleFrames) - { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; - frames -= frame; - frame += frames; - - while(--frames>=0) - { - VOICE *V = voice; - l = r = 0.0f; - - for(v=0; v<activevoices; v++) - { - V->frac += V->delta; //integer-based linear interpolation - V->pos += V->frac >> 16; - V->frac &= 0xFFFF; - if(V->pos > V->end) V->pos -= V->loop; - i = waves[V->pos]; - i = (i << 7) + (V->frac >> 9) * (waves[V->pos + 1] - i) + 0x40400000; - x = V->env * (*(float *)&i - 3.0f); //fast int->float - - V->env = V->env * V->dec; //envelope - V->f0 += V->ff * (x + V->f1 - V->f0); //muffle filter - V->f1 = x; - - l += V->outl * V->f0; - r += V->outr * V->f0; - - V++; - } - comb[cpos] = l + r; - ++cpos &= cmax; - x = cdep * comb[cpos]; //stereo simulator - - *out0++ += l + x; - *out1++ += r - x; - } - - if(frame<sampleFrames) - { - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); - } - } - for(v=0; v<activevoices; v++) if(voice[v].env < SILENCE) voice[v] = voice[--activevoices]; - notes[0] = EVENTS_DONE; //mark events buffer as done -} - - void mdaPiano::processReplacing(float **inputs, float **outputs, int32_t sampleFrames) { float* out0 = outputs[0]; float* out1 = outputs[1]; - int32_t event=0, frame=0, frames, v; + int32_t frame=0, frames, v; float x, l, r; int32_t i; + LV2_Atom_Event* ev = lv2_atom_sequence_begin(&eventInput->body); while(frame<sampleFrames) { - frames = notes[event++]; - if(frames>sampleFrames) frames = sampleFrames; + bool end = lv2_atom_sequence_is_end(&eventInput->body, eventInput->atom.size, ev); + frames = end ? sampleFrames : ev->time.frames; frames -= frame; frame += frames; @@ -432,15 +373,13 @@ if(!(r > -2.0f) || !(r < 2.0f)) *out1++ = r - x; } - if(frame<sampleFrames) + if(!end) { - int32_t note = notes[event++]; - int32_t vel = notes[event++]; - noteOn(note, vel); + processEvent(ev); + ev = lv2_atom_sequence_next(ev); } } for(v=0; v<activevoices; v++) if(voice[v].env < SILENCE) voice[v] = voice[--activevoices]; - notes[0] = EVENTS_DONE; //mark events buffer as done } @@ -518,28 +457,21 @@ void mdaPiano::noteOn(int32_t note, int32_t velocity) } -int32_t mdaPiano::processEvents(LvzEvents* ev) +int32_t mdaPiano::processEvent(const LV2_Atom_Event* ev) { - int32_t npos=0; + if (ev->body.type != midiEventType) + return 0; - for (int32_t i=0; i<ev->numEvents; i++) - { - if((ev->events[i])->type != kLvzMidiType) continue; - LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i]; - char* midiData = event->midiData; + const uint8_t* midiData = (const uint8_t*)LV2_ATOM_BODY(&ev->body); switch(midiData[0] & 0xf0) //status byte (all channels) { case 0x80: //note off - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = 0; //vel + noteOn(midiData[1] & 0x7F, 0); break; case 0x90: //note on - notes[npos++] = event->deltaFrames; //delta - notes[npos++] = midiData[1] & 0x7F; //note - notes[npos++] = midiData[2] & 0x7F; //vel + noteOn(midiData[1] & 0x7F, midiData[2] & 0x7F); break; case 0xB0: //controller @@ -559,9 +491,7 @@ int32_t mdaPiano::processEvents(LvzEvents* ev) sustain = midiData[2] & 0x40; if(sustain==0) { - notes[npos++] = event->deltaFrames; - notes[npos++] = SUSTAIN; //end all sustained notes - notes[npos++] = 0; + noteOn(SUSTAIN, 0); //end all sustained notes } break; @@ -583,10 +513,6 @@ int32_t mdaPiano::processEvents(LvzEvents* ev) default: break; } - if(npos>EVENTBUFFER) npos -= 3; //discard events if buffer full!! - event++; //? - } - notes[npos] = EVENTS_DONE; return 1; } diff --git a/src/mdaPiano.h b/src/mdaPiano.h index 1885671..bd6f82a 100644 --- a/src/mdaPiano.h +++ b/src/mdaPiano.h @@ -80,9 +80,7 @@ public: mdaPiano(audioMasterCallback audioMaster); ~mdaPiano(); - virtual void process(float **inputs, float **outputs, int32_t sampleframes); virtual void processReplacing(float **inputs, float **outputs, int32_t sampleframes); - virtual int32_t processEvents(LvzEvents* events); virtual void setProgram(int32_t program); virtual void setProgramName(char *name); @@ -102,7 +100,7 @@ public: virtual bool getVendorString (char* text); virtual bool getProductString (char* text); virtual int32_t getVendorVersion () {return 1;} - virtual int32_t canDo (char* text); + virtual int32_t canDo (const char* text); virtual int32_t getNumMidiInputChannels () { return 1; } @@ -110,6 +108,7 @@ public: void guiGetDisplay(int32_t index, char *label); private: + int32_t processEvent(const LV2_Atom_Event* ev); void update(); //my parameter update void noteOn(int32_t note, int32_t velocity); void fillpatch(int32_t p, const char *name, float p0, float p1, float p2, float p3, float p4, @@ -119,10 +118,6 @@ private: mdaPianoProgram* programs; float Fs, iFs; - #define EVENTBUFFER 120 - #define EVENTS_DONE 99999999 - int32_t notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block - ///global internal variables KGRP kgrp[16]; VOICE voice[NVOICES]; diff --git a/src/mdaRePsycho.cpp b/src/mdaRePsycho.cpp index 7a882ce..4469b49 100644 --- a/src/mdaRePsycho.cpp +++ b/src/mdaRePsycho.cpp @@ -35,7 +35,7 @@ mdaRePsycho::mdaRePsycho(audioMasterCallback audioMaster) : AudioEffectX(audioMa fParam4 = (float)1.0; //mix fParam5 = (float)0.45; //minimum chunk length fParam6 = (float)1.0; //fine tune - fParam7 = (float)0.4; //quality + fParam7 = (float)0.0; //quality size = 22050; buffer = new float[size]; buffer2 = new float[size]; @@ -168,7 +168,7 @@ void mdaRePsycho::getParameterDisplay(int32_t index, char *text) case 5: long2string((long)(100.0 * fParam4), text); break; case 4: long2string((long)(1000.0 * dtim / getSampleRate()), text); break; case 1: long2string((long)(int(99.0 * fParam6) - 99.0), text); break; - case 6: if(fParam7>0.5) strcpy(text, "HIGH"); + case 6: if(fParam7>0.0) strcpy(text, "HIGH"); else strcpy(text, "LOW"); break; } } @@ -207,7 +207,7 @@ void mdaRePsycho::process(float **inputs, float **outputs, int32_t sampleFrames) --out1; --out2; - if(fParam7>0.5) //high quality + if(fParam7>0.0) //high quality { we=(float)(we*2.0); while(--sampleFrames >= 0) @@ -338,7 +338,7 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, int32_t samp --out1; --out2; - if(fParam7>0.5) //high quality + if(fParam7>0.0) //high quality { we=(float)(we*2.0); while(--sampleFrames >= 0) diff --git a/src/mdaRezFilter.cpp b/src/mdaRezFilter.cpp index d89f358..98d3da0 100644 --- a/src/mdaRezFilter.cpp +++ b/src/mdaRezFilter.cpp @@ -41,6 +41,10 @@ mdaRezFilter::mdaRezFilter(audioMasterCallback audioMaster) : AudioEffectX(audio fParam8 = 0.00f; //trigger fParam9 = 0.75f; //max freq + fff = fq = fg = fmax = env = fenv = att = rel = 0.0f; + flfo = phi = dphi = bufl = buf0 = buf1 = buf2 = tthr = env2 = 0.0f; + lfomode = ttrig = tatt = 0; + setNumInputs(2); setNumOutputs(2); setUniqueID("mdaRezFilter"); diff --git a/src/mdaSplitter.cpp b/src/mdaSplitter.cpp index d98d8ed..881c2ef 100644 --- a/src/mdaSplitter.cpp +++ b/src/mdaSplitter.cpp @@ -41,9 +41,9 @@ mdaSplitter::mdaSplitter(audioMasterCallback audioMaster): AudioEffectX(audioMas ///differences from default program... programs[1].param[2] = 0.50f; - programs[1].param[4] = 0.25f; + programs[1].param[4] = 0.0f; strcpy(programs[1].name,"Pass Peaks Only"); - programs[2].param[0] = 0.60f; + programs[2].param[0] = 0.66666666f; strcpy(programs[2].name,"Stereo Crossover"); setProgram(0); diff --git a/src/mdaSplitter.h b/src/mdaSplitter.h index 398b3ca..d2e237e 100644 --- a/src/mdaSplitter.h +++ b/src/mdaSplitter.h @@ -29,7 +29,7 @@ class mdaSplitterProgram public: mdaSplitterProgram() { - param[0] = 0.10f; //mode + param[0] = 0.00f; //mode param[1] = 0.50f; //freq param[2] = 0.25f; //freq mode param[3] = 0.50f; //level (was 2) diff --git a/src/mdaTestTone.cpp b/src/mdaTestTone.cpp index 9aa98b2..96eee47 100644 --- a/src/mdaTestTone.cpp +++ b/src/mdaTestTone.cpp @@ -28,7 +28,7 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster) mdaTestTone::mdaTestTone(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 8) { - fParam0 = 0.47f; //mode + fParam0 = 0.0f; //mode fParam1 = 0.71f; //level dB fParam2 = 0.50f; //pan dB fParam3 = 0.57f; //freq1 B diff --git a/src/mdaTracker.cpp b/src/mdaTracker.cpp index 7387a6b..f1c1d86 100644 --- a/src/mdaTracker.cpp +++ b/src/mdaTracker.cpp @@ -50,6 +50,10 @@ mdaTracker::mdaTracker(audioMasterCallback audioMaster) : AudioEffectX(audioMast res1 = (float)cos(0.01); //p res2 = (float)sin(0.01); //q + fi = fo = thr = phi = ddphi = trans = buf1 = buf2 = dn = bold = wet = dry = 0.0f; + dyn = env = rel = saw = dsaw = res1 = res2 = buf3 = buf4 = 0.0f; + max = min = num = sig = mode = 0; + setParameter(0, 0.0f); } diff --git a/src/mdaTransient.cpp b/src/mdaTransient.cpp index 0edb476..8f435a6 100644 --- a/src/mdaTransient.cpp +++ b/src/mdaTransient.cpp @@ -41,6 +41,8 @@ mdaTransient::mdaTransient(audioMasterCallback audioMaster) : AudioEffectX(audio canProcessReplacing(); // supports both accumulating and replacing output strcpy(programName, "Transient Processor"); // default program name + dry = att1 = att2 = rel12 = att34 = rel3 = rel4 = 0.0f; + env1 = env2 = env3 = env4 = fili = filo = filx = fbuf1 = fbuf2 = 0.0f; setParameter(0, 0.5f); } diff --git a/src/mdaVocInput.cpp b/src/mdaVocInput.cpp index e008f80..854a41e 100644 --- a/src/mdaVocInput.cpp +++ b/src/mdaVocInput.cpp @@ -30,7 +30,7 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster) mdaVocInputProgram::mdaVocInputProgram() ///default program settings { - param[0] = 0.25f; //Tracking Off / On / Quant + param[0] = 0.0f; //Tracking Off / On / Quant param[1] = 0.50f; //Pitch param[2] = 0.20f; //Breath Noise param[3] = 0.50f; //Voiced/Unvoiced Thresh @@ -47,6 +47,11 @@ mdaVocInput::mdaVocInput(audioMasterCallback audioMaster): AudioEffectX(audioMas DECLARE_LVZ_DEPRECATED(canMono) (); canProcessReplacing(); + track = 0; + pstep = pmult = sawbuf = noise = lenv = henv = 0.0f; + lbuf0 = lbuf1 = lbuf2 = lbuf3 = lfreq = vuv = maxp = minp = 0.0f; + root = 0.0; + programs = new mdaVocInputProgram[numPrograms]; setProgram(0); diff --git a/src/mdaVocoder.cpp b/src/mdaVocoder.cpp index cb40eed..bbdb1a2 100644 --- a/src/mdaVocoder.cpp +++ b/src/mdaVocoder.cpp @@ -30,14 +30,14 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster) mdaVocoderProgram::mdaVocoderProgram() ///default program settings { - param[0] = 0.33f; //input select + param[0] = 0.0f; //input select param[1] = 0.50f; //output dB param[2] = 0.40f; //hi thru param[3] = 0.40f; //hi band param[4] = 0.16f; //envelope param[5] = 0.55f; //filter q param[6] = 0.6667f;//freq range - param[7] = 0.33f; //num bands + param[7] = 0.0f; //num bands strcpy(name, "Vocoder"); } @@ -54,7 +54,7 @@ mdaVocoder::mdaVocoder(audioMasterCallback audioMaster): AudioEffectX(audioMaste setProgram(0); ///differences from default program... - programs[1].param[7] = 0.66f; + programs[1].param[7] = 1.0f; strcpy(programs[1].name,"16 Band Vocoder"); programs[2].param[2] = 0.00f; programs[2].param[3] = 0.00f; @@ -90,7 +90,7 @@ void mdaVocoder::resume() ///update internal parameters... high = param[3] * param[3] * param[3] * thru; thru *= param[2] * param[2] * param[2]; - if(param[7]<0.5f) + if(param[7]<=0.0f) { nbnd=8; //re=0.003f; |