00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __AUDIOFILEFORMATS__
00023 #define __AUDIOFILEFORMATS__
00024
00025 #if USE_SNDFILE != 1
00026 #error USE_SNDFILE was not set to 1 in your settings.cfg file, but you are including files that require this. Please fix your settings.cfg
00027 #endif
00028
00029 #include <sndfile.h>
00030 #include "Enum.hxx"
00031 #include <string>
00032 #include <list>
00033 #include <utility>
00034
00035 namespace CLAM
00036 {
00037
00039 class EAudioFileCodec : public Enum
00040 {
00041 public:
00042 EAudioFileCodec() : Enum(EnumValues(), DefaultValue()) {}
00043 EAudioFileCodec( tValue val ) : Enum(EnumValues(), val) {}
00044 EAudioFileCodec( std::string s ) : Enum(EnumValues(), s) {}
00045 virtual Component* Species() const { return new EAudioFileCodec; }
00046
00047 enum {
00048 ePCM,
00049 eOggVorbis,
00050 eMpeg,
00051 eUnknown
00052 } tEnum;
00053
00054 static tValue DefaultValue() { return ePCM; }
00055 static tEnumValue * EnumValues()
00056 {
00057 static tEnumValue sEnumValues[] = {
00058 { ePCM, "PCM" },
00059 { eOggVorbis, "Ogg/Vorbis" },
00060 { eMpeg, "Mpeg Audio" },
00061 { eUnknown, "Unknown" },
00062 { 0, NULL }
00063 };
00064 return sEnumValues;
00065 }
00066
00067 };
00068
00070 class EAudioFileFormat : public Enum
00071 {
00072 public:
00073 EAudioFileFormat() : Enum(EnumValues(), DefaultValue()) {}
00074 EAudioFileFormat( tValue val ) : Enum(EnumValues(), val) {}
00075 EAudioFileFormat( std::string s ) : Enum(EnumValues(), s) {}
00076 virtual Component* Species() const { return new EAudioFileFormat; }
00077
00078 enum
00079 {
00080 eWAV = SF_FORMAT_WAV,
00081 eAIFF = SF_FORMAT_AIFF,
00082 eAU = SF_FORMAT_AU,
00083 eRAW = SF_FORMAT_RAW,
00084 ePAF = SF_FORMAT_PAF,
00085 eSVX = SF_FORMAT_SVX,
00086 eNIST = SF_FORMAT_NIST,
00087 eVOC = SF_FORMAT_VOC,
00088 eIRCAM = SF_FORMAT_IRCAM,
00089 eW64 = SF_FORMAT_W64,
00090 eMAT4 = SF_FORMAT_MAT4,
00091 eMAT5 = SF_FORMAT_MAT5,
00092 eVorbisMk1 = 1000 + SF_FORMAT_MAT5,
00093 eMpegLayer1 = 1001 + SF_FORMAT_MAT5,
00094 eMpegLayer2 = 1002 + SF_FORMAT_MAT5,
00095 eMpegLayer3 = 1003 + SF_FORMAT_MAT5
00096 };
00097
00098 static tValue DefaultValue() { return eWAV; }
00099 static tEnumValue * EnumValues()
00100 {
00101 static tEnumValue sEnumValues[] = {
00102 { eWAV, "WAV" },
00103 { eAIFF, "AIFF" },
00104 { eAU, "AU" },
00105 { eRAW, "RAW" },
00106 { ePAF, "PAF" },
00107 { eSVX, "SVX" },
00108 { eNIST, "NIST" },
00109 { eVOC, "VOC" },
00110 { eIRCAM, "IRCAM" },
00111 { eW64, "W64" },
00112 { eMAT4, "MAT4" },
00113 { eMAT5, "MAT5" },
00114 { eVorbisMk1, "VorbisMk1"},
00115 { eMpegLayer1, "Mpeg Audio Layer 1"},
00116 { eMpegLayer2, "Mpeg Audio Layer 2"},
00117 { eMpegLayer3, "Mpeg Audio Layer 3"},
00118 { 0, 0 }
00119 };
00120 return sEnumValues;
00121 }
00122
00123 public:
00124
00125 static EAudioFileFormat FormatFromFilename( std::string filename );
00126
00127 };
00128
00130 class EAudioFileEncoding : public Enum
00131 {
00132 public:
00133 EAudioFileEncoding() : Enum(EnumValues(), DefaultValue()) {}
00134 EAudioFileEncoding( tValue val ) : Enum(EnumValues(), val) {}
00135 EAudioFileEncoding( std::string s ) : Enum(EnumValues(), s) {}
00136 virtual Component* Species() const { return new EAudioFileEncoding; }
00137
00138 enum
00139 {
00140 ePCM_S8 = SF_FORMAT_PCM_S8,
00141 ePCM_16 = SF_FORMAT_PCM_16,
00142 ePCM_24 = SF_FORMAT_PCM_24,
00143 ePCM_32 = SF_FORMAT_PCM_32,
00144 ePCM_U8 = SF_FORMAT_PCM_U8,
00145 eFLOAT = SF_FORMAT_FLOAT,
00146 eDOUBLE = SF_FORMAT_DOUBLE,
00147 eU_LAW = SF_FORMAT_ULAW,
00148 eA_LAW = SF_FORMAT_ALAW,
00149 eIMA_ADPCM = SF_FORMAT_IMA_ADPCM,
00150 eMS_ADPCM = SF_FORMAT_MS_ADPCM,
00151 eGSM610 = SF_FORMAT_GSM610,
00152 eVOX_ADPCM = SF_FORMAT_VOX_ADPCM,
00153 eG721_32 = SF_FORMAT_G721_32,
00154 eG723_24 = SF_FORMAT_G723_24,
00155 eG723_40 = SF_FORMAT_G723_40,
00156 eDWVW_12 = SF_FORMAT_DWVW_12,
00157 eDWVW_16 = SF_FORMAT_DWVW_16,
00158 eDWVW_24 = SF_FORMAT_DWVW_24,
00159 eDWVW_N = SF_FORMAT_DWVW_N,
00160 eDefault = 1000 + SF_FORMAT_DWVW_N,
00161 e5015US = 1001 + SF_FORMAT_DWVW_N,
00162 eCCITTJ17 = 1002 + SF_FORMAT_DWVW_N
00163 };
00164 static tValue DefaultValue() { return ePCM_16; }
00165 static tEnumValue * EnumValues()
00166 {
00167 static tEnumValue sEnumValues[] = {
00168 { ePCM_S8, "signed 8-bit" },
00169 { ePCM_16, "signed 16-bit" },
00170 { ePCM_24, "signed 24-bit" },
00171 { ePCM_32, "signed 32-bit" },
00172 { ePCM_U8, "unsigned 8-bit" },
00173 { eFLOAT, "float 32-bit"},
00174 { eDOUBLE, "float 64-bit"},
00175 { eU_LAW, "u-law"},
00176 { eA_LAW, "a-law"},
00177 { eIMA_ADPCM, "IMA ADPCM" },
00178 { eMS_ADPCM, "MS ADPCM "},
00179 { eGSM610, "GSM 6.10"},
00180 { eVOX_ADPCM, "Oki ADPCM"},
00181 { eG721_32, "32k G721 ADPCM"},
00182 { eG723_24, "24k G723 ADPCM"},
00183 { eG723_40, "40k G723 ADPCM"},
00184 { eDWVW_12, "DWVW 12-bit"},
00185 { eDWVW_16, "DWVW 16-bit"},
00186 { eDWVW_24, "DWVW 24-bit"},
00187 { eDWVW_N, "DWVW N-bit"},
00188 { eDefault, "Format Default"},
00189 { e5015US, "Emphasis 50/15 US"},
00190 { eCCITTJ17, "Emphasis CCITT J.17"},
00191 { 0, NULL }
00192 };
00193 return sEnumValues;
00194 }
00195 };
00196
00198 class EAudioFileEndianess : public Enum
00199 {
00200 public:
00201 EAudioFileEndianess() : Enum(EnumValues(), DefaultValue()) {}
00202 EAudioFileEndianess( tValue val ) : Enum(EnumValues(), val) {}
00203 EAudioFileEndianess( std::string s ) : Enum(EnumValues(), s) {}
00204 virtual Component* Species() const { return new EAudioFileEndianess; }
00205
00206 enum
00207 {
00208 eDefault = SF_ENDIAN_FILE,
00209 eLittle = SF_ENDIAN_LITTLE,
00210 eBig = SF_ENDIAN_BIG,
00211 eHost = SF_ENDIAN_CPU
00212 };
00213 static tValue DefaultValue() { return eDefault; }
00214 static tEnumValue * EnumValues()
00215 {
00216 static tEnumValue sEnumValues[] = {
00217 { eDefault, "Format Default" },
00218 { eLittle, "Little Endian"},
00219 { eBig, "Big Endian"},
00220 { eHost, "Host CPU Endianess"},
00221 { 0, NULL }
00222 };
00223 return sEnumValues;
00224 }
00225 };
00226
00227 }
00228
00229 #endif // AudioFileFormats.hxx
00230