GClasses

GClasses::GWaveIterator Class Reference

This class iterates over the samples in a WAVE file. Regardless of the bits-per-sample, this iterator will convert all samples to doubles with a range from -1 to 1. More...

#include <GWave.h>

List of all members.

Public Member Functions

 GWaveIterator (GWave &wave)
 ~GWaveIterator ()
size_t remaining ()
 Returns the number of samples remaining.
bool advance ()
 Advances to the next sample. Returns false if it reaches the end of the samples. Returns true otherwise.
double * current ()
 Returns a pointer to a c-dimensional array of doubles, where c is the number of channels. Each element is one of the sample values for a channel from -1 to 1.
void set (double *pSamples)
 pSamples should be an array of doubles, one for each channel, where each value ranges from -1 to 1. Sets the values in the format specified by the wave object.
void copy (GWaveIterator &other)
 Copies the position of another wave iterator that is iterating on the same wave. (Behavior is undefined if the other iterator is iterating on a different wave.)

Protected Attributes

GWavem_wave
size_t m_remaining
double * m_pSamples
unsigned char * m_pPos

Detailed Description

This class iterates over the samples in a WAVE file. Regardless of the bits-per-sample, this iterator will convert all samples to doubles with a range from -1 to 1.


Constructor & Destructor Documentation

GClasses::GWaveIterator::GWaveIterator ( GWave wave)
GClasses::GWaveIterator::~GWaveIterator ( )

Member Function Documentation

bool GClasses::GWaveIterator::advance ( )

Advances to the next sample. Returns false if it reaches the end of the samples. Returns true otherwise.

void GClasses::GWaveIterator::copy ( GWaveIterator other)

Copies the position of another wave iterator that is iterating on the same wave. (Behavior is undefined if the other iterator is iterating on a different wave.)

double* GClasses::GWaveIterator::current ( )

Returns a pointer to a c-dimensional array of doubles, where c is the number of channels. Each element is one of the sample values for a channel from -1 to 1.

size_t GClasses::GWaveIterator::remaining ( )

Returns the number of samples remaining.

void GClasses::GWaveIterator::set ( double *  pSamples)

pSamples should be an array of doubles, one for each channel, where each value ranges from -1 to 1. Sets the values in the format specified by the wave object.


Member Data Documentation

unsigned char* GClasses::GWaveIterator::m_pPos [protected]