Initial
This commit is contained in:
56
sample/hold/fmtchnk.cpp
Normal file
56
sample/hold/fmtchnk.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <sample/fmtchnk.hpp>
|
||||
|
||||
FormatChunk &FormatChunk::operator=(const FormatChunk &someFormatChunk)
|
||||
{
|
||||
formatTag(someFormatChunk.formatTag());
|
||||
channels(someFormatChunk.channels());
|
||||
samplesPerSecond(someFormatChunk.samplesPerSecond());
|
||||
averageBytesPerSecond(someFormatChunk.averageBytesPerSecond());
|
||||
blockAlign(someFormatChunk.blockAlign());
|
||||
bitsPerSample(someFormatChunk.bitsPerSample());
|
||||
return *this;
|
||||
}
|
||||
|
||||
MemFile &FormatChunk::operator>>(MemFile &someMemFile)const
|
||||
{
|
||||
mChunkID>>someMemFile;
|
||||
someMemFile.write((char*)&mSize,sizeof(mSize));
|
||||
someMemFile.write((char*)&mFormatTag,sizeof(mFormatTag));
|
||||
someMemFile.write((char*)&mChannels,sizeof(mChannels));
|
||||
someMemFile.write((char*)&mSamplesPerSecond,sizeof(mSamplesPerSecond));
|
||||
someMemFile.write((char*)&mAvgBytesPerSecond,sizeof(mAvgBytesPerSecond));
|
||||
someMemFile.write((char*)&mBlockAlign,sizeof(mBlockAlign));
|
||||
someMemFile.write((char*)&mBitsPerSample,sizeof(mBitsPerSample));
|
||||
if(mSize==sizeof(mFormatTag)+sizeof(mChannels)+sizeof(mSamplesPerSecond)+sizeof(mAvgBytesPerSecond)+sizeof(mBlockAlign)+sizeof(mBitsPerSample)+sizeof(mExtraInfo))someMemFile.write((char*)&mExtraInfo,sizeof(mExtraInfo));
|
||||
return someMemFile;
|
||||
}
|
||||
|
||||
FileHandle &FormatChunk::operator<<(FileHandle &someFileHandle)
|
||||
{
|
||||
mChunkID<<someFileHandle;
|
||||
someFileHandle.read((BYTE*)&mSize,sizeof(mSize));
|
||||
someFileHandle.read((BYTE*)&mFormatTag,sizeof(mFormatTag));
|
||||
someFileHandle.read((BYTE*)&mChannels,sizeof(mChannels));
|
||||
someFileHandle.read((BYTE*)&mSamplesPerSecond,sizeof(mSamplesPerSecond));
|
||||
someFileHandle.read((BYTE*)&mAvgBytesPerSecond,sizeof(mAvgBytesPerSecond));
|
||||
someFileHandle.read((BYTE*)&mBlockAlign,sizeof(mBlockAlign));
|
||||
someFileHandle.read((BYTE*)&mBitsPerSample,sizeof(mBitsPerSample));
|
||||
if(mSize==sizeof(mFormatTag)+sizeof(mChannels)+sizeof(mSamplesPerSecond)+sizeof(mAvgBytesPerSecond)+sizeof(mBlockAlign)+sizeof(mBitsPerSample)+sizeof(mExtraInfo))someFileHandle.read((BYTE*)&mExtraInfo,sizeof(mExtraInfo));
|
||||
return someFileHandle;
|
||||
}
|
||||
|
||||
String FormatChunk::toString(void)const
|
||||
{
|
||||
String strChunk;
|
||||
strChunk+=String("<FORMATCHUNK>");
|
||||
strChunk+=mChunkID.toString();
|
||||
strChunk+=String(" Size=")+String().fromInt(mSize).quotes();
|
||||
strChunk+=String(" FormatTag=")+String().fromInt(mFormatTag).quotes();
|
||||
strChunk+=String(" Channels=")+String().fromInt(mChannels).quotes();
|
||||
strChunk+=String(" SamplesPerSecond=")+String().fromInt(mSamplesPerSecond).quotes();
|
||||
strChunk+=String(" AvgBytesPerSecond=")+String().fromInt(mAvgBytesPerSecond).quotes();
|
||||
strChunk+=String(" BlockAlign=")+String().fromInt(mBlockAlign).quotes();
|
||||
strChunk+=String(" BitsPerSample=")+String().fromInt(mBitsPerSample).quotes();
|
||||
strChunk+=String(" ExtraInfo=")+String().fromInt(mExtraInfo).quotes()+String("</FORMATCHUNK>");
|
||||
return strChunk;
|
||||
}
|
||||
Reference in New Issue
Block a user