}
/* check the current state */
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
ttsd_set_synth_control(TTSD_SYNTHESIS_CONTROL_DONE);
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
SLOG(LOG_INFO, tts_tag(), "[Server] Server finalize");
SLOG(LOG_INFO, tts_tag(), "[Server] File num(%d), Avg Latency(%lf), Min(%lf), Max(%lf)", g_file_num, (g_avg_latency / (double)g_file_num), g_min_latency, g_max_latency);
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ if (0 > ttsd_data_is_client(uid)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_finalize : uid is not valid");
}
int ttsd_server_set_mode(unsigned int uid, ttsd_mode_e mode)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%u) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_add_queue(unsigned int uid, const char* text, const char* lang, int voice_type, int speed, int utt_id, const char* credential)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_add_queue : uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
}
return;
}
- app_tts_state_e state = APP_STATE_CREATED;
-
- if (0 != ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get state. uid(%u), pid(%d)", uid, pid);
return;
}
int ttsd_server_play(unsigned int uid, const char* credential)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%u) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_stop(unsigned int uid)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ 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;
}
int ttsd_server_pause(unsigned int uid, int* utt_id)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_pause : uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_get_support_voices(unsigned int uid, GList** voice_list)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ if (0 > ttsd_data_is_client(uid)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_get_current_voice(unsigned int uid, char** language, int* voice_type)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ if (0 > ttsd_data_is_client(uid)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_get_current_voice : uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_set_private_data(unsigned int uid, const char* key, const char* data)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%u) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_get_private_data(unsigned int uid, const char* key, char** data)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%u) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_play_pcm(unsigned int uid)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ app_tts_state_e state = ttsd_data_get_client_state(uid);
+ if (APP_STATE_NONE == state) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%u) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_server_stop_pcm(unsigned int uid)
{
- app_tts_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
+ 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;
}
ttsd_player_stop(uid);
-
return TTSD_ERROR_NONE;
}