29ea810e667701a07e2258c0b9c8e5f212823750
[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 Sets server tts.
32  * @details Using this API, the application can ask server tts with a credential.
33  *  The credential is a key to verify the authorization about using the engine based on server, not embeded engine.
34  *  If the application sets the credential, it will be able to use functions of the server engine entirely.
35  * @since_tizen @if MOBILE 3.0
36  *
37  * @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.
38  *  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.
39  *
40  * @param[in] tts The TTS handle
41  * @param[in] credential The credential
42  *
43  * @return 0 on success, otherwise a negative error value
44  * @retval #TTS_ERROR_NONE Success
45  * @retval #TTS_ERROR_INVALID_STATE Invalid state
46  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
47  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
48  * @retval #TTS_ERROR_OUT_OF_MEMORY TTS Out of memory
49  *
50  * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
51  *
52  * @see tts_play()
53 */
54 int tts_set_server_tts(tts_h tts, const char* credential);
55
56 /**
57  * @brief Adds a sound stream to the queue.
58  * @since_tizen 4.0
59  *
60  * @param[in] tts The TTS handle
61  * @param[in] event An event about pcm buffer (-1: error, 1: start, 2: continue, 3: finish) 
62  * @param[in] data The pcm data buffer
63  * @param[in] data_size The data size of pcm data buffer
64  * @param[in] audio_type The audio type of pcm (0: signed 16-bit, 1: unsigned 8-bit)
65  * @param[in] rate The sampling rate of pcm
66  * @return @c 0 on success, 
67  *         otherwise a negative error value
68  * @retval #TTS_ERROR_NONE Successful
69  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
70  * @retval #TTS_ERROR_INVALID_STATE Invalid state
71  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
72  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
73  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
74  * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING, or #TTS_STATE_PAUSED.
75  * @see tts_play_pcm()
76  * @see tts_stop_pcm()
77 */
78 int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size, int audio_type, int rate);
79
80 /**
81  * @brief Request to play pcm.
82  * @since_tizen 4.0
83  *
84  * @param[in] tts The TTS handle
85  * @return @c 0 on success, 
86  *         otherwise a negative error value
87  * @retval #TTS_ERROR_NONE Successful
88  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
89  * @retval #TTS_ERROR_INVALID_STATE Invalid state
90  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
91  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
92  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
93  * @pre The state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
94  * @see tts_add_pcm()
95  * @see tts_stop_pcm()
96 */
97 int tts_play_pcm(tts_h tts);
98
99 /**
100  * @brief Request to stop pcm.
101  * @since_tizen 4.0
102  *
103  * @param[in] tts The TTS handle
104  * @return @c 0 on success, 
105  *         otherwise a negative error value
106  * @retval #TTS_ERROR_NONE Successful
107  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
108  * @retval #TTS_ERROR_INVALID_STATE Invalid state
109  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
110  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
111  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
112  * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING, or #TTS_STATE_PAUSED.
113  * @see tts_play_pcm()
114  * @see tts_add_pcm()
115 */
116 int tts_stop_pcm(tts_h tts);
117
118 #ifdef __cplusplus
119 }
120 #endif
121
122 /**
123    * @}@}
124     */
125
126 #endif /* __TTS_INTERNAL_H__ */