Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources
This commit is contained in:
46
sdk/app/media_test_demo/AT_play_audio.c
Normal file
46
sdk/app/media_test_demo/AT_play_audio.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/***************************************************
|
||||
该demo主要是使用AT命令控制播放音频,
|
||||
AT命令格式:AT+PLAY_AUDIO=xxx.xxx,mode,
|
||||
支持的格式为wav、mp3、amr、aac-lc,
|
||||
***************************************************/
|
||||
#include "basic_include.h"
|
||||
#include "audio_media_ctrl/audio_media_ctrl.h"
|
||||
|
||||
struct msi *audio_play_msi = NULL;
|
||||
int32 atcmd_play_audio(const char *cmd, char *argv[], uint32 argc)
|
||||
{
|
||||
char audio_filePath[20];
|
||||
uint8_t play_mode = 0;
|
||||
AUDEC_INIT audec_init;
|
||||
|
||||
if(argc < 2) {
|
||||
os_printf("%s argc err:%d,enter the path and mode\n",__FUNCTION__,argc);
|
||||
return 0;
|
||||
}
|
||||
if(argv[0]) {
|
||||
memset(audio_filePath,0,sizeof(audio_filePath));
|
||||
memcpy(audio_filePath,argv[0],strlen(argv[0]));
|
||||
play_mode = os_atoi(argv[1]);
|
||||
if(play_mode) {
|
||||
if(audio_play_msi) {
|
||||
audio_file_play_stop(audio_play_msi);
|
||||
audio_play_msi = NULL;
|
||||
}
|
||||
audec_init.track_type = MEDIA_TRACK;
|
||||
audec_init.priority = play_interruptible;
|
||||
audec_init.direct_to_dac = 1;
|
||||
audec_init.use_tpc = 0;
|
||||
audec_init.destroy_self = 0;
|
||||
audec_init.src_msi = NULL;
|
||||
audio_play_msi = audio_file_play_init(audio_filePath,play_mode,&audec_init);
|
||||
}
|
||||
else {
|
||||
if(audio_play_msi == NULL) {
|
||||
return 0;
|
||||
}
|
||||
audio_file_play_stop(audio_play_msi);
|
||||
audio_play_msi = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
27
sdk/app/media_test_demo/AT_save_audio.c
Normal file
27
sdk/app/media_test_demo/AT_save_audio.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/********************************************************
|
||||
该demo主要是使用AT命令控制录制音频,录制默认格式为aac-lc,
|
||||
*********************************************************/
|
||||
#include "basic_include.h"
|
||||
#include "audio_media_ctrl/audio_media_ctrl.h"
|
||||
|
||||
int32 atcmd_save_audio(const char *cmd, char *argv[], uint32 argc)
|
||||
{
|
||||
uint32_t record_time = 0;
|
||||
uint32_t record_ctl = 0;
|
||||
uint32_t samplerate = 0;
|
||||
|
||||
if(argc < 3) {
|
||||
os_printf("%s argc err:%d,enter the mode,samplerate and time\n",__FUNCTION__,argc);
|
||||
return 0;
|
||||
}
|
||||
record_ctl = os_atoi(argv[0]);
|
||||
if(record_ctl) {
|
||||
samplerate = os_atoi(argv[1]);
|
||||
record_time = os_atoi(argv[2]);
|
||||
audio_file_record_init(NULL,samplerate,record_time);
|
||||
}
|
||||
else {
|
||||
audio_file_record_stop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
9
sdk/app/media_test_demo/media_test_demo.h
Normal file
9
sdk/app/media_test_demo/media_test_demo.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _MEDIA_TEST_DEMO_H
|
||||
#define _MEDIA_TEST_DEMO_H
|
||||
|
||||
#include "basic_include.h"
|
||||
|
||||
int32 atcmd_save_audio(const char *cmd, char *argv[], uint32 argc);
|
||||
int32 atcmd_play_audio(const char *cmd, char *argv[], uint32 argc);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user