![]() |
Mixxx
|
00001 /*************************************************************************** 00002 * enginefilter.h - Wrapper for FidLib Filter Library * 00003 * ---------------------- * 00004 * copyright : (C) 2007 by John Sully * 00005 * email : jsully@scs.ryerson.ca * 00006 * * 00007 **************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef ENGINEFILTER_H 00019 #define ENGINEFILTER_H 00020 00021 #define MIXXX 00022 #include "engine/engineobject.h" 00023 #include "../lib/fidlib-0.9.9/fidlib.h" 00024 #include "defs.h" 00025 00026 enum filterType{ 00027 FILTER_LOWPASS, 00028 FILTER_BANDPASS, 00029 FILTER_HIGHPASS 00030 }; 00031 00032 #define PREDEF_HP 1 00033 #define PREDEF_BP 2 00034 #define PREDEF_LP 3 00035 00036 class EngineFilter : public EngineObject 00037 { 00038 public: 00039 EngineFilter( char *conf, int predefinedType = 0); 00040 ~EngineFilter(); 00041 void process(const CSAMPLE *pIn, const CSAMPLE *ppOut, const int iBufferSize); 00042 protected: 00043 const double *coefs; 00044 double iir; 00045 double fir; 00046 double tmp; 00047 #define FILTER_BUF_SIZE 16 00048 double buf1[FILTER_BUF_SIZE]; 00049 double buf2[FILTER_BUF_SIZE]; 00050 private: 00051 double (*processSample)(void *buf, const double sample); 00052 00053 FidFilter *ff; 00054 FidFunc *funcp; 00055 FidRun *run; 00056 void *fbuf1; 00057 void *fbuf2; 00058 }; 00059 00060 double processSampleDynamic(void *buf, const double sample); 00061 double processSampleHp(void *buf, const double sample); 00062 double processSampleBp(void *buf, const double sample); 00063 double processSampleLp(void *buf, const double sample); 00064 00065 #endif