}
// TODO: make function duplicated block
- tts_core_set_current_state(client, TTS_STATE_READY);
+ tts_core_notify_state_changed(client, TTS_STATE_READY);
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return EINA_FALSE;
}
SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_dbus_request_play");
- return tts_core_set_current_state(client, TTS_STATE_PLAYING);
+ return tts_core_notify_state_changed(client, TTS_STATE_PLAYING);
}
int tts_core_initialize()
return TTS_ERROR_NONE;
}
-int tts_core_notify_state_changed(tts_client_s* client, tts_state_e before_state, tts_state_e current_state)
+int tts_core_notify_state_changed(tts_client_s* client, tts_state_e current_state)
{
if (false == tts_client_is_valid_client(client)) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Handle is not valid.");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Client is invalid.");
return TTS_ERROR_INVALID_PARAMETER;
}
+ tts_state_e before_state = tts_client_get_current_state(client);
+ if (before_state == current_state) {
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] State is not changed. before(%s), current(%s)", __convert_state(before_state), __convert_state(current_state));
+ return TTS_ERROR_NONE;
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "State changed to (%s).", __convert_state(current_state));
+ tts_client_set_current_state(client, current_state);
__client_state_changed_cb(client, before_state, current_state);
return TTS_ERROR_NONE;
return TTS_ERROR_NONE;
}
-int tts_core_set_current_state(tts_client_s* client, tts_state_e state)
-{
- if (false == tts_client_is_valid_client(client)) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Client is invalid.");
- return TTS_ERROR_INVALID_PARAMETER;
- }
-
- tts_state_e before_state = tts_client_get_current_state(client);
- if (before_state == state) {
- SLOG(LOG_INFO, TAG_TTSC, "[INFO] State is not changed. before(%s), current(%s)", __convert_state(before_state), __convert_state(state));
- return TTS_ERROR_NONE;
- }
-
- SLOG(LOG_DEBUG, TAG_TTSC, "State changed to (%s).", __convert_state(state));
- tts_client_set_current_state(client, state);
- __client_state_changed_cb(client, before_state, state);
-
- return TTS_ERROR_NONE;
-}
-
int tts_core_set_mode(tts_client_s* client, tts_mode_e mode)
{
if (false == tts_client_is_valid_client(client)) {
return ret;
}
- return tts_core_set_current_state(client, TTS_STATE_READY);
+ return tts_core_notify_state_changed(client, TTS_STATE_READY);
}
int tts_core_pause(tts_client_s* client)
}
SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_dbus_request_pause");
- return tts_core_set_current_state(client, TTS_STATE_PAUSED);
+ return tts_core_notify_state_changed(client, TTS_STATE_PAUSED);
}
int tts_core_repeat(tts_client_s* client, char** text_repeat, int* utt_id)
}
SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_dbus_request_play_pcm");
- return tts_core_set_current_state(client, TTS_STATE_PLAYING);
+ return tts_core_notify_state_changed(client, TTS_STATE_PLAYING);
}
int tts_core_stop_pcm(tts_client_s* client)
}
SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_dbus_request_stop_pcm");
- return tts_core_set_current_state(client, TTS_STATE_READY);
+ return tts_core_notify_state_changed(client, TTS_STATE_READY);
}
int tts_core_set_private_data(tts_client_s* client, const char* key, const char* data)
#include "tts_client.h"
// common function
-int tts_core_notify_state_changed(tts_client_s* client, tts_state_e before_state, tts_state_e current_state);
+int tts_core_notify_state_changed(tts_client_s* client, tts_state_e current_state);
int tts_core_notify_state_changed_async(tts_client_s* client, tts_state_e before_state, tts_state_e current_state);
int tts_core_notify_utt_started(tts_client_s* client, int utt_id);
int tts_core_notify_utt_completeted(tts_client_s* client, int utt_id);
int tts_core_notify_default_voice_changed(tts_client_s* client, const char* before_lang, int before_voice_type, const char* language, int voice_type);
int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id, const char* language, int voice_type, bool need_credential);
-int tts_core_set_current_state(tts_client_s* client, tts_state_e state);
int tts_core_set_mode(tts_client_s* client, tts_mode_e mode);
bool tts_core_is_valid_text(const char* text);