Skip to content

daisy::WavPlayer

More...

#include <wavplayer.h>

Public Functions

Name
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

Detailed Description

class daisy::WavPlayer;

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

Public Functions Documentation

function WavPlayer

inline WavPlayer()

function ~WavPlayer

inline ~WavPlayer()

function Init

void Init(
    const char * search_path
)

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


function Open

int Open(
    size_t sel
)

Parameters:

  • sel File to open

Opens the file at index sel for reading.


function Close

int Close()

Return: &

Closes whatever file is currently open.


function Stream

int16_t Stream()

Return: The next sample if playing, otherwise returns 0


function Prepare

void Prepare()

Collects buffer for playback when needed.


function Restart

void Restart()

Resets the playback position to the beginning of the file immediately


function SetLooping

inline void SetLooping(
    bool loop
)

Parameters:

  • loop To loop or not to loop.

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


function GetLooping

inline bool GetLooping() const

Return: Whether the WavPlayer is looping or not.


function GetNumberFiles

inline size_t GetNumberFiles() const

Return: The number of files loaded by the WavPlayer


function GetCurrentFile

inline size_t GetCurrentFile() const

Return: currently selected file.

---

Updated on 2024-01-03 at 19:41:00 +0000