[ACR-1216][tts][Add tts_repeat()]
[platform/core/uifw/tts.git] / include / tts_internal.h
1 /*
2    * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3    *
4    * Licensed under the Apache License, Version 2.0 (the License);
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an AS IS BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16
17
18 #ifndef __TTS_INTERNAL_H__
19 #define __TTS_INTERNAL_H__
20
21 #include <tizen.h>
22 #include <tts.h>
23
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29
30 /**
31  * @brief Definition for TTS interrupt mode
32  */
33 #define TTS_MODE_INTERRUPT              3
34
35 /**
36  * @brief Sets server tts.
37  * @details Using this API, the application can ask server tts with a credential.
38  *  The credential is a key to verify the authorization about using the engine based on server, not embeded engine.
39  *  If the application sets the credential, it will be able to use functions of the server engine entirely.
40  * @since_tizen @if MOBILE 3.0
41  *
42  * @remarks The necessity of the credential depends on the engine. In case of the engine which is basically embedded in Tizen, the credential is not necessary so far.
43  *  However, if the user wants to apply the 3rd party's engine, the credential may be necessary. In that case, please follow the policy provided by the corresponding engine.
44  *
45  * @param[in] tts The TTS handle
46  * @param[in] credential The credential
47  *
48  * @return 0 on success, otherwise a negative error value
49  * @retval #TTS_ERROR_NONE Success
50  * @retval #TTS_ERROR_INVALID_STATE Invalid state
51  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
52  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
53  * @retval #TTS_ERROR_OUT_OF_MEMORY TTS Out of memory
54  *
55  * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
56  *
57  * @see tts_play()
58 */
59 int tts_set_server_tts(tts_h tts, const char* credential);
60
61 /**
62  * @brief Adds a sound stream to the queue.
63  * @since_tizen 4.0
64  *
65  * @param[in] tts The TTS handle
66  * @param[in] event An event about pcm buffer (-1: error, 1: start, 2: continue, 3: finish) 
67  * @param[in] data The pcm data buffer
68  * @param[in] data_size The data size of pcm data buffer
69  * @param[in] audio_type The audio type of pcm (0: signed 16-bit, 1: unsigned 8-bit)
70  * @param[in] rate The sampling rate of pcm
71  * @return @c 0 on success, 
72  *         otherwise a negative error value
73  * @retval #TTS_ERROR_NONE Successful
74  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
75  * @retval #TTS_ERROR_INVALID_STATE Invalid state
76  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
77  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
78  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
79  * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING, or #TTS_STATE_PAUSED.
80  * @see tts_play_pcm()
81  * @see tts_stop_pcm()
82 */
83 int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size, int audio_type, int rate);
84
85 /**
86  * @brief Request to play pcm.
87  * @since_tizen 4.0
88  *
89  * @param[in] tts The TTS handle
90  * @return @c 0 on success, 
91  *         otherwise a negative error value
92  * @retval #TTS_ERROR_NONE Successful
93  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
94  * @retval #TTS_ERROR_INVALID_STATE Invalid state
95  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
96  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
97  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
98  * @pre The state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
99  * @see tts_add_pcm()
100  * @see tts_stop_pcm()
101 */
102 int tts_play_pcm(tts_h tts);
103
104 /**
105  * @brief Request to stop pcm.
106  * @since_tizen 4.0
107  *
108  * @param[in] tts The TTS handle
109  * @return @c 0 on success, 
110  *         otherwise a negative error value
111  * @retval #TTS_ERROR_NONE Successful
112  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
113  * @retval #TTS_ERROR_INVALID_STATE Invalid state
114  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
115  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
116  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
117  * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING, or #TTS_STATE_PAUSED.
118  * @see tts_play_pcm()
119  * @see tts_add_pcm()
120 */
121 int tts_stop_pcm(tts_h tts);
122
123
124 /**
125  * @brief Connects the daemon asynchronously.
126  * @since_tizen 5.0
127  * @param[in] tts The TTS handle
128  * @return @c 0 on success,
129  *         otherwise a negative error value
130  * @retval #TTS_ERROR_NONE Successful
131  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
132  * @retval #TTS_ERROR_INVALID_STATE Invalid state
133  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
134  * @pre The state should be #TTS_STATE_CREATED.
135  * @post If this function is successful, the TTS state will be #TTS_STATE_READY.
136  *       If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
137  * @see tts_unprepare()
138 */
139 int tts_prepare_sync(tts_h tts);
140
141
142 #ifdef __cplusplus
143 }
144 #endif
145
146 /**
147  * @}
148  */
149
150 #endif /* __TTS_INTERNAL_H__ */