Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/AudioSinkBlocking.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2011 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 
00020 #ifndef MARSYAS_AUDIOSINK_BLOCKING_H
00021 #define MARSYAS_AUDIOSINK_BLOCKING_H
00022 
00023 
00024 #include <marsyas/common_header.h>
00025 
00026 #include <marsyas/system/MarSystem.h>
00027 
00028 
00029 
00030 
00031 class RtAudio3;
00032 
00033 
00034 
00035 namespace Marsyas
00036 {
00037 
00038 
00056 class AudioSinkBlocking:public MarSystem
00057 {
00058 private:
00059   RtAudio3 *audio_;
00060 
00061   int bufferSize_;
00062   int rtSrate_;
00063   int rtChannels_;
00064   int srate_;
00065   unsigned int rtDevice_;
00066 
00067   bool isInitialized_;
00068   bool stopped_;
00069 
00070   mrs_natural nChannels_;
00071   mrs_real *data_;
00072   realvec reservoir_;
00073   mrs_natural reservoirSize_;
00074   mrs_natural preservoirSize_;
00075   mrs_natural pnChannels_;
00076 
00077   mrs_natural start_;
00078   mrs_natural end_;
00079   mrs_natural diff_;
00080   mrs_natural rsize_;
00081 
00082   void addControls();
00083   void myUpdate(MarControlPtr sender);
00084 
00085   void initRtAudio();
00086 
00087   void start();
00088   void stop();
00089 
00090   void localActivate(bool state);
00091 
00092 public:
00093   AudioSinkBlocking(std::string name);
00094   ~AudioSinkBlocking();
00095   MarSystem* clone() const;
00096 
00097   void myProcess(realvec& in, realvec& out);
00098 };
00099 
00100 }//namespace Marsyas
00101 
00102 #endif
00103 
00104 
00105 
00106 
00107