WaveHC
Public Member Functions | Public Attributes
WaveHC Class Reference

Wave file player. More...

#include <WaveHC.h>

Collaboration diagram for WaveHC:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 WaveHC (void)
uint8_t create (FatReader &f)
uint32_t getSize (void)
uint8_t isPaused (void)
void pause (void)
void play (void)
int16_t readWaveData (uint8_t *buff, uint16_t len)
void resume (void)
void seek (uint32_t pos)
void setSampleRate (uint32_t samplerate)
void stop (void)

Public Attributes

uint8_t Channels
uint32_t dwSamplesPerSec
uint8_t BitsPerSample
uint32_t remainingBytesInChunk
volatile uint8_t isplaying
uint32_t errors
FatReaderfd

Detailed Description

Wave file player.

Play wave files from FAT16 and FAT32 file systems on SD and SDHC flash memory cards.


Constructor & Destructor Documentation

WaveHC::WaveHC ( void  )

create an instance of WaveHC.


Member Function Documentation

uint8_t WaveHC::create ( FatReader f)

Read a wave file's metadata and initialize member variables.

Parameters:
[in]fA open FatReader instance for the wave file.
Returns:
The value one, true, is returned for success and the value zero, false, is returned for failure. Reasons for failure include I/O error, an invalid wave file or a wave file with features that WaveHC does not support.
uint32_t WaveHC::getSize ( void  ) [inline]

Return the size of the WAV file

uint8_t WaveHC::isPaused ( void  )

Returns true if the player is paused else false.

void WaveHC::pause ( void  )

Pause the player.

void WaveHC::play ( void  )

Play a wave file.

WaveHC::create() must be called before a file can be played.

Check the member variable WaveHC::isplaying to monitor the status of the player.

int16_t WaveHC::readWaveData ( uint8_t *  buff,
uint16_t  len 
)

Read wave data.

Not for use in applications. Must be public so SD read ISR can access it. Insures SD sectors are aligned with buffers.

void WaveHC::resume ( void  )

Resume a paused player.

void WaveHC::seek ( uint32_t  pos)

Reposition a wave file.

Parameters:
[in]posseek will attempt to position the file near pos. pos is the byte number from the beginning of file.
void WaveHC::setSampleRate ( uint32_t  samplerate)

Set the player's sample rate.

Parameters:
[in]samplerateThe new sample rate in samples per second. No checks are done on the input parameter.
void WaveHC::stop ( void  )

Stop the player.


Member Data Documentation

Wave file bits per sample. Must be 8 or 16.

Wave file number of channels. Mono = 1, Stereo = 2

Wave file sample rate. Must be not greater than 44100/sec.

uint32_t WaveHC::errors

Number of times data was not available from the SD in the DAC ISR

FatReader instance for current wave file.

volatile uint8_t WaveHC::isplaying

Has the value true if a wave file is playing else false.

Remaining bytes to be played in Wave file data chunk.


The documentation for this class was generated from the following files: