2 * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __TTS_INTERNAL_H__
19 #define __TTS_INTERNAL_H__
31 * @brief Definition for TTS interrupt mode
33 #define TTS_MODE_INTERRUPT 3
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
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.
45 * @param[in] tts The TTS handle
46 * @param[in] credential The credential
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
55 * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
59 int tts_set_server_tts(tts_h tts, const char* credential);
62 * @brief Adds a sound stream to the queue.
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.
83 int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size, int audio_type, int rate);
86 * @brief Request to play pcm.
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.
100 * @see tts_stop_pcm()
102 int tts_play_pcm(tts_h tts);
105 * @brief Request to stop pcm.
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()
121 int tts_stop_pcm(tts_h tts);
125 * @brief Connects the daemon asynchronously.
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()
139 int tts_prepare_sync(tts_h tts);
150 #endif /* __TTS_INTERNAL_H__ */