+ SLOG(LOG_INFO, get_tag(), "[Player] Sound info : id(%d) data(%p) size(%d) audiotype(%d) rate(%d) event(%d)",
+ sound_data->utt_id, sound_data->data, sound_data->data_size, sound_data->audio_type, sound_data->rate, sound_data->event);
+ } else {
+ sound_data = NULL;
+ ret = ttsd_data_get_sound_data(player->uid, &sound_data);
+ if (0 != ret || NULL == sound_data) {
+ /* empty queue */
+ SLOG(LOG_DEBUG, get_tag(), "[Player] No sound data. Waiting mode");
+ /* release audio & recover session */
+ ret = audio_out_unprepare(g_audio_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail to unprepare audio : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, get_tag(), "[Player SUCCESS] Unprepare audio");
+ }
+ g_audio_state = AUDIO_STATE_READY;
+
+ /* unset volume policy, volume will be 100% */
+ __unset_volume_using_voice_policy();
+
+ /* wait for new audio data come */
+ while (1) {
+ usleep(10000);
+ if (NULL == g_playing_info) {
+ /* current playing uid is replaced */
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Finish thread");
+ return;
+ } else if (0 < ttsd_data_get_sound_data_size(player->uid)) {
+ /* new audio data come */
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Resume thread");
+ break;
+ }
+ }
+
+ /* set volume policy as 40%, when resume play thread*/
+ __set_volume_using_voice_policy(40);
+
+ /* resume play thread */
+ player->state = APP_STATE_PLAYING;
+ continue;
+ }