Marsyas  0.5.0-beta1
/Users/jleben/code/marsyas/src/marsyas/marsystems/Plucked.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_PLUCKED_H
00020 #define MARSYAS_PLUCKED_H
00021 
00022 
00023 #include <marsyas/system/MarSystem.h>
00024 #include "Gain.h"
00025 
00026 #include <cstdlib>
00027 
00028 namespace Marsyas
00029 {
00040 class Plucked: public MarSystem
00041 {
00042 private:
00043   void addControls();
00044   void myUpdate(MarControlPtr sender);
00045 
00046   realvec delayline1_;
00047   realvec pickDelayLine_;
00048   realvec noise_;
00049 
00050   mrs_real delaylineSize_;
00051   mrs_real a_;
00052   mrs_real b_;
00053   mrs_real blend_;
00054   mrs_real loss_;
00055   mrs_real s_;
00056   mrs_real d_; //the delay of the all pass filter dependant on the freq
00057   mrs_real g_; //coefficient of all pass filter g_=-(1-d)/d+1)
00058   mrs_real c;  //output of inverse comb filt (for pick pos)
00059 
00060   mrs_real nton_;
00061   mrs_bool noteon_;
00062 
00063   mrs_natural wp_;
00064   mrs_natural wpp_;
00065 
00066   mrs_natural rp_;
00067 
00068   // Why do these 'pointers' exist
00069   mrs_natural pointer1_;
00070   mrs_natural pointer2_;
00071   mrs_natural pointer3_;
00072 
00073   mrs_natural picklength_;
00074   mrs_natural N_;
00075   mrs_natural p;
00076   MarSystem* gain_;
00077   realvec gout_;
00078 
00079 public:
00080   Plucked(std::string name);
00081   ~Plucked();
00082   MarSystem* clone() const;
00083 
00084   void myProcess(realvec& in, realvec& out);
00085 };
00086 
00087 }//namespace Marsyas
00088 
00089 #endif