1 /* 2 ZynAddSubFX - a software synthesizer 3 Synthfilter.h - Synthesizer filter effect 4 Copyright (C) 2010 Ryan Billing 5 Based on Analog Phaser derived from 6 Phaser.h/.C 7 Copyright (C) 2002-2005 Nasca Octavian Paul 8 9 Authors: Nasca Octavian Paul, Ryan Billing, Josep Andreu 10 11 Modified for rakarrack by Josep Andreu 12 13 Further modified for rakarrack by Ryan Billing (Transmogrifox) to model Analog Phaser behavior 2009 14 15 This program is free software; you can redistribute it and/or modify 16 it under the terms of version 2 of the GNU General Public License 17 as published by the Free Software Foundation. 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License (version 2) for more details. 23 24 You should have received a copy of the GNU General Public License (version 2) 25 along with this program; if not, write to the Free Software Foundation, 26 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 28 */ 29 30 #ifndef SYNTHFILTER_H 31 #define SYNTHFILTER_H 32 #include "global.h" 33 #include "EffectLFO.h" 34 35 36 class Synthfilter 37 { 38 public: 39 Synthfilter (float * efxoutl_, float * efxoutr_, double sample_rate); 40 ~Synthfilter (); 41 void out (float * smpsl, float * smpsr, uint32_t period); 42 void setpreset (int npreset); 43 void changepar (int npar, int value); 44 int getpar (int npar); 45 void cleanup (); 46 47 int Ppreset; 48 float outvolume; 49 50 float *efxoutl; 51 float *efxoutr; 52 53 uint32_t PERIOD; 54 55 private: 56 57 //Control parameters 58 void setvolume (int Pvolume); 59 void setdistortion (int Pdistortion); 60 void setwidth (int Pwidth); 61 void setfb (int Pfb); 62 void setdepth (int Pdepth); 63 64 //Phaser parameters 65 int Pvolume; //0//Used in Process.C to set wet/dry mix 66 int Pdistortion; //1//0...127//Model distortion 67 //2//Tempo//LFO frequency 68 //3//0...127//LFO Random 69 //4//0...max types//LFO Type 70 //5//0...127//LFO stereo offset 71 int Pwidth; //6//0...127//Phaser width (LFO amplitude) 72 int Pfb; //7//-64...64//feedback 73 int Plpstages; //8//0...12//Number of first-order Low-Pass stages 74 int Phpstages; //9//0...12//Number of first-order High-Pass stages 75 int Poutsub; //10//0 or 1//subtract the output instead of the adding it 76 int Pdepth; //11//0...127//Depth of phaser sweep 77 int Penvelope; //12//-64...64//envelope sensitivity 78 int Pattack; //13//0...1000ms//Attack Time 79 int Prelease; //14//0...500ms//Release Time 80 int Pbandwidth; //15//0...127//Separate high pass & low pass 81 82 83 84 //Internal Variables 85 float distortion, fb, width, env, envdelta, sns, att, rls, fbl, fbr, depth, bandgain; 86 float *lyn1, *ryn1, *lx1hp, *ly1hp, *rx1hp, *ry1hp; 87 float oldlgain, oldrgain, inv_period; 88 89 float delta; 90 float Rmin; // 2N5457 typical on resistance at Vgs = 0 91 float Rmax; // Resistor parallel to FET 92 float C, Clp, Chp; // Capacitor 93 EffectLFO* lfo; //Filter modulator 94 95 class FPreset *Fpre; 96 97 }; 98 99 #endif 100