Initial
This commit is contained in:
143
sample/WaveForm.hpp
Normal file
143
sample/WaveForm.hpp
Normal file
@@ -0,0 +1,143 @@
|
||||
#ifndef _SAMPLE_WAVEFORMAT_HPP_
|
||||
#define _SAMPLE_WAVEFORMAT_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_MMSYSTEM_HPP_
|
||||
#include <common/mmsystem.hpp>
|
||||
#endif
|
||||
#ifndef _SAMPLE_FORMATCHUNK_HPP_
|
||||
#include <sample/fmtchnk.hpp>
|
||||
#endif
|
||||
|
||||
class WaveFormat : private WAVEFORMAT
|
||||
{
|
||||
public:
|
||||
enum FormatType{PulseCodeModulation=WAVE_FORMAT_PCM};
|
||||
WaveFormat(void);
|
||||
WaveFormat(const WaveFormat &someWaveFormat);
|
||||
WaveFormat(const FormatChunk &someFormatChunk);
|
||||
virtual ~WaveFormat();
|
||||
WaveFormat &operator=(const WaveFormat &someWaveFormat);
|
||||
WaveFormat &operator=(const FormatChunk &someFormatChunk);
|
||||
WORD formatTag(void)const;
|
||||
void formatTag(WORD formatTag);
|
||||
WORD channels(void)const;
|
||||
void channels(WORD channels);
|
||||
DWORD samplePerSecond(void)const;
|
||||
void samplesPerSecond(DWORD samplesPerSecond);
|
||||
DWORD averageBytesPerSecond(void)const;
|
||||
void averageBytesPerSecond(DWORD averageBytesPerSecond);
|
||||
WORD blockAlign(void)const;
|
||||
void blockAlign(WORD blockAlign);
|
||||
operator WAVEFORMAT &(void)const;
|
||||
private:
|
||||
};
|
||||
|
||||
inline
|
||||
WaveFormat::WaveFormat(void)
|
||||
{
|
||||
::memset(this,0,sizeof(*this));
|
||||
}
|
||||
|
||||
inline
|
||||
WaveFormat::WaveFormat(const WaveFormat &someWaveFormat)
|
||||
{
|
||||
*this=someWaveFormat;
|
||||
}
|
||||
|
||||
inline
|
||||
WaveFormat::WaveFormat(const FormatChunk &someFormatChunk)
|
||||
{
|
||||
*this=someFormatChunk;
|
||||
}
|
||||
|
||||
inline
|
||||
WaveFormat::~WaveFormat()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
WaveFormat &WaveFormat::operator=(const WaveFormat &someWaveFormat)
|
||||
{
|
||||
::memcpy(this,&someWaveFormat,sizeof(*this));
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD WaveFormat::formatTag(void)const
|
||||
{
|
||||
return WAVEFORMAT::wFormatTag;
|
||||
}
|
||||
|
||||
inline
|
||||
void WaveFormat::formatTag(WORD formatTag)
|
||||
{
|
||||
WAVEFORMAT::wFormatTag=formatTag;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD WaveFormat::channels(void)const
|
||||
{
|
||||
return WAVEFORMAT::nChannels;
|
||||
}
|
||||
|
||||
inline
|
||||
void WaveFormat::channels(WORD channels)
|
||||
{
|
||||
WAVEFORMAT::nChannels=channels;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD WaveFormat::samplePerSecond(void)const
|
||||
{
|
||||
return WAVEFORMAT::nSamplesPerSec;
|
||||
}
|
||||
|
||||
inline
|
||||
void WaveFormat::samplesPerSecond(DWORD samplesPerSecond)
|
||||
{
|
||||
WAVEFORMAT::nSamplesPerSec=samplesPerSecond;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD WaveFormat::averageBytesPerSecond(void)const
|
||||
{
|
||||
return WAVEFORMAT::nAvgBytesPerSec;
|
||||
}
|
||||
|
||||
inline
|
||||
void WaveFormat::averageBytesPerSecond(DWORD averageBytesPerSecond)
|
||||
{
|
||||
WAVEFORMAT::nAvgBytesPerSec=averageBytesPerSecond;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD WaveFormat::blockAlign(void)const
|
||||
{
|
||||
return WAVEFORMAT::nBlockAlign;
|
||||
}
|
||||
|
||||
inline
|
||||
void WaveFormat::blockAlign(WORD blockAlign)
|
||||
{
|
||||
WAVEFORMAT::nBlockAlign=blockAlign;
|
||||
}
|
||||
|
||||
inline
|
||||
WaveFormat::operator WAVEFORMAT &(void)const
|
||||
{
|
||||
return *((WAVEFORMAT*)this);
|
||||
}
|
||||
|
||||
inline
|
||||
WaveFormat &WaveFormat::operator=(const FormatChunk &someFormatChunk)
|
||||
{
|
||||
formatTag(someFormatChunk.formatTag());
|
||||
channels(someFormatChunk.channels());
|
||||
samplesPerSecond(someFormatChunk.samplesPerSecond());
|
||||
averageBytesPerSecond(someFormatChunk.averageBytesPerSecond());
|
||||
blockAlign(someFormatChunk.blockAlign());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user