Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2010 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MARSYAS_LYONEAR_H 00020 #define MARSYAS_LYONEAR_H 00021 00022 #include <marsyas/system/MarSystem.h> 00023 00024 namespace Marsyas 00025 { 00026 class Series; 00027 class Filter; 00028 00063 class LyonPassiveEar: public MarSystem 00064 { 00065 private: 00066 void addControls(); 00067 void myUpdate(MarControlPtr sender); 00068 00069 mrs_bool setParametersIntern (); 00070 void updateControlsIntern (); 00071 static mrs_realvec lyonSecondOrderFilter (mrs_real midFreq, mrs_real q, mrs_real sRate); 00072 static mrs_real lyonFreqResp (mrs_realvec firCoeffs, mrs_realvec iirCoeffs, mrs_real freq, mrs_real sRate, mrs_bool inDb = true); 00073 static mrs_real lyonSetGain (mrs_realvec firCoeffs, mrs_realvec iirCoeffs, mrs_real newGain, mrs_real freq, mrs_real sRate); 00074 static Filter* lyonCreateFilter (mrs_realvec firCoeffs, mrs_realvec iirCoeffs, mrs_string name); 00075 00076 // control parameters 00077 mrs_real fs_; 00078 00079 mrs_natural decimFactor_; 00080 mrs_real earQ_; 00081 mrs_real stepFactor_; 00082 mrs_bool channelDiffActive_; 00083 mrs_bool agcActive_; 00084 mrs_real decimTauFactor_; 00085 00086 mrs_realvec centerFreqs_, 00087 tmpOut_, 00088 decimOut_; 00089 00090 //internal variables and parameters 00091 mrs_natural currDecimState_; 00092 unsigned int numFilterChannels_; 00093 00094 00096 Series *passiveEar_; 00097 00098 public: 00099 LyonPassiveEar(std::string name); 00100 ~LyonPassiveEar(); 00101 00102 MarSystem* clone() const; 00103 00104 void myProcess(realvec& in, realvec& out); 00105 }; 00106 00107 }//namespace Marsyas 00108 00109 #endif // MARSYAS_LYONEAR_H 00110