From 41b298b0bed13c88e1b971cb7d897146d96185fe Mon Sep 17 00:00:00 2001 From: Martin <10679603+mading0405@user.noreply.gitee.com> Date: Fri, 12 Jan 2024 07:41:46 +0000 Subject: [PATCH] =?UTF-8?q?update=20cplusplus/level1=5Fsingle=5Fapi/6=5Fme?= =?UTF-8?q?dia/1=5Faudio/audio=5Fgitee/sample=5Faudio.c.=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8F=8C=E5=A3=B0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin <10679603+mading0405@user.noreply.gitee.com> --- .../6_media/1_audio/audio_gitee/sample_audio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cplusplus/level1_single_api/6_media/1_audio/audio_gitee/sample_audio.c b/cplusplus/level1_single_api/6_media/1_audio/audio_gitee/sample_audio.c index 86960a03b..19e33641e 100644 --- a/cplusplus/level1_single_api/6_media/1_audio/audio_gitee/sample_audio.c +++ b/cplusplus/level1_single_api/6_media/1_audio/audio_gitee/sample_audio.c @@ -54,12 +54,13 @@ hi_s32 sample_comm_sys_init(void) static hi_void sample_audio_aio_init_param(hi_aio_attr *aio_attr) { - aio_attr->chn_cnt = 1; + aio_attr->chn_cnt = 2; aio_attr->point_num_per_frame = 960; aio_attr->expand_flag = 0; aio_attr->frame_num = 30; aio_attr->clk_share = 1; - aio_attr->snd_mode = HI_AUDIO_SOUND_MODE_MONO; + // aio_attr->snd_mode = HI_AUDIO_SOUND_MODE_MONO; /* single voice */ + aio_attr->snd_mode = HI_AUDIO_SOUND_MODE_STEREO; /* double voice */ aio_attr->sample_rate = HI_AUDIO_SAMPLE_RATE_48000; aio_attr->bit_width = HI_AUDIO_BIT_WIDTH_16; aio_attr->work_mode = HI_AIO_MODE_I2S_MASTER; @@ -239,6 +240,7 @@ static hi_s32 audio_ai_get_frame_and_send(sample_ai *ai_ctl, FILE *capture_fd) } fwrite(frame.virt_addr[0], 1, frame.len, capture_fd); + fwrite(frame.virt_addr[1], 1, frame.len, capture_fd); /* finally you must release the stream */ ret = hi_mpi_ai_release_frame(ai_ctl->ai_dev, ai_ctl->ai_chn, &frame, &aec_frm); -- Gitee