libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::WavPlayer Class Reference

Detailed Description

Wav Player that will load .wav files from an SD Card, and then provide a method of accessing the samples with double-buffering.

#include <wavplayer.h>

Public Member Functions

 WavPlayer ()
 
 ~WavPlayer ()
 
void Init (const char *search_path)
 
int Open (size_t sel)
 
int Close ()
 
int16_t Stream ()
 
void Prepare ()
 
void Restart ()
 
void SetLooping (bool loop)
 
bool GetLooping () const
 
size_t GetNumberFiles () const
 
size_t GetCurrentFile () const
 

Constructor & Destructor Documentation

◆ WavPlayer()

daisy::WavPlayer::WavPlayer ( )
inline

◆ ~WavPlayer()

daisy::WavPlayer::~WavPlayer ( )
inline

Member Function Documentation

◆ Close()

int daisy::WavPlayer::Close ( )

Closes whatever file is currently open.

Returns
&

◆ GetCurrentFile()

size_t daisy::WavPlayer::GetCurrentFile ( ) const
inline
Returns
currently selected file.

◆ GetLooping()

bool daisy::WavPlayer::GetLooping ( ) const
inline
Returns
Whether the WavPlayer is looping or not.

◆ GetNumberFiles()

size_t daisy::WavPlayer::GetNumberFiles ( ) const
inline
Returns
The number of files loaded by the WavPlayer

◆ Init()

void daisy::WavPlayer::Init ( const char search_path)

Initializes the WavPlayer, loading up to max_files of wav files from an SD Card.

◆ Open()

int daisy::WavPlayer::Open ( size_t  sel)

Opens the file at index sel for reading.

Parameters
selFile to open

◆ Prepare()

void daisy::WavPlayer::Prepare ( )

Collects buffer for playback when needed.

◆ Restart()

void daisy::WavPlayer::Restart ( )

Resets the playback position to the beginning of the file immediately

◆ SetLooping()

void daisy::WavPlayer::SetLooping ( bool  loop)
inline

Sets whether or not the current file will repeat after completing playback.

Parameters
loopTo loop or not to loop.

◆ Stream()

int16_t daisy::WavPlayer::Stream ( )
Returns
The next sample if playing, otherwise returns 0

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