unsigned int uid;
int utt_id_stopped;
app_tts_state_e state;
+ tts_app_play_type_e type;
ttsd_mode_e mode;
ttse_result_event_e result_event;
return TTSD_ERROR_NONE;
}
+tts_app_play_type_e ttsd_data_get_play_type(unsigned int uid)
+{
+ lock_guard<mutex> lock(g_app_data_mutex);
+ app_data_s* app_data = __get_client_app_data(uid);
+ if (nullptr == app_data) {
+ SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%u)", uid);
+ return TTS_APP_PLAY_TYPE_SYNTH;
+ }
+
+ return app_data->type;
+}
+
+int ttsd_data_set_play_type(unsigned int uid, tts_app_play_type_e type)
+{
+ lock_guard<mutex> lock(g_app_data_mutex);
+ app_data_s* app_data = __get_client_app_data(uid);
+ if (nullptr == app_data) {
+ SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%u)", uid);
+ return TTSD_ERROR_INVALID_PARAMETER;
+ }
+
+ app_data->type = type;
+
+ return TTSD_ERROR_NONE;
+}
+
int ttsd_data_set_paused_data_existing(unsigned int uid, bool is_paused_data_existing)
{
lock_guard<mutex> lock(g_app_data_mutex);
static GList *g_proc_list = NULL;
-static bool g_is_paused;
-
static bool g_is_terminated = false;
int ret = TTSD_ERROR_NONE;
if (APP_STATE_PAUSED == state) {
SLOG(LOG_DEBUG, tts_tag(), "[Server] uid(%u) is 'Pause' state : resume player", uid);
- g_is_paused = false;
ret = ttsd_player_resume(uid);
} else {
SLOG(LOG_DEBUG, tts_tag(), "[Server] Play player. uid(%u)", uid);
} else {
__synthesis(uid);
}
+ ttsd_data_set_play_type(uid, TTS_APP_PLAY_TYPE_SYNTH);
return TTSD_ERROR_NONE;
}
+static void __stop_engine_synthesis(unsigned int uid)
+{
+ ttsd_synthesis_control_e synth_control = ttsd_get_synth_control();
+ SLOG(LOG_INFO, tts_tag(), "[Server INFO] synth_control(%d)", synth_control);
+
+ if (TTSD_SYNTHESIS_CONTROL_DOING == synth_control && uid == ttsd_data_get_current_playing()) {
+ SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS-engine is running");
+
+ int ret = ttsd_engine_cancel_synthesis();
+ if (TTSD_ERROR_NONE != ret)
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to cancel synthesis : ret(%d)", ret);
+ }
+
+ ttsd_set_synth_control(TTSD_SYNTHESIS_CONTROL_EXPIRED);
+}
+
int ttsd_server_stop(unsigned int uid)
{
app_tts_state_e state = ttsd_data_get_client_state(uid);
SLOG(LOG_INFO, tts_tag(), "[Server] server stop, uid(%d), state(%d)", uid, state);
if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state) {
- ttsd_synthesis_control_e synth_control = ttsd_get_synth_control();
- SLOG(LOG_INFO, tts_tag(), "[Server INFO] synth_control(%d)", synth_control);
- if (TTSD_SYNTHESIS_CONTROL_DOING == synth_control && uid == ttsd_data_get_current_playing()) {
- SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS-engine is running");
-
- int ret = ttsd_engine_cancel_synthesis();
- if (TTSD_ERROR_NONE != ret)
- SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to cancel synthesis : ret(%d)", ret);
+ if (TTS_APP_PLAY_TYPE_SYNTH == ttsd_data_get_play_type(uid)) {
+ __stop_engine_synthesis(uid);
}
- ttsd_set_synth_control(TTSD_SYNTHESIS_CONTROL_EXPIRED);
/* stop player */
ttsd_data_set_client_state(uid, APP_STATE_READY);
/* Reset all data */
ttsd_data_clear_data(uid);
- g_is_paused = false;
return TTSD_ERROR_NONE;
}
return TTSD_ERROR_OPERATION_FAILED;
}
- g_is_paused = true;
-
return TTSD_ERROR_NONE;
}
int ret = TTSD_ERROR_NONE;
if (APP_STATE_PAUSED == state) {
SLOG(LOG_DEBUG, tts_tag(), "[Server] uid(%u) is 'Pause' state : resume player", uid);
- g_is_paused = false;
ret = ttsd_player_resume(uid);
} else {
SLOG(LOG_DEBUG, tts_tag(), "[Server] Play player. uid(%u)", uid);
return TTSD_ERROR_OPERATION_FAILED;
}
- return TTSD_ERROR_NONE;
-}
-
-int ttsd_server_stop_pcm(unsigned int uid)
-{
- app_tts_state_e state = ttsd_data_get_client_state(uid);
- if (APP_STATE_NONE == state) {
- SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
-
- SLOG(LOG_INFO, tts_tag(), "[Server] server stop, state(%d)", state);
-
- if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state || APP_STATE_READY == state) {
- ttsd_data_set_client_state(uid, APP_STATE_READY);
- }
-
- /* Reset all data */
- ttsd_data_clear_data(uid);
-
- ttsd_player_stop(uid);
+ ttsd_data_set_play_type(uid, TTS_APP_PLAY_TYPE_PCM);
return TTSD_ERROR_NONE;
}