GClasses

GClasses::GWave Class Reference

Currently only supports PCM wave format. More...

#include <GWave.h>

List of all members.

Public Member Functions

 GWave ()
 ~GWave ()
void load (const char *szFilename)
 Loads from a file in WAV format.
void save (const char *szFilename)
 Saves to a file in WAV format.
unsigned char * data ()
 Returns a pointer to the raw sample bytes.
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.
int sampleCount ()
 Returns the number of samples.
int bitsPerSample ()
 Returns the number of bits-per-sample.
int sampleRate ()
 Returns the sample rate.
unsigned short channels ()
 Returns the number of channels.

Protected Attributes

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

Detailed Description

Currently only supports PCM wave format.


Constructor & Destructor Documentation

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

Member Function Documentation

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.

int GClasses::GWave::sampleCount ( ) [inline]

Returns the number of samples.

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]