home *** CD-ROM | disk | FTP | other *** search
- //
- // Copyright 2002 Sony Corporation
- //
- // Permission to use, copy, modify, and redistribute this software for
- // non-commercial use is hereby granted.
- //
- // This software is provided "as is" without warranty of any kind,
- // either expressed or implied, including but not limited to the
- // implied warranties of fitness for a particular purpose.
- //
-
- #ifndef WAV_h_DEFINED
- #define WAV_h_DEFINED
-
- #include <OPENR/ODataFormats.h>
-
- enum WAVError {
- WAV_SUCCESS,
- WAV_FAIL,
- WAV_NOT_RIFF,
- WAV_NOT_WAV,
- WAV_FORMAT_NOT_SUPPORTED,
- WAV_CHANNEL_NOT_SUPPORTED,
- WAV_SAMPLINGRATE_NOT_SUPPORTED,
- WAV_BITSPERSAMPLE_NOT_SUPPORTED,
- WAV_SIZE_NOT_ENOUGH,
- };
-
- class WAV {
- public:
- WAV();
- WAV(byte* addr);
- ~WAV() {}
-
- WAVError Set(byte *addr);
- WAVError CopyTo(OSoundVectorData* data);
- WAVError Rewind();
-
- int GetSamplingRate() { return soundInfo.samplingRate; }
- int GetBitsPerSample() { return soundInfo.bitsPerSample; }
-
- private:
- longword get_longword(byte* addr);
- word get_word(byte* addr);
-
- //
- // 8KHz 8bits MONO (8 * 1 * 1 * 32 = 256)
- //
- static const size_t SOUND_UNIT_SIZE = 256; // bytes / 32ms
- static const size_t FMTSIZE_WITHOUT_EXTINFO = 16;
-
- OSoundInfo soundInfo;
- byte* dataStart;
- byte* dataEnd;
- byte* dataCurrent;
- };
-
- #endif // WAV_h_DEFINED
-