libdragon
Loading...
Searching...
No Matches
Macros | Functions | Variables
wav64.c File Reference

Support for WAV64 audio files. More...

Macros

#define VADPCM_REFERENCE_DECODER   0
 Set to 1 to use the reference C decode for VADPCM.
 
#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.
 
void wav64_open (wav64_t *wav, const char *fn)
 Open a WAV64 file for playback.
 
void wav64_play (wav64_t *wav, int ch)
 Start playing a WAV64 file.
 
void wav64_set_loop (wav64_t *wav, bool loop)
 Configure a WAV64 file for looping playback.
 
int wav64_get_bitrate (wav64_t *wav)
 Get the (possibly compressed) bitrate of the WAV64 file.
 
void wav64_close (wav64_t *wav)
 Close a WAV64 file.
 

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.

◆ wav64_get_bitrate()

int wav64_get_bitrate ( wav64_t wav)

Get the (possibly compressed) bitrate of the WAV64 file.

Parameters
wavPointer to wav64_t structure
Returns
int Bitrate in bits per second

◆ wav64_close()

void wav64_close ( wav64_t wav)

Close a WAV64 file.

Parameters
wavPointer to wav64_t structure