最近调试一款个案子,用到了WIFI,因WIFI没有codec功能所以只能外接一个codec IC进行音频解码播放,用到了杰理的6925,通过串口通信把MP3数据从WIFI传到了杰理6925,6925这边负责解码播放,解码实现如下:
//测试用的mp3数据
const u8 music_data[] = {
0xFF, 0xF2, 0x3B, 0xC0, 0x4E, 0x54, 0x00, 0x12, 0x90, 0x2E, 0xA4, 0xF6, 0x31, 0x8C, 0x04, 0x04,
0xDB, 0xEA, 0xDC, 0x9A, 0x87, 0x04, 0x94, 0xE0, 0xB5, 0x82, 0x28, 0x11, 0x47, 0xE5, 0x00, 0x03,
0x43, 0xE0, 0x80, 0x44, 0x30, 0x0F, 0x88, 0x22, 0x41, 0x39, 0x4D, 0x21, 0x10, 0xB3, 0xBF, 0x43,
0x65, 0x3C, 0x81, 0x3E, 0xB1, 0xCE, 0xF2, 0x85, 0x2D, 0x39, 0xF4, 0x77, 0x1C, 0x26, 0x42, 0x82,
0x7F, 0xCA, 0x2D, 0xE7, 0x3E, 0x82, 0xEA, 0x93, 0x26, 0xCC, 0xBB, 0xFE, 0x18, 0x3F, 0xAB, 0xB0,
0x2C, 0xE2, 0x85, 0xFC, 0xF9, 0xC3, 0xE9, 0xA8, 0xBA, 0x3F, 0x24, 0x8A, 0x9F, 0x49, 0xA7, 0x1D,
0x76, 0xEC, 0xD3, 0x42, 0xD5, 0x38, 0xC9, 0x11, 0xE1, 0xD4, 0x9D, 0xD8, 0x9E, 0xFF, 0xF2, 0x49,
0xC0, 0x40, 0x49, 0x13, 0x10, 0x10, 0x76, 0xD2, 0x5E, 0x48, 0xC6, 0x48, 0xB2, 0xE8, 0xCC, 0x81,
0x6C, 0x0B, 0x21, 0x93, 0x67, 0x35, 0xD9, 0xE5, 0xFF, 0xC3, 0x7E, 0x45, 0xDD, 0x97, 0x4B, 0x7F,
0xFD, 0x60, 0x88, 0x5F, 0xBF, 0xFA, 0x3E, 0xBE, 0x2C, 0x0B, 0x23, 0x5B, 0xCE, 0x7A, 0xD9, 0xF6,
0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0xEA, 0xFA, 0xB5, 0xFF, 0xF4, 0x59, 0x57, 0x4C, 0xC5, 0xB7, 0xE8, 0x4F, 0xFA,
0x5C, 0xB4, 0x74, 0xE0, 0xC5, 0x05, 0xF4, 0xB3, 0xA9, 0x10, 0xCA, 0xE9, 0xFE, 0xAA, 0x9F, 0x4F,
};
//user file
typedef struct __user_decoder {
u32 file_size; //文件大小
u32 read_prt; //读位置
volatile u32 rec_prt_start; //缓存开始位置
volatile u32 rec_prt_end; //缓存结束位置
u32 rec_prt;
u32 rec_file_prt; //当前接收缓存的位置
u8 st; //是否接收缓存
volatile bool need_data_pause_flag;
volatile bool play_buff_choice; //0表示播放选BUFF0 接收选BUFF1第一次除外
bool first_rec_data;
}_USER_DEC;
_USER_DEC uart_decoder ;
bool decoder_start(void)
{
bool ret = FALSE;
uart_decoder.file_size = 0xffffffff;
MUSIC_DECODER *obj = NULL;
obj = music_decoder_creat();
if (obj == NULL)
{
printf("fail\n");
return ret;
}
sound_automute_set(0, -1, -1, -1); // 关自动mute
dac_mute(0, 1);
decoder_hdl = obj;
AUDIO_STREAM_PARAM stream_param;
stream_param.ef = AUDIO_EFFECT_NULL;
stream_param.ch = 2;
stream_param.sr = SR44100;
music_decoder_set_output(obj, audio_stream_init(&stream_param, NULL));
music_decoder_set_file_interface(obj,(AUDIO_FILE *)&player_interface,(void *)&uart_decoder/*使用者主注册的file_io的私有属性*/);
music_decoder_set_err_deal_interface(obj, decoder_err_deal, NULL); ///暂不处理错误
decoder_set_configs(obj);
tbool err = music_decoder_play(obj, NULL);
if (err == MUSIC_DECODER_ERR_NONE)
{
printf(" codec start! \n");
ret = TRUE;
}
return ret;
}
static void decoder_err_deal(void *priv, u32 err)
{
u32 msg;
if (err) {
switch (err) {
case MAD_ERROR_FILE_END://file end
msg = SYS_EVENT_DEC_END;
// uart_cmd_send(SEND_CMD_PLAY_END);
break;
// case MAD_ERROR_SYNC_LIMIT:// 文件错误 */
// break;
case MAD_ERROR_FF_FR_FILE_END://快进结束 */
msg = SYS_EVENT_DEC_FF_END;
break;
case MAD_ERROR_FF_FR_FILE_START://快退结束 */
msg = SYS_EVENT_DEC_FR_END;
break;
case MAD_ERROR_NODATA:
msg = SYS_EVENT_DEC_END;
break;
default:
msg = SYS_EVENT_DEC_END;
break;
}
printf("error%x\n", err);
}
}
static u32 data_read(_USER_DEC *p_f, u8 _xdata *buff, u16 len)
{
len = sizeof(music_data); //512
memcpy(buff, music_data, len);
return len;
}
static u32 data_seek(_USER_DEC *p_f, u8 type, u32 offsize)
{
return 0;
}
static u32 data_get_size(void *priv)
{
return uart_decoder.file_size;
}
static const AUDIO_FILE player_interface = {
.seek = NULL,
.read = (void *)data_read,
.get_size = data_get_size,
};
杰理原厂提供的包没有解码原型的接口,所以自己摸索了一番,记录下来,decoder_err_deal为解码器出错处理,data_read为读回调函数,只要往里面一直填数据,并返回相应的长度,就可以播放了。接口是没有问题的,调试了几个案子。以上会不断重复播放雨夜的浪漫这首歌。。