#include "ma_defs.h"
#include "ma_config_mgr.h"
+/* Sound buf save for test */
+#if 0
+#define BUF_SAVE_MODE
+#endif
+
#define MAX_ASSISTANT_INFO_STR_LEN 128
#define MAX_ASSISTANT_NUM 10
#define ENABLED_ASSISTANTS_URL "db/multi-assistant/enabled_assistants"
}
#endif
+#ifdef BUF_SAVE_MODE
+ static char g_temp_file_name[128] = {'\0',};
+ static FILE* g_pFile = NULL;
+ static int g_count = 1;
+ if (MA_AUDIO_STREAMING_EVENT_START == event) {
+ if (g_pFile) {
+ fclose(g_pFile);
+ g_pFile = NULL;
+ } else {
+ MA_LOGD("[Recorder Info] File not found!");
+ }
+
+ while (1) {
+ snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/ma_%d_%d", getpid(), g_count);
+ int ret = access(g_temp_file_name, 0);
+
+ if (0 == ret) {
+ MA_LOGD("[Recorder ERROR] File is already exist");
+ if (0 == remove(g_temp_file_name)) {
+ MA_LOGD("[Recorder] Remove file");
+ break;
+ } else {
+ g_count++;
+ }
+ } else {
+ break;
+ }
+ }
+
+ MA_LOGD("[Recorder] Temp file name=[%s]", g_temp_file_name);
+
+ /* open test file */
+ g_pFile = fopen(g_temp_file_name, "wb+x");
+ if (!g_pFile) {
+ MA_LOGD("[Recorder ERROR] File not found!");
+ }
+ g_count++;
+ }
+
+ if (g_pFile)
+ fwrite(buffer, 1, len, g_pFile);
+
+ if (MA_AUDIO_STREAMING_EVENT_FINISH == event) {
+ if (g_pFile) {
+ MA_LOGE("[Recorder SUCCESS] File Close");
+ fclose(g_pFile);
+ g_pFile = NULL;
+ } else {
+ MA_LOGE("[Recorder ERROR] File not found!");
+ }
+ }
+#endif
+
ma_client_get_audio_streaming_cb(g_ma, &callback, &user_data);
if (NULL != callback) {