请教:MTK平台停止播放剪辑

BuleRiver 2010-01-05 02:00:20
大家好:我现在使用函数mdi_audio_play_string_with_vol_path_non_block()播放mp3的片段,播放的还可以,但是当我想停止播放的时候,调用了函数mdi_audio_stop_string()或者mdi_audio_stop_all(),并没有停止播放,这是什么原因呢?基本的代码如下:

FS_HANDLE g_file_handle;
#define buf_size (256 * 1024)
U8 audio_data[buf_size];

void stop_play_mp3_string(void)
{
mdi_audio_stop_all();
FS_Close(g_file_handle);
GoBackHistory();
}

/* continue play mp3 string */
void play_mp3_string_continue(mdi_result result)
{
UINT len = 0;

if (FS_NO_ERROR != FS_Read(g_file_handle, audio_data, buf_size, &len))
{
DisplayPopup((U8*)L"Read File Failed", IMG_GLOBAL_OK, 1, 5000, 13);
return;
}

if (len <= 0)
{
return;
}
else
{
mdi_audio_play_string_with_vol_path_non_block(audio_data, buf_size,
MDI_FORMAT_DAF, DEVICE_AUDIO_PLAY_ONCE, NULL, play_mp3_string_continue,
(U8)6, MDI_DEVICE_SPEAKER_BOTH);
}
}

/* start to play mp3 string */
void start_play_mp3_string(void)
{
UINT len;

if ((g_file_handle = FS_Open(L"D:\\text\\a.mp3", FS_READ_ONLY)) < 0)
{
DisplayPopup((U8*)L"Open File Failed", IMG_GLOBAL_OK, 1, 5000, 13);
return;
}

if (FS_NO_ERROR != FS_Read(g_file_handle, audio_data, buf_size, &len))
{
DisplayPopup((U8*)L"Read File Failed", IMG_GLOBAL_OK, 1, 5000, 13);
FS_Close(g_file_handle);
return;
}

mdi_audio_play_string_with_vol_path_non_block(audio_data, buf_size,
MDI_FORMAT_DAF, DEVICE_AUDIO_PLAY_ONCE, NULL, play_mp3_string_continue,
(U8)6, MDI_DEVICE_SPEAKER_BOTH);
}

void audio_play_entry(void)
{
EntryNewScreen(MAIN_MENU_SCREENID, NULL, audio_play_entry, NULL);
clear_screen();
gui_set_text_color(UI_COLOR_RED);
gui_move_text_cursor(50, 50);
gui_print_text(L"Audio Player");
gui_move_text_cursor(25, 100);
gui_print_text(L"Press left key to play");
gui_move_text_cursor(10, 120);
gui_print_text(L"Press right key to pause/resume");
gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);

// 左键
SetKeyHandler(start_play_mp3_string, KEY_LSK, KEY_EVENT_DOWN);
// 右键
SetKeyHandler(stop_play_mp3_string, KEY_RSK, KEY_EVENT_DOWN);
}
...全文
126 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
BuleRiver 2010-01-05
  • 打赏
  • 举报
回复
问题已经解决。

567

社区成员

发帖
与我相关
我的任务
社区描述
英特尔® 边缘计算,聚焦于边缘计算、AI、IoT等领域,为开发者提供丰富的开发资源、创新技术、解决方案与行业活动。
社区管理员
  • 英特尔技术社区
  • shere_lin
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧