#ifndef _SAMPLE_FMTCHNKADPCM_HPP_ #define _SAMPLE_FMTCHNKADPCM_HPP_ #ifndef _COMMON_WINDOWS_HPP_ #include #endif #ifndef _COMMON_MMREG_HPP_ #include #endif #ifndef _COMMON_ARRAY_HPP_ #include #endif class FormatChunkADPCM : public Array { public: FormatChunkADPCM(); virtual ~FormatChunkADPCM(); bool write(MemFile &memFile)const; bool read(FileHandle &handle); WORD extraSize(void)const; void extraSize(WORD extraSize); WORD samplesPerBlock(void)const; void samplesPerBlock(WORD samplesPerBlock); WORD numCoef(void)const; void numCoef(WORD numCoef); String toString(void)const; private: WORD mExtraSize; WORD mSamplesPerBlock; }; inline FormatChunkADPCM::FormatChunkADPCM() : mExtraSize(0), mSamplesPerBlock(0) { } inline FormatChunkADPCM::~FormatChunkADPCM() { } inline bool FormatChunkADPCM::write(MemFile &memFile)const { WORD numCoefs; if(!memFile.write((char*)&mExtraSize,sizeof(WORD)))return false; if(!memFile.write((char*)&mSamplesPerBlock,sizeof(WORD)))return false; numCoefs=size(); if(!memFile.write((char*)&numCoefs,sizeof(WORD)))return false; if(!memFile.write((char*)&(((Array&)*this).operator[](0)),sizeBytes()))return false; return true; } inline bool FormatChunkADPCM::read(FileHandle &handle) { WORD numCoef; if(!handle.read((BYTE*)&mExtraSize,sizeof(WORD)))return false; if(!handle.read((BYTE*)&mSamplesPerBlock,sizeof(WORD)))return false; if(!handle.read((BYTE*)&numCoef,sizeof(WORD)))return false; size(numCoef); if(!handle.read((BYTE*)&(((Array&)*this).operator[](0)),sizeBytes()))return false; return true; } inline WORD FormatChunkADPCM::extraSize(void)const { return mExtraSize; } inline void FormatChunkADPCM::extraSize(WORD extraSize) { mExtraSize=extraSize; } inline WORD FormatChunkADPCM::samplesPerBlock(void)const { return mSamplesPerBlock; } inline void FormatChunkADPCM::samplesPerBlock(WORD samplesPerBlock) { mSamplesPerBlock=samplesPerBlock; } inline WORD FormatChunkADPCM::numCoef(void)const { return size(); } inline void FormatChunkADPCM::numCoef(WORD numCoef) { size(numCoef); } inline String FormatChunkADPCM::toString(void)const { String strChunk=""; strChunk+=String(" ExtraSize=")+String().fromInt(mExtraSize).quotes(); strChunk+=String(" SamplesPerBlock=")+String().fromInt(mSamplesPerBlock).quotes(); strChunk+=String(" NumCoefs=")+String().fromInt(size()).quotes(); for(int index=0;index"; } strChunk+=""; return strChunk; } #endif