static Ecore_Timer* g_check_client_timer = NULL;
static Ecore_Timer* g_wait_timer = NULL;
+static Ecore_Timer* g_terminate_timer = NULL;
static utterance_t g_utt;
static GList *g_proc_list = NULL;
+static bool g_is_paused;
+
+
/* Function definitions */
static int __synthesis(int uid, const char* credential);
if (0 != ttsd_data_add_sound_data(uid, temp_sound_data)) {
SECURE_SLOG(LOG_ERROR, tts_tag(), "[SERVER ERROR] Fail to add sound data : uid(%d)", uid);
+ if (NULL != temp_sound_data->data) {
+ free(temp_sound_data->data);
+ temp_sound_data->data = NULL;
+ }
+
+ free(temp_sound_data);
+ temp_sound_data = NULL;
+
+ return TTSD_ERROR_OPERATION_FAILED;
}
if (event == TTSE_RESULT_EVENT_FINISH) {
ttsd_set_synth_control(TTSD_SYNTHESIS_CONTROL_DONE);
}
+ /* If the app state is paused, do not result to play */
+ if (true == g_is_paused) {
+ SLOG(LOG_DEBUG, tts_tag(), "[Server DEBUG] tts_pause is called. Do not request to play");
+ return TTSD_ERROR_NONE;
+ }
+
if (0 != ttsd_player_play(uid)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to play sound : uid(%d)", uid);
return true;
}
-void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_param)
+void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_param, double double_param)
{
switch (type) {
case TTS_CONFIG_TYPE_ENGINE:
}
break;
}
+
+ case TTS_CONFIG_TYPE_BACKGROUND_VOLUME_RATIO:
+ {
+ if (0.0 <= double_param && double_param <= 1.0) {
+ /* set default bg volume ratio */
+ int ret = 0;
+ ret = ttsd_player_set_background_volume_ratio(double_param);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set default bg volume ratio : result(%d)", ret);
+ }
+ }
+ break;
+ }
}
return;
Eina_Bool ttsd_terminate_daemon(void *data)
{
ttsd_data_foreach_clients(__terminate_client, NULL);
+ g_terminate_timer = NULL;
return EINA_FALSE;
}
{
if (TTSD_MODE_SCREEN_READER == ttsd_get_mode() && false == value) {
SLOG(LOG_INFO, tts_tag(), "[Server] Screen reader is OFF. Start to terminate tts daemon");
- ecore_timer_add(1, ttsd_terminate_daemon, NULL);
+ if (g_terminate_timer) {
+ ecore_timer_del(g_terminate_timer);
+ g_terminate_timer = NULL;
+ }
+ g_terminate_timer = ecore_timer_add(1, ttsd_terminate_daemon, NULL);
} else {
SLOG(LOG_DEBUG, tts_tag(), "[Server] Screen reader is %s", value ? "ON" : "OFF");
}
SLOG(LOG_ERROR, tts_tag(), "[Server WARNING] Fail to initialize config.");
}
+ double ratio;
+ if (0 == ttsd_config_get_bg_volume_ratio(&ratio))
+ {
+ SLOG(LOG_ERROR, tts_tag(), "[Server] get bg volume ratio is %lf", ratio);
+ int ret = ttsd_player_set_background_volume_ratio(ratio);
+ if (0 != ret)
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set bg volume ratio : result(%d)", ret);
+ }
+ else
+ SLOG(LOG_ERROR, tts_tag(), "[Server WARNING] Fail to get bg volume ratio");
+
/* player init */
if (ttsd_player_init()) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to initialize player init.");
ttsd_engine_agent_release();
+
+ if (g_wait_timer) {
+ ecore_timer_del(g_wait_timer);
+ g_wait_timer = NULL;
+ SLOG(LOG_INFO, tts_tag(), "[INFO] Delete ecore waiting timer handle");
+ }
+
+ if (g_terminate_timer) {
+ ecore_timer_del(g_terminate_timer);
+ g_terminate_timer = NULL;
+ SLOG(LOG_INFO, tts_tag(), "[INFO] Delete ecore terminating timer handle");
+ }
+
if (NULL != g_check_client_timer) {
ecore_timer_del(g_check_client_timer);
g_check_client_timer = NULL;
-
- SLOG(LOG_INFO, tts_tag(), "[INFO] Delete ecore timer handle");
+ SLOG(LOG_INFO, tts_tag(), "[INFO] Delete ecore checking client timer handle");
}
return TTSD_ERROR_NONE;
}
+int ttsd_terminate()
+{
+ SLOG(LOG_INFO, tts_tag(), "[Server] Terminate");
+
+ ttsd_terminate_daemon(NULL);
+
+ ttsd_dbus_close_connection();
+ ttsd_network_finalize();
+ ttsd_finalize();
+
+ return TTSD_ERROR_NONE;
+}
+
/*
* TTS Server Functions for Client
*/
ttsd_data_foreach_clients(__get_client_for_clean_up, NULL);
} else {
ecore_timer_add(0, __quit_ecore_loop, NULL);
+ SLOG(LOG_ERROR, tts_tag(), "[Server] Deleted timer");
+ return EINA_FALSE;
}
SLOG(LOG_DEBUG, tts_tag(), "@@@");
} else {
if (true == is_current_interrupt) {
SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes.");
+ ttsd_data_clear_data(uid);
return TTSD_ERROR_AUDIO_POLICY_BLOCKED;
}
}
if (APP_STATE_PAUSED == state) {
SLOG(LOG_DEBUG, tts_tag(), "[Server] uid(%d) is 'Pause' state : resume player", uid);
+ g_is_paused = false;
+
/* Resume player */
if (0 != ttsd_player_resume(uid)) {
SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Fail to ttsd_player_resume()");
/* Reset all data */
ttsd_data_clear_data(uid);
+ g_is_paused = false;
return TTSD_ERROR_NONE;
}
return TTSD_ERROR_INVALID_STATE;
}
+ g_is_paused = true;
+
*utt_id = g_utt.uttid;
SLOG(LOG_INFO, tts_tag(), "[Server] server pause, uid(%d), g_uid(%d), utt_id(%d)", uid, g_utt.uid, *utt_id);