00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_AUDIO_SOUNDLOADER_H__
00009 #define __SP_AUDIO_SOUNDLOADER_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "Base/spBaseFileFormatHandler.hpp"
00014
00015 #include <boost/shared_ptr.hpp>
00016
00017
00018 namespace sp
00019 {
00020 namespace audio
00021 {
00022
00023
00025 enum EWaveBufferFormats
00026 {
00027 WAVEFORMAT_PCM = 0x0001,
00028 WAVEFORMAT_MS_ADPCM = 0x0002,
00029 WAVEFORMAT_IEEE_FLOAT = 0x0003,
00030 WAVEFORMAT_IBM_CVSD = 0x0005,
00031 WAVEFORMAT_ALAW = 0x0006,
00032 WAVEFORMAT_MULAW = 0x0007,
00033 WAVEFORMAT_OKI_ADPCM = 0x0010,
00034 WAVEFORMAT_DVI_IMA_ADPCM = 0x0011,
00035 WAVEFORMAT_MEDIASPACE_ADPCM = 0x0012,
00036 WAVEFORMAT_SIERRA_ADPCM = 0x0013,
00037 WAVEFORMAT_G723_ADPCM = 0x0014,
00038 WAVEFORMAT_DIGISTD = 0x0015,
00039 WAVEFORMAT_DIGIFIX = 0x0016,
00040 WAVEFORMAT_DIALOGIC_OKI_ADPCM = 0x0017,
00041 WAVEFORMAT_YAMAHA_ADPCM = 0x0020,
00042 WAVEFORMAT_SONARC = 0x0021,
00043 WAVEFORMAT_DSPGROUP_TRUESPEECH = 0x0022,
00044 WAVEFORMAT_ECHOSC1 = 0x0023,
00045 WAVEFORMAT_AUDIOFILE_AF36 = 0x0024,
00046 WAVEFORMAT_APTX = 0x0025,
00047 WAVEFORMAT_AUDIOFILE_AF10 = 0x0026,
00048 WAVEFORMAT_DOLBY_AC2 = 0x0030,
00049 WAVEFORMAT_GSM610 = 0x0031,
00050 WAVEFORMAT_ANTEX_ADPCME = 0x0033,
00051 WAVEFORMAT_CONTROL_RES_VQLPC1 = 0x0034,
00052 WAVEFORMAT_CONTROL_RES_VQLPC2 = 0x0035,
00053 WAVEFORMAT_DIGIADPCM = 0x0036,
00054 WAVEFORMAT_CONTROL_RES_CR10 = 0x0037,
00055 WAVEFORMAT_NMS_VBXADPCM = 0x0038,
00056 WAVEFORMAT_CS_IMAADPCM = 0x0039,
00057 WAVEFORMAT_G721_ADPCM = 0x0040,
00058 WAVEFORMAT_MPEG_1_Layer_I_II = 0x0050,
00059 WAVEFORMAT_MPEG_1_Layer_III = 0x0055,
00060 WAVEFORMAT_XBOX_ADPCM = 0x0069,
00061 WAVEFORMAT_CREATIVE_ADPCM = 0x0200,
00062 WAVEFORMAT_CREATIVE_FASTSPEECH8 = 0x0202,
00063 WAVEFORMAT_CREATIVE_FASTSPEECH10 = 0x0203,
00064 WAVEFORMAT_FM_TOWNS_SND = 0x0300,
00065 WAVEFORMAT_OLIGSM = 0x1000,
00066 WAVEFORMAT_OLIADPCM = 0x1001,
00067 WAVEFORMAT_OLICELP = 0x1002,
00068 WAVEFORMAT_OLISBC = 0x1003,
00069 WAVEFORMAT_OLIOPR = 0x1004,
00070 };
00071
00073 enum EWaveChannelFormats
00074 {
00075 WAVECHANNEL_MONO8 = 0,
00076 WAVECHANNEL_MONO16,
00077 WAVECHANNEL_STEREO8,
00078 WAVECHANNEL_STEREO16,
00079 };
00080
00081
00083 struct SWaveFormatFlags
00084 {
00085 SWaveFormatFlags() :
00086 Channels (1 ),
00087 SamplesPerSec (0 ),
00088 BytePerSec (8 ),
00089 BlockAlign (0 ),
00090 BitsPerSample (8 ),
00091 ChannelFormat (WAVECHANNEL_MONO8 )
00092 {
00093 }
00094 ~SWaveFormatFlags()
00095 {
00096 }
00097
00098
00099 s16 Channels;
00100 s32 SamplesPerSec;
00101 s32 BytePerSec;
00102 s16 BlockAlign;
00103 s16 BitsPerSample;
00104 EWaveChannelFormats ChannelFormat;
00105 };
00106
00108 struct SAudioBuffer
00109 {
00110 SAudioBuffer() :
00111 BufferPCM (0),
00112 BufferSize (0)
00113 {
00114 }
00115 ~SAudioBuffer()
00116 {
00117 MemoryManager::deleteBuffer(BufferPCM);
00118 }
00119
00120
00121 s8* BufferPCM;
00122 u32 BufferSize;
00123 SWaveFormatFlags FormatFlags;
00124 };
00125
00127 typedef boost::shared_ptr<SAudioBuffer> SAudioBufferPtr;
00128
00129
00130 class SP_EXPORT SoundLoader : public io::BaseFileFormatHandler
00131 {
00132
00133 public:
00134
00135 virtual ~SoundLoader()
00136 {
00137 }
00138
00139
00140
00141 virtual SAudioBufferPtr loadSoundData(io::File* File) = 0;
00142
00143 protected:
00144
00145 SoundLoader() : io::BaseFileFormatHandler()
00146 {
00147 }
00148
00149
00150
00151 SAudioBufferPtr AudioBuffer_;
00152
00153 };
00154
00155
00156 }
00157
00158 }
00159
00160
00161 #endif
00162
00163
00164
00165