#ifndef __APP_CODEC_H__
#define __APP_CODEC_H__

#include <stdint.h>
#include <stdbool.h>

#define CODEC_TX_FRAME_BYTE_SIZE 		1280//20ms ,@16k 16bits,stereo
#define CODEC_RX_FRAME_BYTE_SIZE  		1920//30ms ,@16k 16bits,stereo

/*
 *  0x2f: 幅值2.62V
 *  0x2B: 幅值1.86V
 *  0x29: 幅值1.54V  (客户测得1.1V)
 *  0x27: 幅值1.28V
 */
#define CODEC_OUT_MAX_VOLUME_DB         0x27// 音量设置
// N*0.75  -35.25 (dB)

// N*0.75  -12 (dB)
#define CODEC_IN_MAX_VOLUME_DB          46//(46 -16)*0.75 = 24.75dB    +20dB boost
//max (63-16)*0.75 = 35.25dB   +20dB boost

extern volatile unsigned char cb_codec_output_transfer_flag;

int8_t app_codec_init(void);
void app_codec_dac_power_control(bool f_power_on);
void app_codec_delay_init(void);
void app_codec_process(void);
unsigned int app_codec_adc_input(unsigned int *pdst, unsigned int b_len);
unsigned int app_codec_dac_output(unsigned int *psrc, unsigned int b_len);
void app_codec_uninit(void);
#endif