AIFFFileIO.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 };//CLAM
00088 #endif
00089 

Generated on Tue Jun 19 20:34:52 2007 for CLAM-Development by  doxygen 1.5.2