代码拉取完成,页面将自动刷新
同步操作将从 AliOS Things/audio_demo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* Copyright (C) 2015-2019 Alibaba Group Holding Limited
*
*/
#include "k_api.h"
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include "ulog/ulog.h"
#include "uvoice_init.h"
#include "uvoice_test.h"
void cmd_tts_handler(char *buf, int len, int argc, char **argv)
{
/* >> tts "我爱你中国" /data/tts.mp3 */
extern void test_tts_handle(int argc, char **argv);
return test_tts_handle(argc, argv);
}
void cmd_play_handler(char *buf, int len, int argc, char **argv)
{
/* >> play fs:/data/6.mp3 */
char *param_array[2];
if (argc < 2 || strcmp(argv[0], "play"))
return;
if(!strcmp(argv[1], "pause")) {
param_array[0] = "play";
param_array[1] = "pause";
uvoice_play_test(2, param_array);
} else if(!strcmp(argv[1], "resume")) {
param_array[0] = "play";
param_array[1] = "resume";
uvoice_play_test(2, param_array);
} else if(!strcmp(argv[1], "stop")) {
param_array[0] = "play";
param_array[1] = "stop";
uvoice_play_test(2, param_array);
param_array[0] = "play";
param_array[1] = "clear";
uvoice_play_test(2, param_array);
} else {
param_array[0] = "play";
param_array[1] = "stopsync";
uvoice_play_test(2, param_array);
param_array[0] = "play";
param_array[1] = "clear";
uvoice_play_test(2, param_array);
param_array[0] = "play";
param_array[1] = argv[1];
uvoice_play_test(2, param_array);
}
}
#if AOS_COMP_CLI
struct cli_command audio_demo_commands[] = {
{"play", "try 'play fs:/data/6.mp3' | 'play url' | play pause | play pause | play resume", cmd_play_handler},
{"tts", "try 'tts 我爱你中国 /data/tts.mp3", cmd_tts_handler},
};
#endif /* AOS_COMP_CLI */
int haas_audio_init(void)
{
uvoice_init();
#if AOS_COMP_CLI
aos_cli_register_commands(audio_demo_commands, sizeof(audio_demo_commands) / sizeof(struct cli_command));
#endif /* AOS_COMP_CLI */
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。