Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

WAV.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2002,2003 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #ifndef WAV_h_DEFINED
00013 #define WAV_h_DEFINED
00014 
00015 #include <OPENR/ODataFormats.h>
00016 
00017 enum WAVError {
00018     WAV_SUCCESS,
00019     WAV_FAIL,
00020     WAV_NOT_RIFF,
00021     WAV_NOT_WAV,
00022     WAV_FORMAT_NOT_SUPPORTED,
00023     WAV_CHANNEL_NOT_SUPPORTED,
00024     WAV_SAMPLINGRATE_NOT_SUPPORTED,
00025     WAV_BITSPERSAMPLE_NOT_SUPPORTED,
00026     WAV_SIZE_NOT_ENOUGH,
00027 };
00028 
00034 class WAV {
00035 public:
00036     WAV();
00037     WAV(byte* addr);
00038     ~WAV() {}
00039 
00040     WAVError Set(byte *addr);
00041     WAVError CopyTo(OSoundVectorData* data);
00042     WAVError Rewind();
00043 
00044     int    GetSamplingRate()  { return soundInfo.samplingRate;  }
00045     int    GetBitsPerSample() { return soundInfo.bitsPerSample; }
00046     size_t GetSoundUnitSize() { return soundUnitSize;           }
00047 
00048 private:
00049     longword get_longword(byte* addr);
00050     word     get_word(byte* addr);
00051 
00052     // 8KHz 8bits MONO (8 * 1 * 1 * 32ms = 256)
00053     static const size_t MONO8K8B_UNIT_SIZE  = 256;
00054 
00055     // 16KHz 16bits MONO (16 * 2 * 1 * 32ms = 1024)
00056     static const size_t MONO16K16B_UNIT_SIZE  = 1024;
00057 
00058     static const size_t FMTSIZE_WITHOUT_EXTINFO = 16;
00059 
00060     OSoundInfo soundInfo;
00061     size_t     soundUnitSize;
00062     byte*      dataStart;
00063     byte*      dataEnd;
00064     byte*      dataCurrent;
00065 };
00066 
00067 #endif // WAV_h_DEFINED


tams Tim Baier AiboLib v0.2.4
Generated Thu Jan 19 11:54:30 2006 by doxygen 1.4.3