Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/BeatTimesSink.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_BEATTIMESSINK_H
00020 #define MARSYAS_BEATTIMESSINK_H
00021 
00022 //sockets only available in Windows
00023 #ifdef _WIN32
00024 #include <windows.h>
00025 #endif
00026 
00027 #include <marsyas/system/MarSystem.h>
00028 
00029 namespace Marsyas
00030 {
00050 class BeatTimesSink: public MarSystem
00051 {
00052 private:
00053   //Add specific controls needed by this MarSystem.
00054   void addControls();
00055   MarControlPtr ctrl_hopSize_;
00056   MarControlPtr ctrl_winSize_;
00057   MarControlPtr ctrl_srcFs_;
00058   MarControlPtr ctrl_destFileName_;
00059   MarControlPtr ctrl_mode_;
00060   MarControlPtr ctrl_tickCount_;
00061   MarControlPtr ctrl_curMedianTempo_;
00062   MarControlPtr ctrl_adjustment_;
00063   MarControlPtr ctrl_bestFinalAgentHistory_;
00064   MarControlPtr ctrl_soundFileSize_;
00065   MarControlPtr ctrl_nonCausal_;
00066   MarControlPtr ctrl_socketsPort_;
00067   MarControlPtr ctrl_tempo_;
00068 
00069   mrs_real beatTimeTmp_;
00070   mrs_real lastIbi_;
00071   mrs_natural soundFileSize_;
00072   mrs_bool nonCausal_;
00073   mrs_realvec bestFinalAgentHistory_;
00074   mrs_realvec ibiBPMVec_;
00075   mrs_natural inc_;
00076   mrs_string destFile_;
00077   mrs_string destFile2_;
00078   mrs_string destFile3_;
00079   mrs_string mode_;
00080   mrs_real lastBeatTime_;
00081   mrs_real ibiBPM_;
00082   mrs_bool initialOut_;
00083   mrs_bool initialOut2_;
00084   mrs_bool initialOut3_;
00085   mrs_real beatTime_;
00086   mrs_real srcFs_;
00087   mrs_real adjustment_;
00088   mrs_natural hopSize_;
00089   mrs_natural winSize_;
00090   mrs_natural timeElapsed_;
00091   mrs_real ibiBPMSum_;
00092   mrs_natural beatCount_;
00093   std::vector <mrs_real> tempoVec_;
00094 
00095   mrs_natural socketsPort_;
00096   // SOCKET mySocket_, myAcceptSocket_;
00097   mrs_real *data_;
00098 
00099   void myUpdate(MarControlPtr sender);
00100 
00101 public:
00102   BeatTimesSink(std::string name);
00103   BeatTimesSink(const BeatTimesSink& a);
00104   ~BeatTimesSink();
00105   MarSystem* clone() const;
00106 
00107   void myProcess(realvec& in, realvec& out);
00108   mrs_realvec addMedianVector(mrs_real ibiBPM);
00109   mrs_natural refreshSocket();
00110 };
00111 
00112 }//namespace Marsyas
00113 
00114 #endif