#define SOUND_BUFFER_LENGTH 2048
#define FOCUS_SERVER_READY "/tmp/.sound_server_ready"
+/* Sound buf save for test */
+/*
+#define BUF_SAVE_MODE
+*/
+#ifdef BUF_SAVE_MODE
+static char g_temp_file_name[128] = {'\0',};
+
+static FILE* g_pFile;
+
+static int g_count = 1;
+#endif
+
/** player init info */
static bool g_player_init = false;
static void __end_play_thread(void *data, Ecore_Thread *thread)
{
SLOG(LOG_ERROR, tts_tag(), "@@@ End thread");
+
+#ifdef BUF_SAVE_MODE
+ fclose(g_pFile);
+#endif
}
static void __set_policy_for_playing(int volume)
{
SLOG(LOG_DEBUG, tts_tag(), "@@@ Start thread");
+#ifdef BUF_SAVE_MODE
+ g_count++;
+
+ while (1) {
+ snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/tts_temp_%d_%d", getpid(), g_count);
+ int ret = access(g_temp_file_name, 0);
+
+ if (0 == ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Recorder ERROR] File is already exist");
+ if (0 == remove(g_temp_file_name)) {
+ SLOG(LOG_DEBUG, tts_tag(), "[Recorder] Remove file");
+ break;
+ } else {
+ g_count++;
+ }
+ } else {
+ break;
+ }
+ }
+
+ SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Recorder] Temp file name=[%s]", g_temp_file_name);
+
+ /* open test file */
+ g_pFile = fopen(g_temp_file_name, "wb+x");
+ if (!g_pFile) {
+ SLOG(LOG_ERROR, tts_tag(), "[Recorder ERROR] File not found!");
+ return;
+ }
+#endif
+
if (NULL == g_playing_info) {
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] No current player");
return;
char* temp_data = sound_data->data;
SLOG(LOG_INFO, tts_tag(), "[Player INFO] Before audio_out_write. data(%p), data[%d](%p), uid(%d), utt_id(%d), len(%d)",
temp_data, idx, &temp_data[idx], player->uid, sound_data->utt_id, len);
+#ifdef BUF_SAVE_MODE
+ /* write pcm buffer */
+ fwrite(&temp_data[idx], 1, len, g_pFile);
+#endif
ret = audio_out_write(g_audio_h, &temp_data[idx], len);
if (0 > ret) {
SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to audio write - %d", ret);