Adafruit WaveHC Arduino Library
|
Wave file player. More...
#include <WaveHC.h>
Public Member Functions | |
WaveHC (void) | |
uint8_t | create (FatReader &f) |
uint32_t | getSize (void) |
Return the size of the WAV file. More... | |
uint8_t | isPaused (void) |
Returns true if the player is paused else false. More... | |
void | pause (void) |
void | play (void) |
int16_t | readWaveData (uint8_t *buff, uint16_t len) |
Not for use in applications. Must be public so SD read ISR can access it. Insures SD sectors are aligned with buffers. More... | |
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 |
uint8_t | volume |
FatReader * | fd |
Wave file player.
Play wave files from FAT16 and FAT32 file systems on SD and SDHC flash memory cards.
WaveHC::WaveHC | ( | void | ) |
create an instance of WaveHC.
uint8_t WaveHC::create | ( | FatReader & | f | ) |
Read a wave file's metadata and initialize member variables.
[in] | f | A open FatReader instance for the wave file. |
|
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 | ||
) |
Not for use in applications. Must be public so SD read ISR can access it. Insures SD sectors are aligned with buffers.
Read wave data.
buff | pointer to the buffer where the data should be placed |
len | the number of bytes to read. |
void WaveHC::resume | ( | void | ) |
Resume a paused player.
void WaveHC::seek | ( | uint32_t | pos | ) |
Reposition a wave file.
[in] | pos | seek 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.
[in] | samplerate | The new sample rate in samples per second. No checks are done on the input parameter. |
void WaveHC::stop | ( | void | ) |
Stop the player.
uint8_t WaveHC::Channels |
Wave file number of channels. Mono = 1, Stereo = 2
uint32_t WaveHC::dwSamplesPerSec |
Wave file sample rate. Must be not greater than 44100/sec.
uint8_t WaveHC::BitsPerSample |
Wave file bits per sample. Must be 8 or 16.
uint32_t WaveHC::remainingBytesInChunk |
Remaining bytes to be played in Wave file data chunk.
volatile uint8_t WaveHC::isplaying |
Has the value true if a wave file is playing else false.
uint32_t WaveHC::errors |
Number of times data was not available from the SD in the DAC ISR
uint8_t WaveHC::volume |
Software volume control. Reduce volume by 6 dB per step. See DAC ISR.