sttd_config_time_save();
sttd_config_time_reset();
+ sttd_recorder_clear();
+
sttd_client_set_state(uid, APP_STATE_READY);
stt_client_unset_current_recognition();
return;
}
- /* Notify uid state change */
- sttdc_send_set_state(uid, APP_STATE_RECORDING);
-
- SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Start recognition");
+ app_state_e temp_app_state;
+ if (0 != sttd_client_get_state(uid, &temp_app_state)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid ");
+ return;
+ }
+ if (APP_STATE_READY != temp_app_state && 0 != stt_client_get_current_recognition()) {
+ /* Notify uid state change */
+ sttdc_send_set_state(uid, APP_STATE_RECORDING);
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Start recognition");
+ }
}
void __sttd_start_sound_completed_cb(int id, void *user_data)
if (NULL != sound) {
int id = 0;
intptr_t puid = (intptr_t)uid;
- ret = wav_player_start(sound, SOUND_TYPE_MEDIA, __sttd_start_sound_completed_cb, (void*)puid, &id);
- if (WAV_PLAYER_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav");
+ sound_stream_info_h wav_stream_info_h;
+ if (0 != sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &wav_stream_info_h)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to create stream info for playing wav");
is_sound_done = true;
+ } else {
+ ret = wav_player_start_new(sound, wav_stream_info_h, __sttd_start_sound_completed_cb, (void*)puid, &id);
+ if (WAV_PLAYER_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav");
+ is_sound_done = true;
+ }
+
+ if (0 != sound_manager_destroy_stream_information(wav_stream_info_h)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy stream info for playing wav");
+ }
}
free(sound);
sound = NULL;
g_recording_log_count = 0;
+ app_state_e temp_app_state;
+
if (true == is_sound_done) {
SLOG(LOG_DEBUG, TAG_STTD, "[Server] No sound play");
return ret;
}
- /* Notify uid state change */
- sttdc_send_set_state(uid, APP_STATE_RECORDING);
+ if (0 != sttd_client_get_state(uid, &temp_app_state)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid");
+ return STTD_ERROR_INVALID_PARAMETER;
+ }
+ if (APP_STATE_READY != temp_app_state && 0 != stt_client_get_current_recognition()) {
+ /* Notify uid state change */
+ sttdc_send_set_state(uid, APP_STATE_RECORDING);
+ }
SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Start recognition");
return STTD_RESULT_STATE_DONE;
if (NULL != sound) {
int id = 0;
intptr_t puid = (intptr_t)uid;
- ret = wav_player_start(sound, SOUND_TYPE_MEDIA, __sttd_stop_sound_completed_cb, (void*)puid, &id);
- if (WAV_PLAYER_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav");
+ sound_stream_info_h wav_stream_info_h;
+ if (0 != sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &wav_stream_info_h)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to create stream info for playing wav");
} else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Server] Play wav : %s", sound);
- }
+ ret = wav_player_start_new(sound, wav_stream_info_h, __sttd_stop_sound_completed_cb, (void*)puid, &id);
+ if (WAV_PLAYER_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav");
+ } else {
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server] Play wav : %s", sound);
+ }
+ if (0 != sound_manager_destroy_stream_information(wav_stream_info_h)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy stream info for playing wav");
+ }
+ }
free(sound);
g_processing_timer = ecore_timer_add(g_processing_timeout, __time_out_for_processing, NULL);