1 /* 2 * Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com. 3 * All rights reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 7 #ifndef __EQUALIZER_H__ 8 #define __EQUALIZER_H__ 9 10 #define MAX_CHANNELS 8 11 #define EQ_BANDS 10 12 13 class Equalizer { 14 public: 15 Equalizer(); 16 ~Equalizer(); 17 void SetFormat(int channels, float framerate); 18 void SetPreAmp(double); 19 double PreAmp(void); 20 void SetBand(int band, double value); 21 double Band(int band); 22 int BandCount(void); 23 float BandFrequency(int band); 24 void ProcessBuffer(float *buffer, int samples); 25 void CleanUp(); 26 private: 27 void RecalcGains(void); 28 void BandPassFilterCalcs(float *a, float *b, float f); 29 30 bool fActivated; 31 int fChannels; 32 float fRate; 33 int fActiveBands; 34 35 float fAWeights[EQ_BANDS][2]; 36 float fBWeights[EQ_BANDS][2]; 37 float fWDataVector[MAX_CHANNELS][EQ_BANDS][2]; 38 float fGainVector[MAX_CHANNELS][EQ_BANDS]; 39 float fFrequency[EQ_BANDS]; 40 41 double fBands[EQ_BANDS]; 42 double fPreAmp; 43 44 }; 45 46 #endif //__EQUALIZER_H__ 47