AudioFile.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-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 __AUDIOFILE__
00023 #define __AUDIOFILE__
00024 
00025 #include "DataTypes.hxx"
00026 #include "AudioFileFormats.hxx"
00027 #include "AudioFileHeader.hxx"
00028 #include "AudioTextDescriptors.hxx"
00029 #include "Filename.hxx"
00030 
00031 namespace CLAM
00032 {
00033         namespace AudioCodecs
00034         {
00035                 class Codec;       // forward declaration
00036                 class Stream; // forward declaration
00037         }
00038 
00040         class AudioFile
00041         {
00042         public:
00043 
00044                 AudioFile();
00045                 AudioFile( const AudioFile& );
00046                 const AudioFile& operator=( const AudioFile& );
00047                 virtual ~AudioFile();
00048 
00049                 const Filename & GetLocation() const { return mLocation; }
00050                 const AudioFileHeader & GetHeader() const { return mHeaderData; }
00051                 const AudioTextDescriptors &   GetTextDescriptors() const { return mTextDescriptors; }
00052                 AudioTextDescriptors & GetTextDescriptors() { return mTextDescriptors; }
00053 
00054                 void SetTextDescriptors( const AudioTextDescriptors & descriptors ) { mTextDescriptors=descriptors; }
00055 
00056                 EAudioFileCodec                GetCodec() const;
00057 
00058                 bool                          IsValid() const;
00059                 bool                          IsReadable() const;
00060                 bool                          IsWritable() const;
00061 
00062                 AudioCodecs::Stream*   GetStream();
00063 
00064         protected:
00066                 bool SetHeader( const AudioFileHeader& );
00067                 void ResolveCodec();
00068 
00069                 void ActivateCodec();
00070                 void ResetHeaderData();
00071 
00072                 Filename mLocation;
00073                 EAudioFileCodec        mCodec;
00074         private:
00075                 AudioCodecs::Codec*   mActiveCodec;
00076                 AudioFileHeader       mHeaderData;
00077                 AudioTextDescriptors  mTextDescriptors;
00078 
00079         };
00080 
00081         class AudioFileSource : public AudioFile
00082         {
00083         public:
00084                 void OpenExisting(const std::string &location);
00085         };
00086 
00087         class AudioFileTarget : public AudioFile
00088         {
00089         public:
00090                 bool CreateNew(const std::string &location,
00091                                 const AudioFileHeader &header);
00092         };
00093 
00094 
00095 }
00096 
00097 
00098 
00099 
00100 #endif // AudioFile.hxx
00101 
Generated by  doxygen 1.6.3