1 #ifndef __DALI_TTS_PLAYER_H__
2 #define __DALI_TTS_PLAYER_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
28 * @addtogroup dali_adaptor_framework
32 namespace Internal DALI_INTERNAL
41 * @brief The Text-to-speech Player.
44 class DALI_IMPORT_API TtsPlayer : public BaseHandle
49 * @brief Enumeration of TTS mode.
54 DEFAULT = 0, ///< Default mode for normal application @SINCE_1_0.0
55 NOTIFICATION, ///< Notification mode @SINCE_1_0.0
56 SCREEN_READER, ///< Screen reader mode @SINCE_1_0.0
61 * @brief Enumeration of TTS state.
66 UNAVAILABLE = 0, ///< Player is not available @SINCE_1_0.0
67 READY, ///< Player is ready to play @SINCE_1_0.0
68 PLAYING, ///< Player is playing @SINCE_1_0.0
69 PAUSED ///< Player is paused @SINCE_1_0.0
75 * @brief Type of signal emitted when the TTS state changes.
78 typedef Signal< void ( const Dali::TtsPlayer::State, const Dali::TtsPlayer::State ) > StateChangedSignalType;
83 * @brief Create an uninitialized handle.
85 * This can be initialized by calling TtsPlayer::Get().
91 * @brief Gets the singleton of the TtsPlayer for the given mode.
94 * @param mode the mode of tts-player
95 * @return A handle of the Ttsplayer for the given mode.
97 static TtsPlayer Get(Dali::TtsPlayer::Mode mode = Dali::TtsPlayer::DEFAULT);
102 * This is non-virtual since derived Handle types must not contain data or virtual methods.
108 * @brief This copy constructor is required for (smart) pointer semantics.
111 * @param [in] handle A reference to the copied handle
113 TtsPlayer(const TtsPlayer& handle);
116 * @brief This assignment operator is required for (smart) pointer semantics.
119 * @param [in] rhs A reference to the copied handle
120 * @return A reference to this
122 TtsPlayer& operator=(const TtsPlayer& rhs);
125 * @brief Start playing the audio data synthesized from the specified text.
128 * @param[in] text to play.
129 * @pre The TtsPlayer needs to be initialized.
131 void Play(const std::string& text);
134 * @brief Stops playing the utterance.
136 * @pre The TtsPlayer needs to be initialized.
141 * @brief Pauses the currently playing utterance.
143 * @pre The TtsPlayer needs to be initialized.
148 * @brief Resumes the previously paused utterance.
150 * @pre The TtsPlayer needs to be initialized.
155 * @brief Gets the current state of the player.
157 * @pre The TtsPlayer needs to be initialized.
162 * @brief Allows connection TTS state change signal.
163 * Note: Only supported by some adaptor types.
165 * @return A reference to the signal for connection.
167 Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal();
169 public: // Not intended for application developers
172 * @brief This constructor is used by TtsPlayer::Get().
174 * @param[in] ttsPlayer A pointer to the TTS player.
176 explicit DALI_INTERNAL TtsPlayer( Internal::Adaptor::TtsPlayer* ttsPlayer );
184 #endif // __DALI_TTS_PLAYER_H__