Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/AimGammatone.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2006 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_AIMGAMMATONE_H
00020 #define MARSYAS_AIMGAMMATONE_H
00021 
00022 #include <marsyas/system/MarSystem.h>
00023 
00024 // sness - TODO - Eventually make these realvecs.  However, in the
00025 // existing code there is quite a bit of stuff that involves STL
00026 // methods, so I thought it would be safer to use STL for now.
00027 #include <vector>
00028 
00029 namespace Marsyas
00030 {
00054 class marsyas_EXPORT AimGammatone: public MarSystem
00055 {
00056 private:
00057   void myUpdate(MarControlPtr sender);
00058 
00059   // Parameters
00060   MarControlPtr ctrl_num_channels_;
00061   MarControlPtr ctrl_max_frequency_;
00062   MarControlPtr ctrl_min_frequency_;
00063 
00064   // Filter coefficients
00065   std::vector<std::vector<double> > b1_;
00066   std::vector<std::vector<double> > b2_;
00067   std::vector<std::vector<double> > b3_;
00068   std::vector<std::vector<double> > b4_;
00069   std::vector<std::vector<double> > a_;
00070 
00071   std::vector<std::vector<double> > state_1_;
00072   std::vector<std::vector<double> > state_2_;
00073   std::vector<std::vector<double> > state_3_;
00074   std::vector<std::vector<double> > state_4_;
00075 
00076   std::vector<double> centre_frequencies_;
00077 
00078   // Reset all internal state variables to their initial values
00079   void ResetInternal();
00080 
00081   // Prepare the module
00082   bool InitializeInternal();
00083 
00084   // Does the MarSystem need initialization?
00085   bool is_initialized;
00086 
00087   // What changes cause it to need initialization?
00088   mrs_natural initialized_num_channels;
00089   mrs_real initialized_min_frequency;
00090   mrs_real initialized_max_frequency;
00091   mrs_real initialized_israte;
00092 
00093   // Does the MarSystem need reset?
00094   bool is_reset;
00095 
00096   // What changes cause it to need a reset?
00097   mrs_natural reset_num_channels;
00098 
00099 public:
00100   AimGammatone(std::string name);
00101   AimGammatone(const AimGammatone& a);
00102 
00103   ~AimGammatone();
00104   MarSystem* clone() const;
00105   void addControls();
00106 
00107   void myProcess(realvec& in, realvec& out);
00108 };
00109 
00110 }//namespace marsyas
00111 
00112 #endif