Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/SoundFileSource.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_SOUNDFILESOURCE_H
00020 #define MARSYAS_SOUNDFILESOURCE_H
00021 
00022 #include <marsyas/realvec.h>
00023 #include "AuFileSource.h"
00024 #include "WavFileSource.h"
00025 #include "RawFileSource.h"
00026 
00027 #include "CollectionFileSource.h"
00028 
00029 #include <cstdio>
00030 #include <cmath>
00031 
00032 namespace Marsyas
00033 {
00088 class SoundFileSource: public MarSystem
00089 {
00090 private:
00091   std::string filename_;
00092   mrs_natural sampleSize_; //in bytes
00093   mrs_natural samplesRead_;
00094   mrs_natural samplesToRead_;
00095   mrs_natural nChannels_;
00096 
00097   MarControlPtr ctrl_pos_;
00098   MarControlPtr ctrl_loop_;
00099   MarControlPtr ctrl_hasData_;
00100   MarControlPtr ctrl_lastTickWithData_;
00101   MarControlPtr ctrl_mute_;
00102   MarControlPtr ctrl_advance_;
00103   MarControlPtr ctrl_filename_;
00104   MarControlPtr ctrl_currentlyPlaying_;
00105   MarControlPtr ctrl_previouslyPlaying_;
00106   MarControlPtr ctrl_regression_;
00107   MarControlPtr ctrl_currentLabel_;
00108   MarControlPtr ctrl_previousLabel_;
00109   MarControlPtr ctrl_nLabels_;
00110   MarControlPtr ctrl_labelNames_;
00111   MarControlPtr ctrl_currentHasData_;
00112   MarControlPtr ctrl_currentLastTickWithData_;
00113   MarControlPtr ctrl_currentCollectionNewFile_;
00114   MarControlPtr ctrl_startStable_;
00115 
00116   MarControlPtr ctrl_rewindToPos_;
00117 
00118   AbsSoundFileSource* backend_;
00119 
00120   mrs_natural advance_;
00121   std::string file_extension_;
00122 
00123 
00124   void addControls();
00125   void myUpdate(MarControlPtr sender);
00126 
00127   bool updateCurrDuration;
00128 
00129   void clearBackend();
00130 
00131 public:
00132 
00133   SoundFileSource(std::string name);
00134   SoundFileSource(const SoundFileSource& a);
00135 
00136   ~SoundFileSource();
00137   MarSystem* clone() const;
00138 
00139   virtual void myProcess(realvec& in,realvec& out);
00140   virtual bool updateBackend();
00141   virtual void getHeader();
00142 
00143 };
00144 
00145 }//namespace Marsyas
00146 
00147 #endif /* !MARSYAS_SOUNDFILESOURCE_H */