00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MARSYAS_MP3FILESINK_H
00020 #define MARSYAS_MP3FILESINK_H
00021
00022 #include "common_header.h"
00023 #include "SoundFileSink.h"
00024 #include "FileName.h"
00025 #include "AbsSoundFileSink.h"
00026
00027 #ifdef MARSYAS_LAME
00028 #include "lame/lame.h"
00029 #endif
00030
00031 namespace Marsyas
00032 {
00041 class MP3FileSink: public AbsSoundFileSink
00042 {
00043 private:
00044 unsigned long written_;
00045 long fpos_;
00046
00047 #ifdef MARSYAS_LAME
00048 lame_global_flags *gfp_;
00049 #endif
00050 unsigned char *mp3Buffer_;
00051 short int *leftpcm_;
00052 short int *rightpcm_;
00053
00054 std::string filename_;
00055 FILE *sfp_;
00056 long sfp_begin_;
00057 mrs_natural nChannels_;
00058
00059 unsigned long ByteSwapLong(unsigned long nLongNumber);
00060 unsigned short ByteSwapShort (unsigned short nValue);
00061
00062 void addControls();
00063 void myUpdate(MarControlPtr sender);
00064
00065 public:
00066 MP3FileSink(std::string name);
00067 ~MP3FileSink();
00068 MarSystem* clone() const;
00069
00070 void putHeader(std::string filename);
00071 bool checkExtension(std::string filename);
00072 void myProcess(realvec& in, realvec& out);
00073 };
00074
00075 }
00076
00077 #endif
00078
00079
00080
00081
00082