ers200/BallTrackingHead/LostFoundSound/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 
00029 class WAV {
00030 public:
00031     WAV();
00032     WAV(byte* addr);
00033     ~WAV() {}
00034 
00035     WAVError Set(byte *addr);
00036     WAVError CopyTo(OSoundVectorData* data);
00037     WAVError Rewind();
00038 
00039     int    GetSamplingRate()  { return soundInfo.samplingRate;  }
00040     int    GetBitsPerSample() { return soundInfo.bitsPerSample; }
00041     size_t GetSoundUnitSize() { return soundUnitSize;           }
00042 
00043 private:
00044     longword get_longword(byte* addr);
00045     word     get_word(byte* addr);
00046 
00047     // 8KHz 8bits MONO (8 * 1 * 1 * 32ms = 256)
00048     static const size_t MONO8K8B_UNIT_SIZE  = 256;
00049 
00050     // 16KHz 16bits MONO (16 * 2 * 1 * 32ms = 1024)
00051     static const size_t MONO16K16B_UNIT_SIZE  = 1024;
00052 
00053     static const size_t FMTSIZE_WITHOUT_EXTINFO = 16;
00054 
00055     OSoundInfo soundInfo;
00056     size_t     soundUnitSize;
00057     byte*      dataStart;
00058     byte*      dataEnd;
00059     byte*      dataCurrent;
00060 };
00061 
00062 #endif // WAV_h_DEFINED

Generated on Sun Dec 2 23:04:31 2007 for openSDK by  doxygen 1.3.9.1