Modify doxygen group names
[platform/core/uifw/dali-adaptor.git] / adaptors / public-api / adaptor-framework / tts-player.h
1 #ifndef __DALI_TTS_PLAYER_H__
2 #define __DALI_TTS_PLAYER_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
24
25 namespace Dali
26 {
27 /**
28  * @addtogroup dali_adaptor_framework
29  * @{
30  */
31
32 namespace Internal DALI_INTERNAL
33 {
34 namespace Adaptor
35 {
36 class TtsPlayer;
37 }
38 }
39
40 /**
41  * @brief The Text-to-speech Player.
42  */
43 class DALI_IMPORT_API TtsPlayer : public BaseHandle
44 {
45 public: // ENUMs
46
47   /**
48    * @brief Enumeration of TTS mode.
49    */
50   enum Mode
51   {
52     DEFAULT = 0,  ///< Default mode for normal application
53     NOTIFICATION, ///< Notification mode
54     SCREEN_READER, ///< Screen reader mode
55     MODE_NUM
56   };
57
58   /**
59    * @brief Enumeration of TTS state.
60    */
61   enum State
62   {
63     UNAVAILABLE = 0,    ///< Player is not available
64     READY,              ///< Player is ready to play
65     PLAYING,            ///< Player is playing
66     PAUSED              ///< Player is paused
67   };
68
69 public: // Typedefs
70
71   /**
72    * @brief Type of signal emitted when the TTS state changes.
73    */
74   typedef Signal< void ( const Dali::TtsPlayer::State, const Dali::TtsPlayer::State ) > StateChangedSignalType;
75
76 public: // API
77
78   /**
79    * @brief Create an uninitialized handle.
80    *
81    * This can be initialized by calling TtsPlayer::Get().
82    */
83   TtsPlayer();
84
85   /**
86    * @brief Gets the singleton of the TtsPlayer for the given mode.
87    *
88    * @param mode the mode of tts-player
89    * @return A handle of the Ttsplayer for the given mode.
90    */
91   static TtsPlayer Get(Dali::TtsPlayer::Mode mode = Dali::TtsPlayer::DEFAULT);
92
93   /**
94    * @brief Destructor
95    *
96    * This is non-virtual since derived Handle types must not contain data or virtual methods.
97    */
98   ~TtsPlayer();
99
100   /**
101    * @brief This copy constructor is required for (smart) pointer semantics.
102    *
103    * @param [in] handle A reference to the copied handle
104    */
105   TtsPlayer(const TtsPlayer& handle);
106
107   /**
108    * @brief This assignment operator is required for (smart) pointer semantics.
109    *
110    * @param [in] rhs  A reference to the copied handle
111    * @return A reference to this
112    */
113   TtsPlayer& operator=(const TtsPlayer& rhs);
114
115   /**
116    * @brief Start playing the audio data synthesized from the specified text.
117    *
118    * @pre The TtsPlayer needs to be initialized.
119    * @param[in] text to play.
120    */
121   void Play(const std::string& text);
122
123   /**
124    * @brief Stops playing the utterance.
125    * @pre The TtsPlayer needs to be initialized.
126    */
127   void Stop();
128
129   /**
130    * @brief Pauses the currently playing utterance.
131    * @pre The TtsPlayer needs to be initialized.
132    */
133   void Pause();
134
135   /**
136    * @brief Resumes the previously paused utterance.
137    * @pre The TtsPlayer needs to be initialized.
138    */
139   void Resume();
140
141   /**
142    * @brief Gets the current state of the player.
143    * @pre The TtsPlayer needs to be initialized.
144    */
145   State GetState();
146
147   /**
148    * @brief Allows connection TTS state change signal.
149    * Note: Only supported by some adaptor types.
150    * @return A reference to the signal for connection.
151    */
152   Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal();
153
154 public: // Not intended for application developers
155
156   /**
157    * @brief This constructor is used by TtsPlayer::Get().
158    * @param[in] ttsPlayer A pointer to the TTS player.
159    */
160   explicit DALI_INTERNAL TtsPlayer( Internal::Adaptor::TtsPlayer* ttsPlayer );
161 };
162
163 /**
164  * @}
165  */
166 } // namespace Dali
167
168 #endif // __DALI_TTS_PLAYER_H__