diff options
author | David Robillard <d@drobilla.net> | 2011-03-15 04:19:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-03-15 04:19:00 +0000 |
commit | 4fbdf88bfb0ce05b44c53f270af863273228e61a (patch) | |
tree | cfe1289d1dd0a50608fc423451eec3611654aecd | |
parent | 866fea628ca3df85af4d90520f38317d48c2b4a9 (diff) | |
download | mda.lv2-4fbdf88bfb0ce05b44c53f270af863273228e61a.tar.gz mda.lv2-4fbdf88bfb0ce05b44c53f270af863273228e61a.tar.bz2 mda.lv2-4fbdf88bfb0ce05b44c53f270af863273228e61a.zip |
Convert to UNIX line ends.
git-svn-id: http://svn.drobilla.net/lad/trunk/plugins/mdala.lv2@3088 a436a847-0d15-0410-975c-d299462d15a1
34 files changed, 3575 insertions, 3575 deletions
diff --git a/src/mdaBandisto.h b/src/mdaBandisto.h index 042033b..2e8463a 100644 --- a/src/mdaBandisto.h +++ b/src/mdaBandisto.h @@ -1,58 +1,58 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaBandisto_H
-#define __mdaBandisto_H
-
-#include "audioeffectx.h"
-
-class mdaBandisto : public AudioEffectX
-{
-public:
- mdaBandisto(audioMasterCallback audioMaster);
- ~mdaBandisto();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1, fParam2, fParam3, fParam4;
- float fParam5, fParam6, fParam7, fParam8;
- float fParam9, fParam10;
- float gain1, driv1, trim1;
- float gain2, driv2, trim2;
- float gain3, driv3, trim3;
- float fi1, fb1, fo1, fi2, fb2, fo2, fb3, slev;
- int valve;
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaBandisto_H +#define __mdaBandisto_H + +#include "audioeffectx.h" + +class mdaBandisto : public AudioEffectX +{ +public: + mdaBandisto(audioMasterCallback audioMaster); + ~mdaBandisto(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1, fParam2, fParam3, fParam4; + float fParam5, fParam6, fParam7, fParam8; + float fParam9, fParam10; + float gain1, driv1, trim1; + float gain2, driv2, trim2; + float gain3, driv3, trim3; + float fi1, fb1, fo1, fi2, fb2, fo2, fb3, slev; + int valve; + char programName[32]; +}; + +#endif diff --git a/src/mdaBeatBox.h b/src/mdaBeatBox.h index 9d02fff..414e5d2 100644 --- a/src/mdaBeatBox.h +++ b/src/mdaBeatBox.h @@ -1,78 +1,78 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaBeatBox_H
-#define __mdaBeatBox_H
-
-#include "audioeffectx.h"
-
-class mdaBeatBox : public AudioEffectX
-{
-public:
- mdaBeatBox(audioMasterCallback audioMaster);
- ~mdaBeatBox();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
- virtual void synth();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fParam7;
- float fParam8;
- float fParam9;
- float fParam10;
- float fParam11;
- float fParam12;
- float hthr, hfil, sthr, kthr, kfil1, kfil2, mix;
- float klev, hlev, slev;
- float ww, wwx, sb1, sb2, sf1, sf2, sf3;
- float kww, kwwx, ksb1, ksb2, ksf1, ksf2;
- float dyne, dyna, dynr, dynm;
-
- float *hbuf;
- float *kbuf;
- float *sbuf, *sbuf2;
- LvzInt32 hbuflen, hbufpos, hdel;
- LvzInt32 sbuflen, sbufpos, sdel, sfx;
- LvzInt32 kbuflen, kbufpos, kdel, ksfx;
- LvzInt32 rec, recx, recpos;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaBeatBox_H +#define __mdaBeatBox_H + +#include "audioeffectx.h" + +class mdaBeatBox : public AudioEffectX +{ +public: + mdaBeatBox(audioMasterCallback audioMaster); + ~mdaBeatBox(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + virtual void synth(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fParam7; + float fParam8; + float fParam9; + float fParam10; + float fParam11; + float fParam12; + float hthr, hfil, sthr, kthr, kfil1, kfil2, mix; + float klev, hlev, slev; + float ww, wwx, sb1, sb2, sf1, sf2, sf3; + float kww, kwwx, ksb1, ksb2, ksf1, ksf2; + float dyne, dyna, dynr, dynm; + + float *hbuf; + float *kbuf; + float *sbuf, *sbuf2; + LvzInt32 hbuflen, hbufpos, hdel; + LvzInt32 sbuflen, sbufpos, sdel, sfx; + LvzInt32 kbuflen, kbufpos, kdel, ksfx; + LvzInt32 rec, recx, recpos; + + char programName[32]; +}; + +#endif diff --git a/src/mdaCombo.h b/src/mdaCombo.h index 2198640..dfa19be 100644 --- a/src/mdaCombo.h +++ b/src/mdaCombo.h @@ -1,69 +1,69 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaCombo_H
-#define __mdaCombo_H
-
-#include "audioeffectx.h"
-
-class mdaCombo : public AudioEffectX
-{
-public:
- mdaCombo(audioMasterCallback audioMaster);
- ~mdaCombo();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual float filterFreq(float hz);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fParam7;
-
- float clip, drive, trim, lpf, hpf, mix1, mix2;
- float ff1, ff2, ff3, ff4, ff5, bias;
- float ff6, ff7, ff8, ff9, ff10;
- float hhf, hhq, hh0, hh1; //hpf
-
- float *buffer, *buffe2;
- LvzInt32 size, bufpos, del1, del2;
- int mode, ster;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaCombo_H +#define __mdaCombo_H + +#include "audioeffectx.h" + +class mdaCombo : public AudioEffectX +{ +public: + mdaCombo(audioMasterCallback audioMaster); + ~mdaCombo(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual float filterFreq(float hz); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fParam7; + + float clip, drive, trim, lpf, hpf, mix1, mix2; + float ff1, ff2, ff3, ff4, ff5, bias; + float ff6, ff7, ff8, ff9, ff10; + float hhf, hhq, hh0, hh1; //hpf + + float *buffer, *buffe2; + LvzInt32 size, bufpos, del1, del2; + int mode, ster; + + char programName[32]; +}; + +#endif diff --git a/src/mdaDeEss.h b/src/mdaDeEss.h index 10cacd1..9d2684b 100644 --- a/src/mdaDeEss.h +++ b/src/mdaDeEss.h @@ -1,54 +1,54 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaDeEss_H
-#define __mdaDeEss_H
-
-#include "audioeffectx.h"
-
-class mdaDeEss : public AudioEffectX
-{
-public:
- mdaDeEss(audioMasterCallback audioMaster);
- ~mdaDeEss();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fbuf1, fbuf2, gai;
- float thr, att, rel, env, fil;
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaDeEss_H +#define __mdaDeEss_H + +#include "audioeffectx.h" + +class mdaDeEss : public AudioEffectX +{ +public: + mdaDeEss(audioMasterCallback audioMaster); + ~mdaDeEss(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fbuf1, fbuf2, gai; + float thr, att, rel, env, fil; + char programName[32]; +}; + +#endif diff --git a/src/mdaDegrade.h b/src/mdaDegrade.h index b1c9e92..f94d559 100644 --- a/src/mdaDegrade.h +++ b/src/mdaDegrade.h @@ -1,62 +1,62 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaDegrade_H
-#define __mdaDegrade_H
-
-#include "audioeffectx.h"
-
-class mdaDegrade : public AudioEffectX
-{
-public:
- mdaDegrade(audioMasterCallback audioMaster);
- ~mdaDegrade();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual float filterFreq(float hz);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fi2, fo2, clp, lin, lin2, g1, g2, g3, mode;
- float buf0, buf1, buf2, buf3, buf4, buf5, buf6, buf7, buf8, buf9;
- int tn, tcount;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaDegrade_H +#define __mdaDegrade_H + +#include "audioeffectx.h" + +class mdaDegrade : public AudioEffectX +{ +public: + mdaDegrade(audioMasterCallback audioMaster); + ~mdaDegrade(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual float filterFreq(float hz); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fi2, fo2, clp, lin, lin2, g1, g2, g3, mode; + float buf0, buf1, buf2, buf3, buf4, buf5, buf6, buf7, buf8, buf9; + int tn, tcount; + + char programName[32]; +}; + +#endif diff --git a/src/mdaDelay.h b/src/mdaDelay.h index 6c7535e..12877af 100644 --- a/src/mdaDelay.h +++ b/src/mdaDelay.h @@ -1,64 +1,64 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaDelay_H
-#define __mdaDelay_H
-
-#include "audioeffectx.h"
-
-class mdaDelay : public AudioEffectX
-{
-public:
- mdaDelay(audioMasterCallback audioMaster);
- ~mdaDelay();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam0;
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
-
- float *buffer; //delay
- LvzInt32 size, ipos, ldel, rdel; //delay max time, pointer, left time, right time
- float wet, dry, fbk; //wet & dry mix
- float lmix, hmix, fil, fil0; //low & high mix, crossover filter coeff & buffer
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaDelay_H +#define __mdaDelay_H + +#include "audioeffectx.h" + +class mdaDelay : public AudioEffectX +{ +public: + mdaDelay(audioMasterCallback audioMaster); + ~mdaDelay(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam0; + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + + float *buffer; //delay + LvzInt32 size, ipos, ldel, rdel; //delay max time, pointer, left time, right time + float wet, dry, fbk; //wet & dry mix + float lmix, hmix, fil, fil0; //low & high mix, crossover filter coeff & buffer + + char programName[32]; +}; + +#endif diff --git a/src/mdaDetune.h b/src/mdaDetune.h index 2bfe229..59ee1a0 100644 --- a/src/mdaDetune.h +++ b/src/mdaDetune.h @@ -1,74 +1,74 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define NPARAMS 4 ///number of parameters
-#define NPROGS 4 ///number of programs
-#define BUFMAX 4096
-
-#ifndef __mdaDetune_H
-#define __mdaDetune_H
-
-#include "audioeffectx.h"
-
-struct mdaDetuneProgram
-{
- friend class mdaDetune;
- float param[NPARAMS];
- char name[32];
-};
-
-
-class mdaDetune : public AudioEffectX
-{
-public:
- mdaDetune(audioMasterCallback audioMaster);
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaDetuneProgram programs[NPROGS];
- float buf[BUFMAX];
- float win[BUFMAX];
-
- ///global internal variables
- LvzInt32 buflen; //buffer length
- float bufres; //buffer resolution display
- float semi; //detune display
- LvzInt32 pos0; //buffer input
- float pos1, dpos1; //buffer output, rate
- float pos2, dpos2; //downwards shift
- float wet, dry; //ouput levels
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define NPARAMS 4 ///number of parameters +#define NPROGS 4 ///number of programs +#define BUFMAX 4096 + +#ifndef __mdaDetune_H +#define __mdaDetune_H + +#include "audioeffectx.h" + +struct mdaDetuneProgram +{ + friend class mdaDetune; + float param[NPARAMS]; + char name[32]; +}; + + +class mdaDetune : public AudioEffectX +{ +public: + mdaDetune(audioMasterCallback audioMaster); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaDetuneProgram programs[NPROGS]; + float buf[BUFMAX]; + float win[BUFMAX]; + + ///global internal variables + LvzInt32 buflen; //buffer length + float bufres; //buffer resolution display + float semi; //detune display + LvzInt32 pos0; //buffer input + float pos1, dpos1; //buffer output, rate + float pos2, dpos2; //downwards shift + float wet, dry; //ouput levels +}; + +#endif diff --git a/src/mdaDither.h b/src/mdaDither.h index 21529f8..88a0eb4 100644 --- a/src/mdaDither.h +++ b/src/mdaDither.h @@ -1,62 +1,62 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaDither_H
-#define __mdaDither_H
-
-#include "audioeffectx.h"
-
-class mdaDither : public AudioEffectX
-{
-public:
- mdaDither(audioMasterCallback audioMaster);
- ~mdaDither();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam0;
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
-
- float dith;
- LvzInt32 rnd1, rnd3;
- float shap, sh1, sh2, sh3, sh4;
- float offs, bits, wlen, gain;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaDither_H +#define __mdaDither_H + +#include "audioeffectx.h" + +class mdaDither : public AudioEffectX +{ +public: + mdaDither(audioMasterCallback audioMaster); + ~mdaDither(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam0; + float fParam1; + float fParam2; + float fParam3; + float fParam4; + + float dith; + LvzInt32 rnd1, rnd3; + float shap, sh1, sh2, sh3, sh4; + float offs, bits, wlen, gain; + + char programName[32]; +}; + +#endif diff --git a/src/mdaDubDelay.h b/src/mdaDubDelay.h index 56be65c..72d0598 100644 --- a/src/mdaDubDelay.h +++ b/src/mdaDubDelay.h @@ -1,67 +1,67 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaDubDelay_H
-#define __mdaDubDelay_H
-
-#include "audioeffectx.h"
-
-class mdaDubDelay : public AudioEffectX
-{
-public:
- mdaDubDelay(audioMasterCallback audioMaster);
- ~mdaDubDelay();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam0;
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
-
- float *buffer; //delay
- LvzInt32 size, ipos; //delay max time, pointer, left time, right time
- float wet, dry, fbk; //wet & dry mix
- float lmix, hmix, fil, fil0; //low & high mix, crossover filter coeff & buffer
- float env, rel; //limiter (clipper when release is instant)
- float del, mod, phi, dphi; //lfo
- float dlbuf; //smoothed modulated delay
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaDubDelay_H +#define __mdaDubDelay_H + +#include "audioeffectx.h" + +class mdaDubDelay : public AudioEffectX +{ +public: + mdaDubDelay(audioMasterCallback audioMaster); + ~mdaDubDelay(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam0; + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + + float *buffer; //delay + LvzInt32 size, ipos; //delay max time, pointer, left time, right time + float wet, dry, fbk; //wet & dry mix + float lmix, hmix, fil, fil0; //low & high mix, crossover filter coeff & buffer + float env, rel; //limiter (clipper when release is instant) + float del, mod, phi, dphi; //lfo + float dlbuf; //smoothed modulated delay + + char programName[32]; +}; + +#endif diff --git a/src/mdaDynamics.h b/src/mdaDynamics.h index 7040191..ced7aca 100644 --- a/src/mdaDynamics.h +++ b/src/mdaDynamics.h @@ -1,64 +1,64 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaDynamics_H
-#define __mdaDynamics_H
-
-#include "audioeffectx.h"
-
-class mdaDynamics : public AudioEffectX
-{
-public:
- mdaDynamics(audioMasterCallback audioMaster);
- ~mdaDynamics();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fParam7;
- float fParam8;
- float fParam9;
- float fParam10;
- float thr, rat, env, env2, att, rel, trim, lthr, xthr, xrat, dry;
- float genv, gatt, irel;
- int mode;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaDynamics_H +#define __mdaDynamics_H + +#include "audioeffectx.h" + +class mdaDynamics : public AudioEffectX +{ +public: + mdaDynamics(audioMasterCallback audioMaster); + ~mdaDynamics(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fParam7; + float fParam8; + float fParam9; + float fParam10; + float thr, rat, env, env2, att, rel, trim, lthr, xthr, xrat, dry; + float genv, gatt, irel; + int mode; + + char programName[32]; +}; + +#endif diff --git a/src/mdaImage.h b/src/mdaImage.h index 69b53bd..b5cb804 100644 --- a/src/mdaImage.h +++ b/src/mdaImage.h @@ -1,59 +1,59 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaImage_H
-#define __mdaImage_H
-
-#include "audioeffectx.h"
-
-class mdaImage : public AudioEffectX
-{
-public:
- mdaImage(audioMasterCallback audioMaster);
- ~mdaImage();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float l2l, l2r, r2l, r2r;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaImage_H +#define __mdaImage_H + +#include "audioeffectx.h" + +class mdaImage : public AudioEffectX +{ +public: + mdaImage(audioMasterCallback audioMaster); + ~mdaImage(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float l2l, l2r, r2l, r2r; + + char programName[32]; +}; + +#endif diff --git a/src/mdaJX10.cpp b/src/mdaJX10.cpp index dbbc76c..33880cf 100644 --- a/src/mdaJX10.cpp +++ b/src/mdaJX10.cpp @@ -1,1010 +1,1010 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "mdaJX10.h"
-
-#include <stdio.h>
-#include <stdlib.h> //rand()
-#include <math.h>
-
-
-AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
-{
- return new mdaJX10(audioMaster);
-}
-
-
-mdaJX10Program::mdaJX10Program()
-{
- param[0] = 0.00f; //OSC Mix
- param[1] = 0.25f; //OSC Tune
- param[2] = 0.50f; //OSC Fine
-
- param[3] = 0.00f; //OSC Mode
- param[4] = 0.35f; //OSC Rate
- param[5] = 0.50f; //OSC Bend
-
- param[6] = 1.00f; //VCF Freq
- param[7] = 0.15f; //VCF Reso
- param[8] = 0.75f; //VCF <Env
-
- param[9] = 0.00f; //VCF <LFO
- param[10] = 0.50f; //VCF <Vel
- param[11] = 0.00f; //VCF Att
-
- param[12] = 0.30f; //VCF Dec
- param[13] = 0.00f; //VCF Sus
- param[14] = 0.25f; //VCF Rel
-
- param[15] = 0.00f; //ENV Att
- param[16] = 0.50f; //ENV Dec
- param[17] = 1.00f; //ENV Sus
-
- param[18] = 0.30f; //ENV Rel
- param[19] = 0.81f; //LFO Rate
- param[20] = 0.50f; //Vibrato
-
- param[21] = 0.00f; //Noise - not present in original patches
- param[22] = 0.50f; //Octave
- param[23] = 0.50f; //Tuning
- strcpy (name, "Empty Patch");
-}
-
-
-mdaJX10::mdaJX10(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NPROGS, NPARAMS)
-{
- LvzInt32 i=0;
- Fs = 44100.0f;
-
- programs = new mdaJX10Program[NPROGS];
- if(programs)
- {
- fillpatch(i++, "5th Sweep Pad", 1.0f, 0.37f, 0.25f, 0.3f, 0.32f, 0.5f, 0.9f, 0.6f, 0.12f, 0.0f, 0.5f, 0.9f, 0.89f, 0.9f, 0.73f, 0.0f, 0.5f, 1.0f, 0.71f, 0.81f, 0.65f, 0.0f, 0.5f, 0.5f);
- fillpatch(i++, "Echo Pad [SA]", 0.88f, 0.51f, 0.5f, 0.0f, 0.49f, 0.5f, 0.46f, 0.76f, 0.69f, 0.1f, 0.69f, 1.0f, 0.86f, 0.76f, 0.57f, 0.3f, 0.8f, 0.68f, 0.66f, 0.79f, 0.13f, 0.25f, 0.45f, 0.5f);
- fillpatch(i++, "Space Chimes [SA]", 0.88f, 0.51f, 0.5f, 0.16f, 0.49f, 0.5f, 0.49f, 0.82f, 0.66f, 0.08f, 0.89f, 0.85f, 0.69f, 0.76f, 0.47f, 0.12f, 0.22f, 0.55f, 0.66f, 0.89f, 0.34f, 0.0f, 1.0f, 0.5f);
- fillpatch(i++, "Solid Backing", 1.0f, 0.26f, 0.14f, 0.0f, 0.35f, 0.5f, 0.3f, 0.25f, 0.7f, 0.0f, 0.63f, 0.0f, 0.35f, 0.0f, 0.25f, 0.0f, 0.5f, 1.0f, 0.3f, 0.81f, 0.5f, 0.5f, 0.5f, 0.5f);
- fillpatch(i++, "Velocity Backing [SA]", 0.41f, 0.5f, 0.79f, 0.0f, 0.08f, 0.32f, 0.49f, 0.01f, 0.34f, 0.0f, 0.93f, 0.61f, 0.87f, 1.0f, 0.93f, 0.11f, 0.48f, 0.98f, 0.32f, 0.81f, 0.5f, 0.0f, 0.5f, 0.5f);
- fillpatch(i++, "Rubber Backing [ZF]", 0.29f, 0.76f, 0.26f, 0.0f, 0.18f, 0.76f, 0.35f, 0.15f, 0.77f, 0.14f, 0.54f, 0.0f, 0.42f, 0.13f, 0.21f, 0.0f, 0.56f, 0.0f, 0.32f, 0.2f, 0.58f, 0.22f, 0.53f, 0.5f);
- fillpatch(i++, "808 State Lead", 1.0f, 0.65f, 0.24f, 0.4f, 0.34f, 0.85f, 0.65f, 0.63f, 0.75f, 0.16f, 0.5f, 0.0f, 0.3f, 0.0f, 0.25f, 0.17f, 0.5f, 1.0f, 0.03f, 0.81f, 0.5f, 0.0f, 0.68f, 0.5f);
- fillpatch(i++, "Mono Glide", 0.0f, 0.25f, 0.5f, 1.0f, 0.46f, 0.5f, 0.51f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.3f, 0.0f, 0.25f, 0.37f, 0.5f, 1.0f, 0.38f, 0.81f, 0.62f, 0.0f, 0.5f, 0.5f);
- fillpatch(i++, "Detuned Techno Lead", 0.84f, 0.51f, 0.15f, 0.45f, 0.41f, 0.42f, 0.54f, 0.01f, 0.58f, 0.21f, 0.67f, 0.0f, 0.09f, 1.0f, 0.25f, 0.2f, 0.85f, 1.0f, 0.3f, 0.83f, 0.09f, 0.4f, 0.49f, 0.5f);
- fillpatch(i++, "Hard Lead [SA]", 0.71f, 0.75f, 0.53f, 0.18f, 0.24f, 1.0f, 0.56f, 0.52f, 0.69f, 0.19f, 0.7f, 1.0f, 0.14f, 0.65f, 0.95f, 0.07f, 0.91f, 1.0f, 0.15f, 0.84f, 0.33f, 0.0f, 0.49f, 0.5f);
- fillpatch(i++, "Bubble", 0.0f, 0.25f, 0.43f, 0.0f, 0.71f, 0.48f, 0.23f, 0.77f, 0.8f, 0.32f, 0.63f, 0.4f, 0.18f, 0.66f, 0.14f, 0.0f, 0.38f, 0.65f, 0.16f, 0.48f, 0.5f, 0.0f, 0.67f, 0.5f);
- fillpatch(i++, "Monosynth", 0.62f, 0.26f, 0.51f, 0.79f, 0.35f, 0.54f, 0.64f, 0.39f, 0.51f, 0.65f, 0.0f, 0.07f, 0.52f, 0.24f, 0.84f, 0.13f, 0.3f, 0.76f, 0.21f, 0.58f, 0.3f, 0.0f, 0.36f, 0.5f);
- fillpatch(i++, "Moogcury Lite", 0.81f, 1.0f, 0.21f, 0.78f, 0.15f, 0.35f, 0.39f, 0.17f, 0.69f, 0.4f, 0.62f, 0.0f, 0.47f, 0.19f, 0.37f, 0.0f, 0.5f, 0.2f, 0.33f, 0.38f, 0.53f, 0.0f, 0.12f, 0.5f);
- fillpatch(i++, "Gangsta Whine", 0.0f, 0.51f, 0.52f, 0.96f, 0.44f, 0.5f, 0.41f, 0.46f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.25f, 0.15f, 0.5f, 1.0f, 0.32f, 0.81f, 0.49f, 0.0f, 0.83f, 0.5f);
- fillpatch(i++, "Higher Synth [ZF]", 0.48f, 0.51f, 0.22f, 0.0f, 0.0f, 0.5f, 0.5f, 0.47f, 0.73f, 0.3f, 0.8f, 0.0f, 0.1f, 0.0f, 0.07f, 0.0f, 0.42f, 0.0f, 0.22f, 0.21f, 0.59f, 0.16f, 0.98f, 0.5f);
- fillpatch(i++, "303 Saw Bass", 0.0f, 0.51f, 0.5f, 0.83f, 0.49f, 0.5f, 0.55f, 0.75f, 0.69f, 0.35f, 0.5f, 0.0f, 0.56f, 0.0f, 0.56f, 0.0f, 0.8f, 1.0f, 0.24f, 0.26f, 0.49f, 0.0f, 0.07f, 0.5f);
- fillpatch(i++, "303 Square Bass", 0.75f, 0.51f, 0.5f, 0.83f, 0.49f, 0.5f, 0.55f, 0.75f, 0.69f, 0.35f, 0.5f, 0.14f, 0.49f, 0.0f, 0.39f, 0.0f, 0.8f, 1.0f, 0.24f, 0.26f, 0.49f, 0.0f, 0.07f, 0.5f);
- fillpatch(i++, "Analog Bass", 1.0f, 0.25f, 0.2f, 0.81f, 0.19f, 0.5f, 0.3f, 0.51f, 0.85f, 0.09f, 0.0f, 0.0f, 0.88f, 0.0f, 0.21f, 0.0f, 0.5f, 1.0f, 0.46f, 0.81f, 0.5f, 0.0f, 0.27f, 0.5f);
- fillpatch(i++, "Analog Bass 2", 1.0f, 0.25f, 0.2f, 0.72f, 0.19f, 0.86f, 0.48f, 0.43f, 0.94f, 0.0f, 0.8f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.61f, 1.0f, 0.32f, 0.81f, 0.5f, 0.0f, 0.27f, 0.5f);
- fillpatch(i++, "Low Pulses", 0.97f, 0.26f, 0.3f, 0.0f, 0.35f, 0.5f, 0.8f, 0.4f, 0.52f, 0.0f, 0.5f, 0.0f, 0.77f, 0.0f, 0.25f, 0.0f, 0.5f, 1.0f, 0.3f, 0.81f, 0.16f, 0.0f, 0.0f, 0.5f);
- fillpatch(i++, "Sine Infra-Bass", 0.0f, 0.25f, 0.5f, 0.65f, 0.35f, 0.5f, 0.33f, 0.76f, 0.53f, 0.0f, 0.5f, 0.0f, 0.3f, 0.0f, 0.25f, 0.0f, 0.55f, 0.25f, 0.3f, 0.81f, 0.52f, 0.0f, 0.14f, 0.5f);
- fillpatch(i++, "Wobble Bass [SA]", 1.0f, 0.26f, 0.22f, 0.64f, 0.82f, 0.59f, 0.72f, 0.47f, 0.34f, 0.34f, 0.82f, 0.2f, 0.69f, 1.0f, 0.15f, 0.09f, 0.5f, 1.0f, 0.07f, 0.81f, 0.46f, 0.0f, 0.24f, 0.5f);
- fillpatch(i++, "Squelch Bass", 1.0f, 0.26f, 0.22f, 0.71f, 0.35f, 0.5f, 0.67f, 0.7f, 0.26f, 0.0f, 0.5f, 0.48f, 0.69f, 1.0f, 0.15f, 0.0f, 0.5f, 1.0f, 0.07f, 0.81f, 0.46f, 0.0f, 0.24f, 0.5f);
- fillpatch(i++, "Rubber Bass [ZF]", 0.49f, 0.25f, 0.66f, 0.81f, 0.35f, 0.5f, 0.36f, 0.15f, 0.75f, 0.2f, 0.5f, 0.0f, 0.38f, 0.0f, 0.25f, 0.0f, 0.6f, 1.0f, 0.22f, 0.19f, 0.5f, 0.0f, 0.17f, 0.5f);
- fillpatch(i++, "Soft Pick Bass", 0.37f, 0.51f, 0.77f, 0.71f, 0.22f, 0.5f, 0.33f, 0.47f, 0.71f, 0.16f, 0.59f, 0.0f, 0.0f, 0.0f, 0.25f, 0.04f, 0.58f, 0.0f, 0.22f, 0.15f, 0.44f, 0.33f, 0.15f, 0.5f);
- fillpatch(i++, "Fretless Bass", 0.5f, 0.51f, 0.17f, 0.8f, 0.34f, 0.5f, 0.51f, 0.0f, 0.58f, 0.0f, 0.67f, 0.0f, 0.09f, 0.0f, 0.25f, 0.2f, 0.85f, 0.0f, 0.3f, 0.81f, 0.7f, 0.0f, 0.0f, 0.5f);
- fillpatch(i++, "Whistler", 0.23f, 0.51f, 0.38f, 0.0f, 0.35f, 0.5f, 0.33f, 1.0f, 0.5f, 0.0f, 0.5f, 0.0f, 0.29f, 0.0f, 0.25f, 0.68f, 0.39f, 0.58f, 0.36f, 0.81f, 0.64f, 0.38f, 0.92f, 0.5f);
- fillpatch(i++, "Very Soft Pad", 0.39f, 0.51f, 0.27f, 0.38f, 0.12f, 0.5f, 0.35f, 0.78f, 0.5f, 0.0f, 0.5f, 0.0f, 0.3f, 0.0f, 0.25f, 0.35f, 0.5f, 0.8f, 0.7f, 0.81f, 0.5f, 0.0f, 0.5f, 0.5f);
- fillpatch(i++, "Pizzicato", 0.0f, 0.25f, 0.5f, 0.0f, 0.35f, 0.5f, 0.23f, 0.2f, 0.75f, 0.0f, 0.5f, 0.0f, 0.22f, 0.0f, 0.25f, 0.0f, 0.47f, 0.0f, 0.3f, 0.81f, 0.5f, 0.8f, 0.5f, 0.5f);
- fillpatch(i++, "Synth Strings", 1.0f, 0.51f, 0.24f, 0.0f, 0.0f, 0.35f, 0.42f, 0.26f, 0.75f, 0.14f, 0.69f, 0.0f, 0.67f, 0.55f, 0.97f, 0.82f, 0.7f, 1.0f, 0.42f, 0.84f, 0.67f, 0.3f, 0.47f, 0.5f);
- fillpatch(i++, "Synth Strings 2", 0.75f, 0.51f, 0.29f, 0.0f, 0.49f, 0.5f, 0.55f, 0.16f, 0.69f, 0.08f, 0.2f, 0.76f, 0.29f, 0.76f, 1.0f, 0.46f, 0.8f, 1.0f, 0.39f, 0.79f, 0.27f, 0.0f, 0.68f, 0.5f);
- fillpatch(i++, "Leslie Organ", 0.0f, 0.5f, 0.53f, 0.0f, 0.13f, 0.39f, 0.38f, 0.74f, 0.54f, 0.2f, 0.0f, 0.0f, 0.55f, 0.52f, 0.31f, 0.0f, 0.17f, 0.73f, 0.28f, 0.87f, 0.24f, 0.0f, 0.29f, 0.5f);
- fillpatch(i++, "Click Organ", 0.5f, 0.77f, 0.52f, 0.0f, 0.35f, 0.5f, 0.44f, 0.5f, 0.65f, 0.16f, 0.0f, 0.0f, 0.0f, 0.18f, 0.0f, 0.0f, 0.75f, 0.8f, 0.0f, 0.81f, 0.49f, 0.0f, 0.44f, 0.5f);
- fillpatch(i++, "Hard Organ", 0.89f, 0.91f, 0.37f, 0.0f, 0.35f, 0.5f, 0.51f, 0.62f, 0.54f, 0.0f, 0.0f, 0.0f, 0.37f, 0.0f, 1.0f, 0.04f, 0.08f, 0.72f, 0.04f, 0.77f, 0.49f, 0.0f, 0.58f, 0.5f);
- fillpatch(i++, "Bass Clarinet", 1.0f, 0.51f, 0.51f, 0.37f, 0.0f, 0.5f, 0.51f, 0.1f, 0.5f, 0.11f, 0.5f, 0.0f, 0.0f, 0.0f, 0.25f, 0.35f, 0.65f, 0.65f, 0.32f, 0.79f, 0.49f, 0.2f, 0.35f, 0.5f);
- fillpatch(i++, "Trumpet", 0.0f, 0.51f, 0.51f, 0.82f, 0.06f, 0.5f, 0.57f, 0.0f, 0.32f, 0.15f, 0.5f, 0.21f, 0.15f, 0.0f, 0.25f, 0.24f, 0.6f, 0.8f, 0.1f, 0.75f, 0.55f, 0.25f, 0.69f, 0.5f);
- fillpatch(i++, "Soft Horn", 0.12f, 0.9f, 0.67f, 0.0f, 0.35f, 0.5f, 0.5f, 0.21f, 0.29f, 0.12f, 0.6f, 0.0f, 0.35f, 0.36f, 0.25f, 0.08f, 0.5f, 1.0f, 0.27f, 0.83f, 0.51f, 0.1f, 0.25f, 0.5f);
- fillpatch(i++, "Brass Section", 0.43f, 0.76f, 0.23f, 0.0f, 0.28f, 0.36f, 0.5f, 0.0f, 0.59f, 0.0f, 0.5f, 0.24f, 0.16f, 0.91f, 0.08f, 0.17f, 0.5f, 0.8f, 0.45f, 0.81f, 0.5f, 0.0f, 0.58f, 0.5f);
- fillpatch(i++, "Synth Brass", 0.4f, 0.51f, 0.25f, 0.0f, 0.3f, 0.28f, 0.39f, 0.15f, 0.75f, 0.0f, 0.5f, 0.39f, 0.3f, 0.82f, 0.25f, 0.33f, 0.74f, 0.76f, 0.41f, 0.81f, 0.47f, 0.23f, 0.5f, 0.5f);
- fillpatch(i++, "Detuned Syn Brass [ZF]", 0.68f, 0.5f, 0.93f, 0.0f, 0.31f, 0.62f, 0.26f, 0.07f, 0.85f, 0.0f, 0.66f, 0.0f, 0.83f, 0.0f, 0.05f, 0.0f, 0.75f, 0.54f, 0.32f, 0.76f, 0.37f, 0.29f, 0.56f, 0.5f);
- fillpatch(i++, "Power PWM", 1.0f, 0.27f, 0.22f, 0.0f, 0.35f, 0.5f, 0.82f, 0.13f, 0.75f, 0.0f, 0.0f, 0.24f, 0.3f, 0.88f, 0.34f, 0.0f, 0.5f, 1.0f, 0.48f, 0.71f, 0.37f, 0.0f, 0.35f, 0.5f);
- fillpatch(i++, "Water Velocity [SA]", 0.76f, 0.51f, 0.35f, 0.0f, 0.49f, 0.5f, 0.87f, 0.67f, 1.0f, 0.32f, 0.09f, 0.95f, 0.56f, 0.72f, 1.0f, 0.04f, 0.76f, 0.11f, 0.46f, 0.88f, 0.72f, 0.0f, 0.38f, 0.5f);
- fillpatch(i++, "Ghost [SA]", 0.75f, 0.51f, 0.24f, 0.45f, 0.16f, 0.48f, 0.38f, 0.58f, 0.75f, 0.16f, 0.81f, 0.0f, 0.3f, 0.4f, 0.31f, 0.37f, 0.5f, 1.0f, 0.54f, 0.85f, 0.83f, 0.43f, 0.46f, 0.5f);
- fillpatch(i++, "Soft E.Piano", 0.31f, 0.51f, 0.43f, 0.0f, 0.35f, 0.5f, 0.34f, 0.26f, 0.53f, 0.0f, 0.63f, 0.0f, 0.22f, 0.0f, 0.39f, 0.0f, 0.8f, 0.0f, 0.44f, 0.81f, 0.51f, 0.0f, 0.5f, 0.5f);
- fillpatch(i++, "Thumb Piano", 0.72f, 0.82f, 1.0f, 0.0f, 0.35f, 0.5f, 0.37f, 0.47f, 0.54f, 0.0f, 0.5f, 0.0f, 0.45f, 0.0f, 0.39f, 0.0f, 0.39f, 0.0f, 0.48f, 0.81f, 0.6f, 0.0f, 0.71f, 0.5f);
- fillpatch(i++, "Steel Drums [ZF]", 0.81f, 0.76f, 0.19f, 0.0f, 0.18f, 0.7f, 0.4f, 0.3f, 0.54f, 0.17f, 0.4f, 0.0f, 0.42f, 0.23f, 0.47f, 0.12f, 0.48f, 0.0f, 0.49f, 0.53f, 0.36f, 0.34f, 0.56f, 0.5f);
-
- fillpatch(58, "Car Horn", 0.57f, 0.49f, 0.31f, 0.0f, 0.35f, 0.5f, 0.46f, 0.0f, 0.68f, 0.0f, 0.5f, 0.46f, 0.3f, 1.0f, 0.23f, 0.3f, 0.5f, 1.0f, 0.31f, 1.0f, 0.38f, 0.0f, 0.5f, 0.5f);
- fillpatch(59, "Helicopter", 0.0f, 0.25f, 0.5f, 0.0f, 0.35f, 0.5f, 0.08f, 0.36f, 0.69f, 1.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f, 0.96f, 0.5f, 1.0f, 0.92f, 0.97f, 0.5f, 1.0f, 0.0f, 0.5f);
- fillpatch(60, "Arctic Wind", 0.0f, 0.25f, 0.5f, 0.0f, 0.35f, 0.5f, 0.16f, 0.85f, 0.5f, 0.28f, 0.5f, 0.37f, 0.3f, 0.0f, 0.25f, 0.89f, 0.5f, 1.0f, 0.89f, 0.24f, 0.5f, 1.0f, 1.0f, 0.5f);
- fillpatch(61, "Thip", 1.0f, 0.37f, 0.51f, 0.0f, 0.35f, 0.5f, 0.0f, 1.0f, 0.97f, 0.0f, 0.5f, 0.02f, 0.2f, 0.0f, 0.2f, 0.0f, 0.46f, 0.0f, 0.3f, 0.81f, 0.5f, 0.78f, 0.48f, 0.5f);
- fillpatch(62, "Synth Tom", 0.0f, 0.25f, 0.5f, 0.0f, 0.76f, 0.94f, 0.3f, 0.33f, 0.76f, 0.0f, 0.68f, 0.0f, 0.59f, 0.0f, 0.59f, 0.1f, 0.5f, 0.0f, 0.5f, 0.81f, 0.5f, 0.7f, 0.0f, 0.5f);
- fillpatch(63, "Squelchy Frog", 0.5f, 0.41f, 0.23f, 0.45f, 0.77f, 0.0f, 0.4f, 0.65f, 0.95f, 0.0f, 0.5f, 0.33f, 0.5f, 0.0f, 0.25f, 0.0f, 0.7f, 0.65f, 0.18f, 0.32f, 1.0f, 0.0f, 0.06f, 0.5f);
-
- //for testing...
- //fillpatch(0, "Monosynth", 0.62f, 0.26f, 0.51f, 0.79f, 0.35f, 0.54f, 0.64f, 0.39f, 0.51f, 0.65f, 0.0f, 0.07f, 0.52f, 0.24f, 0.84f, 0.13f, 0.3f, 0.76f, 0.21f, 0.58f, 0.3f, 0.0f, 0.36f, 0.5f);
-
- setProgram(0);
- }
-
- setUniqueID("mdaJX10");
-
- if(audioMaster)
- {
- setNumInputs(0);
- setNumOutputs(NOUTS);
- canProcessReplacing();
- isSynth();
- }
-
- //initialise...
- for(LvzInt32 v=0; v<NVOICES; v++)
- {
- voice[v].dp = voice[v].dp2 = 1.0f;
- voice[v].saw = voice[v].p = voice[v].p2 = 0.0f;
- voice[v].env = voice[v].envd = voice[v].envl = 0.0f;
- voice[v].fenv = voice[v].fenvd = voice[v].fenvl = 0.0f;
- 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;
- K = mode = lastnote = sustain = activevoices = 0;
- noise = 22222;
-
- update();
- suspend();
-}
-
-
-void mdaJX10::update() //parameter change
-{
- double ifs = 1.0 / Fs;
- float * param = programs[curProgram].param;
-
- mode = (LvzInt32)(7.9f * param[3]);
- noisemix = param[21] * param[21];
- voltrim = (3.2f - param[0] - 1.5f * noisemix) * (1.5f - 0.5f * param[7]);
- noisemix *= 0.06f;
- oscmix = param[0];
-
- semi = (float)floor(48.0f * param[1]) - 24.0f;
- cent = 15.876f * param[2] - 7.938f;
- cent = 0.1f * (float)floor(cent * cent * cent);
- detune = (float)pow(1.059463094359f, - semi - 0.01f * cent);
- tune = -23.376f - 2.0f * param[23] - 12.0f * (float)floor(param[22] * 4.9);
- tune = Fs * (float)pow(1.059463094359f, tune);
-
- vibrato = pwmdep = 0.2f * (param[20] - 0.5f) * (param[20] - 0.5f);
- if(param[20]<0.5f) vibrato = 0.0f;
-
- lfoHz = (float)exp(7.0f * param[19] - 4.0f);
- dlfo = lfoHz * (float)(ifs * TWOPI * KMAX);
-
- filtf = 8.0f * param[6] - 1.5f;
- filtq = (1.0f - param[7]) * (1.0f - param[7]); ////// + 0.02f;
- filtlfo = 2.5f * param[9] * param[9];
- filtenv = 12.0f * param[8] - 6.0f;
- filtvel = 0.1f * param[10] - 0.05f;
- if(param[10]<0.05f) { veloff = 1; filtvel = 0; } else veloff = 0;
-
- att = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[15]));
- dec = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[16]));
- sus = param[17];
- rel = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[18]));
- if(param[18]<0.01f) rel = 0.1f; //extra fast release
-
- ifs *= KMAX; //lower update rate...
-
- fatt = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[11]));
- fdec = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[12]));
- fsus = param[13] * param[13];
- frel = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[14]));
-
- if(param[4]<0.02f) glide = 1.0f; else
- glide = 1.0f - (float)exp(-ifs * exp(6.0 - 7.0 * param[4]));
- glidedisp = (6.604f * param[5] - 3.302f);
- glidedisp *= glidedisp * glidedisp;
-}
-
-
-void mdaJX10::setSampleRate(float rate)
-{
- AudioEffectX::setSampleRate(rate);
- Fs = rate;
-
- dlfo = lfoHz * (float)(TWOPI * KMAX) / Fs;
-}
-
-
-void mdaJX10::resume()
-{
- DECLARE_LVZ_DEPRECATED (wantEvents) ();
-}
-
-
-void mdaJX10::suspend() //Used by Logic (have note off code in 3 places now...)
-{
- for(LvzInt32 v=0; v<NVOICES; v++)
- {
- voice[v].envl = voice[v].env = 0.0f;
- voice[v].envd = 0.99f;
- voice[v].note = 0;
- voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f;
- }
-}
-
-
-mdaJX10::~mdaJX10() //destroy any buffers...
-{
- if(programs) delete[] programs;
-}
-
-
-void mdaJX10::setProgram(LvzInt32 program)
-{
- curProgram = program;
- update();
-} //may want all notes off here - but this stops use of patches as snapshots!
-
-
-void mdaJX10::setParameter(LvzInt32 index, float value)
-{
- programs[curProgram].param[index] = value;
- update();
-
- ///if(editor) editor->postUpdate();
-}
-
-
-void mdaJX10::fillpatch(LvzInt32 p, const char *name,
- float p0, float p1, float p2, float p3, float p4, float p5,
- float p6, float p7, float p8, float p9, float p10, float p11,
- float p12, float p13, float p14, float p15, float p16, float p17,
- float p18, float p19, float p20, float p21, float p22, float p23)
-{
- strcpy(programs[p].name, name);
- programs[p].param[0] = p0; programs[p].param[1] = p1;
- programs[p].param[2] = p2; programs[p].param[3] = p3;
- programs[p].param[4] = p4; programs[p].param[5] = p5;
- programs[p].param[6] = p6; programs[p].param[7] = p7;
- programs[p].param[8] = p8; programs[p].param[9] = p9;
- programs[p].param[10] = p10; programs[p].param[11] = p11;
- programs[p].param[12] = p12; programs[p].param[13] = p13;
- programs[p].param[14] = p14; programs[p].param[15] = p15;
- programs[p].param[16] = p16; programs[p].param[17] = p17;
- programs[p].param[18] = p18; programs[p].param[19] = p19;
- programs[p].param[20] = p20; programs[p].param[21] = p21;
- programs[p].param[22] = p22; programs[p].param[23] = p23;
-}
-
-
-float mdaJX10::getParameter(LvzInt32 index) { return programs[curProgram].param[index]; }
-void mdaJX10::setProgramName(char *name) { strcpy(programs[curProgram].name, name); }
-void mdaJX10::getProgramName(char *name) { strcpy(name, programs[curProgram].name); }
-void mdaJX10::setBlockSize(LvzInt32 blockSize) { AudioEffectX::setBlockSize(blockSize); }
-bool mdaJX10::getEffectName(char* name) { strcpy(name, "MDA JX10 Synth"); return true; }
-bool mdaJX10::getVendorString(char* text) { strcpy(text, "MDA"); return true; }
-bool mdaJX10::getProductString(char* text) { strcpy(text, "MDA JX10 Synth"); return true; }
-
-
-bool mdaJX10::getOutputProperties(LvzInt32 index, LvzPinProperties* properties)
-{
- if(index<NOUTS)
- {
- sprintf(properties->label, "JX10%d", index + 1);
- properties->flags = kLvzPinIsActive;
- if(index<2) properties->flags |= kLvzPinIsStereo; //make channel 1+2 stereo
- return true;
- }
- return false;
-}
-
-
-bool mdaJX10::getProgramNameIndexed(LvzInt32 category, LvzInt32 index, char* text)
-{
- if ((unsigned int)index < NPROGS)
- {
- strcpy(text, programs[index].name);
- return true;
- }
- return false;
-}
-
-
-bool mdaJX10::copyProgram(LvzInt32 destination)
-{
- if(destination<NPROGS)
- {
- programs[destination] = programs[curProgram];
- return true;
- }
- return false;
-}
-
-
-LvzInt32 mdaJX10::canDo(char* text)
-{
- if(!strcmp (text, "receiveLvzEvents")) return 1;
- if(!strcmp (text, "receiveLvzMidiEvent")) return 1;
- return -1;
-}
-
-
-void mdaJX10::getParameterName(LvzInt32 index, char *label)
-{
- switch (index)
- {
- case 0: strcpy(label, "OSC Mix"); break;
- case 1: strcpy(label, "OSC Tune"); break;
- case 2: strcpy(label, "OSC Fine"); break;
-
- case 3: strcpy(label, "Glide"); break;
- case 4: strcpy(label, "Gld Rate"); break;
- case 5: strcpy(label, "Gld Bend"); break;
-
- case 6: strcpy(label, "VCF Freq"); break;
- case 7: strcpy(label, "VCF Reso"); break;
- case 8: strcpy(label, "VCF Env"); break;
-
- case 9: strcpy(label, "VCF LFO"); break;
- case 10: strcpy(label, "VCF Vel"); break;
- case 11: strcpy(label, "VCF Att"); break;
-
- case 12: strcpy(label, "VCF Dec"); break;
- case 13: strcpy(label, "VCF Sus"); break;
- case 14: strcpy(label, "VCF Rel"); break;
-
- case 15: strcpy(label, "ENV Att"); break;
- case 16: strcpy(label, "ENV Dec"); break;
- case 17: strcpy(label, "ENV Sus"); break;
-
- case 18: strcpy(label, "ENV Rel"); break;
- case 19: strcpy(label, "LFO Rate"); break;
- case 20: strcpy(label, "Vibrato"); break;
-
- case 21: strcpy(label, "Noise"); break;
- case 22: strcpy(label, "Octave"); break;
- default: strcpy(label, "Tuning");
- }
-}
-
-
-void mdaJX10::getParameterDisplay(LvzInt32 index, char *text)
-{
- char string[16];
- float * param = programs[curProgram].param;
-
- switch(index)
- {
- case 0: sprintf(string, "%4.0f:%2.0f", 100.0-50.0f*param[index], 50.0f*param[index]); break;
- case 1: sprintf(string, "%.0f", semi); break;
- case 2: sprintf(string, "%.1f", cent); break;
- case 3: switch(mode)
- { case 0:
- case 1: strcpy(string, "POLY "); break;
- case 2: strcpy(string, "P-LEGATO"); break;
- case 3: strcpy(string, "P-GLIDE "); break;
- case 4:
- case 5: strcpy(string, "MONO "); break;
- case 6: strcpy(string, "M-LEGATO"); break;
- default: strcpy(string, "M-GLIDE "); break; } break;
- case 5: sprintf(string, "%.2f", glidedisp); break;
- case 6: sprintf(string, "%.1f", 100.0f * param[index]); break;
- case 8:
- case 23: sprintf(string, "%.1f", 200.0f * param[index] - 100.0f); break;
- case 10: if(param[index]<0.05f) strcpy(string, " OFF ");
- else sprintf(string, "%.0f", 200.0f * param[index] - 100.0f); break;
- case 19: sprintf(string, "%.3f", lfoHz); break;
- case 20: if(param[index]<0.5f) sprintf(string, "PWM %3.0f", 100.0f - 200.0f * param[index]);
- else sprintf(string, "%7.0f", 200.0f * param[index] - 100.0f); break;
- case 22: sprintf(string, "%d", (LvzInt32)(param[index] * 4.9f) - 2); break;
- default: sprintf(string, "%.0f", 100.0f * param[index]);
- }
- string[8] = 0;
- strcpy(text, (char *)string);
-}
-
-
-void mdaJX10::getParameterLabel(LvzInt32 index, char *label)
-{
- switch(index)
- {
- case 1:
- case 5: strcpy(label, " semi "); break;
- case 2:
- case 23: strcpy(label, " cent "); break;
- case 3:
- case 22: strcpy(label, " "); break;
- case 19: strcpy(label, " Hz "); break;
- default: strcpy(label, " % ");
- }
-}
-
-
-void mdaJX10::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
-{
- float* out1 = outputs[0];
- float* out2 = outputs[1];
- LvzInt32 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;
- LvzInt32 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)
- {
- LvzInt32 note = notes[event++];
- LvzInt32 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, LvzInt32 sampleFrames)
-{
- float* out1 = outputs[0];
- float* out2 = outputs[1];
- LvzInt32 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;
- LvzInt32 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
-
- V->f2 = x;
-
- o += V->env * V->f0;
- }
- V++;
- }
-
- *out1++ = o;
- *out2++ = o;
- }
-
- if(frame<sampleFrames)
- {
- LvzInt32 note = notes[event++];
- LvzInt32 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--;
- }
- }
- }
- else //empty block
- {
- while(--sampleFrames >= 0)
- {
- *out1++ = 0.0f;
- *out2++ = 0.0f;
- }
- }
- notes[0] = EVENTS_DONE; //mark events buffer as done
- fzip = fz;
- K = k;
-}
-
-
-void mdaJX10::noteOn(LvzInt32 note, LvzInt32 velocity)
-{
- float p, l=100.0f; //louder than any envelope!
- LvzInt32 v=0, tmp, held=0;
-
- if(velocity>0) //note on
- {
- if(veloff) velocity = 80;
-
- if(mode & 4) //monophonic
- {
- if(voice[0].note > 0) //legato pitch change
- {
- for(tmp=(NVOICES-1); tmp>0; tmp--) //queue any held notes
- {
- voice[tmp].note = voice[tmp - 1].note;
- }
- p = tune * (float)exp(-0.05776226505 * ((double)note + ANALOG * (double)v));
- while(p<3.0f || (p * detune)<3.0f) p += p;
- voice[v].target = p;
- if((mode & 2)==0) voice[v].period = p;
- voice[v].fc = (float)exp(filtvel * (float)(velocity - 64)) / p;
- voice[v].env += SILENCE + SILENCE; ///was missed out below if returned?
- voice[v].note = note;
- return;
- }
- }
- else //polyphonic
- {
- for(tmp=0; tmp<NVOICES; tmp++) //replace quietest voice not in attack
- {
- if(voice[tmp].note > 0) held++;
- if(voice[tmp].env<l && voice[tmp].envl<2.0f) { l=voice[tmp].env; v=tmp; }
- }
- }
- p = tune * (float)exp(-0.05776226505 * ((double)note + ANALOG * (double)v));
- while(p<3.0f || (p * detune)<3.0f) p += p;
- voice[v].target = p;
- voice[v].detune = detune;
-
- tmp = 0;
- if(mode & 2)
- {
- if((mode & 1) || held) tmp = note - lastnote; //glide
- }
- voice[v].period = p * (float)pow(1.059463094359, (double)tmp - glidedisp);
- if(voice[v].period<3.0f) voice[v].period = 3.0f; //limit min period
-
- voice[v].note = lastnote = note;
-
- voice[v].fc = (float)exp(filtvel * (float)(velocity - 64)) / p; //filter tracking
-
- voice[v].lev = voltrim * volume * (0.004f * (float)((velocity + 64) * (velocity + 64)) - 8.0f);
- voice[v].lev2 = voice[v].lev * oscmix;
-
- if(programs[curProgram].param[20]<0.5f) //force 180 deg phase difference for PWM
- {
- if(voice[v].dp>0.0f)
- {
- p = voice[v].pmax + voice[v].pmax - voice[v].p;
- voice[v].dp2 = -voice[v].dp;
- }
- else
- {
- p = voice[v].p;
- voice[v].dp2 = voice[v].dp;
- }
- voice[v].p2 = voice[v].pmax2 = p + PI * voice[v].period;
-
- voice[v].dc2 = 0.0f;
- voice[v].sin02 = voice[v].sin12 = voice[v].sinx2 = 0.0f;
- }
-
- if(mode & 4) //monophonic retriggering
- {
- voice[v].env += SILENCE + SILENCE;
- }
- else
- {
- //if(programs[curProgram].param[15] < 0.28f)
- //{
- // voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f; //reset filter
- // voice[v].env = SILENCE + SILENCE;
- // voice[v].fenv = 0.0f;
- //}
- //else
- voice[v].env += SILENCE + SILENCE; //anti-glitching trick
- }
- voice[v].envl = 2.0f;
- voice[v].envd = att;
- voice[v].fenvl = 2.0f;
- voice[v].fenvd = fatt;
- }
- else //note off
- {
- if((mode & 4) && (voice[0].note==note)) //monophonic (and current note)
- {
- for(v=(NVOICES-1); v>0; v--)
- {
- if(voice[v].note>0) held = v; //any other notes queued?
- }
- if(held>0)
- {
- voice[v].note = voice[held].note;
- voice[held].note = 0;
-
- p = tune * (float)exp(-0.05776226505 * ((double)voice[v].note + ANALOG * (double)v));
- while(p<3.0f || (p * detune)<3.0f) p += p;
- voice[v].target = p;
- if((mode & 2)==0) voice[v].period = p;
- voice[v].fc = 1.0f / p;
- }
- else
- {
- voice[v].envl = 0.0f;
- voice[v].envd = rel;
- voice[v].fenvl = 0.0f;
- voice[v].fenvd = frel;
- voice[v].note = 0;
- }
- }
- else //polyphonic
- {
- for(v=0; v<NVOICES; v++) if(voice[v].note==note) //any voices playing that note?
- {
- if(sustain==0)
- {
- voice[v].envl = 0.0f;
- voice[v].envd = rel;
- voice[v].fenvl = 0.0f;
- voice[v].fenvd = frel;
- voice[v].note = 0;
- }
- else voice[v].note = SUSTAIN;
- }
- }
- }
-}
-
-
-LvzInt32 mdaJX10::processEvents(LvzEvents* ev)
-{
- LvzInt32 npos=0;
-
- for (LvzInt32 i=0; i<ev->numEvents; i++)
- {
- if((ev->events[i])->type != kLvzMidiType) continue;
- LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i];
- char* midiData = event->midiData;
-
- 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
- break;
-
- case 0x90: //note on
- notes[npos++] = event->deltaFrames; //delta
- notes[npos++] = midiData[1] & 0x7F; //note
- notes[npos++] = midiData[2] & 0x7F; //vel
- break;
-
- case 0xB0: //controller
- switch(midiData[1])
- {
- case 0x01: //mod wheel
- modwhl = 0.000005f * (float)(midiData[2] * midiData[2]);
- break;
- case 0x02: //filter +
- case 0x4A:
- filtwhl = 0.02f * (float)(midiData[2]);
- break;
- case 0x03: //filter -
- filtwhl = -0.03f * (float)(midiData[2]);
- break;
-
- case 0x07: //volume
- volume = 0.00000005f * (float)(midiData[2] * midiData[2]);
- break;
-
- case 0x10: //resonance
- case 0x47:
- rezwhl = 0.0065f * (float)(154 - midiData[2]);
- break;
-
- case 0x40: //sustain
- sustain = midiData[2] & 0x40;
- if(sustain==0)
- {
- notes[npos++] = event->deltaFrames;
- notes[npos++] = SUSTAIN; //end all sustained notes
- notes[npos++] = 0;
- }
- break;
-
- default: //all notes off
- if(midiData[1]>0x7A)
- {
- for(LvzInt32 v=0; v<NVOICES; v++)
- {
- voice[v].envl = voice[v].env = 0.0f;
- voice[v].envd = 0.99f;
- voice[v].note = 0;
- //could probably reset some more stuff here for safety!
- }
- sustain = 0;
- }
- break;
- }
- break;
-
- case 0xC0: //program change
- if(midiData[1]<NPROGS) setProgram(midiData[1]);
- break;
-
- case 0xD0: //channel aftertouch
- press = 0.00001f * (float)(midiData[1] * midiData[1]);
- break;
-
- case 0xE0: //pitch bend
- ipbend = (float)exp(0.000014102 * (double)(midiData[1] + 128 * midiData[2] - 8192));
- pbend = 1.0f / ipbend;
- break;
-
- default: break;
- }
-
- if(npos>EVENTBUFFER) npos -= 3; //discard events if buffer full!!
- event++;
- }
- notes[npos] = EVENTS_DONE;
- return 1;
-}
-
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "mdaJX10.h" + +#include <stdio.h> +#include <stdlib.h> //rand() +#include <math.h> + + +AudioEffect *createEffectInstance(audioMasterCallback audioMaster) +{ + return new mdaJX10(audioMaster); +} + + +mdaJX10Program::mdaJX10Program() +{ + param[0] = 0.00f; //OSC Mix + param[1] = 0.25f; //OSC Tune + param[2] = 0.50f; //OSC Fine + + param[3] = 0.00f; //OSC Mode + param[4] = 0.35f; //OSC Rate + param[5] = 0.50f; //OSC Bend + + param[6] = 1.00f; //VCF Freq + param[7] = 0.15f; //VCF Reso + param[8] = 0.75f; //VCF <Env + + param[9] = 0.00f; //VCF <LFO + param[10] = 0.50f; //VCF <Vel + param[11] = 0.00f; //VCF Att + + param[12] = 0.30f; //VCF Dec + param[13] = 0.00f; //VCF Sus + param[14] = 0.25f; //VCF Rel + + param[15] = 0.00f; //ENV Att + param[16] = 0.50f; //ENV Dec + param[17] = 1.00f; //ENV Sus + + param[18] = 0.30f; //ENV Rel + param[19] = 0.81f; //LFO Rate + param[20] = 0.50f; //Vibrato + + param[21] = 0.00f; //Noise - not present in original patches + param[22] = 0.50f; //Octave + param[23] = 0.50f; //Tuning + strcpy (name, "Empty Patch"); +} + + +mdaJX10::mdaJX10(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NPROGS, NPARAMS) +{ + LvzInt32 i=0; + Fs = 44100.0f; + + programs = new mdaJX10Program[NPROGS]; + if(programs) + { + fillpatch(i++, "5th Sweep Pad", 1.0f, 0.37f, 0.25f, 0.3f, 0.32f, 0.5f, 0.9f, 0.6f, 0.12f, 0.0f, 0.5f, 0.9f, 0.89f, 0.9f, 0.73f, 0.0f, 0.5f, 1.0f, 0.71f, 0.81f, 0.65f, 0.0f, 0.5f, 0.5f); + fillpatch(i++, "Echo Pad [SA]", 0.88f, 0.51f, 0.5f, 0.0f, 0.49f, 0.5f, 0.46f, 0.76f, 0.69f, 0.1f, 0.69f, 1.0f, 0.86f, 0.76f, 0.57f, 0.3f, 0.8f, 0.68f, 0.66f, 0.79f, 0.13f, 0.25f, 0.45f, 0.5f); + fillpatch(i++, "Space Chimes [SA]", 0.88f, 0.51f, 0.5f, 0.16f, 0.49f, 0.5f, 0.49f, 0.82f, 0.66f, 0.08f, 0.89f, 0.85f, 0.69f, 0.76f, 0.47f, 0.12f, 0.22f, 0.55f, 0.66f, 0.89f, 0.34f, 0.0f, 1.0f, 0.5f); + fillpatch(i++, "Solid Backing", 1.0f, 0.26f, 0.14f, 0.0f, 0.35f, 0.5f, 0.3f, 0.25f, 0.7f, 0.0f, 0.63f, 0.0f, 0.35f, 0.0f, 0.25f, 0.0f, 0.5f, 1.0f, 0.3f, 0.81f, 0.5f, 0.5f, 0.5f, 0.5f); + fillpatch(i++, "Velocity Backing [SA]", 0.41f, 0.5f, 0.79f, 0.0f, 0.08f, 0.32f, 0.49f, 0.01f, 0.34f, 0.0f, 0.93f, 0.61f, 0.87f, 1.0f, 0.93f, 0.11f, 0.48f, 0.98f, 0.32f, 0.81f, 0.5f, 0.0f, 0.5f, 0.5f); + fillpatch(i++, "Rubber Backing [ZF]", 0.29f, 0.76f, 0.26f, 0.0f, 0.18f, 0.76f, 0.35f, 0.15f, 0.77f, 0.14f, 0.54f, 0.0f, 0.42f, 0.13f, 0.21f, 0.0f, 0.56f, 0.0f, 0.32f, 0.2f, 0.58f, 0.22f, 0.53f, 0.5f); + fillpatch(i++, "808 State Lead", 1.0f, 0.65f, 0.24f, 0.4f, 0.34f, 0.85f, 0.65f, 0.63f, 0.75f, 0.16f, 0.5f, 0.0f, 0.3f, 0.0f, 0.25f, 0.17f, 0.5f, 1.0f, 0.03f, 0.81f, 0.5f, 0.0f, 0.68f, 0.5f); + fillpatch(i++, "Mono Glide", 0.0f, 0.25f, 0.5f, 1.0f, 0.46f, 0.5f, 0.51f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.3f, 0.0f, 0.25f, 0.37f, 0.5f, 1.0f, 0.38f, 0.81f, 0.62f, 0.0f, 0.5f, 0.5f); + fillpatch(i++, "Detuned Techno Lead", 0.84f, 0.51f, 0.15f, 0.45f, 0.41f, 0.42f, 0.54f, 0.01f, 0.58f, 0.21f, 0.67f, 0.0f, 0.09f, 1.0f, 0.25f, 0.2f, 0.85f, 1.0f, 0.3f, 0.83f, 0.09f, 0.4f, 0.49f, 0.5f); + fillpatch(i++, "Hard Lead [SA]", 0.71f, 0.75f, 0.53f, 0.18f, 0.24f, 1.0f, 0.56f, 0.52f, 0.69f, 0.19f, 0.7f, 1.0f, 0.14f, 0.65f, 0.95f, 0.07f, 0.91f, 1.0f, 0.15f, 0.84f, 0.33f, 0.0f, 0.49f, 0.5f); + fillpatch(i++, "Bubble", 0.0f, 0.25f, 0.43f, 0.0f, 0.71f, 0.48f, 0.23f, 0.77f, 0.8f, 0.32f, 0.63f, 0.4f, 0.18f, 0.66f, 0.14f, 0.0f, 0.38f, 0.65f, 0.16f, 0.48f, 0.5f, 0.0f, 0.67f, 0.5f); + fillpatch(i++, "Monosynth", 0.62f, 0.26f, 0.51f, 0.79f, 0.35f, 0.54f, 0.64f, 0.39f, 0.51f, 0.65f, 0.0f, 0.07f, 0.52f, 0.24f, 0.84f, 0.13f, 0.3f, 0.76f, 0.21f, 0.58f, 0.3f, 0.0f, 0.36f, 0.5f); + fillpatch(i++, "Moogcury Lite", 0.81f, 1.0f, 0.21f, 0.78f, 0.15f, 0.35f, 0.39f, 0.17f, 0.69f, 0.4f, 0.62f, 0.0f, 0.47f, 0.19f, 0.37f, 0.0f, 0.5f, 0.2f, 0.33f, 0.38f, 0.53f, 0.0f, 0.12f, 0.5f); + fillpatch(i++, "Gangsta Whine", 0.0f, 0.51f, 0.52f, 0.96f, 0.44f, 0.5f, 0.41f, 0.46f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.25f, 0.15f, 0.5f, 1.0f, 0.32f, 0.81f, 0.49f, 0.0f, 0.83f, 0.5f); + fillpatch(i++, "Higher Synth [ZF]", 0.48f, 0.51f, 0.22f, 0.0f, 0.0f, 0.5f, 0.5f, 0.47f, 0.73f, 0.3f, 0.8f, 0.0f, 0.1f, 0.0f, 0.07f, 0.0f, 0.42f, 0.0f, 0.22f, 0.21f, 0.59f, 0.16f, 0.98f, 0.5f); + fillpatch(i++, "303 Saw Bass", 0.0f, 0.51f, 0.5f, 0.83f, 0.49f, 0.5f, 0.55f, 0.75f, 0.69f, 0.35f, 0.5f, 0.0f, 0.56f, 0.0f, 0.56f, 0.0f, 0.8f, 1.0f, 0.24f, 0.26f, 0.49f, 0.0f, 0.07f, 0.5f); + fillpatch(i++, "303 Square Bass", 0.75f, 0.51f, 0.5f, 0.83f, 0.49f, 0.5f, 0.55f, 0.75f, 0.69f, 0.35f, 0.5f, 0.14f, 0.49f, 0.0f, 0.39f, 0.0f, 0.8f, 1.0f, 0.24f, 0.26f, 0.49f, 0.0f, 0.07f, 0.5f); + fillpatch(i++, "Analog Bass", 1.0f, 0.25f, 0.2f, 0.81f, 0.19f, 0.5f, 0.3f, 0.51f, 0.85f, 0.09f, 0.0f, 0.0f, 0.88f, 0.0f, 0.21f, 0.0f, 0.5f, 1.0f, 0.46f, 0.81f, 0.5f, 0.0f, 0.27f, 0.5f); + fillpatch(i++, "Analog Bass 2", 1.0f, 0.25f, 0.2f, 0.72f, 0.19f, 0.86f, 0.48f, 0.43f, 0.94f, 0.0f, 0.8f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.61f, 1.0f, 0.32f, 0.81f, 0.5f, 0.0f, 0.27f, 0.5f); + fillpatch(i++, "Low Pulses", 0.97f, 0.26f, 0.3f, 0.0f, 0.35f, 0.5f, 0.8f, 0.4f, 0.52f, 0.0f, 0.5f, 0.0f, 0.77f, 0.0f, 0.25f, 0.0f, 0.5f, 1.0f, 0.3f, 0.81f, 0.16f, 0.0f, 0.0f, 0.5f); + fillpatch(i++, "Sine Infra-Bass", 0.0f, 0.25f, 0.5f, 0.65f, 0.35f, 0.5f, 0.33f, 0.76f, 0.53f, 0.0f, 0.5f, 0.0f, 0.3f, 0.0f, 0.25f, 0.0f, 0.55f, 0.25f, 0.3f, 0.81f, 0.52f, 0.0f, 0.14f, 0.5f); + fillpatch(i++, "Wobble Bass [SA]", 1.0f, 0.26f, 0.22f, 0.64f, 0.82f, 0.59f, 0.72f, 0.47f, 0.34f, 0.34f, 0.82f, 0.2f, 0.69f, 1.0f, 0.15f, 0.09f, 0.5f, 1.0f, 0.07f, 0.81f, 0.46f, 0.0f, 0.24f, 0.5f); + fillpatch(i++, "Squelch Bass", 1.0f, 0.26f, 0.22f, 0.71f, 0.35f, 0.5f, 0.67f, 0.7f, 0.26f, 0.0f, 0.5f, 0.48f, 0.69f, 1.0f, 0.15f, 0.0f, 0.5f, 1.0f, 0.07f, 0.81f, 0.46f, 0.0f, 0.24f, 0.5f); + fillpatch(i++, "Rubber Bass [ZF]", 0.49f, 0.25f, 0.66f, 0.81f, 0.35f, 0.5f, 0.36f, 0.15f, 0.75f, 0.2f, 0.5f, 0.0f, 0.38f, 0.0f, 0.25f, 0.0f, 0.6f, 1.0f, 0.22f, 0.19f, 0.5f, 0.0f, 0.17f, 0.5f); + fillpatch(i++, "Soft Pick Bass", 0.37f, 0.51f, 0.77f, 0.71f, 0.22f, 0.5f, 0.33f, 0.47f, 0.71f, 0.16f, 0.59f, 0.0f, 0.0f, 0.0f, 0.25f, 0.04f, 0.58f, 0.0f, 0.22f, 0.15f, 0.44f, 0.33f, 0.15f, 0.5f); + fillpatch(i++, "Fretless Bass", 0.5f, 0.51f, 0.17f, 0.8f, 0.34f, 0.5f, 0.51f, 0.0f, 0.58f, 0.0f, 0.67f, 0.0f, 0.09f, 0.0f, 0.25f, 0.2f, 0.85f, 0.0f, 0.3f, 0.81f, 0.7f, 0.0f, 0.0f, 0.5f); + fillpatch(i++, "Whistler", 0.23f, 0.51f, 0.38f, 0.0f, 0.35f, 0.5f, 0.33f, 1.0f, 0.5f, 0.0f, 0.5f, 0.0f, 0.29f, 0.0f, 0.25f, 0.68f, 0.39f, 0.58f, 0.36f, 0.81f, 0.64f, 0.38f, 0.92f, 0.5f); + fillpatch(i++, "Very Soft Pad", 0.39f, 0.51f, 0.27f, 0.38f, 0.12f, 0.5f, 0.35f, 0.78f, 0.5f, 0.0f, 0.5f, 0.0f, 0.3f, 0.0f, 0.25f, 0.35f, 0.5f, 0.8f, 0.7f, 0.81f, 0.5f, 0.0f, 0.5f, 0.5f); + fillpatch(i++, "Pizzicato", 0.0f, 0.25f, 0.5f, 0.0f, 0.35f, 0.5f, 0.23f, 0.2f, 0.75f, 0.0f, 0.5f, 0.0f, 0.22f, 0.0f, 0.25f, 0.0f, 0.47f, 0.0f, 0.3f, 0.81f, 0.5f, 0.8f, 0.5f, 0.5f); + fillpatch(i++, "Synth Strings", 1.0f, 0.51f, 0.24f, 0.0f, 0.0f, 0.35f, 0.42f, 0.26f, 0.75f, 0.14f, 0.69f, 0.0f, 0.67f, 0.55f, 0.97f, 0.82f, 0.7f, 1.0f, 0.42f, 0.84f, 0.67f, 0.3f, 0.47f, 0.5f); + fillpatch(i++, "Synth Strings 2", 0.75f, 0.51f, 0.29f, 0.0f, 0.49f, 0.5f, 0.55f, 0.16f, 0.69f, 0.08f, 0.2f, 0.76f, 0.29f, 0.76f, 1.0f, 0.46f, 0.8f, 1.0f, 0.39f, 0.79f, 0.27f, 0.0f, 0.68f, 0.5f); + fillpatch(i++, "Leslie Organ", 0.0f, 0.5f, 0.53f, 0.0f, 0.13f, 0.39f, 0.38f, 0.74f, 0.54f, 0.2f, 0.0f, 0.0f, 0.55f, 0.52f, 0.31f, 0.0f, 0.17f, 0.73f, 0.28f, 0.87f, 0.24f, 0.0f, 0.29f, 0.5f); + fillpatch(i++, "Click Organ", 0.5f, 0.77f, 0.52f, 0.0f, 0.35f, 0.5f, 0.44f, 0.5f, 0.65f, 0.16f, 0.0f, 0.0f, 0.0f, 0.18f, 0.0f, 0.0f, 0.75f, 0.8f, 0.0f, 0.81f, 0.49f, 0.0f, 0.44f, 0.5f); + fillpatch(i++, "Hard Organ", 0.89f, 0.91f, 0.37f, 0.0f, 0.35f, 0.5f, 0.51f, 0.62f, 0.54f, 0.0f, 0.0f, 0.0f, 0.37f, 0.0f, 1.0f, 0.04f, 0.08f, 0.72f, 0.04f, 0.77f, 0.49f, 0.0f, 0.58f, 0.5f); + fillpatch(i++, "Bass Clarinet", 1.0f, 0.51f, 0.51f, 0.37f, 0.0f, 0.5f, 0.51f, 0.1f, 0.5f, 0.11f, 0.5f, 0.0f, 0.0f, 0.0f, 0.25f, 0.35f, 0.65f, 0.65f, 0.32f, 0.79f, 0.49f, 0.2f, 0.35f, 0.5f); + fillpatch(i++, "Trumpet", 0.0f, 0.51f, 0.51f, 0.82f, 0.06f, 0.5f, 0.57f, 0.0f, 0.32f, 0.15f, 0.5f, 0.21f, 0.15f, 0.0f, 0.25f, 0.24f, 0.6f, 0.8f, 0.1f, 0.75f, 0.55f, 0.25f, 0.69f, 0.5f); + fillpatch(i++, "Soft Horn", 0.12f, 0.9f, 0.67f, 0.0f, 0.35f, 0.5f, 0.5f, 0.21f, 0.29f, 0.12f, 0.6f, 0.0f, 0.35f, 0.36f, 0.25f, 0.08f, 0.5f, 1.0f, 0.27f, 0.83f, 0.51f, 0.1f, 0.25f, 0.5f); + fillpatch(i++, "Brass Section", 0.43f, 0.76f, 0.23f, 0.0f, 0.28f, 0.36f, 0.5f, 0.0f, 0.59f, 0.0f, 0.5f, 0.24f, 0.16f, 0.91f, 0.08f, 0.17f, 0.5f, 0.8f, 0.45f, 0.81f, 0.5f, 0.0f, 0.58f, 0.5f); + fillpatch(i++, "Synth Brass", 0.4f, 0.51f, 0.25f, 0.0f, 0.3f, 0.28f, 0.39f, 0.15f, 0.75f, 0.0f, 0.5f, 0.39f, 0.3f, 0.82f, 0.25f, 0.33f, 0.74f, 0.76f, 0.41f, 0.81f, 0.47f, 0.23f, 0.5f, 0.5f); + fillpatch(i++, "Detuned Syn Brass [ZF]", 0.68f, 0.5f, 0.93f, 0.0f, 0.31f, 0.62f, 0.26f, 0.07f, 0.85f, 0.0f, 0.66f, 0.0f, 0.83f, 0.0f, 0.05f, 0.0f, 0.75f, 0.54f, 0.32f, 0.76f, 0.37f, 0.29f, 0.56f, 0.5f); + fillpatch(i++, "Power PWM", 1.0f, 0.27f, 0.22f, 0.0f, 0.35f, 0.5f, 0.82f, 0.13f, 0.75f, 0.0f, 0.0f, 0.24f, 0.3f, 0.88f, 0.34f, 0.0f, 0.5f, 1.0f, 0.48f, 0.71f, 0.37f, 0.0f, 0.35f, 0.5f); + fillpatch(i++, "Water Velocity [SA]", 0.76f, 0.51f, 0.35f, 0.0f, 0.49f, 0.5f, 0.87f, 0.67f, 1.0f, 0.32f, 0.09f, 0.95f, 0.56f, 0.72f, 1.0f, 0.04f, 0.76f, 0.11f, 0.46f, 0.88f, 0.72f, 0.0f, 0.38f, 0.5f); + fillpatch(i++, "Ghost [SA]", 0.75f, 0.51f, 0.24f, 0.45f, 0.16f, 0.48f, 0.38f, 0.58f, 0.75f, 0.16f, 0.81f, 0.0f, 0.3f, 0.4f, 0.31f, 0.37f, 0.5f, 1.0f, 0.54f, 0.85f, 0.83f, 0.43f, 0.46f, 0.5f); + fillpatch(i++, "Soft E.Piano", 0.31f, 0.51f, 0.43f, 0.0f, 0.35f, 0.5f, 0.34f, 0.26f, 0.53f, 0.0f, 0.63f, 0.0f, 0.22f, 0.0f, 0.39f, 0.0f, 0.8f, 0.0f, 0.44f, 0.81f, 0.51f, 0.0f, 0.5f, 0.5f); + fillpatch(i++, "Thumb Piano", 0.72f, 0.82f, 1.0f, 0.0f, 0.35f, 0.5f, 0.37f, 0.47f, 0.54f, 0.0f, 0.5f, 0.0f, 0.45f, 0.0f, 0.39f, 0.0f, 0.39f, 0.0f, 0.48f, 0.81f, 0.6f, 0.0f, 0.71f, 0.5f); + fillpatch(i++, "Steel Drums [ZF]", 0.81f, 0.76f, 0.19f, 0.0f, 0.18f, 0.7f, 0.4f, 0.3f, 0.54f, 0.17f, 0.4f, 0.0f, 0.42f, 0.23f, 0.47f, 0.12f, 0.48f, 0.0f, 0.49f, 0.53f, 0.36f, 0.34f, 0.56f, 0.5f); + + fillpatch(58, "Car Horn", 0.57f, 0.49f, 0.31f, 0.0f, 0.35f, 0.5f, 0.46f, 0.0f, 0.68f, 0.0f, 0.5f, 0.46f, 0.3f, 1.0f, 0.23f, 0.3f, 0.5f, 1.0f, 0.31f, 1.0f, 0.38f, 0.0f, 0.5f, 0.5f); + fillpatch(59, "Helicopter", 0.0f, 0.25f, 0.5f, 0.0f, 0.35f, 0.5f, 0.08f, 0.36f, 0.69f, 1.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f, 0.96f, 0.5f, 1.0f, 0.92f, 0.97f, 0.5f, 1.0f, 0.0f, 0.5f); + fillpatch(60, "Arctic Wind", 0.0f, 0.25f, 0.5f, 0.0f, 0.35f, 0.5f, 0.16f, 0.85f, 0.5f, 0.28f, 0.5f, 0.37f, 0.3f, 0.0f, 0.25f, 0.89f, 0.5f, 1.0f, 0.89f, 0.24f, 0.5f, 1.0f, 1.0f, 0.5f); + fillpatch(61, "Thip", 1.0f, 0.37f, 0.51f, 0.0f, 0.35f, 0.5f, 0.0f, 1.0f, 0.97f, 0.0f, 0.5f, 0.02f, 0.2f, 0.0f, 0.2f, 0.0f, 0.46f, 0.0f, 0.3f, 0.81f, 0.5f, 0.78f, 0.48f, 0.5f); + fillpatch(62, "Synth Tom", 0.0f, 0.25f, 0.5f, 0.0f, 0.76f, 0.94f, 0.3f, 0.33f, 0.76f, 0.0f, 0.68f, 0.0f, 0.59f, 0.0f, 0.59f, 0.1f, 0.5f, 0.0f, 0.5f, 0.81f, 0.5f, 0.7f, 0.0f, 0.5f); + fillpatch(63, "Squelchy Frog", 0.5f, 0.41f, 0.23f, 0.45f, 0.77f, 0.0f, 0.4f, 0.65f, 0.95f, 0.0f, 0.5f, 0.33f, 0.5f, 0.0f, 0.25f, 0.0f, 0.7f, 0.65f, 0.18f, 0.32f, 1.0f, 0.0f, 0.06f, 0.5f); + + //for testing... + //fillpatch(0, "Monosynth", 0.62f, 0.26f, 0.51f, 0.79f, 0.35f, 0.54f, 0.64f, 0.39f, 0.51f, 0.65f, 0.0f, 0.07f, 0.52f, 0.24f, 0.84f, 0.13f, 0.3f, 0.76f, 0.21f, 0.58f, 0.3f, 0.0f, 0.36f, 0.5f); + + setProgram(0); + } + + setUniqueID("mdaJX10"); + + if(audioMaster) + { + setNumInputs(0); + setNumOutputs(NOUTS); + canProcessReplacing(); + isSynth(); + } + + //initialise... + for(LvzInt32 v=0; v<NVOICES; v++) + { + voice[v].dp = voice[v].dp2 = 1.0f; + voice[v].saw = voice[v].p = voice[v].p2 = 0.0f; + voice[v].env = voice[v].envd = voice[v].envl = 0.0f; + voice[v].fenv = voice[v].fenvd = voice[v].fenvl = 0.0f; + 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; + K = mode = lastnote = sustain = activevoices = 0; + noise = 22222; + + update(); + suspend(); +} + + +void mdaJX10::update() //parameter change +{ + double ifs = 1.0 / Fs; + float * param = programs[curProgram].param; + + mode = (LvzInt32)(7.9f * param[3]); + noisemix = param[21] * param[21]; + voltrim = (3.2f - param[0] - 1.5f * noisemix) * (1.5f - 0.5f * param[7]); + noisemix *= 0.06f; + oscmix = param[0]; + + semi = (float)floor(48.0f * param[1]) - 24.0f; + cent = 15.876f * param[2] - 7.938f; + cent = 0.1f * (float)floor(cent * cent * cent); + detune = (float)pow(1.059463094359f, - semi - 0.01f * cent); + tune = -23.376f - 2.0f * param[23] - 12.0f * (float)floor(param[22] * 4.9); + tune = Fs * (float)pow(1.059463094359f, tune); + + vibrato = pwmdep = 0.2f * (param[20] - 0.5f) * (param[20] - 0.5f); + if(param[20]<0.5f) vibrato = 0.0f; + + lfoHz = (float)exp(7.0f * param[19] - 4.0f); + dlfo = lfoHz * (float)(ifs * TWOPI * KMAX); + + filtf = 8.0f * param[6] - 1.5f; + filtq = (1.0f - param[7]) * (1.0f - param[7]); ////// + 0.02f; + filtlfo = 2.5f * param[9] * param[9]; + filtenv = 12.0f * param[8] - 6.0f; + filtvel = 0.1f * param[10] - 0.05f; + if(param[10]<0.05f) { veloff = 1; filtvel = 0; } else veloff = 0; + + att = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[15])); + dec = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[16])); + sus = param[17]; + rel = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[18])); + if(param[18]<0.01f) rel = 0.1f; //extra fast release + + ifs *= KMAX; //lower update rate... + + fatt = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[11])); + fdec = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[12])); + fsus = param[13] * param[13]; + frel = 1.0f - (float)exp(-ifs * exp(5.5 - 7.5 * param[14])); + + if(param[4]<0.02f) glide = 1.0f; else + glide = 1.0f - (float)exp(-ifs * exp(6.0 - 7.0 * param[4])); + glidedisp = (6.604f * param[5] - 3.302f); + glidedisp *= glidedisp * glidedisp; +} + + +void mdaJX10::setSampleRate(float rate) +{ + AudioEffectX::setSampleRate(rate); + Fs = rate; + + dlfo = lfoHz * (float)(TWOPI * KMAX) / Fs; +} + + +void mdaJX10::resume() +{ + DECLARE_LVZ_DEPRECATED (wantEvents) (); +} + + +void mdaJX10::suspend() //Used by Logic (have note off code in 3 places now...) +{ + for(LvzInt32 v=0; v<NVOICES; v++) + { + voice[v].envl = voice[v].env = 0.0f; + voice[v].envd = 0.99f; + voice[v].note = 0; + voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f; + } +} + + +mdaJX10::~mdaJX10() //destroy any buffers... +{ + if(programs) delete[] programs; +} + + +void mdaJX10::setProgram(LvzInt32 program) +{ + curProgram = program; + update(); +} //may want all notes off here - but this stops use of patches as snapshots! + + +void mdaJX10::setParameter(LvzInt32 index, float value) +{ + programs[curProgram].param[index] = value; + update(); + + ///if(editor) editor->postUpdate(); +} + + +void mdaJX10::fillpatch(LvzInt32 p, const char *name, + float p0, float p1, float p2, float p3, float p4, float p5, + float p6, float p7, float p8, float p9, float p10, float p11, + float p12, float p13, float p14, float p15, float p16, float p17, + float p18, float p19, float p20, float p21, float p22, float p23) +{ + strcpy(programs[p].name, name); + programs[p].param[0] = p0; programs[p].param[1] = p1; + programs[p].param[2] = p2; programs[p].param[3] = p3; + programs[p].param[4] = p4; programs[p].param[5] = p5; + programs[p].param[6] = p6; programs[p].param[7] = p7; + programs[p].param[8] = p8; programs[p].param[9] = p9; + programs[p].param[10] = p10; programs[p].param[11] = p11; + programs[p].param[12] = p12; programs[p].param[13] = p13; + programs[p].param[14] = p14; programs[p].param[15] = p15; + programs[p].param[16] = p16; programs[p].param[17] = p17; + programs[p].param[18] = p18; programs[p].param[19] = p19; + programs[p].param[20] = p20; programs[p].param[21] = p21; + programs[p].param[22] = p22; programs[p].param[23] = p23; +} + + +float mdaJX10::getParameter(LvzInt32 index) { return programs[curProgram].param[index]; } +void mdaJX10::setProgramName(char *name) { strcpy(programs[curProgram].name, name); } +void mdaJX10::getProgramName(char *name) { strcpy(name, programs[curProgram].name); } +void mdaJX10::setBlockSize(LvzInt32 blockSize) { AudioEffectX::setBlockSize(blockSize); } +bool mdaJX10::getEffectName(char* name) { strcpy(name, "MDA JX10 Synth"); return true; } +bool mdaJX10::getVendorString(char* text) { strcpy(text, "MDA"); return true; } +bool mdaJX10::getProductString(char* text) { strcpy(text, "MDA JX10 Synth"); return true; } + + +bool mdaJX10::getOutputProperties(LvzInt32 index, LvzPinProperties* properties) +{ + if(index<NOUTS) + { + sprintf(properties->label, "JX10%d", index + 1); + properties->flags = kLvzPinIsActive; + if(index<2) properties->flags |= kLvzPinIsStereo; //make channel 1+2 stereo + return true; + } + return false; +} + + +bool mdaJX10::getProgramNameIndexed(LvzInt32 category, LvzInt32 index, char* text) +{ + if ((unsigned int)index < NPROGS) + { + strcpy(text, programs[index].name); + return true; + } + return false; +} + + +bool mdaJX10::copyProgram(LvzInt32 destination) +{ + if(destination<NPROGS) + { + programs[destination] = programs[curProgram]; + return true; + } + return false; +} + + +LvzInt32 mdaJX10::canDo(char* text) +{ + if(!strcmp (text, "receiveLvzEvents")) return 1; + if(!strcmp (text, "receiveLvzMidiEvent")) return 1; + return -1; +} + + +void mdaJX10::getParameterName(LvzInt32 index, char *label) +{ + switch (index) + { + case 0: strcpy(label, "OSC Mix"); break; + case 1: strcpy(label, "OSC Tune"); break; + case 2: strcpy(label, "OSC Fine"); break; + + case 3: strcpy(label, "Glide"); break; + case 4: strcpy(label, "Gld Rate"); break; + case 5: strcpy(label, "Gld Bend"); break; + + case 6: strcpy(label, "VCF Freq"); break; + case 7: strcpy(label, "VCF Reso"); break; + case 8: strcpy(label, "VCF Env"); break; + + case 9: strcpy(label, "VCF LFO"); break; + case 10: strcpy(label, "VCF Vel"); break; + case 11: strcpy(label, "VCF Att"); break; + + case 12: strcpy(label, "VCF Dec"); break; + case 13: strcpy(label, "VCF Sus"); break; + case 14: strcpy(label, "VCF Rel"); break; + + case 15: strcpy(label, "ENV Att"); break; + case 16: strcpy(label, "ENV Dec"); break; + case 17: strcpy(label, "ENV Sus"); break; + + case 18: strcpy(label, "ENV Rel"); break; + case 19: strcpy(label, "LFO Rate"); break; + case 20: strcpy(label, "Vibrato"); break; + + case 21: strcpy(label, "Noise"); break; + case 22: strcpy(label, "Octave"); break; + default: strcpy(label, "Tuning"); + } +} + + +void mdaJX10::getParameterDisplay(LvzInt32 index, char *text) +{ + char string[16]; + float * param = programs[curProgram].param; + + switch(index) + { + case 0: sprintf(string, "%4.0f:%2.0f", 100.0-50.0f*param[index], 50.0f*param[index]); break; + case 1: sprintf(string, "%.0f", semi); break; + case 2: sprintf(string, "%.1f", cent); break; + case 3: switch(mode) + { case 0: + case 1: strcpy(string, "POLY "); break; + case 2: strcpy(string, "P-LEGATO"); break; + case 3: strcpy(string, "P-GLIDE "); break; + case 4: + case 5: strcpy(string, "MONO "); break; + case 6: strcpy(string, "M-LEGATO"); break; + default: strcpy(string, "M-GLIDE "); break; } break; + case 5: sprintf(string, "%.2f", glidedisp); break; + case 6: sprintf(string, "%.1f", 100.0f * param[index]); break; + case 8: + case 23: sprintf(string, "%.1f", 200.0f * param[index] - 100.0f); break; + case 10: if(param[index]<0.05f) strcpy(string, " OFF "); + else sprintf(string, "%.0f", 200.0f * param[index] - 100.0f); break; + case 19: sprintf(string, "%.3f", lfoHz); break; + case 20: if(param[index]<0.5f) sprintf(string, "PWM %3.0f", 100.0f - 200.0f * param[index]); + else sprintf(string, "%7.0f", 200.0f * param[index] - 100.0f); break; + case 22: sprintf(string, "%d", (LvzInt32)(param[index] * 4.9f) - 2); break; + default: sprintf(string, "%.0f", 100.0f * param[index]); + } + string[8] = 0; + strcpy(text, (char *)string); +} + + +void mdaJX10::getParameterLabel(LvzInt32 index, char *label) +{ + switch(index) + { + case 1: + case 5: strcpy(label, " semi "); break; + case 2: + case 23: strcpy(label, " cent "); break; + case 3: + case 22: strcpy(label, " "); break; + case 19: strcpy(label, " Hz "); break; + default: strcpy(label, " % "); + } +} + + +void mdaJX10::process(float **inputs, float **outputs, LvzInt32 sampleFrames) +{ + float* out1 = outputs[0]; + float* out2 = outputs[1]; + LvzInt32 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; + LvzInt32 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) + { + LvzInt32 note = notes[event++]; + LvzInt32 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, LvzInt32 sampleFrames) +{ + float* out1 = outputs[0]; + float* out2 = outputs[1]; + LvzInt32 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; + LvzInt32 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 + + V->f2 = x; + + o += V->env * V->f0; + } + V++; + } + + *out1++ = o; + *out2++ = o; + } + + if(frame<sampleFrames) + { + LvzInt32 note = notes[event++]; + LvzInt32 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--; + } + } + } + else //empty block + { + while(--sampleFrames >= 0) + { + *out1++ = 0.0f; + *out2++ = 0.0f; + } + } + notes[0] = EVENTS_DONE; //mark events buffer as done + fzip = fz; + K = k; +} + + +void mdaJX10::noteOn(LvzInt32 note, LvzInt32 velocity) +{ + float p, l=100.0f; //louder than any envelope! + LvzInt32 v=0, tmp, held=0; + + if(velocity>0) //note on + { + if(veloff) velocity = 80; + + if(mode & 4) //monophonic + { + if(voice[0].note > 0) //legato pitch change + { + for(tmp=(NVOICES-1); tmp>0; tmp--) //queue any held notes + { + voice[tmp].note = voice[tmp - 1].note; + } + p = tune * (float)exp(-0.05776226505 * ((double)note + ANALOG * (double)v)); + while(p<3.0f || (p * detune)<3.0f) p += p; + voice[v].target = p; + if((mode & 2)==0) voice[v].period = p; + voice[v].fc = (float)exp(filtvel * (float)(velocity - 64)) / p; + voice[v].env += SILENCE + SILENCE; ///was missed out below if returned? + voice[v].note = note; + return; + } + } + else //polyphonic + { + for(tmp=0; tmp<NVOICES; tmp++) //replace quietest voice not in attack + { + if(voice[tmp].note > 0) held++; + if(voice[tmp].env<l && voice[tmp].envl<2.0f) { l=voice[tmp].env; v=tmp; } + } + } + p = tune * (float)exp(-0.05776226505 * ((double)note + ANALOG * (double)v)); + while(p<3.0f || (p * detune)<3.0f) p += p; + voice[v].target = p; + voice[v].detune = detune; + + tmp = 0; + if(mode & 2) + { + if((mode & 1) || held) tmp = note - lastnote; //glide + } + voice[v].period = p * (float)pow(1.059463094359, (double)tmp - glidedisp); + if(voice[v].period<3.0f) voice[v].period = 3.0f; //limit min period + + voice[v].note = lastnote = note; + + voice[v].fc = (float)exp(filtvel * (float)(velocity - 64)) / p; //filter tracking + + voice[v].lev = voltrim * volume * (0.004f * (float)((velocity + 64) * (velocity + 64)) - 8.0f); + voice[v].lev2 = voice[v].lev * oscmix; + + if(programs[curProgram].param[20]<0.5f) //force 180 deg phase difference for PWM + { + if(voice[v].dp>0.0f) + { + p = voice[v].pmax + voice[v].pmax - voice[v].p; + voice[v].dp2 = -voice[v].dp; + } + else + { + p = voice[v].p; + voice[v].dp2 = voice[v].dp; + } + voice[v].p2 = voice[v].pmax2 = p + PI * voice[v].period; + + voice[v].dc2 = 0.0f; + voice[v].sin02 = voice[v].sin12 = voice[v].sinx2 = 0.0f; + } + + if(mode & 4) //monophonic retriggering + { + voice[v].env += SILENCE + SILENCE; + } + else + { + //if(programs[curProgram].param[15] < 0.28f) + //{ + // voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f; //reset filter + // voice[v].env = SILENCE + SILENCE; + // voice[v].fenv = 0.0f; + //} + //else + voice[v].env += SILENCE + SILENCE; //anti-glitching trick + } + voice[v].envl = 2.0f; + voice[v].envd = att; + voice[v].fenvl = 2.0f; + voice[v].fenvd = fatt; + } + else //note off + { + if((mode & 4) && (voice[0].note==note)) //monophonic (and current note) + { + for(v=(NVOICES-1); v>0; v--) + { + if(voice[v].note>0) held = v; //any other notes queued? + } + if(held>0) + { + voice[v].note = voice[held].note; + voice[held].note = 0; + + p = tune * (float)exp(-0.05776226505 * ((double)voice[v].note + ANALOG * (double)v)); + while(p<3.0f || (p * detune)<3.0f) p += p; + voice[v].target = p; + if((mode & 2)==0) voice[v].period = p; + voice[v].fc = 1.0f / p; + } + else + { + voice[v].envl = 0.0f; + voice[v].envd = rel; + voice[v].fenvl = 0.0f; + voice[v].fenvd = frel; + voice[v].note = 0; + } + } + else //polyphonic + { + for(v=0; v<NVOICES; v++) if(voice[v].note==note) //any voices playing that note? + { + if(sustain==0) + { + voice[v].envl = 0.0f; + voice[v].envd = rel; + voice[v].fenvl = 0.0f; + voice[v].fenvd = frel; + voice[v].note = 0; + } + else voice[v].note = SUSTAIN; + } + } + } +} + + +LvzInt32 mdaJX10::processEvents(LvzEvents* ev) +{ + LvzInt32 npos=0; + + for (LvzInt32 i=0; i<ev->numEvents; i++) + { + if((ev->events[i])->type != kLvzMidiType) continue; + LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i]; + char* midiData = event->midiData; + + 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 + break; + + case 0x90: //note on + notes[npos++] = event->deltaFrames; //delta + notes[npos++] = midiData[1] & 0x7F; //note + notes[npos++] = midiData[2] & 0x7F; //vel + break; + + case 0xB0: //controller + switch(midiData[1]) + { + case 0x01: //mod wheel + modwhl = 0.000005f * (float)(midiData[2] * midiData[2]); + break; + case 0x02: //filter + + case 0x4A: + filtwhl = 0.02f * (float)(midiData[2]); + break; + case 0x03: //filter - + filtwhl = -0.03f * (float)(midiData[2]); + break; + + case 0x07: //volume + volume = 0.00000005f * (float)(midiData[2] * midiData[2]); + break; + + case 0x10: //resonance + case 0x47: + rezwhl = 0.0065f * (float)(154 - midiData[2]); + break; + + case 0x40: //sustain + sustain = midiData[2] & 0x40; + if(sustain==0) + { + notes[npos++] = event->deltaFrames; + notes[npos++] = SUSTAIN; //end all sustained notes + notes[npos++] = 0; + } + break; + + default: //all notes off + if(midiData[1]>0x7A) + { + for(LvzInt32 v=0; v<NVOICES; v++) + { + voice[v].envl = voice[v].env = 0.0f; + voice[v].envd = 0.99f; + voice[v].note = 0; + //could probably reset some more stuff here for safety! + } + sustain = 0; + } + break; + } + break; + + case 0xC0: //program change + if(midiData[1]<NPROGS) setProgram(midiData[1]); + break; + + case 0xD0: //channel aftertouch + press = 0.00001f * (float)(midiData[1] * midiData[1]); + break; + + case 0xE0: //pitch bend + ipbend = (float)exp(0.000014102 * (double)(midiData[1] + 128 * midiData[2] - 8192)); + pbend = 1.0f / ipbend; + break; + + 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 275e07f..1050b00 100644 --- a/src/mdaJX10.h +++ b/src/mdaJX10.h @@ -1,157 +1,157 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaJX10__
-#define __mdaJX10__
-
-#include <string.h>
-
-#include "audioeffectx.h"
-
-#define NPARAMS 24 //number of parameters
-#define NPROGS 64 //number of programs
-#define NOUTS 2 //number of outputs
-#define NVOICES 8 //max polyphony
-#define SILENCE 0.001f //voice choking
-#define PI 3.1415926535897932f
-#define TWOPI 6.2831853071795864f
-#define ANALOG 0.002f //oscillator drift
-
-class mdaJX10Program
-{
- friend class mdaJX10;
-public:
- mdaJX10Program();
-private:
- float param[NPARAMS];
- char name[24];
-};
-
-
-struct VOICE //voice state
-{
- float period;
- float p; //sinc position
- float pmax; //loop length
- float dp; //delta
- float sin0; //sine osc
- float sin1;
- float sinx;
- float dc; //dc offset
-
- float detune;
- float p2; //sinc position
- float pmax2; //loop length
- float dp2; //delta
- float sin02; //sine osc
- float sin12;
- float sinx2;
- float dc2; //dc offset
-
- float fc; //filter cutoff root
- float ff; //filter cutoff
- float f0; //filter buffers
- float f1;
- float f2;
-
- float saw;
- //float vca; //current level ///eliminate osc1 level when separate amp & filter envs?
- //float env; //envelope
- //float att; //attack
- //float dec; //decay
- float env;
- float envd;
- float envl;
- float fenv;
- float fenvd;
- float fenvl;
-
- float lev; //osc levels
- float lev2;
- float target; //period target
- LvzInt32 note; //remember what note triggered this
-};
-
-
-class mdaJX10 : public AudioEffectX
-{
-public:
- mdaJX10(audioMasterCallback audioMaster);
- ~mdaJX10();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleframes);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleframes);
- virtual LvzInt32 processEvents(LvzEvents* events);
-
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void setSampleRate(float sampleRate);
- virtual void setBlockSize(LvzInt32 blockSize);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getOutputProperties (LvzInt32 index, LvzPinProperties* properties);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* text);
- virtual bool copyProgram (LvzInt32 destination);
- virtual bool getEffectName (char* name);
- virtual bool getVendorString (char* text);
- virtual bool getProductString (char* text);
- virtual LvzInt32 getVendorVersion () {return 1;}
- virtual LvzInt32 canDo (char* text);
-
-private:
- void update(); //my parameter update
- void noteOn(LvzInt32 note, LvzInt32 velocity);
- void fillpatch(LvzInt32 p, const char *name,
- float p0, float p1, float p2, float p3, float p4, float p5,
- float p6, float p7, float p8, float p9, float p10, float p11,
- float p12, float p13, float p14, float p15, float p16, float p17,
- float p18, float p19, float p20, float p21, float p22, float p23);
-
- mdaJX10Program* programs;
- float Fs;
-
- #define EVENTBUFFER 120
- #define EVENTS_DONE 99999999
- LvzInt32 notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block
- #define KMAX 32
-
- ///global internal variables
- #define SUSTAIN -1
- LvzInt32 sustain, activevoices;
- VOICE voice[NVOICES];
-
- float semi, cent;
- float tune, detune;
- float filtf, fzip, filtq, filtlfo, filtenv, filtvel, filtwhl;
- float oscmix, noisemix;
- float att, dec, sus, rel, fatt, fdec, fsus, frel;
- float lfo, dlfo, modwhl, press, pbend, ipbend, rezwhl;
- float velsens, volume, voltrim;
- float vibrato, pwmdep, lfoHz, glide, glidedisp;
- LvzInt32 K, lastnote, veloff, mode;
- unsigned int noise;
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaJX10__ +#define __mdaJX10__ + +#include <string.h> + +#include "audioeffectx.h" + +#define NPARAMS 24 //number of parameters +#define NPROGS 64 //number of programs +#define NOUTS 2 //number of outputs +#define NVOICES 8 //max polyphony +#define SILENCE 0.001f //voice choking +#define PI 3.1415926535897932f +#define TWOPI 6.2831853071795864f +#define ANALOG 0.002f //oscillator drift + +class mdaJX10Program +{ + friend class mdaJX10; +public: + mdaJX10Program(); +private: + float param[NPARAMS]; + char name[24]; +}; + + +struct VOICE //voice state +{ + float period; + float p; //sinc position + float pmax; //loop length + float dp; //delta + float sin0; //sine osc + float sin1; + float sinx; + float dc; //dc offset + + float detune; + float p2; //sinc position + float pmax2; //loop length + float dp2; //delta + float sin02; //sine osc + float sin12; + float sinx2; + float dc2; //dc offset + + float fc; //filter cutoff root + float ff; //filter cutoff + float f0; //filter buffers + float f1; + float f2; + + float saw; + //float vca; //current level ///eliminate osc1 level when separate amp & filter envs? + //float env; //envelope + //float att; //attack + //float dec; //decay + float env; + float envd; + float envl; + float fenv; + float fenvd; + float fenvl; + + float lev; //osc levels + float lev2; + float target; //period target + LvzInt32 note; //remember what note triggered this +}; + + +class mdaJX10 : public AudioEffectX +{ +public: + mdaJX10(audioMasterCallback audioMaster); + ~mdaJX10(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleframes); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleframes); + virtual LvzInt32 processEvents(LvzEvents* events); + + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void setSampleRate(float sampleRate); + virtual void setBlockSize(LvzInt32 blockSize); + virtual void suspend(); + virtual void resume(); + + virtual bool getOutputProperties (LvzInt32 index, LvzPinProperties* properties); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* text); + virtual bool copyProgram (LvzInt32 destination); + virtual bool getEffectName (char* name); + virtual bool getVendorString (char* text); + virtual bool getProductString (char* text); + virtual LvzInt32 getVendorVersion () {return 1;} + virtual LvzInt32 canDo (char* text); + +private: + void update(); //my parameter update + void noteOn(LvzInt32 note, LvzInt32 velocity); + void fillpatch(LvzInt32 p, const char *name, + float p0, float p1, float p2, float p3, float p4, float p5, + float p6, float p7, float p8, float p9, float p10, float p11, + float p12, float p13, float p14, float p15, float p16, float p17, + float p18, float p19, float p20, float p21, float p22, float p23); + + mdaJX10Program* programs; + float Fs; + + #define EVENTBUFFER 120 + #define EVENTS_DONE 99999999 + LvzInt32 notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block + #define KMAX 32 + + ///global internal variables + #define SUSTAIN -1 + LvzInt32 sustain, activevoices; + VOICE voice[NVOICES]; + + float semi, cent; + float tune, detune; + float filtf, fzip, filtq, filtlfo, filtenv, filtvel, filtwhl; + float oscmix, noisemix; + float att, dec, sus, rel, fatt, fdec, fsus, frel; + float lfo, dlfo, modwhl, press, pbend, ipbend, rezwhl; + float velsens, volume, voltrim; + float vibrato, pwmdep, lfoHz, glide, glidedisp; + LvzInt32 K, lastnote, veloff, mode; + unsigned int noise; +}; + +#endif diff --git a/src/mdaLimiter.h b/src/mdaLimiter.h index f162299..539d512 100644 --- a/src/mdaLimiter.h +++ b/src/mdaLimiter.h @@ -1,57 +1,57 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaLimiter_H
-#define __mdaLimiter_H
-
-#include "audioeffectx.h"
-
-class mdaLimiter : public AudioEffectX
-{
-public:
- mdaLimiter(audioMasterCallback audioMaster);
- ~mdaLimiter();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float thresh, gain, att, rel, trim;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaLimiter_H +#define __mdaLimiter_H + +#include "audioeffectx.h" + +class mdaLimiter : public AudioEffectX +{ +public: + mdaLimiter(audioMasterCallback audioMaster); + ~mdaLimiter(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float thresh, gain, att, rel, trim; + + char programName[32]; +}; + +#endif diff --git a/src/mdaLooplex.cpp b/src/mdaLooplex.cpp index 8c4fcdc..0cf408d 100644 --- a/src/mdaLooplex.cpp +++ b/src/mdaLooplex.cpp @@ -120,27 +120,27 @@ IdleList::IdleList(mdaLooplex *effect, IdleList *next) : effect(effect), next(ne timer = SetTimer(NULL, 0, IDLE_MSEC, TimerCallback); #elif __linux__ timer = 1; - pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, 16 * 1024);
+ pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 16 * 1024); int policy; -
- if (pthread_attr_getschedpolicy(&attr, &policy) == 0)
- {
- struct sched_param param;
- param.sched_priority = sched_get_priority_min(policy);
- pthread_attr_setschedpolicy(&attr, SCHED_OTHER);
- pthread_attr_setschedparam(&attr, ¶m);
- }
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
-
- if (pthread_create(&thread, &attr, &ThreadCallback, 0) != 0)
- {
+ + if (pthread_attr_getschedpolicy(&attr, &policy) == 0) + { + struct sched_param param; + param.sched_priority = sched_get_priority_min(policy); + pthread_attr_setschedpolicy(&attr, SCHED_OTHER); + pthread_attr_setschedparam(&attr, ¶m); + } + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0); + + if (pthread_create(&thread, &attr, &ThreadCallback, 0) != 0) + { thread = 0; - timer = 0;
- fprintf(stderr, "Error: mdaLooplex.cpp (line %d)\n", __LINE__);
- }
+ timer = 0; + fprintf(stderr, "Error: mdaLooplex.cpp (line %d)\n", __LINE__); + } pthread_attr_destroy(&attr); #else //OSX double ms = kEventDurationMillisecond * (double)IDLE_MSEC; diff --git a/src/mdaLoudness.h b/src/mdaLoudness.h index 6b61ce4..ef13620 100644 --- a/src/mdaLoudness.h +++ b/src/mdaLoudness.h @@ -1,72 +1,72 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define NPARAMS 3 ///number of parameters
-#define NPROGS 8 ///number of programs
-
-#ifndef __mdaLoudness_H
-#define __mdaLoudness_H
-
-#include "audioeffectx.h"
-
-class mdaLoudnessProgram
-{
-public:
- mdaLoudnessProgram();
-private:
- friend class mdaLoudness;
- float param[NPARAMS];
- char name[32];
-};
-
-
-class mdaLoudness : public AudioEffectX
-{
-public:
- mdaLoudness(audioMasterCallback audioMaster);
- ~mdaLoudness();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaLoudnessProgram *programs;
-
- ///global internal variables
- float Z0, Z1, Z2, Z3, A0, A1, A2, gain;
- float igain, ogain;
- LvzInt32 mode;
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define NPARAMS 3 ///number of parameters +#define NPROGS 8 ///number of programs + +#ifndef __mdaLoudness_H +#define __mdaLoudness_H + +#include "audioeffectx.h" + +class mdaLoudnessProgram +{ +public: + mdaLoudnessProgram(); +private: + friend class mdaLoudness; + float param[NPARAMS]; + char name[32]; +}; + + +class mdaLoudness : public AudioEffectX +{ +public: + mdaLoudness(audioMasterCallback audioMaster); + ~mdaLoudness(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaLoudnessProgram *programs; + + ///global internal variables + float Z0, Z1, Z2, Z3, A0, A1, A2, gain; + float igain, ogain; + LvzInt32 mode; +}; + +#endif diff --git a/src/mdaMultiBand.h b/src/mdaMultiBand.h index 657ee69..611ccee 100644 --- a/src/mdaMultiBand.h +++ b/src/mdaMultiBand.h @@ -1,59 +1,59 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaMultiBand_H
-#define __mdaMultiBand_H
-
-#include "audioeffectx.h"
-
-class mdaMultiBand : public AudioEffectX
-{
-public:
- mdaMultiBand(audioMasterCallback audioMaster);
- ~mdaMultiBand();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1, fParam2, fParam3, fParam4;
- float fParam5, fParam6, fParam7, fParam8;
- float fParam9, fParam10, fParam11, fParam12, fParam13;
- float gain1, driv1, att1, rel1, trim1;
- float gain2, driv2, att2, rel2, trim2;
- float gain3, driv3, att3, rel3, trim3;
- float fi1, fb1, fo1, fi2, fb2, fo2, fb3, slev;
- int mswap;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaMultiBand_H +#define __mdaMultiBand_H + +#include "audioeffectx.h" + +class mdaMultiBand : public AudioEffectX +{ +public: + mdaMultiBand(audioMasterCallback audioMaster); + ~mdaMultiBand(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1, fParam2, fParam3, fParam4; + float fParam5, fParam6, fParam7, fParam8; + float fParam9, fParam10, fParam11, fParam12, fParam13; + float gain1, driv1, att1, rel1, trim1; + float gain2, driv2, att2, rel2, trim2; + float gain3, driv3, att3, rel3, trim3; + float fi1, fb1, fo1, fi2, fb2, fo2, fb3, slev; + int mswap; + + char programName[32]; +}; + +#endif diff --git a/src/mdaOverdrive.h b/src/mdaOverdrive.h index 5f0011c..b10e6c1 100644 --- a/src/mdaOverdrive.h +++ b/src/mdaOverdrive.h @@ -1,58 +1,58 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaOverdrive_H
-#define __mdaOverdrive_H
-
-#include "audioeffectx.h"
-
-class mdaOverdrive : public AudioEffectX
-{
-public:
- mdaOverdrive(audioMasterCallback audioMaster);
- ~mdaOverdrive();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
-
- float filt1, filt2; //filter buffers
- float filt; //filter coeff.
- float gain; //output gain
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaOverdrive_H +#define __mdaOverdrive_H + +#include "audioeffectx.h" + +class mdaOverdrive : public AudioEffectX +{ +public: + mdaOverdrive(audioMasterCallback audioMaster); + ~mdaOverdrive(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + + float filt1, filt2; //filter buffers + float filt; //filter coeff. + float gain; //output gain + + char programName[32]; +}; + +#endif diff --git a/src/mdaRePsycho.h b/src/mdaRePsycho.h index 57735d7..c07401d 100644 --- a/src/mdaRePsycho.h +++ b/src/mdaRePsycho.h @@ -1,63 +1,63 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaRePsycho_H
-#define __mdaRePsycho_H
-
-#include "audioeffectx.h"
-
-class mdaRePsycho : public AudioEffectX
-{
-public:
- mdaRePsycho(audioMasterCallback audioMaster);
- ~mdaRePsycho();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fParam7;
- float thr, env, gai, tun, wet, dry, fil, buf, buf2;
- long tim, dtim;
-
- float *buffer, *buffer2;
- long size;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaRePsycho_H +#define __mdaRePsycho_H + +#include "audioeffectx.h" + +class mdaRePsycho : public AudioEffectX +{ +public: + mdaRePsycho(audioMasterCallback audioMaster); + ~mdaRePsycho(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fParam7; + float thr, env, gai, tun, wet, dry, fil, buf, buf2; + long tim, dtim; + + float *buffer, *buffer2; + long size; + + char programName[32]; +}; + +#endif diff --git a/src/mdaRezFilter.h b/src/mdaRezFilter.h index d113ce2..e28df58 100644 --- a/src/mdaRezFilter.h +++ b/src/mdaRezFilter.h @@ -1,69 +1,69 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaRezFilter_H
-#define __mdaRezFilter_H
-
-#include "audioeffectx.h"
-
-class mdaRezFilter : public AudioEffectX
-{
-public:
- mdaRezFilter(audioMasterCallback audioMaster);
- ~mdaRezFilter();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam0;
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fParam7;
- float fParam8;
- float fParam9;
-
- float fff, fq, fg, fmax;
- float env, fenv, att, rel;
- float flfo, phi, dphi, bufl;
- float buf0, buf1, buf2, tthr, env2;
- int lfomode, ttrig, tatt;
-
- char bugFix[32]; //Program name was corrupted here!
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaRezFilter_H +#define __mdaRezFilter_H + +#include "audioeffectx.h" + +class mdaRezFilter : public AudioEffectX +{ +public: + mdaRezFilter(audioMasterCallback audioMaster); + ~mdaRezFilter(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam0; + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fParam7; + float fParam8; + float fParam9; + + float fff, fq, fg, fmax; + float env, fenv, att, rel; + float flfo, phi, dphi, bufl; + float buf0, buf1, buf2, tthr, env2; + int lfomode, ttrig, tatt; + + char bugFix[32]; //Program name was corrupted here! + char programName[32]; +}; + +#endif diff --git a/src/mdaRingMod.h b/src/mdaRingMod.h index 3e8750d..ace3107 100644 --- a/src/mdaRingMod.h +++ b/src/mdaRingMod.h @@ -1,60 +1,60 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaRingMod_H
-#define __mdaRingMod_H
-
-#include "audioeffectx.h"
-
-class mdaRingMod : public AudioEffectX
-{
-public:
- mdaRingMod(audioMasterCallback audioMaster);
- ~mdaRingMod();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fPhi;
- float fdPhi;
- float nul;
- float twoPi;
- float ffb, fprev;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaRingMod_H +#define __mdaRingMod_H + +#include "audioeffectx.h" + +class mdaRingMod : public AudioEffectX +{ +public: + mdaRingMod(audioMasterCallback audioMaster); + ~mdaRingMod(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fPhi; + float fdPhi; + float nul; + float twoPi; + float ffb, fprev; + + char programName[32]; +}; + +#endif diff --git a/src/mdaRoundPan.h b/src/mdaRoundPan.h index 674c406..85fc996 100644 --- a/src/mdaRoundPan.h +++ b/src/mdaRoundPan.h @@ -1,60 +1,60 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaRoundPan_H
-#define __mdaRoundPan_H
-
-#include "audioeffectx.h"
-
-class mdaRoundPan : public AudioEffectX
-{
-public:
- mdaRoundPan(audioMasterCallback audioMaster);
- ~mdaRoundPan();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float phi, dphi;
-
- //float *buffer, *buffer2;
- //LvzInt32 size, bufpos;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaRoundPan_H +#define __mdaRoundPan_H + +#include "audioeffectx.h" + +class mdaRoundPan : public AudioEffectX +{ +public: + mdaRoundPan(audioMasterCallback audioMaster); + ~mdaRoundPan(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float phi, dphi; + + //float *buffer, *buffer2; + //LvzInt32 size, bufpos; + + char programName[32]; +}; + +#endif diff --git a/src/mdaShepard.h b/src/mdaShepard.h index 51fda27..1042a6a 100644 --- a/src/mdaShepard.h +++ b/src/mdaShepard.h @@ -1,59 +1,59 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaShepard_H
-#define __mdaShepard_H
-
-#include "audioeffectx.h"
-
-class mdaShepard : public AudioEffectX
-{
-public:
- mdaShepard(audioMasterCallback audioMaster);
- ~mdaShepard();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam0;
- float fParam1;
- float fParam2;
- float level, pos, rate, drate, out, filt;
-
- float *buf1, *buf2;
- LvzInt32 max, mode;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaShepard_H +#define __mdaShepard_H + +#include "audioeffectx.h" + +class mdaShepard : public AudioEffectX +{ +public: + mdaShepard(audioMasterCallback audioMaster); + ~mdaShepard(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam0; + float fParam1; + float fParam2; + float level, pos, rate, drate, out, filt; + + float *buf1, *buf2; + LvzInt32 max, mode; + + char programName[32]; +}; + +#endif diff --git a/src/mdaSpecMeter.h b/src/mdaSpecMeter.h index 84f2df6..b23a92d 100644 --- a/src/mdaSpecMeter.h +++ b/src/mdaSpecMeter.h @@ -1,87 +1,87 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 2002 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "audioeffectx.h"
-
-#include <string.h>
-
-#define NPROGS 4 //can hide decay settings in programs! fast...slow...peak hold
-#define SILENCE 0.00000001f
-
-enum {
- _PARAM0, //gain
-// _PARAM0, //peak decay
-// _PARAM1, //RMS speed
-// _PARAM2, //spectrum speed
-// _PARAM3, //peak reset?
-
- NPARAMS
-};
-
-class mdaSpecMeter;
-
-class mdaSpecMeterProgram
-{
-friend class mdaSpecMeter;
-public:
- mdaSpecMeterProgram();
-private:
- float param[NPARAMS];
- char name[24];
-};
-
-
-class mdaSpecMeter : public AudioEffectX
-{
-public:
- mdaSpecMeter(audioMasterCallback audioMaster);
- ~mdaSpecMeter();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void setSampleRate(float sampleRate);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
- //accessible from editor
- LvzInt32 counter;
- float Lpeak, Lhold, Lmin, Lrms, Rpeak, Rhold, Rmin, Rrms, Corr; // #11 #12
- float band[2][16]; //8 16 31 64 125 250 500 1k 2k 4k 8k 16k 32k
-
-private:
- mdaSpecMeterProgram *programs;
-
- float iK, lpeak, lmin, lrms, rpeak, rmin, rrms, corr, den;
- float lpp[6][16], rpp[6][16];
- LvzInt32 topband, K, kmax;
-
- float gain;
-};
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 2002 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "audioeffectx.h" + +#include <string.h> + +#define NPROGS 4 //can hide decay settings in programs! fast...slow...peak hold +#define SILENCE 0.00000001f + +enum { + _PARAM0, //gain +// _PARAM0, //peak decay +// _PARAM1, //RMS speed +// _PARAM2, //spectrum speed +// _PARAM3, //peak reset? + + NPARAMS +}; + +class mdaSpecMeter; + +class mdaSpecMeterProgram +{ +friend class mdaSpecMeter; +public: + mdaSpecMeterProgram(); +private: + float param[NPARAMS]; + char name[24]; +}; + + +class mdaSpecMeter : public AudioEffectX +{ +public: + mdaSpecMeter(audioMasterCallback audioMaster); + ~mdaSpecMeter(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void setSampleRate(float sampleRate); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + + //accessible from editor + LvzInt32 counter; + float Lpeak, Lhold, Lmin, Lrms, Rpeak, Rhold, Rmin, Rrms, Corr; // #11 #12 + float band[2][16]; //8 16 31 64 125 250 500 1k 2k 4k 8k 16k 32k + +private: + mdaSpecMeterProgram *programs; + + float iK, lpeak, lmin, lrms, rpeak, rmin, rrms, corr, den; + float lpp[6][16], rpp[6][16]; + LvzInt32 topband, K, kmax; + + float gain; +}; diff --git a/src/mdaSplitter.h b/src/mdaSplitter.h index 32e1f3a..2feabf5 100644 --- a/src/mdaSplitter.h +++ b/src/mdaSplitter.h @@ -1,83 +1,83 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define NPARAMS 7 ///number of parameters
-#define NPROGS 3 ///number of programs
-
-#ifndef __mdaSplitter_H
-#define __mdaSplitter_H
-
-#include "audioeffectx.h"
-
-class mdaSplitterProgram
-{
-public:
- mdaSplitterProgram()
- {
- param[0] = 0.10f; //mode
- param[1] = 0.50f; //freq
- param[2] = 0.25f; //freq mode
- param[3] = 0.50f; //level (was 2)
- param[4] = 0.50f; //level mode
- param[5] = 0.50f; //envelope
- param[6] = 0.50f; //gain
- strcpy(name, "Frequency/Level Splitter");
- }
-private:
- friend class mdaSplitter;
- float param[NPARAMS];
- char name[32];
-};
-
-
-class mdaSplitter : public AudioEffectX
-{
-public:
- mdaSplitter(audioMasterCallback audioMaster);
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 which, char* name);
- virtual void setParameter(LvzInt32 which, float value);
- virtual float getParameter(LvzInt32 which);
- virtual void getParameterLabel(LvzInt32 which, char *label);
- virtual void getParameterDisplay(LvzInt32 which, char *text);
- virtual void getParameterName(LvzInt32 which, char *text);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaSplitterProgram programs[NPROGS];
-
- ///global internal variables
- float freq, fdisp, buf0, buf1, buf2, buf3; //filter
- float level, ldisp, env, att, rel; //level switch
- float ff, ll, pp, i2l, i2r, o2l, o2r; //routing (freq, level, phase, output)
- LvzInt32 mode;
-
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define NPARAMS 7 ///number of parameters +#define NPROGS 3 ///number of programs + +#ifndef __mdaSplitter_H +#define __mdaSplitter_H + +#include "audioeffectx.h" + +class mdaSplitterProgram +{ +public: + mdaSplitterProgram() + { + param[0] = 0.10f; //mode + param[1] = 0.50f; //freq + param[2] = 0.25f; //freq mode + param[3] = 0.50f; //level (was 2) + param[4] = 0.50f; //level mode + param[5] = 0.50f; //envelope + param[6] = 0.50f; //gain + strcpy(name, "Frequency/Level Splitter"); + } +private: + friend class mdaSplitter; + float param[NPARAMS]; + char name[32]; +}; + + +class mdaSplitter : public AudioEffectX +{ +public: + mdaSplitter(audioMasterCallback audioMaster); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 which, char* name); + virtual void setParameter(LvzInt32 which, float value); + virtual float getParameter(LvzInt32 which); + virtual void getParameterLabel(LvzInt32 which, char *label); + virtual void getParameterDisplay(LvzInt32 which, char *text); + virtual void getParameterName(LvzInt32 which, char *text); + virtual void suspend(); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaSplitterProgram programs[NPROGS]; + + ///global internal variables + float freq, fdisp, buf0, buf1, buf2, buf3; //filter + float level, ldisp, env, att, rel; //level switch + float ff, ll, pp, i2l, i2r, o2l, o2r; //routing (freq, level, phase, output) + LvzInt32 mode; + +}; + +#endif diff --git a/src/mdaStereo.h b/src/mdaStereo.h index 788b110..d60186c 100644 --- a/src/mdaStereo.h +++ b/src/mdaStereo.h @@ -1,63 +1,63 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaStereo_H
-#define __mdaStereo_H
-
-#include "audioeffectx.h"
-
-class mdaStereo : public AudioEffectX
-{
-public:
- mdaStereo(audioMasterCallback audioMaster);
- ~mdaStereo();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
-
- float fli, fld, fri, frd, fdel, phi, dphi, mod;
-
- float *buffer;
- LvzInt32 size, bufpos;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaStereo_H +#define __mdaStereo_H + +#include "audioeffectx.h" + +class mdaStereo : public AudioEffectX +{ +public: + mdaStereo(audioMasterCallback audioMaster); + ~mdaStereo(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + + float fli, fld, fri, frd, fdel, phi, dphi, mod; + + float *buffer; + LvzInt32 size, bufpos; + + char programName[32]; +}; + +#endif diff --git a/src/mdaSubSynth.cpp b/src/mdaSubSynth.cpp index e6039da..8324c72 100644 --- a/src/mdaSubSynth.cpp +++ b/src/mdaSubSynth.cpp @@ -1,380 +1,380 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "mdaSubSynth.h"
-
-#include <math.h>
-#include <stdio.h>
-
-AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
-{
- return new mdaSubSynth(audioMaster);
-}
-
-mdaSubSynth::mdaSubSynth(audioMasterCallback audioMaster)
- : AudioEffectX(audioMaster, 1, 6) // programs, parameters
-{
- //inits here!
- fParam1 = (float)0.0; //type
- fParam2 = (float)0.3; //level
- fParam3 = (float)0.6; //tune
- fParam4 = (float)1.0; //dry mix
- fParam5 = (float)0.6; //thresh
- fParam6 = (float)0.65; //release
-
- setNumInputs(2);
- setNumOutputs(2);
- setUniqueID("mdaSubSynth"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
- strcpy(programName, "Sub Bass Synthesizer");
-
- resume();
-}
-
-mdaSubSynth::~mdaSubSynth()
-{
-
-}
-
-bool mdaSubSynth::getProductString(char* text) { strcpy(text, "MDA SubSynth"); return true; }
-bool mdaSubSynth::getVendorString(char* text) { strcpy(text, "mda"); return true; }
-bool mdaSubSynth::getEffectName(char* name) { strcpy(name, "SubSynth"); return true; }
-
-void mdaSubSynth::setProgramName(char *name)
-{
- strcpy(programName, name);
-}
-
-void mdaSubSynth::getProgramName(char *name)
-{
- strcpy(name, programName);
-}
-
-bool mdaSubSynth::getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name)
-{
- if (index == 0)
- {
- strcpy(name, programName);
- return true;
- }
- return false;
-}
-
-void mdaSubSynth::setProgram(LvzInt32 program)
-{
-}
-
-void mdaSubSynth::setParameter(LvzInt32 index, float value)
-{
- switch(index)
- {
- case 0: fParam1 = value; break;
- case 1: fParam2 = value; break;
- case 2: fParam3 = value; break;
- case 3: fParam4 = value; break;
- case 4: fParam5 = value; break;
- case 5: fParam6 = value; break;
- }
-
- dvd = 1.0;
- phs = 1.0;
- osc = 0.0; //oscillator phase
- typ = int(3.5 * fParam1);
- filti = (typ == 3)? 0.018f : (float)pow(10.0,-3.0 + (2.0 * fParam3));
- filto = 1.0f - filti;
- wet = fParam2;
- dry = fParam4;
- thr = (float)pow(10.0,-3.0 + (3.0 * fParam5));
- rls = (float)(1.0 - pow(10.0, -2.0 - (3.0 * fParam6)));
- dphi = (float)(0.456159 * pow(10.0,-2.5 + (1.5 * fParam3)));
-}
-
-float mdaSubSynth::getParameter(LvzInt32 index)
-{
- float v=0;
-
- switch(index)
- {
- case 0: v = fParam1; break;
- case 1: v = fParam2; break;
- case 2: v = fParam3; break;
- case 3: v = fParam4; break;
- case 4: v = fParam5; break;
- case 5: v = fParam6; break;
- }
- return v;
-}
-
-void mdaSubSynth::getParameterName(LvzInt32 index, char *label)
-{
- switch(index)
- {
- case 0: strcpy(label, "Type"); break;
- case 1: strcpy(label, "Level"); break;
- case 2: strcpy(label, "Tune"); break;
- case 3: strcpy(label, "Dry Mix"); break;
- case 4: strcpy(label, "Thresh"); break;
- case 5: strcpy(label, "Release"); break;
- }
-}
-
-void mdaSubSynth::getParameterDisplay(LvzInt32 index, char *text)
-{
- char string[16];
-
- switch(index)
- {
- case 1: sprintf(string, "%d", (LvzInt32)(100.0f * wet)); break;
- case 2: sprintf(string, "%d", (LvzInt32)(0.0726 * getSampleRate() * pow(10.0,-2.5 + (1.5 * fParam3)))); break;
- case 3: sprintf(string, "%d", (LvzInt32)(100. * dry)); break;
- case 4: sprintf(string, "%.1f", 60.0f * fParam5 - 60.0f); break;
- case 5: sprintf(string, "%d", (LvzInt32)(-301.03 / (getSampleRate() * log10(rls)))); break;
-
- case 0: switch(typ)
- {
- case 0: strcpy(string, "Distort"); break;
- case 1: strcpy(string, "Divide"); break;
- case 2: strcpy(string, "Invert"); break;
- case 3: strcpy(string, "Key Osc."); break;
- }
- }
-
- string[8] = 0;
- strcpy(text, (char *)string);
-}
-
-void mdaSubSynth::getParameterLabel(LvzInt32 index, char *label)
-{
- switch(index)
- {
- case 0: strcpy(label, " " ); break;
- case 1: strcpy(label, "% "); break;
- case 2: strcpy(label, "Hz"); break;
- case 3: strcpy(label, "%" ); break;
- case 4: strcpy(label, "dB"); break;
- case 5: strcpy(label, "ms"); break;
- }
-}
-
-
-void mdaSubSynth::resume()
-{
- phi = env = filt1 = filt2 = filt3 = filt4 = filti = filto = 0.0f;
-
- setParameter(0, getParameter(0));
-}
-
-//--------------------------------------------------------------------------------
-// process
-
-void mdaSubSynth::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
-{
- float *in1 = inputs[0];
- float *in2 = inputs[1];
- float *out1 = outputs[0];
- float *out2 = outputs[1];
- float a, b, c, d;
- float we, dr, fi, fo, f1, f2, f3, f4, sub, rl, th, dv, ph, phii, dph, os, en;
-
- dph = dphi;
- rl = rls;
- phii = phi;
- en = env;
- os = osc;
- th = thr;
- dv = dvd;
- ph = phs;
- we = wet;
- dr = dry;
- f1 = filt1;
- f2 = filt2;
- f3 = filt3;
- f4 = filt4;
- fi = filti;
- fo = filto;
-
- --in1;
- --in2;
- --out1;
- --out2;
- while(--sampleFrames >= 0)
- {
- a = *++in1;
- b = *++in2;
-
- c = out1[1];
- d = out2[1]; //process from here...
-
- f1 = (fo * f1) + (fi * (a + b));
- f2 = (fo * f2) + (fi * f1);
-
- sub = f2;
- if (sub > th)
- {
- sub = 1.0;
- }
- else
- {
- if(sub < -th)
- {
- sub = -1.0;
- }
- else
- {
- sub = 0.0;
- }
- }
-
- if((sub * dv) < 0) //octave divider
- {
- dv = -dv; if(dv < 0.) ph = -ph;
- }
-
- if(typ == 1) //divide
- {
- sub = ph * sub;
- }
- if(typ == 2) //invert
- {
- sub = (float)(ph * f2 * 2.0);
- }
- if(typ == 3) //osc
- {
- if (f2 > th) {en = 1.0; }
- else {en = en * rl;}
- sub = (float)(en * sin(phii));
- phii = (float)fmod( phii + dph, 6.283185f );
- }
-
- f3 = (fo * f3) + (fi * sub);
- f4 = (fo * f4) + (fi * f3);
-
- c += (a * dr) + (f4 * we); // output
- d += (b * dr) + (f4 * we);
-
- *++out1 = c;
- *++out2 = d;
- }
- if(fabs(f1)<1.0e-10) filt1=0.f; else filt1=f1;
- if(fabs(f2)<1.0e-10) filt2=0.f; else filt2=f2;
- if(fabs(f3)<1.0e-10) filt3=0.f; else filt3=f3;
- if(fabs(f4)<1.0e-10) filt4=0.f; else filt4=f4;
- dvd = dv;
- phs = ph;
- osc = os;
- phi = phii;
- env = en;
-}
-
-void mdaSubSynth::processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames)
-{
- float *in1 = inputs[0];
- float *in2 = inputs[1];
- float *out1 = outputs[0];
- float *out2 = outputs[1];
- float a, b, c, d;
- float we, dr, fi, fo, f1, f2, f3, f4, sub, rl, th, dv, ph, phii, dph, os, en;
-
- dph = dphi;
- rl = rls;
- phii = phi;
- en = env;
- os = osc;
- th = thr;
- dv = dvd;
- ph = phs;
- we = wet;
- dr = dry;
- f1 = filt1;
- f2 = filt2;
- f3 = filt3;
- f4 = filt4;
-
- fi = filti;
- fo = filto;
-
- --in1;
- --in2;
- --out1;
- --out2;
- while(--sampleFrames >= 0)
- {
- a = *++in1;
- b = *++in2; //process from here...
-
- f1 = (fo * f1) + (fi * (a + b));
- f2 = (fo * f2) + (fi * f1);
-
- sub = f2;
- if (sub > th)
- {
- sub = 1.0;
- }
- else
- {
- if(sub < -th)
- {
- sub = -1.0;
- }
- else
- {
- sub = 0.0;
- }
- }
-
- if((sub * dv) < 0) //octave divider
- {
- dv = -dv; if(dv < 0.) ph = -ph;
- }
-
- if(typ == 1) //divide
- {
- sub = ph * sub;
- }
- if(typ == 2) //invert
- {
- sub = (float)(ph * f2 * 2.0);
- }
- if(typ == 3) //osc
- {
- if (f2 > th) {en = 1.0; }
- else {en = en * rl;}
- sub = (float)(en * sin(phii));
- phii = (float)fmod( phii + dph, 6.283185f );
- }
-
- f3 = (fo * f3) + (fi * sub);
- f4 = (fo * f4) + (fi * f3);
-
- c = (a * dr) + (f4 * we); // output
- d = (b * dr) + (f4 * we);
-
- *++out1 = c;
- *++out2 = d;
- }
- if(fabs(f1)<1.0e-10) filt1=0.f; else filt1=f1;
- if(fabs(f2)<1.0e-10) filt2=0.f; else filt2=f2;
- if(fabs(f3)<1.0e-10) filt3=0.f; else filt3=f3;
- if(fabs(f4)<1.0e-10) filt4=0.f; else filt4=f4;
- dvd = dv;
- phs = ph;
- osc = os;
- phi = phii;
- env = en;
-}
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "mdaSubSynth.h" + +#include <math.h> +#include <stdio.h> + +AudioEffect *createEffectInstance(audioMasterCallback audioMaster) +{ + return new mdaSubSynth(audioMaster); +} + +mdaSubSynth::mdaSubSynth(audioMasterCallback audioMaster) + : AudioEffectX(audioMaster, 1, 6) // programs, parameters +{ + //inits here! + fParam1 = (float)0.0; //type + fParam2 = (float)0.3; //level + fParam3 = (float)0.6; //tune + fParam4 = (float)1.0; //dry mix + fParam5 = (float)0.6; //thresh + fParam6 = (float)0.65; //release + + setNumInputs(2); + setNumOutputs(2); + setUniqueID("mdaSubSynth"); // identify here + DECLARE_LVZ_DEPRECATED(canMono) (); + canProcessReplacing(); + strcpy(programName, "Sub Bass Synthesizer"); + + resume(); +} + +mdaSubSynth::~mdaSubSynth() +{ + +} + +bool mdaSubSynth::getProductString(char* text) { strcpy(text, "MDA SubSynth"); return true; } +bool mdaSubSynth::getVendorString(char* text) { strcpy(text, "mda"); return true; } +bool mdaSubSynth::getEffectName(char* name) { strcpy(name, "SubSynth"); return true; } + +void mdaSubSynth::setProgramName(char *name) +{ + strcpy(programName, name); +} + +void mdaSubSynth::getProgramName(char *name) +{ + strcpy(name, programName); +} + +bool mdaSubSynth::getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name) +{ + if (index == 0) + { + strcpy(name, programName); + return true; + } + return false; +} + +void mdaSubSynth::setProgram(LvzInt32 program) +{ +} + +void mdaSubSynth::setParameter(LvzInt32 index, float value) +{ + switch(index) + { + case 0: fParam1 = value; break; + case 1: fParam2 = value; break; + case 2: fParam3 = value; break; + case 3: fParam4 = value; break; + case 4: fParam5 = value; break; + case 5: fParam6 = value; break; + } + + dvd = 1.0; + phs = 1.0; + osc = 0.0; //oscillator phase + typ = int(3.5 * fParam1); + filti = (typ == 3)? 0.018f : (float)pow(10.0,-3.0 + (2.0 * fParam3)); + filto = 1.0f - filti; + wet = fParam2; + dry = fParam4; + thr = (float)pow(10.0,-3.0 + (3.0 * fParam5)); + rls = (float)(1.0 - pow(10.0, -2.0 - (3.0 * fParam6))); + dphi = (float)(0.456159 * pow(10.0,-2.5 + (1.5 * fParam3))); +} + +float mdaSubSynth::getParameter(LvzInt32 index) +{ + float v=0; + + switch(index) + { + case 0: v = fParam1; break; + case 1: v = fParam2; break; + case 2: v = fParam3; break; + case 3: v = fParam4; break; + case 4: v = fParam5; break; + case 5: v = fParam6; break; + } + return v; +} + +void mdaSubSynth::getParameterName(LvzInt32 index, char *label) +{ + switch(index) + { + case 0: strcpy(label, "Type"); break; + case 1: strcpy(label, "Level"); break; + case 2: strcpy(label, "Tune"); break; + case 3: strcpy(label, "Dry Mix"); break; + case 4: strcpy(label, "Thresh"); break; + case 5: strcpy(label, "Release"); break; + } +} + +void mdaSubSynth::getParameterDisplay(LvzInt32 index, char *text) +{ + char string[16]; + + switch(index) + { + case 1: sprintf(string, "%d", (LvzInt32)(100.0f * wet)); break; + case 2: sprintf(string, "%d", (LvzInt32)(0.0726 * getSampleRate() * pow(10.0,-2.5 + (1.5 * fParam3)))); break; + case 3: sprintf(string, "%d", (LvzInt32)(100. * dry)); break; + case 4: sprintf(string, "%.1f", 60.0f * fParam5 - 60.0f); break; + case 5: sprintf(string, "%d", (LvzInt32)(-301.03 / (getSampleRate() * log10(rls)))); break; + + case 0: switch(typ) + { + case 0: strcpy(string, "Distort"); break; + case 1: strcpy(string, "Divide"); break; + case 2: strcpy(string, "Invert"); break; + case 3: strcpy(string, "Key Osc."); break; + } + } + + string[8] = 0; + strcpy(text, (char *)string); +} + +void mdaSubSynth::getParameterLabel(LvzInt32 index, char *label) +{ + switch(index) + { + case 0: strcpy(label, " " ); break; + case 1: strcpy(label, "% "); break; + case 2: strcpy(label, "Hz"); break; + case 3: strcpy(label, "%" ); break; + case 4: strcpy(label, "dB"); break; + case 5: strcpy(label, "ms"); break; + } +} + + +void mdaSubSynth::resume() +{ + phi = env = filt1 = filt2 = filt3 = filt4 = filti = filto = 0.0f; + + setParameter(0, getParameter(0)); +} + +//-------------------------------------------------------------------------------- +// process + +void mdaSubSynth::process(float **inputs, float **outputs, LvzInt32 sampleFrames) +{ + float *in1 = inputs[0]; + float *in2 = inputs[1]; + float *out1 = outputs[0]; + float *out2 = outputs[1]; + float a, b, c, d; + float we, dr, fi, fo, f1, f2, f3, f4, sub, rl, th, dv, ph, phii, dph, os, en; + + dph = dphi; + rl = rls; + phii = phi; + en = env; + os = osc; + th = thr; + dv = dvd; + ph = phs; + we = wet; + dr = dry; + f1 = filt1; + f2 = filt2; + f3 = filt3; + f4 = filt4; + fi = filti; + fo = filto; + + --in1; + --in2; + --out1; + --out2; + while(--sampleFrames >= 0) + { + a = *++in1; + b = *++in2; + + c = out1[1]; + d = out2[1]; //process from here... + + f1 = (fo * f1) + (fi * (a + b)); + f2 = (fo * f2) + (fi * f1); + + sub = f2; + if (sub > th) + { + sub = 1.0; + } + else + { + if(sub < -th) + { + sub = -1.0; + } + else + { + sub = 0.0; + } + } + + if((sub * dv) < 0) //octave divider + { + dv = -dv; if(dv < 0.) ph = -ph; + } + + if(typ == 1) //divide + { + sub = ph * sub; + } + if(typ == 2) //invert + { + sub = (float)(ph * f2 * 2.0); + } + if(typ == 3) //osc + { + if (f2 > th) {en = 1.0; } + else {en = en * rl;} + sub = (float)(en * sin(phii)); + phii = (float)fmod( phii + dph, 6.283185f ); + } + + f3 = (fo * f3) + (fi * sub); + f4 = (fo * f4) + (fi * f3); + + c += (a * dr) + (f4 * we); // output + d += (b * dr) + (f4 * we); + + *++out1 = c; + *++out2 = d; + } + if(fabs(f1)<1.0e-10) filt1=0.f; else filt1=f1; + if(fabs(f2)<1.0e-10) filt2=0.f; else filt2=f2; + if(fabs(f3)<1.0e-10) filt3=0.f; else filt3=f3; + if(fabs(f4)<1.0e-10) filt4=0.f; else filt4=f4; + dvd = dv; + phs = ph; + osc = os; + phi = phii; + env = en; +} + +void mdaSubSynth::processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames) +{ + float *in1 = inputs[0]; + float *in2 = inputs[1]; + float *out1 = outputs[0]; + float *out2 = outputs[1]; + float a, b, c, d; + float we, dr, fi, fo, f1, f2, f3, f4, sub, rl, th, dv, ph, phii, dph, os, en; + + dph = dphi; + rl = rls; + phii = phi; + en = env; + os = osc; + th = thr; + dv = dvd; + ph = phs; + we = wet; + dr = dry; + f1 = filt1; + f2 = filt2; + f3 = filt3; + f4 = filt4; + + fi = filti; + fo = filto; + + --in1; + --in2; + --out1; + --out2; + while(--sampleFrames >= 0) + { + a = *++in1; + b = *++in2; //process from here... + + f1 = (fo * f1) + (fi * (a + b)); + f2 = (fo * f2) + (fi * f1); + + sub = f2; + if (sub > th) + { + sub = 1.0; + } + else + { + if(sub < -th) + { + sub = -1.0; + } + else + { + sub = 0.0; + } + } + + if((sub * dv) < 0) //octave divider + { + dv = -dv; if(dv < 0.) ph = -ph; + } + + if(typ == 1) //divide + { + sub = ph * sub; + } + if(typ == 2) //invert + { + sub = (float)(ph * f2 * 2.0); + } + if(typ == 3) //osc + { + if (f2 > th) {en = 1.0; } + else {en = en * rl;} + sub = (float)(en * sin(phii)); + phii = (float)fmod( phii + dph, 6.283185f ); + } + + f3 = (fo * f3) + (fi * sub); + f4 = (fo * f4) + (fi * f3); + + c = (a * dr) + (f4 * we); // output + d = (b * dr) + (f4 * we); + + *++out1 = c; + *++out2 = d; + } + if(fabs(f1)<1.0e-10) filt1=0.f; else filt1=f1; + if(fabs(f2)<1.0e-10) filt2=0.f; else filt2=f2; + if(fabs(f3)<1.0e-10) filt3=0.f; else filt3=f3; + if(fabs(f4)<1.0e-10) filt4=0.f; else filt4=f4; + dvd = dv; + phs = ph; + osc = os; + phi = phii; + env = en; +} diff --git a/src/mdaSubSynth.h b/src/mdaSubSynth.h index f4e986a..b5a616d 100644 --- a/src/mdaSubSynth.h +++ b/src/mdaSubSynth.h @@ -1,59 +1,59 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "audioeffectx.h"
-
-class mdaSubSynth : public AudioEffectX
-{
-public:
- mdaSubSynth(audioMasterCallback audioMaster);
- ~mdaSubSynth();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float filt1, filt2, filt3, filt4, filti, filto;
- float thr, rls, dry, wet, dvd, phs, osc, env, phi, dphi;
- int typ;
-
- char programName[32];
-};
-
-
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "audioeffectx.h" + +class mdaSubSynth : public AudioEffectX +{ +public: + mdaSubSynth(audioMasterCallback audioMaster); + ~mdaSubSynth(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float filt1, filt2, filt3, filt4, filti, filto; + float thr, rls, dry, wet, dvd, phs, osc, env, phi, dphi; + int typ; + + char programName[32]; +}; + + diff --git a/src/mdaTalkBox.h b/src/mdaTalkBox.h index c2894a5..c9d1157 100644 --- a/src/mdaTalkBox.h +++ b/src/mdaTalkBox.h @@ -1,85 +1,85 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "audioeffectx.h"
-
-#define NPARAMS 4 ///number of parameters
-#define NPROGS 1 ///number of programs
-#define BUF_MAX 1600
-#define ORD_MAX 50
-#define TWO_PI 6.28318530717958647692528676655901f
-
-
-class mdaTalkBoxProgram
-{
-public:
- mdaTalkBoxProgram();
- ~mdaTalkBoxProgram() {}
-
-private:
- friend class mdaTalkBox;
- float param[NPARAMS];
- char name[24];
-};
-
-
-class mdaTalkBox : public AudioEffectX
-{
-public:
- mdaTalkBox(audioMasterCallback audioMaster);
- ~mdaTalkBox();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaTalkBoxProgram *programs;
-
- void lpc(float *buf, float *car, LvzInt32 n, LvzInt32 o);
- void lpc_durbin(float *r, int p, float *k, float *g);
-
- ///global internal variables
- float *car0, *car1;
- float *window;
- float *buf0, *buf1;
-
- float emphasis;
- LvzInt32 K, N, O, pos, swap;
- float wet, dry, FX;
-
- float d0, d1, d2, d3, d4;
- float u0, u1, u2, u3, u4;
-};
-
-
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "audioeffectx.h" + +#define NPARAMS 4 ///number of parameters +#define NPROGS 1 ///number of programs +#define BUF_MAX 1600 +#define ORD_MAX 50 +#define TWO_PI 6.28318530717958647692528676655901f + + +class mdaTalkBoxProgram +{ +public: + mdaTalkBoxProgram(); + ~mdaTalkBoxProgram() {} + +private: + friend class mdaTalkBox; + float param[NPARAMS]; + char name[24]; +}; + + +class mdaTalkBox : public AudioEffectX +{ +public: + mdaTalkBox(audioMasterCallback audioMaster); + ~mdaTalkBox(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaTalkBoxProgram *programs; + + void lpc(float *buf, float *car, LvzInt32 n, LvzInt32 o); + void lpc_durbin(float *r, int p, float *k, float *g); + + ///global internal variables + float *car0, *car1; + float *window; + float *buf0, *buf1; + + float emphasis; + LvzInt32 K, N, O, pos, swap; + float wet, dry, FX; + + float d0, d1, d2, d3, d4; + float u0, u1, u2, u3, u4; +}; + + diff --git a/src/mdaThruZero.h b/src/mdaThruZero.h index e4f58d0..2f35cb2 100644 --- a/src/mdaThruZero.h +++ b/src/mdaThruZero.h @@ -1,75 +1,75 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define NPARAMS 5 ///number of parameters
-#define NPROGS 4 ///number of programs
-#define BUFMAX 2048
-
-#ifndef __mdaThruZero_H
-#define __mdaThruZero_H
-
-#include "audioeffectx.h"
-
-
-class mdaThruZeroProgram
-{
-public:
- mdaThruZeroProgram();
-private:
- friend class mdaThruZero;
- float param[NPARAMS];
- char name[32];
-};
-
-
-class mdaThruZero : public AudioEffectX
-{
-public:
- mdaThruZero(audioMasterCallback audioMaster);
- ~mdaThruZero();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaThruZeroProgram *programs;
-
- ///global internal variables
- float rat, dep, wet, dry, fb, dem; //rate, depth, wet & dry mix, feedback, mindepth
- float phi, fb1, fb2, deps; //lfo & feedback buffers, depth change smoothing
- float *buffer, *buffer2; //maybe use 2D buffer?
- LvzInt32 size, bufpos;
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define NPARAMS 5 ///number of parameters +#define NPROGS 4 ///number of programs +#define BUFMAX 2048 + +#ifndef __mdaThruZero_H +#define __mdaThruZero_H + +#include "audioeffectx.h" + + +class mdaThruZeroProgram +{ +public: + mdaThruZeroProgram(); +private: + friend class mdaThruZero; + float param[NPARAMS]; + char name[32]; +}; + + +class mdaThruZero : public AudioEffectX +{ +public: + mdaThruZero(audioMasterCallback audioMaster); + ~mdaThruZero(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaThruZeroProgram *programs; + + ///global internal variables + float rat, dep, wet, dry, fb, dem; //rate, depth, wet & dry mix, feedback, mindepth + float phi, fb1, fb2, deps; //lfo & feedback buffers, depth change smoothing + float *buffer, *buffer2; //maybe use 2D buffer? + LvzInt32 size, bufpos; +}; + +#endif diff --git a/src/mdaTracker.h b/src/mdaTracker.h index 9caa2c3..9d9228b 100644 --- a/src/mdaTracker.h +++ b/src/mdaTracker.h @@ -1,66 +1,66 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaTracker_H
-#define __mdaTracker_H
-
-#include "audioeffectx.h"
-
-class mdaTracker : public AudioEffectX
-{
-public:
- mdaTracker(audioMasterCallback audioMaster);
- ~mdaTracker();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual float filterFreq(float hz);
- virtual void suspend();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float fParam7;
- float fParam8;
- float fi, fo, thr, phi, dphi, ddphi, trans;
- float buf1, buf2, dn, bold, wet, dry;
- float dyn, env, rel, saw, dsaw;
- float res1, res2, buf3, buf4;
- LvzInt32 max, min, num, sig, mode;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaTracker_H +#define __mdaTracker_H + +#include "audioeffectx.h" + +class mdaTracker : public AudioEffectX +{ +public: + mdaTracker(audioMasterCallback audioMaster); + ~mdaTracker(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual float filterFreq(float hz); + virtual void suspend(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float fParam7; + float fParam8; + float fi, fo, thr, phi, dphi, ddphi, trans; + float buf1, buf2, dn, bold, wet, dry; + float dyn, env, rel, saw, dsaw; + float res1, res2, buf3, buf4; + LvzInt32 max, min, num, sig, mode; + + char programName[32]; +}; + +#endif diff --git a/src/mdaTransient.h b/src/mdaTransient.h index 6511be9..d62b086 100644 --- a/src/mdaTransient.h +++ b/src/mdaTransient.h @@ -1,59 +1,59 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __mdaTransient_H
-#define __mdaTransient_H
-
-#include "audioeffectx.h"
-
-class mdaTransient : public AudioEffectX
-{
-public:
- mdaTransient(audioMasterCallback audioMaster);
- ~mdaTransient();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- float fParam1;
- float fParam2;
- float fParam3;
- float fParam4;
- float fParam5;
- float fParam6;
- float dry, att1, att2, rel12, att34, rel3, rel4;
- float env1, env2, env3, env4, fili, filo, filx, fbuf1, fbuf2;
-
- char programName[32];
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __mdaTransient_H +#define __mdaTransient_H + +#include "audioeffectx.h" + +class mdaTransient : public AudioEffectX +{ +public: + mdaTransient(audioMasterCallback audioMaster); + ~mdaTransient(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + float fParam1; + float fParam2; + float fParam3; + float fParam4; + float fParam5; + float fParam6; + float dry, att1, att2, rel12, att34, rel3, rel4; + float env1, env2, env3, env4, fili, filo, filx, fbuf1, fbuf2; + + char programName[32]; +}; + +#endif diff --git a/src/mdaVocInput.h b/src/mdaVocInput.h index 5df8fa1..c574182 100644 --- a/src/mdaVocInput.h +++ b/src/mdaVocInput.h @@ -1,84 +1,84 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define NPARAMS 5 ///number of parameters
-#define NPROGS 1 ///number of programs
-
-#ifndef __mdaVocInput_H
-#define __mdaVocInput_H
-
-#include "audioeffectx.h"
-
-
-class mdaVocInputProgram
-{
-public:
- mdaVocInputProgram();
-private:
- friend class mdaVocInput;
- float param[NPARAMS];
- char name[32];
-};
-
-
-class mdaVocInput : public AudioEffectX
-{
-public:
- mdaVocInput(audioMasterCallback audioMaster);
- ~mdaVocInput();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void midi2string(LvzInt32 n, char *text);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaVocInputProgram *programs;
-
- ///global internal variables
- LvzInt32 track; //track input pitch
- float pstep; //output sawtooth inc per sample
- float pmult; //tuning multiplier
- float sawbuf;
- float noise; //breath noise level
- float lenv, henv; //LF and overall envelope
- float lbuf0, lbuf1; //LF filter buffers
- float lbuf2; //previous LF sample
- float lbuf3; //period measurement
- float lfreq; //LF filter coeff
- float vuv; //voiced/unvoiced threshold
- float maxp, minp; //preferred period range
- double root; //tuning reference (MIDI note 0 in Hz)
-};
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define NPARAMS 5 ///number of parameters +#define NPROGS 1 ///number of programs + +#ifndef __mdaVocInput_H +#define __mdaVocInput_H + +#include "audioeffectx.h" + + +class mdaVocInputProgram +{ +public: + mdaVocInputProgram(); +private: + friend class mdaVocInput; + float param[NPARAMS]; + char name[32]; +}; + + +class mdaVocInput : public AudioEffectX +{ +public: + mdaVocInput(audioMasterCallback audioMaster); + ~mdaVocInput(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void midi2string(LvzInt32 n, char *text); + virtual void suspend(); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaVocInputProgram *programs; + + ///global internal variables + LvzInt32 track; //track input pitch + float pstep; //output sawtooth inc per sample + float pmult; //tuning multiplier + float sawbuf; + float noise; //breath noise level + float lenv, henv; //LF and overall envelope + float lbuf0, lbuf1; //LF filter buffers + float lbuf2; //previous LF sample + float lbuf3; //period measurement + float lfreq; //LF filter coeff + float vuv; //voiced/unvoiced threshold + float maxp, minp; //preferred period range + double root; //tuning reference (MIDI note 0 in Hz) +}; + +#endif diff --git a/src/mdaVocoder.h b/src/mdaVocoder.h index 4158258..91d026b 100644 --- a/src/mdaVocoder.h +++ b/src/mdaVocoder.h @@ -1,80 +1,80 @@ -/*
- Copyright 2008-2011 David Robillard <http://drobilla.net>
- Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
-
- This is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this software. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define NPARAMS 8 ///number of parameters
-#define NPROGS 5 ///number of programs
-#define NBANDS 16 ///max vocoder bands
-
-#ifndef __mdaVocoder_H
-#define __mdaVocoder_H
-
-#include "audioeffectx.h"
-
-
-class mdaVocoderProgram
-{
-public:
- mdaVocoderProgram();
-private:
- friend class mdaVocoder;
- float param[NPARAMS];
- char name[32];
-};
-
-
-class mdaVocoder : public AudioEffectX
-{
-public:
- mdaVocoder(audioMasterCallback audioMaster);
- ~mdaVocoder();
-
- virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
- virtual void setProgram(LvzInt32 program);
- virtual void setProgramName(char *name);
- virtual void getProgramName(char *name);
- virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name);
- virtual void setParameter(LvzInt32 index, float value);
- virtual float getParameter(LvzInt32 index);
- virtual void getParameterLabel(LvzInt32 index, char *label);
- virtual void getParameterDisplay(LvzInt32 index, char *text);
- virtual void getParameterName(LvzInt32 index, char *text);
- virtual void suspend();
- virtual void resume();
-
- virtual bool getEffectName(char *name);
- virtual bool getVendorString(char *text);
- virtual bool getProductString(char *text);
- virtual LvzInt32 getVendorVersion() { return 1000; }
-
-protected:
- mdaVocoderProgram *programs;
-
- ///global internal variables
- LvzInt32 swap; //input channel swap
- float gain; //output level
- float thru, high; //hf thru
- float kout; //downsampled output
- LvzInt32 kval; //downsample counter
- LvzInt32 nbnd; //number of bands
-
- //filter coeffs and buffers - seems it's faster to leave this global than make local copy
- float f[NBANDS][13]; //[0-8][0 1 2 | 0 1 2 3 | 0 1 2 3 | val rate]
-}; // # reson | carrier |modulator| envelope
-
-#endif
+/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This software is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this software. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define NPARAMS 8 ///number of parameters +#define NPROGS 5 ///number of programs +#define NBANDS 16 ///max vocoder bands + +#ifndef __mdaVocoder_H +#define __mdaVocoder_H + +#include "audioeffectx.h" + + +class mdaVocoderProgram +{ +public: + mdaVocoderProgram(); +private: + friend class mdaVocoder; + float param[NPARAMS]; + char name[32]; +}; + + +class mdaVocoder : public AudioEffectX +{ +public: + mdaVocoder(audioMasterCallback audioMaster); + ~mdaVocoder(); + + virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); + virtual void setProgram(LvzInt32 program); + virtual void setProgramName(char *name); + virtual void getProgramName(char *name); + virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); + virtual void setParameter(LvzInt32 index, float value); + virtual float getParameter(LvzInt32 index); + virtual void getParameterLabel(LvzInt32 index, char *label); + virtual void getParameterDisplay(LvzInt32 index, char *text); + virtual void getParameterName(LvzInt32 index, char *text); + virtual void suspend(); + virtual void resume(); + + virtual bool getEffectName(char *name); + virtual bool getVendorString(char *text); + virtual bool getProductString(char *text); + virtual LvzInt32 getVendorVersion() { return 1000; } + +protected: + mdaVocoderProgram *programs; + + ///global internal variables + LvzInt32 swap; //input channel swap + float gain; //output level + float thru, high; //hf thru + float kout; //downsampled output + LvzInt32 kval; //downsample counter + LvzInt32 nbnd; //number of bands + + //filter coeffs and buffers - seems it's faster to leave this global than make local copy + float f[NBANDS][13]; //[0-8][0 1 2 | 0 1 2 3 | 0 1 2 3 | val rate] +}; // # reson | carrier |modulator| envelope + +#endif |