Marsyas  0.5.0-beta1
/Users/jleben/code/marsyas/src/marsyas/marsystems/SimulMaskingFft.h
Go to the documentation of this file.
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_SimulMaskingFft_H
00020 #define MARSYAS_SimulMaskingFft_H
00021 
00022 #include <marsyas/system/MarSystem.h>
00023 
00024 namespace Marsyas
00025 {
00042 class SimulMaskingFft: public MarSystem
00043 {
00044 private:
00045   //Add specific controls needed by this MarSystem.
00046   void addControls();
00047   MarControlPtr ctrl_SimulMaskingFft_;
00048   void myUpdate(MarControlPtr sender);
00049 
00050   struct FrequencyBands_t
00051   {
00052     mrs_real    fLowFreqBound,
00053                 fUpFreqBound,
00054                 fMidFreq,
00055                 fLowBarkBound,
00056                 fUpBarkBound,
00057                 fMidBark;
00058   };
00059 
00060   void GetBandLevels (FrequencyBands_t *pFrequencyValues, mrs_realvec &bandLevels, mrs_bool bDezibel);
00061   void CalcSpreading (mrs_realvec &bandLevels, mrs_realvec &result);
00062   void ComputeTables ();
00063   void ComputeDifference (mrs_realvec &out, mrs_realvec &in, mrs_natural t);
00064 
00065   mrs_real  normFactor_,
00066             audiosrate_,
00067             barkRes_;
00068   mrs_natural   numBands_;
00069   mrs_realvec processBuff_,
00070               barkSpec_,
00071               excPattern_,
00072               helpBuff_,
00073               outerEar_,
00074               maskingThresh_,
00075               intNoise_,
00076               slopeSpread_,
00077               normSpread_;
00078   FrequencyBands_t  *freqBounds_;
00079 public:
00080   SimulMaskingFft(std::string name);
00081   SimulMaskingFft(const SimulMaskingFft& a);
00082   ~SimulMaskingFft();
00083   MarSystem* clone() const;
00084 
00085   void myProcess(realvec& in, realvec& out);
00086 };
00087 
00088 }//namespace Marsyas
00089 
00090 #endif