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