Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

IIRCascade.cc

Go to the documentation of this file.
00001 /*
00002 
00003     Cascaded IIR stages
00004     Copyright (C) 2002 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #include "dsp/IIRCascade.hh"
00024 
00025 
00026 clIIRCascade::clIIRCascade ()
00027 {
00028     bInitialized = false;
00029     lStages = 0;
00030     IIR = NULL;
00031 }
00032 
00033 
00034 clIIRCascade::~clIIRCascade ()
00035 {
00036     if (bInitialized)
00037         Uninitialize();
00038 }
00039 
00040 
00041 bool clIIRCascade::Initialize (const float fppCoeffs[][5], long lStageCount)
00042 {
00043     long lStageCntr;
00044 
00045     if (bInitialized) Uninitialize();
00046     lStages = lStageCount;
00047     IIR = new clDSPOp[lStages];
00048     if (IIR == NULL)
00049         return false;
00050     for (lStageCntr = 0; lStageCntr < lStages; lStageCntr++)
00051         IIR[lStageCntr].IIRInitialize(fppCoeffs[lStageCntr]);
00052     return true;
00053 }
00054 
00055 
00056 bool clIIRCascade::Initialize (const double dppCoeffs[][5], long lStageCount)
00057 {
00058     long lStageCntr;
00059 
00060     if (bInitialized) Uninitialize();
00061     lStages = lStageCount;
00062     IIR = new clDSPOp[lStages];
00063     if (IIR == NULL)
00064         return false;
00065     for (lStageCntr = 0; lStageCntr < lStages; lStageCntr++)
00066         IIR[lStageCntr].IIRInitialize(dppCoeffs[lStageCntr]);
00067     return true;
00068 }
00069 
00070 
00071 void clIIRCascade::Uninitialize ()
00072 {
00073     if (IIR != NULL)
00074     {
00075         delete [] IIR;
00076         IIR = NULL;
00077     }
00078     lStages = 0;
00079     bInitialized = false;
00080 }
00081 
00082 
00083 void clIIRCascade::Process (float *fpVect, long lCount)
00084 {
00085     long lStageCntr;
00086     
00087     for (lStageCntr = 0; lStageCntr < lStages; lStageCntr++)
00088         IIR[lStageCntr].IIRFilter(fpVect, lCount);
00089 }
00090 
00091 
00092 void clIIRCascade::Process (double *dpVect, long lCount)
00093 {
00094     long lStageCntr;
00095     
00096     for (lStageCntr = 0; lStageCntr < lStages; lStageCntr++)
00097         IIR[lStageCntr].IIRFilter(dpVect, lCount);
00098 }
00099 
00100 
00101 void clIIRCascade::Process (float *fpDest, const float *fpSrc, long lCount)
00102 {
00103     long lStageCntr;
00104     
00105     IIR[0].IIRFilter(fpDest, fpSrc, lCount);
00106     for (lStageCntr = 1; lStageCntr < lStages; lStageCntr++)
00107         IIR[lStageCntr].IIRFilter(fpDest, lCount);
00108 }
00109 
00110 
00111 void clIIRCascade::Process (double *dpDest, const double *dpSrc, long lCount)
00112 {
00113     long lStageCntr;
00114     
00115     IIR[0].IIRFilter(dpDest, dpSrc, lCount);
00116     for (lStageCntr = 1; lStageCntr < lStages; lStageCntr++)
00117         IIR[lStageCntr].IIRFilter(dpDest, lCount);
00118 }
00119 
00120 
00121 void clIIRCascade::Clear ()
00122 {
00123     long lStageCntr;
00124     
00125     for (lStageCntr = 0; lStageCntr < lStages; lStageCntr++)
00126         IIR[lStageCntr].IIRClear();
00127 }

Generated on Tue Mar 2 19:46:45 2004 for libDSP by doxygen 1.3.6