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

Filter.hh

Go to the documentation of this file.
00001 /*
00002 
00003     FFT filter
00004     Copyright (C) 1999-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/DSPConfig.hh"
00024 #include "dsp/DSPOp.hh"
00025 #include "dsp/ReBuffer.hh"
00026 
00027 
00028 #ifndef FILTER_HH
00029     #define FILTER_HH
00030 
00031 
00035     enum
00036     {
00037         FILTER_SMOOTH_NONE = 0,
00038         FILTER_SMOOTH_KAISER = 1,
00039         FILTER_SMOOTH_KAISER_BESSEL = 2,
00040         FILTER_SMOOTH_DOLPH_CHEBYSHEV = 3
00041     };
00042 
00047     class clFilter : private clDSPOp
00048     {
00049             bool bInitialized;
00050             long lFFTSize;
00051             long lHalfSize;
00052             long lOldSize;
00053             long lNewSize;
00054             long lSpectPoints;
00055             clDSPAlloc CoeffWin;
00056             clDSPAlloc Prev;
00057             clDSPAlloc Proc;
00058             clDSPAlloc CCoeffs;
00059             clDSPAlloc CProc;
00060             clReBuffer InBuf;
00061             clReBuffer OutBuf;
00068             void InitCoeffsS ();
00070             void InitCoeffsD ();
00078             void ReadyFilterS ();
00080             void ReadyFilterD ();
00091             float GetKaiserBeta (float fAlpha);
00093             double GetKaiserBeta (double dAlpha);
00094         public:
00095             clFilter ();
00096             ~clFilter ();
00107             bool Initialize (long, const float *,
00108                 float = DSP_FILT_DEF_OVERLAPF,
00109                 float = DSP_FILT_DEF_BETAF,
00110                 int = FILTER_SMOOTH_DOLPH_CHEBYSHEV);
00112             bool Initialize (long, const double *,
00113                 double = DSP_FILT_DEF_OVERLAP,
00114                 double = DSP_FILT_DEF_BETA,
00115                 int = FILTER_SMOOTH_DOLPH_CHEBYSHEV);
00117             bool InitFloat (long);
00119             bool InitDouble (long);
00131             bool InitializeLP (float, float, float,
00132                 float = DSP_FILT_DEF_OVERLAPF);
00134             bool InitializeLP (double, double, double,
00135                 double = DSP_FILT_DEF_OVERLAP);
00137             bool InitializeHP (float, float, float,
00138                 float = DSP_FILT_DEF_OVERLAPF);
00140             bool InitializeHP (double, double, double,
00141                 double = DSP_FILT_DEF_OVERLAP);
00145             void Uninitialize ();
00156             void SetCoeffs (const float *);
00158             void SetCoeffs (const double *);
00160             void SetCoeffs (const stpSCplx, bool = false);
00162             void SetCoeffs (const stpDCplx, bool = false);
00170             void GetCoeffs (float *);
00172             void GetCoeffs (double *);
00174             void GetCoeffs (stpSCplx);
00176             void GetCoeffs (stpDCplx);
00184             long GetDelay ();
00196             void Put (const float *, long);
00198             void Put (const double *, long);
00206             void Put (const float *, long, const stpSCplx);
00208             void Put (const double *, long, const stpDCplx);
00216             bool Get (float *, long);
00218             bool Get (double *, long);
00226             void DesignLP (float *, bool = false);
00228             void DesignLP (double *, bool = false);
00230             void DesignLP (float *, float, bool = false);
00232             void DesignLP (double *, double, bool = false);
00236             void DesignHP (float *);
00238             void DesignHP (double *);
00240             void DesignHP (float *, float);
00242             void DesignHP (double *, double);
00250             void DesignBP (float *, float *);
00252             void DesignBP (double *, double *);
00254             void DesignBP (float *, float *, float);
00256             void DesignBP (double *, double *, double);
00260             void DesignBR (float *, float *);
00262             void DesignBR (double *, double *);
00264             void DesignBR (float *, float *, float);
00266             void DesignBR (double *, double *, double);
00267     };
00268 
00269 #endif

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