void TtsPlayer::Play(const std::string& text)
{
- return GetImplementation(*this).Play(text);
+ GetImplementation(*this).Play(text);
}
void TtsPlayer::Stop()
GetImplementation(*this).Resume();
}
+TtsPlayer::State TtsPlayer::GetState()
+{
+ return GetImplementation(*this).GetState();
+}
+
TtsPlayer::TtsPlayer( Internal::Adaptor::TtsPlayer* player )
: BaseHandle( player )
{
MODE_NUM
};
+ /**
+ * @brief Enumeration of TTS state.
+ */
+ enum State
+ {
+ UNAVAILABLE = 0, ///< Player is not available
+ READY, ///< Player is ready to play
+ PLAYING, ///< Player is playing
+ PAUSED ///< Player is paused
+ };
+
public: // API
/**
*/
void Resume();
+ /**
+ * @brief Gets the current state of the player.
+ * @pre The TtsPlayer needs to be initialized.
+ */
+ State GetState();
+
public: // Not intended for application developers
/**
}
}
+Dali::TtsPlayer::State TtsPlayer::GetState()
+{
+ Dali::TtsPlayer::State ttsState = Dali::TtsPlayer::UNAVAILABLE;
+
+ if(mInitialized)
+ {
+ // Check the current TTS state
+ tts_state_e state;
+ int retVal = tts_get_state(mTtsHandle, &state);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ else
+ {
+ ttsState = static_cast<Dali::TtsPlayer::State>(state);
+ }
+ }
+
+ return ttsState;
+}
+
void TtsPlayer::StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *userData)
{
TtsPlayer* obj = static_cast<TtsPlayer*>(userData);
*/
void Resume();
+ /**
+ * @copydoc TtsPlayer::GetState()
+ */
+ Dali::TtsPlayer::State GetState();
+
private:
/**
{
}
+Dali::TtsPlayer::State TtsPlayer::GetState()
+{
+ return Dali::TtsPlayer::UNAVAILABLE;
+}
+
+
} // namespace Adaptor
} // namespace Internal
*/
void Resume();
+ /**
+ * @copydoc TtsPlayer::GetState()
+ */
+ Dali::TtsPlayer::State GetState();
+
private:
/**
END_TEST;
}
+int UtcDaliTtsPlayerGetStateN(void)
+{
+ Dali::TtsPlayer player = Dali::TtsPlayer::Get();
+
+ try
+ {
+ Dali::TtsPlayer::State state = player.GetState();
+ DALI_TEST_CHECK( false ); // Should not reach here!
+ }
+ catch( ... )
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+