GClasses
GClasses::GWaveIterator Class Reference

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.

#include <GWave.h>

Public Member Functions

 GWaveIterator (GWave &wave)
 
 ~GWaveIterator ()
 
bool advance (size_t steps=1)
 Advances to the next sample. Returns false if it reaches the end of the samples. Returns true otherwise. More...
 
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.) More...
 
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. More...
 
size_t remaining ()
 Returns the number of samples remaining. More...
 
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. More...
 

Protected Attributes

unsigned char * m_pPos
 
double * m_pSamples
 
size_t m_remaining
 
GWavem_wave
 

Constructor & Destructor Documentation

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

Member Function Documentation

bool GClasses::GWaveIterator::advance ( size_t  steps = 1)

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
double* GClasses::GWaveIterator::m_pSamples
protected
size_t GClasses::GWaveIterator::m_remaining
protected
GWave& GClasses::GWaveIterator::m_wave
protected