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