00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __AIFFFileIO__
00023 #define __AIFFFileIO__
00024
00025 #include "SoundFileIO.hxx"
00026
00027 namespace CLAM{
00028
00030 class AIFFFileIO:public SoundFileIO
00031 {
00032 public:
00033 ~AIFFFileIO()
00034 {
00035 Close();
00036 }
00037 private:
00038 void ReadHeader(void);
00039 void WriteHeader(void);
00040
00041 struct ID {
00042 ID(const char* str = "\0\0\0\0")
00043 {
00044 memcpy(id,str,4);
00045 }
00046 char id[4];
00047 };
00048
00049 struct ChunkHeader {
00050 ChunkHeader()
00051 {
00052 len = 0;
00053 }
00054 ChunkHeader(const ID& _id,int _len = 0):id(_id),len(_len)
00055 {
00056 }
00057 ID id;
00058 unsigned int len;
00059 };
00060 struct extended{
00061 unsigned char bytes[10];
00062 };
00063
00064 #pragma pack (2)
00065
00066 struct AIFFCommChunk
00067 {
00068 short channels;
00069 unsigned int numSampleFrames;
00070 short sampleWidth;
00071 extended samplerate;
00072 };
00073
00074 #pragma pack ()
00075
00076 int ReadChunkHeader(ChunkHeader& h);
00077 int ReadID(ID& id);
00078
00079 int WriteChunkHeader(const ChunkHeader& h);
00080 int WriteID(ID& id);
00081
00082 bool CheckID(const ID& id,const ID& cmp);
00083
00084 void InitSelf(void);
00085 };
00086
00087 };
00088 #endif
00089