www.pudn.com > iMagic_2006_0428_v098r23.rar > wavcodec.h
/* * File : wavcodec.h * Purpose : WAV Codec * ***************************************************************************** */ #ifndef WAVCODEC_H #define WAVCODEC_H /* ***************************************************************************** * INCLUDE FILES ***************************************************************************** */ /* ***************************************************************************** * DEFINITION OF DATA TYPES ***************************************************************************** */ #define RIFF_CHUNK_NUMBER 0x52494646 //"RIFF" #define WAVE_CONTAINER_TYPE_NUMBER 0x57415645 //"WAVE" #define FMT_CHUNK_NUMBER 0x666D7420 //"fmt " #define DATA_CHUNK_NUMBER 0x64617461 //"data" #define CHUNK_ID_LENGTH 4 #define CHUNK_SIZE_LENGTH 4 #define CHUNK_HEADER_LENGTH CHUNK_ID_LENGTH+CHUNK_SIZE_LENGTH #define WAVE_CONTAINER_TYPE_LENGTH 4 #define DEFAULT_FMT_CHUNK_SIZE 14 #define DEFAULT_ENCODER_HEADER_SIZE 44 #define WAVE_BUFFER_SIZE 256*2 #define WAVE_OUTPUT_BUFFER_ADDRESS AUDIO_SRAM_BUFFER_ADDRESS #define FMT_COMPRESSION_CODE 0 #define FMT_NUMBER_OF_CHANNELS 2 #define FMT_SAMPLING_RATE 4 #define FMT_BYTE_RATE 8 #define FMT_BLOCK_ALIGNMENT 12 #define CHUNK_NOT_FOUNDED -1 //WAVE Format Codes #define Unknown_Illegal 0x0000 #define PCM_COMPRESSION_CODE 0x0100 #define Microsoft_ADPCM 0x0200 #define ITU_G711_ALaw 0x0600 #define ITU_G711_uLaw 0x0700 #define IMA_ADPCM 0x1100 #define ITU_G723_ADPCM 0x1400 #define GSM_610 0x3100 #define ITU_G721_ADPCM 0x4000 #define MPEG_CODE 0x5000 #define ADPCM_BufSize 256 #define PCM_BufSize (((ADPCM_BufSize-4)<<1)+1) #define ADPCM_PACKET_HEADER_LEN 4 #define IMA_ADPCM_BITS_PERSAMPLE 4 #define IMA_ADPCM_CODE_MASK 0x0f #define SWAP4(x) ( ((x&0xff)<<24) | ((x&0xff00)<<8) | ((x&0xff0000)>>8) | ((x&0xff000000)>>24) ) #define SWAP2(x) ( ((x&0xff00)>>8) | ((x&0xff)<<8) ) /* ******************************************************************************** * DECLARATION OF PROTOTYPES ******************************************************************************** */ int WavDecoder(void); int WavEncoder(void); unsigned long calculateWAVFileLength(void); int WavStartRecordingInf(void); #endif