From e40fc849149dd97c248866a4a1d026dda5e57b62 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Mon, 7 Mar 2011 19:01:11 +0000 Subject: clean3 --- .../synti/zynaddsubfx/Effects/Alienwah.C | 244 +++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 attic/muse_qt4_evolution/synti/zynaddsubfx/Effects/Alienwah.C (limited to 'attic/muse_qt4_evolution/synti/zynaddsubfx/Effects/Alienwah.C') diff --git a/attic/muse_qt4_evolution/synti/zynaddsubfx/Effects/Alienwah.C b/attic/muse_qt4_evolution/synti/zynaddsubfx/Effects/Alienwah.C new file mode 100644 index 00000000..8d2475d2 --- /dev/null +++ b/attic/muse_qt4_evolution/synti/zynaddsubfx/Effects/Alienwah.C @@ -0,0 +1,244 @@ +/* + ZynAddSubFX - a software synthesizer + + Alienwah.C - "AlienWah" effect + Copyright (C) 2002-2005 Nasca Octavian Paul + Author: Nasca Octavian Paul + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License + as published by the Free Software Foundation. + + This program 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 (version 2) for more details. + + You should have received a copy of the GNU General Public License (version 2) + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include +#include "Alienwah.h" +#include + +Alienwah::Alienwah(int insertion_,REALTYPE *efxoutl_,REALTYPE *efxoutr_){ + efxoutl=efxoutl_; + efxoutr=efxoutr_; + + oldl=NULL; + oldr=NULL; + filterpars=NULL; + insertion=insertion_; + + Ppreset=0; + setpreset(Ppreset); + cleanup(); + oldclfol.a=fb;oldclfol.b=0.0; + oldclfor.a=fb;oldclfor.b=0.0; +}; + +Alienwah::~Alienwah(){ + if (oldl!=NULL) delete [] oldl; + if (oldr!=NULL) delete [] oldr ; +}; + + +/* + * Apply the effect + */ +void Alienwah::out(REALTYPE *smpsl,REALTYPE *smpsr){ + int i; + REALTYPE lfol,lfor; + COMPLEXTYPE clfol,clfor,out,tmp; + + lfo.effectlfoout(&lfol,&lfor); + lfol*=depth*PI*2.0;lfor*=depth*PI*2.0; + clfol.a=cos(lfol+phase)*fb;clfol.b=sin(lfol+phase)*fb; + clfor.a=cos(lfor+phase)*fb;clfor.b=sin(lfor+phase)*fb; + + for (i=0;i=Pdelay) oldk=0; + //LRcross + efxoutl[i]=l*(1.0-lrcross)+r*lrcross; + efxoutr[i]=r*(1.0-lrcross)+l*lrcross; + }; + + oldclfol.a=clfol.a;oldclfol.b=clfol.b; + oldclfor.a=clfor.a;oldclfor.b=clfor.b; + +}; + +/* + * Cleanup the effect + */ +void Alienwah::cleanup(){ + for (int i=0;iPdepth=Pdepth; + depth=(Pdepth/127.0); +}; + +void Alienwah::setfb(unsigned char Pfb){ + this->Pfb=Pfb; + fb=fabs((Pfb-64.0)/64.1); + fb=sqrt(fb); + if (fb<0.4) fb=0.4; + if (Pfb<64) fb=-fb; +}; + +void Alienwah::setvolume(unsigned char Pvolume){ + this->Pvolume=Pvolume; + outvolume=Pvolume/127.0; + if (insertion==0) volume=1.0; + else volume=outvolume; +}; + +void Alienwah::setpanning(unsigned char Ppanning){ + this->Ppanning=Ppanning; + panning=Ppanning/127.0; +}; + +void Alienwah::setlrcross(unsigned char Plrcross){ + this->Plrcross=Plrcross; + lrcross=Plrcross/127.0; +}; + +void Alienwah::setphase(unsigned char Pphase){ + this->Pphase=Pphase; + phase=(Pphase-64.0)/64.0*PI; +}; + +void Alienwah::setdelay(unsigned char Pdelay){ + if (oldl!=NULL) delete [] oldl; + if (oldr!=NULL) delete [] oldr; + if (Pdelay>=MAX_ALIENWAH_DELAY) Pdelay=MAX_ALIENWAH_DELAY; + this->Pdelay=Pdelay; + oldl=new COMPLEXTYPE[Pdelay]; + oldr=new COMPLEXTYPE[Pdelay]; + cleanup(); +}; + +void Alienwah::setpreset(unsigned char npreset){ + const int PRESET_SIZE=11; + const int NUM_PRESETS=4; + unsigned char presets[NUM_PRESETS][PRESET_SIZE]={ + //AlienWah1 + {127,64,70,0,0,62,60,105,25,0,64}, + //AlienWah2 + {127,64,73,106,0,101,60,105,17,0,64}, + //AlienWah3 + {127,64,63,0,1,100,112,105,31,0,42}, + //AlienWah4 + {93,64,25,0,1,66,101,11,47,0,86}}; + + if (npreset>=NUM_PRESETS) npreset=NUM_PRESETS-1; + for (int n=0;n