技术专栏
Hi3519、3536音频单声道改双声道
3519音频单声道改双声道部分:
修改源文件Hi3519AV100_SDK_V2.0.2.0/smp/a53_linux/mpp/sample/audio/sample_audio.c
单声道
AUDIO_DEV AiDev = SAMPLE_AUDIO_EXTERN_AI_DEV;
AUDIO_DEV AoDev = SAMPLE_AUDIO_EXTERN_AO_DEV;
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_48000;
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_MONO; //单声道
stAioAttr.u32EXFlag = 0;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = AACLC_SAMPLES_PER_FRAME;
stAioAttr.u32ChnCnt = 1;
stAioAttr.u32ClkSel = 1;
stAioAttr.enI2sType = AIO_I2STYPE_EXTERN; //对接外接设备
双声道
AUDIO_DEV AiDev = SAMPLE_AUDIO_INNER_AI_DEV;
AUDIO_DEV AoDev = SAMPLE_AUDIO_INNER_AO_DEV;
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_48000;
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_STEREO; //双声道
stAioAttr.u32EXFlag = 0;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = AACLC_SAMPLES_PER_FRAME;
stAioAttr.u32ChnCnt = 2; //从1改成2
stAioAttr.u32ClkSel = 0;
stAioAttr.enI2sType = AIO_I2STYPE_INNERCODEC; //对接内置 CODEC
3536音频单声道改双声道部分
单声道参数设置:
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_8000;
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_MONO;
stAioAttr.u32EXFlag = 1;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM;
stAioAttr.u32ChnCnt = 1;
stAioAttr.u32ClkChnCnt = 2;
stAioAttr.u32ClkSel = 0;
双声道参数设置:
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_8000;
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_MONO; //仍为单声道模式
stAioAttr.u32EXFlag = 1;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM;
stAioAttr.u32ChnCnt = 2; //通道数改为2
stAioAttr.u32ClkChnCnt = 2;
stAioAttr.u32ClkSel = 0;
单声道绑定输入输出
/* bind AI to AO channle */
if (HI_TRUE == gs_bUserGetMode)
{
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAiAo(AiDev, AiChn, AoDev, AoChn); //左声道
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
}
else
{
s32Ret = SAMPLE_COMM_AUDIO_AoBindAi(AiDev, AiChn, AoDev, AoChn); //左声道
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
}
printf("ai(%d,%d) bind to ao(%d,%d) ok\n", AiDev, AiChn, AoDev, AoChn); //左声道
双声道绑定输入输出
/* bind AI to AO channle */
if (HI_TRUE == gs_bUserGetMode)
{
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAiAo(AiDev, AiChn, AoDev, AoChn); //左声道
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdAiAo(AiDev, AiChn, AoDev, AoChn+1); //右声道
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
}
else
{
s32Ret = SAMPLE_COMM_AUDIO_AoBindAi(AiDev, AiChn, AoDev, AoChn); //左声道
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_AoBindAi(AiDev, AiChn, AoDev, AoChn+1); //右声道
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
}
printf("ai(%d,%d) bind to ao(%d,%d) ok\n", AiDev, AiChn, AoDev, AoChn); //左声道
printf("ai(%d,%d) bind to ao(%d,%d) ok\n", AiDev, AiChn, AoDev, AoChn+1); //右声道
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
点赞
收藏
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据
相关专栏
-
浏览量:975次2024-01-24 18:13:58
-
浏览量:9942次2020-08-12 09:42:10
-
浏览量:3497次2018-02-06 10:43:46
-
浏览量:3083次2017-11-22 19:41:21
-
浏览量:3284次2022-05-20 10:31:05
-
浏览量:11711次2022-06-10 21:26:04
-
浏览量:1910次2018-11-01 11:18:47
-
2018-04-04 14:06:53
-
浏览量:4303次2018-03-31 20:59:15
-
浏览量:6398次2018-06-14 22:53:53
-
浏览量:1883次2020-08-12 09:36:09
-
浏览量:6459次2022-08-11 09:31:37
-
浏览量:5462次2021-04-27 16:33:54
-
浏览量:5746次2018-04-03 09:53:34
-
2018-06-18 22:47:22
-
浏览量:2890次2018-04-03 09:48:45
-
浏览量:3833次2020-09-24 11:58:24
-
浏览量:2621次2020-08-12 09:33:36
-
浏览量:3489次2020-08-03 19:28:14
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
V
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注