GClasses
GClasses::GWave Class Reference

Detailed Description

Currently only supports PCM wave format.

#include <GWave.h>

Public Member Functions

 GWave ()
 
 ~GWave ()
 
unsigned int bitsPerSample ()
 Returns the number of bits-per-sample. More...
 
unsigned short channels ()
 Returns the number of channels. More...
 
unsigned char * data ()
 Returns a pointer to the raw sample bytes. More...
 
void load (const char *szFilename)
 Loads from a file in WAV format. More...
 
unsigned int sampleCount ()
 Returns the number of samples. More...
 
unsigned int sampleRate ()
 Returns the sample rate. More...
 
void save (const char *szFilename)
 Saves to a file in WAV format. More...
 
void setData (unsigned char *pData, int bitsPerSample, int sampleCount, int channels, int sampleRate)
 pData is a pointer to a buffer of raw data. bitsPerSample should be 8, 16, or 32. If it is 8, sample values are unsigned (0-255). If it is 16 or 32, sample values are signed. channels is typically 1 or 2, but it can be larger. sampleRate is typically one of 8000, 16000, 22050, 44100, 48000, or 96000, but other sample rates could be used as well. More...
 

Protected Attributes

unsigned short m_bitsPerSample
 
unsigned short m_channels
 
unsigned char * m_pData
 
unsigned int m_sampleCount
 
unsigned int m_sampleRate
 
unsigned int m_size
 

Constructor & Destructor Documentation

GClasses::GWave::GWave ( )
GClasses::GWave::~GWave ( )

Member Function Documentation

unsigned int GClasses::GWave::bitsPerSample ( )
inline

Returns the number of bits-per-sample.

unsigned short GClasses::GWave::channels ( )
inline

Returns the number of channels.

unsigned char* GClasses::GWave::data ( )
inline

Returns a pointer to the raw sample bytes.

void GClasses::GWave::load ( const char *  szFilename)

Loads from a file in WAV format.

unsigned int GClasses::GWave::sampleCount ( )
inline

Returns the number of samples.

unsigned int GClasses::GWave::sampleRate ( )
inline

Returns the sample rate.

void GClasses::GWave::save ( const char *  szFilename)

Saves to a file in WAV format.

void GClasses::GWave::setData ( unsigned char *  pData,
int  bitsPerSample,
int  sampleCount,
int  channels,
int  sampleRate 
)

pData is a pointer to a buffer of raw data. bitsPerSample should be 8, 16, or 32. If it is 8, sample values are unsigned (0-255). If it is 16 or 32, sample values are signed. channels is typically 1 or 2, but it can be larger. sampleRate is typically one of 8000, 16000, 22050, 44100, 48000, or 96000, but other sample rates could be used as well.

Member Data Documentation

unsigned short GClasses::GWave::m_bitsPerSample
protected
unsigned short GClasses::GWave::m_channels
protected
unsigned char* GClasses::GWave::m_pData
protected
unsigned int GClasses::GWave::m_sampleCount
protected
unsigned int GClasses::GWave::m_sampleRate
protected
unsigned int GClasses::GWave::m_size
protected