Atmel Software Framework

wavdecode.c File Reference

WAV PCM decoder.

Copyright (c) 2009-2011 Atmel Corporation. All rights reserved.

#include "wavdecode.h"
#include <string.h>

Macros

#define PCM_COMP_CODE   0x1
 Tag for PCM format. More...
 
#define TAG_RIFF   0x52494646
 
#define TAG_WAVE   0x57415645
 
#define TAG_FMT   0x666D7420
 
#define TAG_DATA   0x64617461
 

Functions

static bool pcm_decode (struct wav_info_t *wav_info)
 Decode a buffer of OUTPUT_BUFFER_SIZE bytes from the WAV PCM file. More...
 
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...
 
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...
 
static bool get_wav_data (struct wav_info_t *wav_info, uint8_t *data, uint8_t nbbyte)
 
static bool get_wav_byte (struct wav_info_t *wav_info, uint8_t *data8)
 
static uint16_t conv16little2big (uint16_t i)
 
static uint32_t conv32little2big (uint32_t i)
 

Variables

bool(* p_decode_fct )(struct wav_info_t *)
 

#define PCM_COMP_CODE   0x1

Tag for PCM format.

Referenced by wav_header_decode().

#define TAG_DATA   0x64617461

Referenced by wav_header_decode().

#define TAG_FMT   0x666D7420

Referenced by wav_header_decode().

#define TAG_RIFF   0x52494646

Tags to delimit sections in the WAV file format.

Referenced by wav_header_decode().

#define TAG_WAVE   0x57415645

Referenced by wav_header_decode().

static uint16_t conv16little2big ( uint16_t  i)
static

Referenced by wav_header_decode().

static uint32_t conv32little2big ( uint32_t  i)
static

Referenced by wav_header_decode().

static bool get_wav_byte ( struct wav_info_t wav_info,
uint8_t *  data8 
)
static
static bool get_wav_data ( struct wav_info_t wav_info,
uint8_t *  data,
uint8_t  nbbyte 
)
static
static bool pcm_decode ( struct wav_info_t wav_info)
static

Decode a buffer of OUTPUT_BUFFER_SIZE bytes from the WAV PCM file.

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

References wav_info_t::bits_per_sample, get_wav_byte(), OUTPUT_BUFFER_SIZE, wav_info_t::pcm_samples, and wav_info_t::pcm_samples_length.

Referenced by wav_header_decode().

bool(* p_decode_fct)(struct wav_info_t *)

Referenced by wav_decode(), and wav_header_decode().