Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WAV Decoder

This is the public API for the WAV decoder. This decoder only supports WAV PCM format.

Data Structures

struct  wav_info_t
 This structure contains information about the WAV file format. More...
 

Macros

#define OUTPUT_BUFFER_SIZE   0x400
 

Functions

bool wav_decode (struct wav_info_t *wav_info)
 Decode a buffer of OUTPUT_BUFFER_SIZE bytes from the WAV file. More...
 
bool wav_decode_end (struct wav_info_t *wav_info)
 End the decoding, clean remaining buffers. More...
 
bool wav_file_get_data (struct wav_info_t *wav_info)
 Callback which needs to be implement on the user side to acquire the WAV file data. More...
 
uint32_t wav_get_duration_s (struct wav_info_t *wav_info)
 Get the duration of a WAV file in seconds. More...
 
bool wav_header_decode (struct wav_info_t *wav_info)
 Decode the header of a WAV file.
This function will fill the wav_info_t structure passed in argument to this function. More...
 

#define OUTPUT_BUFFER_SIZE   0x400

Size in byte of the output buffer size

Referenced by pcm_decode(), and play_wav().

bool wav_decode ( struct wav_info_t wav_info)

Decode a buffer of OUTPUT_BUFFER_SIZE bytes from the WAV file.

Parameters
wav_infothe wav_info_t structure describing the file of interest.
Returns
true on success, false otherwise.

References p_decode_fct.

Referenced by play_wav().

bool wav_decode_end ( struct wav_info_t wav_info)

End the decoding, clean remaining buffers.

Parameters
wav_infothe wav_info_t structure describing the file of interest.
Returns
true on success, false otherwise.

Referenced by play_wav().

bool wav_file_get_data ( struct wav_info_t wav_info)

Callback which needs to be implement on the user side to acquire the WAV file data.

Parameters
wav_infothe wav_info_t structure describing the file of interest.
Returns
true on success, false otherwise.

Callback which needs to be implement on the user side to acquire the WAV file data.

References wav_info_t::buffer, wav_info_t::buffer_current_pos, file_eof(), file_read_buf(), file_seek(), FS_NAV_ID_AUDIO, FS_SEEK_CUR_RE, wav_info_t::in_buffer_left, IN_BUFFER_SIZE, nav_checkdisk_disable(), nav_checkdisk_enable(), and nav_select().

Referenced by get_wav_byte(), and get_wav_data().

uint32_t wav_get_duration_s ( struct wav_info_t wav_info)

Get the duration of a WAV file in seconds.

Parameters
wav_infothe wav_info_t structure describing the file of interest.
Returns
the total duration of the WAV file in seconds.

References wav_info_t::bits_per_sample, wav_info_t::dataleft, wav_info_t::nChannels, and wav_info_t::sampling_rate.

Referenced by play_wav().

bool wav_header_decode ( struct wav_info_t wav_info)

Decode the header of a WAV file.
This function will fill the wav_info_t structure passed in argument to this function.

Parameters
wav_infoWAV format information. This structure will be updated with the call of this function.
Returns
true on success, false otherwise.

References wav_info_t::bits_per_sample, wav_info_t::block_align, conv16little2big(), conv32little2big(), wav_info_t::dataleft, get_wav_data(), wav_info_t::nChannels, p_decode_fct, PCM_COMP_CODE, pcm_decode(), wav_info_t::sampling_rate, TAG_DATA, TAG_FMT, TAG_RIFF, and TAG_WAVE.

Referenced by play_wav().