logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

filters.h

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 
00008 
00009 // Visual C++ compiler warnings: 255 char limit on var names.....
00010 #pragma warning(disable: 4786)
00011 
00012 #ifndef __filters__
00013 #define __filters__
00014 
00015 #include "Modules.h"
00016 #include "input.h"
00017 #include "output.h"
00018 #include "sndutils.h"
00019 #include <string>
00020 
00021 namespace SynthCore {
00022 
00023 class Module;
00024 
00026 
00032 class BiQuad : public Module {
00033         
00034         private:
00035 
00037         int UpdateCounter;
00038 
00039         
00040         public:
00041 
00043         bool HACK;
00044         
00046         float rez;  
00048         float freq;
00049         
00050         enum {lowpass,highpass,notch,bandpass2,bandpass1,allpass,highShelf,lowShelf,peakingEQ,bypass};
00051                 
00053         int filterType;
00054 
00056         virtual std::string getName() {return "BIQUAD";}
00057         
00059         float dry;
00060         
00062         Output * Output1;
00063 
00065         Input * Input1;
00066 
00068         Input * FreqInput;
00069 
00073         Input * RezInput;
00074         
00076         BiFilter * myFilter;
00077         
00079         BiFilter * myFilter2;
00080         
00082         static Module * newInstance(SynthVoice * S1) ;
00083 
00084 
00087         virtual Module * sharedClone() ;
00088 
00089 
00091         BiQuad(SynthVoice * S1) ; 
00092         
00094         ~BiQuad(); 
00095 
00097         void update() ;
00098 
00100         void setDry(float s);
00101 
00103         void setFreqAndRez(float frequence, float resonance);
00104         
00108         void updateFreqAndRez();
00109 
00110         std::string getXML(int indent = 0) ;
00111 
00113         void loadXML(XMLNode * n, bool firstPass);
00114 };
00115 
00116 
00117 // -----------------------------------------------------------------------------
00118 
00119 /*
00120 class allpass : public Module {
00121         // This is a third order all pass filter.
00122         private:
00123 
00124         
00125         float fx,fy,z1x,z1y,plx,ply,a0,a1,a2,b1,b2,p1x,p1y;
00126         float output1,output2,output3,input1,input2,input3;
00127                   
00128         public:
00129         float dry;
00130         virtual std::string getName() {return "ALLPASS";}
00131         
00132                 
00133         // Mono Module
00134         Output * Output1;
00135         Input * Input1;
00136 
00137         // Constructor
00138         allpass(SynthVoice * S1) ; // We Need a pointer to Global Sample Step.
00139         
00140         // Destructor;
00141         ~allpass() {
00142                 delete Output1;
00143                 delete Input1;
00144         };
00145 
00146         // Actual Code;
00147         void update() ;
00148         void setFreqAndRez(float rez, float freq);
00149 };
00150 
00151 // -----------------------------------------------------------------------------
00152 
00153 
00154 
00155 class comb : public Module {
00156         // Comb filter.
00157         private:
00158     float * bufferStart, * bufferEnd, * readPtr;
00159                 
00160         public:
00161         virtual std::string getName() {return "Comb";}
00162         
00163                 
00164         float dry;
00165         float feedback;
00166         float output1; 
00167         
00168         // Mono Module
00169         Output * Output1;
00170         Input * Input1;
00171 
00172         // Constructor
00173         comb(SynthVoice * S1) ; 
00174         
00175         // Destructor;
00176         ~comb() ;
00177 
00178         // Actual Code;
00179         void update() ; 
00180 };
00181 */
00182 
00183 }; // end of namespace: SynthCore
00184 
00185 #endif
00186   

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen