libdragon
Macros | Functions | Variables
wav64.c File Reference

Support for WAV64 audio files. More...

Macros

#define WAV_RIFF_ID   "RIFF"
 
#define WAV_RIFX_ID   "RIFX"
 

Functions

void raw_waveform_read (samplebuffer_t *sbuf, int base_rom_addr, int wpos, int wlen, int bps)
 Utility function to help implementing WaveformRead for uncompressed (raw) samples. More...
 
void wav64_open (wav64_t *wav, const char *fn)
 Open a WAV64 file for playback. More...
 
void wav64_play (wav64_t *wav, int ch)
 Start playing a WAV64 file. More...
 
void wav64_set_loop (wav64_t *wav, bool loop)
 Configure a WAV64 file for looping playback.
 

Variables

int64_t __wav64_profile_dma = 0
 Profile of DMA usage by WAV64, used for debugging purposes.
 

Detailed Description

Support for WAV64 audio files.

Macro Definition Documentation

◆ WAV_RIFF_ID

#define WAV_RIFF_ID   "RIFF"

ID of a standard WAV file

◆ WAV_RIFX_ID

#define WAV_RIFX_ID   "RIFX"

ID of a WAVX file (big-endian WAV)

Function Documentation

◆ raw_waveform_read()

void raw_waveform_read ( samplebuffer_t sbuf,
int  base_rom_addr,
int  wpos,
int  wlen,
int  bps 
)

Utility function to help implementing WaveformRead for uncompressed (raw) samples.

This function uses PI DMA to load samples from ROM into the sample buffer.

◆ wav64_open()

void wav64_open ( wav64_t wav,
const char *  fn 
)

Open a WAV64 file for playback.

This function opens the file, parses the header, and initializes for playing back through the audio mixer.

Parameters
wavPointer to wav64_t structure
fnFilename of the wav64 (with filesystem prefix). Currently, only files on DFS ("rom:/") are supported.

◆ wav64_play()

void wav64_play ( wav64_t wav,
int  ch 
)

Start playing a WAV64 file.

This is just a simple wrapper that calls mixer_ch_play on the WAV64's waveform (wav64_t::wave). For advanced usages, please call directly the mixer functions.

Parameters
wavPointer to wav64_t structure
chChannel of the mixer to use for playback.