Initial
This commit is contained in:
120
sample/Wave.hpp
Normal file
120
sample/Wave.hpp
Normal file
@@ -0,0 +1,120 @@
|
||||
#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_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
|
||||
|
||||
#ifndef _SAMPLE_PURESAMPLE_HPP_
|
||||
#include <sample/puresmpl.hpp>
|
||||
#endif
|
||||
#ifndef _SAMPLE_PURESAMPLEEX_HPP_
|
||||
#include <sample/PureSampleEx.hpp>
|
||||
#endif
|
||||
|
||||
class WaveForm
|
||||
{
|
||||
public:
|
||||
WaveForm(void);
|
||||
WaveForm(const String &wavePathFileName);
|
||||
WaveForm(const WaveForm &someWaveForm);
|
||||
virtual ~WaveForm();
|
||||
bool open(String wavePathFileName);
|
||||
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 read(FileHandle &waveFile);
|
||||
bool convert(PureSampleEx::BitsPerSample bitsPerSample);
|
||||
FormatChunk &getFormatChunk(void);
|
||||
PureSampleEx &getPureSample(void);
|
||||
bool save(String wavePathFileName,const PureSampleEx &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;
|
||||
PureSampleEx 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
|
||||
PureSampleEx &WaveForm::getPureSample(void)
|
||||
{
|
||||
return mSampleData;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user