Merge branch 'devel/master' into devel/new_mesh
[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
24 namespace Dali
25 {
26
27 namespace Internal DALI_INTERNAL
28 {
29 namespace Adaptor
30 {
31 class TtsPlayer;
32 }
33 }
34
35 /**
36  * @brief The Text-to-speech Player.
37  */
38 class DALI_IMPORT_API TtsPlayer : public BaseHandle
39 {
40 public: // ENUMs
41
42   /**
43    * @brief Enumeration of TTS mode.
44    */
45   enum Mode
46   {
47     DEFAULT = 0,  ///< Default mode for normal application
48     NOTIFICATION, ///< Notification mode
49     SCREEN_READER, ///< Screen reader mode
50     MODE_NUM
51   };
52
53   /**
54    * @brief Enumeration of TTS state.
55    */
56   enum State
57   {
58     UNAVAILABLE = 0,    ///< Player is not available
59     READY,              ///< Player is ready to play
60     PLAYING,            ///< Player is playing
61     PAUSED              ///< Player is paused
62   };
63
64 public: // API
65
66   /**
67    * @brief Create an uninitialized handle.
68    *
69    * This can be initialized by calling TtsPlayer::Get().
70    */
71   TtsPlayer();
72
73   /**
74    * @brief Gets the singleton of the TtsPlayer for the given mode.
75    *
76    * @param mode the mode of tts-player
77    * @return A handle of the Ttsplayer for the given mode.
78    */
79   static TtsPlayer Get(Dali::TtsPlayer::Mode mode = Dali::TtsPlayer::DEFAULT);
80
81   /**
82    * @brief Destructor
83    *
84    * This is non-virtual since derived Handle types must not contain data or virtual methods.
85    */
86   ~TtsPlayer();
87
88   /**
89    * @brief This copy constructor is required for (smart) pointer semantics.
90    *
91    * @param [in] handle A reference to the copied handle
92    */
93   TtsPlayer(const TtsPlayer& handle);
94
95   /**
96    * @brief This assignment operator is required for (smart) pointer semantics.
97    *
98    * @param [in] rhs  A reference to the copied handle
99    * @return A reference to this
100    */
101   TtsPlayer& operator=(const TtsPlayer& rhs);
102
103   /**
104    * @brief Start playing the audio data synthesized from the specified text.
105    *
106    * @pre The TtsPlayer needs to be initialized.
107    * @param[in] text to play.
108    */
109   void Play(const std::string& text);
110
111   /**
112    * @brief Stops playing the utterance.
113    * @pre The TtsPlayer needs to be initialized.
114    */
115   void Stop();
116
117   /**
118    * @brief Pauses the currently playing utterance.
119    * @pre The TtsPlayer needs to be initialized.
120    */
121   void Pause();
122
123   /**
124    * @brief Resumes the previously paused utterance.
125    * @pre The TtsPlayer needs to be initialized.
126    */
127   void Resume();
128
129   /**
130    * @brief Gets the current state of the player.
131    * @pre The TtsPlayer needs to be initialized.
132    */
133   State GetState();
134
135 public: // Not intended for application developers
136
137   /**
138    * @brief This constructor is used by TtsPlayer::Get().
139    * @param[in] ttsPlayer A pointer to the TTS player.
140    */
141   explicit DALI_INTERNAL TtsPlayer( Internal::Adaptor::TtsPlayer* ttsPlayer );
142 };
143
144 } // namespace Dali
145
146 #endif // __DALI_TTS_PLAYER_H__