libdragon
Loading...
Searching...
No Matches
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 current_fd, int wpos, int wlen, int bps)
 Utility function to help implementing WaveformRead for uncompressed (raw) samples.
 
void raw_waveform_read_address (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 *file_name)
 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.
 
void __wav64_init_compression_lvl3 (void)
 Initialize wav64 compression level 3.
 

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  fd,
int  wpos,
int  wlen,
int  bps 
)

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

This function uses a file descriptor to load samples from ROM into the sample buffer.

◆ raw_waveform_read_address()

void raw_waveform_read_address ( samplebuffer_t sbuf,
int  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. Note: Tempory function should be removed when XM64 moves to using FILE*.

◆ 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.

It is possible to start the same waveform on multiple independent channels. Playback will automatically stop when the waveform is finished, unless it is looping. To stop playing a wav64 file before it is normally finished, call mixer_ch_stop on the channel used for playback.

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.

This function closes the file and frees any resources associated with it. If the file is currently playing, playback will be stopped.

Parameters
wavPointer to wav64_t structure