115 lines
2.3 KiB
C++
115 lines
2.3 KiB
C++
#ifndef _SAMPLE_WAVEFORM_HPP_
|
|
#define _SAMPLE_WAVEFORM_HPP_
|
|
#ifndef _COMMON_STDIO_HPP_
|
|
#include <common/stdio.hpp>
|
|
#endif
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
#ifndef _COMMON_BLOCK_HPP_
|
|
#include <common/block.hpp>
|
|
#endif
|
|
#ifndef _SAMPLE_PURESAMPLE_HPP_
|
|
#include <sample/puresmpl.hpp>
|
|
#endif
|
|
#ifndef _SAMPLE_DATACHUNK_HPP_
|
|
#include <sample/datachnk.hpp>
|
|
#endif
|
|
#ifndef _SAMPLE_FORMATCHUNK_HPP_
|
|
#include <sample/fmtchnk.hpp>
|
|
#endif
|
|
#ifndef _SAMPLE_GENERICCHUNK_HPP_
|
|
#include <sample/genchnk.hpp>
|
|
#endif
|
|
|
|
class WaveForm
|
|
{
|
|
public:
|
|
WaveForm(void);
|
|
WaveForm(String wavePathFileName);
|
|
WaveForm(const WaveForm &someWaveForm);
|
|
virtual ~WaveForm();
|
|
WaveForm &operator=(const WaveForm &someWaveForm);
|
|
WaveForm &operator=(const String &wavePathFileName);
|
|
WaveForm &operator+=(const WaveForm &someWaveForm);
|
|
WaveForm operator+(const WaveForm &someWaveForm);
|
|
bool operator==(const WaveForm &someWaveForm)const;
|
|
bool operator<<(FileHandle &waveFile);
|
|
FormatChunk &getFormatChunk(void);
|
|
PureSample &getPureSample(void);
|
|
bool save(String wavePathFileName,const PureSample &somePureSample,DWORD samplesPerSecond,DWORD avgBytesPerSecond);
|
|
bool save(String wavePathFileName);
|
|
const String &wavePathFileName(void)const;
|
|
bool isOkay(void)const;
|
|
String toString(void)const;
|
|
private:
|
|
enum {MaxLength=4};
|
|
void initWaveForm(void);
|
|
|
|
char mHeaderString[MaxLength];
|
|
DWORD mLengthData;
|
|
char mSubHeaderString[MaxLength];
|
|
FormatChunk mFormatChunk;
|
|
Block<GenericChunk> mGenericChunks;
|
|
DataChunk mDataChunk;
|
|
PureSample mSampleData;
|
|
String mWavePathFileName;
|
|
String mExtensionString;
|
|
String mWaveString;
|
|
String mRiffString;
|
|
};
|
|
|
|
inline
|
|
WaveForm::WaveForm(void)
|
|
{
|
|
initWaveForm();
|
|
}
|
|
|
|
inline
|
|
WaveForm::WaveForm(const WaveForm &someWaveForm)
|
|
{
|
|
*this=someWaveForm;
|
|
}
|
|
|
|
inline
|
|
WaveForm::~WaveForm()
|
|
{
|
|
}
|
|
|
|
inline
|
|
WaveForm &WaveForm::operator=(const String &wavePathFileName)
|
|
{
|
|
*this=WaveForm(wavePathFileName);
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
bool WaveForm::isOkay(void)const
|
|
{
|
|
return mSampleData.isOkay();
|
|
}
|
|
|
|
inline
|
|
const String &WaveForm::wavePathFileName(void)const
|
|
{
|
|
return mWavePathFileName;
|
|
}
|
|
|
|
inline
|
|
FormatChunk &WaveForm::getFormatChunk(void)
|
|
{
|
|
return mFormatChunk;
|
|
}
|
|
|
|
inline
|
|
PureSample &WaveForm::getPureSample(void)
|
|
{
|
|
return mSampleData;
|
|
}
|
|
#endif
|
|
|
|
|