Marsyas
0.6.0-alpha
|
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_AUFILESOURCE_H 00020 #define MARSYAS_AUFILESOURCE_H 00021 00022 #include "AbsSoundFileSource.h" 00023 00024 00025 #include <string> 00026 #include <vector> 00027 00028 namespace Marsyas 00029 { 00040 struct snd_header; 00041 00042 00043 class AuFileSource: public AbsSoundFileSource 00044 { 00045 00046 private: 00047 snd_header* hdr_; 00048 std::string tfname_; 00049 std::string filename_; 00050 00051 short *sdata_; 00052 short sval_; 00053 unsigned short usval_; 00054 00055 unsigned char *cdata_; 00056 FILE *sfp_; 00057 long sfp_begin_; 00058 00059 mrs_natural sampleSize_;// in bytes 00060 mrs_natural size_; 00061 mrs_natural csize_; 00062 00063 mrs_natural samplesOut_; 00064 00065 std::vector<std::string> sndFormats_; 00066 std::vector<int> sndFormatSizes_; 00067 00068 mrs_natural nChannels_; 00069 mrs_natural samplesToRead_; 00070 mrs_natural samplesToWrite_; 00071 mrs_natural samplesRead_; 00072 00073 mrs_real duration_; 00074 mrs_natural advance_; 00075 mrs_natural cindex_; 00076 mrs_natural nt_; 00077 00078 mrs_real repetitions_; 00079 00080 unsigned long ByteSwapLong(unsigned long nLongNumber); 00081 unsigned short ByteSwapShort (unsigned short nValue); 00082 00083 void addControls(); 00084 void myUpdate(MarControlPtr sender); 00085 00086 MarControlPtr ctrl_size_; 00087 MarControlPtr ctrl_pos_; 00088 00089 00090 public: 00091 AuFileSource(std::string name); 00092 AuFileSource(const AuFileSource& a); 00093 ~AuFileSource(); 00094 MarSystem* clone() const; 00095 00096 void getHeader(std::string filename); 00097 mrs_natural getLinear16(realvec& win); 00098 00099 void myProcess(realvec& in,realvec &out); 00100 00101 }; 00102 00103 }//namespace Marsyas 00104 00105 #endif /* !MARSYAS_AUFILESOURCE_H */ 00106 00107