📄 wavfile.h
字号:
#ifndef _WAVFILE_H
#define _WAVFILE_H
#include "stdint.h"
#include "SoundFormat.h"
#include <lang/String.h>
#include <lang/Object.h>
namespace io {
class InputStream;}
/**
* Class for sound file loading and saving.
* @author Jani Kajala (jani.kajala@helsinki.fi)
*/
class WavFile :
public lang::Object
{
public:
/**
* Reads sound file header.
* @exception IOException
*/
explicit WavFile( const lang::String& name );
///
~WavFile();
/**
* Reads specified number of bytes of sound data from the file.
* @exception IOException
*/
void read( void* data, int bytes );
/** Returns number of bytes sound data in the sound file. */
int size() const;
/** Returns sound file format. */
const SoundFormat& format() const;
private:
struct RIFFChunk
{
char id[4];
uint32_t size; // size of data to follow
};
struct WaveFormatHeader
{
uint16_t formatTag;
uint16_t channels;
uint32_t samplesPerSec;
uint32_t avgBytesPerSec;
uint16_t blockAlign;
};
P(io::InputStream) m_in;
SoundFormat m_format;
int m_begin;
int m_end;
int m_size;
static void findChunk( io::InputStream* in, int& size, int end, const char* id, RIFFChunk* chunk );
WavFile( const WavFile& );
WavFile& operator=( const WavFile& );
};
#endif // _WAVFILE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -