00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MARSYAS_WAVFILESOURCE_H
00020 #define MARSYAS_WAVFILESOURCE_H
00021
00022 #include "common_header.h"
00023 #include "AbsSoundFileSource.h"
00024
00025 #include <string>
00026 #include <cstdio>
00027 #include <cstring>
00028
00029 namespace Marsyas
00030 {
00040 class WavFileSource: public AbsSoundFileSource
00041 {
00042 private:
00043 short *sdata_;
00044 unsigned char *cdata_;
00045
00046 FILE *sfp_;
00047 long sfp_begin_;
00048
00049 mrs_natural sampleSize_;
00050 mrs_natural csize_;
00051 mrs_natural size_;
00052 short sval_;
00053 unsigned short bits_;
00054 MarControlPtr ctrl_pos_;
00055
00056 void addControls();
00057 void myUpdate(MarControlPtr sender);
00058 unsigned long ByteSwapLong(unsigned long nLongNumber);
00059 unsigned short ByteSwapShort (unsigned short nValue);
00060
00061 mrs_natural nChannels_;
00062 mrs_natural inSamples_;
00063 mrs_natural samplesToRead_;
00064 mrs_natural samplesRead_;
00065 mrs_natural samplesToWrite_;
00066
00067 mrs_natural nt_;
00068
00069 mrs_natural samplesOut_;
00070
00071 mrs_real repetitions_;
00072 mrs_real duration_;
00073
00074 mrs_natural getLinear16(realvec& win);
00075 mrs_natural getLinear8(realvec& win);
00076
00077
00078 public:
00079 WavFileSource(std::string name);
00080 WavFileSource(const WavFileSource& a);
00081
00082 ~WavFileSource();
00083 MarSystem* clone() const;
00084
00085
00086 void getHeader(std::string filename);
00087 void myProcess(realvec& in, realvec &out);
00088 };
00089
00090 }
00091
00092
00093 #endif