Files
Work/sample/holdii/PCMForm.hpp
2024-08-07 09:16:27 -04:00

83 lines
1.7 KiB
C++

#ifndef _SAMPLE_WAVEFORMATPCM_HPP_
#define _SAMPLE_WAVEFORMATPCM_HPP_
#ifndef _SAMPLE_WAVEFORMATEX_HPP_
#include <sample/wavefmex.hpp>
#endif
#ifndef _SAMPLE_FORMATCHUNK_HPP_
#include <sample/fmtchnk.hpp>
#endif
class WaveFormatPCM : public WaveFormatEx
{
public:
WaveFormatPCM(void);
WaveFormatPCM(const WaveFormatPCM &someWaveFormatPCM);
WaveFormatPCM(const FormatChunk &someFormatChunk);
~WaveFormatPCM();
WaveFormatPCM &operator=(const WaveFormatPCM &someWaveFormatPCM);
WaveFormatPCM &operator=(const FormatChunk &someFormatChunk);
operator PCMWAVEFORMAT &(void)const;
WORD bitsPerSample(void)const;
void bitsPerSample(WORD bitsPerSample);
private:
WORD mBitsPerSample;
};
inline
WaveFormatPCM::WaveFormatPCM(void)
: mBitsPerSample(0)
{
}
inline
WaveFormatPCM::WaveFormatPCM(const WaveFormatPCM &someWaveFormatPCM)
: WaveFormatEx((WaveFormatEx&)*this), mBitsPerSample(someWaveFormatPCM.mBitsPerSample)
{
}
inline
WaveFormatPCM::WaveFormatPCM(const FormatChunk &someFormatChunk)
{
*this=someFormatChunk;
}
inline
WaveFormatPCM::~WaveFormatPCM()
{
}
inline
WaveFormatPCM &WaveFormatPCM::operator=(const WaveFormatPCM &someWaveFormatPCM)
{
mBitsPerSample=someWaveFormatPCM.mBitsPerSample;
(WaveFormatEx&)*this=(WaveFormatEx&)someWaveFormatPCM;
return *this;
}
inline
WaveFormatPCM::operator PCMWAVEFORMAT &(void)const
{
return *((PCMWAVEFORMAT*)this);
}
inline
WORD WaveFormatPCM::bitsPerSample(void)const
{
return mBitsPerSample;
}
inline
void WaveFormatPCM::bitsPerSample(WORD bitsPerSample)
{
mBitsPerSample=bitsPerSample;
}
inline
WaveFormatPCM &WaveFormatPCM::operator=(const FormatChunk &someFormatChunk)
{
(WaveFormatEx&)*this=someFormatChunk;
bitsPerSample(someFormatChunk.bitsPerSample());
return *this;
}
#endif