2 * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
15 #ifndef __TTS_SETTING_H__
16 #define __TTS_SETTING_H__
25 * @addtogroup TTS_SETTING_MODULE
34 * @brief Enumerations of error codes.
37 TTS_SETTING_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success, No error */
38 TTS_SETTING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
39 TTS_SETTING_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
40 TTS_SETTING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
41 TTS_SETTING_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */
42 TTS_SETTING_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< TTS is NOT supported */
43 TTS_SETTING_ERROR_INVALID_STATE = TIZEN_ERROR_TTS | 0x01, /**< Invalid state */
44 TTS_SETTING_ERROR_INVALID_VOICE = TIZEN_ERROR_TTS | 0x02, /**< Invalid voice */
45 TTS_SETTING_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_TTS | 0x03, /**< No available TTS-engine */
46 TTS_SETTING_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
47 TTS_SETTING_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06 /**< Not supported feature of current engine */
48 } tts_setting_error_e;
51 * @brief Definitions for male voice type.
53 #define TTS_SETTING_VOICE_TYPE_MALE 1
56 * @brief Definitions for female voice type.
58 #define TTS_SETTING_VOICE_TYPE_FEMALE 2
61 * @brief Definitions for child voice type.
63 #define TTS_SETTING_VOICE_TYPE_CHILD 3
66 * @brief Called to get a engine information.
68 * @param[in] engine_id Engine id.
69 * @param[in] engine_name Engine name.
70 * @param[in] setting_path Gadget path of engine specific setting.
71 * @param[in] user_data User data passed from the tts_setting_foreach_supported_engines().
73 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
74 * @pre tts_setting_foreach_supported_engines() will invoke this callback.
76 * @see tts_setting_foreach_supported_engines()
78 typedef bool(*tts_setting_supported_engine_cb)(const char* engine_id, const char* engine_name, const char* setting_path, void* user_data);
81 * @brief Called to get a voice.
83 * @param[in] engine_id Engine id
84 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n
85 * followed by ISO 639-1 for the two-letter language code.
86 * For example, "ko_KR" for Korean, "en_US" for American English..
87 * @param[in] voice_type Voice type
88 * @param[in] user_data User data passed from the tts_setting_foreach_surpported_voices()
90 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
91 * @pre tts_setting_foreach_surpported_voices() will invoke this callback.
93 * @see tts_setting_foreach_surpported_voices()
95 typedef bool(*tts_setting_supported_voice_cb)(const char* engine_id, const char* language, int voice_type, void* user_data);
98 * @brief Called when the default engine is changed.
100 * @param[in] engine_id Engine id
101 * @param[in] user_data The user data passed from the callback registration function
103 * @pre An application registers this callback using tts_setting_set_engine_changed_cb().
105 * @see tts_setting_set_engine_changed_cb()
106 * @see tts_setting_unset_engine_changed_cb()
108 typedef void (*tts_setting_engine_changed_cb)(const char* engine_id, void *user_data);
111 * @brief Called when the default voice is changed.
113 * @param[in] language A language
114 * @param[in] voice_type Voice type
115 * @param[in] auto_voice Auto voice
116 * @param[in] user_data The user data passed from the callback registration function
118 * @pre An application registers this callback using registration function.
120 * @see tts_setting_set_voice_changed_cb()
121 * @see tts_setting_unset_voice_changed_cb()
123 typedef void (*tts_setting_voice_changed_cb)(const char* language, int voice_type, bool auto_voice, void *user_data);
126 * @brief Called when the default speed is changed.
128 * @param[in] speed Default speed
129 * @param[in] user_data The user data passed from the callback registration function
131 * @pre An application registers this callback using registration function.
133 * @see tts_setting_set_speed_changed_cb()
134 * @see tts_setting_unset_speed_changed_cb()
136 typedef void (*tts_setting_speed_changed_cb)(int speed, void *user_data);
139 * @brief Called when the default pitch is changed.
141 * @param[in] pitch Default pitch
142 * @param[in] user_data The user data passed from the callback registration function
144 * @pre An application registers this callback using registration function.
146 * @see tts_setting_set_pitch_changed_cb()
147 * @see tts_setting_unset_pitch_changed_cb()
149 typedef void (*tts_setting_pitch_changed_cb)(int pitch, void *user_data);
153 * @brief Initialize TTS setting.
155 * @remarks If the function succeeds, @a tts setting must be released with tts_setting_finalize().
157 * @return 0 on success, otherwise a negative error value.
158 * @retval #TTS_SETTING_ERROR_NONE Success.
159 * @retval #TTS_SETTING_ERROR_INVALID_STATE TTS setting has Already been initialized.
160 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
161 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
163 * @see tts_setting_finalize()
165 int tts_setting_initialize();
168 * @brief finalize TTS setting.
170 * @return 0 on success, otherwise a negative error value.
171 * @retval #TTS_SETTING_ERROR_NONE Success.
172 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
173 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
174 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
176 * @see tts_setting_initialize()
178 int tts_setting_finalize(void);
181 * @brief Retrieve supported engine informations using callback function.
183 * @param[in] callback Callback function
184 * @param[in] user_data User data to be passed to the callback function
186 * @return 0 on success, otherwise a negative error value.
187 * @retval #TTS_SETTING_ERROR_NONE Success.
188 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
189 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
190 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
192 * @post This function invokes tts_setting_supported_engine_cb() repeatedly for getting engine information.
194 * @see tts_setting_supported_engine_cb()
196 int tts_setting_foreach_supported_engines(tts_setting_supported_engine_cb callback, void* user_data);
199 * @brief Get current engine id.
201 * @remark If the function is success, @a engine_id must be released with free() by you.
203 * @param[out] engine_id Engine id
205 * @return 0 on success, otherwise a negative error value.
206 * @retval #TTS_SETTING_ERROR_NONE Success.
207 * @retval #TTS_SETTING_ERROR_OUT_OF_MEMORY Out of memory.
208 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
209 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
210 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
211 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
213 * @see tts_setting_set_engine()
215 int tts_setting_get_engine(char** engine_id);
218 * @brief Set current engine id.
220 * @param[in] engine_id Engine id
222 * @return 0 on success, otherwise a negative error value.
223 * @retval #TTS_SETTING_ERROR_NONE Success.
224 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
225 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
226 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
227 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
229 * @see tts_setting_get_engine()
231 int tts_setting_set_engine(const char* engine_id);
234 * @brief Get supported voices of current engine.
236 * @param[in] callback Callback function
237 * @param[in] user_data User data to be passed to the callback function
239 * @return 0 on success, otherwise a negative error value.
240 * @retval #TTS_SETTING_ERROR_NONE Success.
241 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
242 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
243 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
244 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
246 * @post This function invokes tts_setting_supported_voice_cb() repeatedly for getting supported voices.
248 * @see tts_setting_supported_voice_cb()
250 int tts_setting_foreach_supported_voices(tts_setting_supported_voice_cb callback, void* user_data);
253 * @brief Get a default voice of current engine.
255 * @remark If the function is success, @a language must be released with free() by you.
257 * @param[out] language Default language
258 * @param[out] voice_type Default voice type
260 * @return 0 on success, otherwise a negative error value.
261 * @retval #TTS_SETTING_ERROR_NONE Success.
262 * @retval #TTS_SETTING_ERROR_OUT_OF_MEMORY Out of memory.
263 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
264 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
265 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
266 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
268 * @see tts_setting_set_voice()
270 int tts_setting_get_voice(char** language, int* voice_type);
273 * @brief Set a default voice of current engine.
275 * @param[in] language Default language
276 * @param[in] voice_type Default voice type
278 * @return 0 on success, otherwise a negative error value.
279 * @retval #TTS_SETTING_ERROR_NONE Success.
280 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
281 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
282 * @retval #TTS_SETTING_ERROR_INVALID_VOICE Invalid voice.
283 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
284 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
286 * @see tts_setting_get_voice()
288 int tts_setting_set_voice(const char* language, int voice_type);
291 * @brief Get a automatic option of voice.
293 * @param[out] value Automatic option
295 * @return 0 on success, otherwise a negative error value.
296 * @retval #TTS_SETTING_ERROR_NONE Success.
297 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
298 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
299 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
300 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
302 * @see tts_setting_set_auto_voice()
304 int tts_setting_get_auto_voice(bool* value);
307 * @brief Set a automatic option of voice.
309 * @param[in] value Automatic option
311 * @return 0 on success, otherwise a negative error value.
312 * @retval #TTS_SETTING_ERROR_NONE Success.
313 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
314 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
315 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
316 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
318 * @see tts_setting_get_auto_voice()
320 int tts_setting_set_auto_voice(bool value);
323 * @brief Gets the speed range.
325 * @param[out] min The minimum speed value
326 * @param[out] normal The normal speed value
327 * @param[out] max The maximum speed value
329 * @return 0 on success, otherwise a negative error value
330 * @retval #TTS_SETTING_ERROR_NONE Success.
331 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
332 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
333 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
335 * @see tts_setting_get_speed()
336 * @see tts_setting_set_speed()
338 int tts_setting_get_speed_range(int* min, int* normal, int* max);
341 * @brief Get default speed.
343 * @param[out] speed Default voice speed
345 * @return 0 on success, otherwise a negative error value.
346 * @retval #TTS_SETTING_ERROR_NONE Success.
347 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
348 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
349 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
350 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
352 * @see tts_setting_get_speed_range()
353 * @see tts_setting_set_speed()
355 int tts_setting_get_speed(int* speed);
358 * @brief Set default speed.
360 * @param[in] speed Default voice speed
362 * @return 0 on success, otherwise a negative error value.
363 * @retval #TTS_SETTING_ERROR_NONE Success.
364 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
365 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
366 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
367 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
369 * @see tts_setting_get_speed_range()
370 * @see tts_setting_get_speed()
372 int tts_setting_set_speed(int speed);
375 * @brief Gets the pitch range.
377 * @param[out] min The minimum pitch value
378 * @param[out] normal The normal pitch value
379 * @param[out] max The maximum pitch value
381 * @return 0 on success, otherwise a negative error value
382 * @retval #TTS_SETTING_ERROR_NONE Success.
383 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
384 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
385 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
387 * @see tts_setting_get_pitch()
388 * @see tts_setting_set_pitch()
390 int tts_setting_get_pitch_range(int* min, int* normal, int* max);
393 * @brief Set a default pitch.
395 * @param[out] pitch Default voice pitch
397 * @return 0 on success, otherwise a negative error value.
398 * @retval #TTS_SETTING_ERROR_NONE Success.
399 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
400 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
401 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
402 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
403 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
405 * @see tts_setting_get_pitch_range()
406 * @see tts_setting_set_pitch()
408 int tts_setting_get_pitch(int* pitch);
411 * @brief Set a default pitch.
413 * @param[in] pitch Default voice pitch
415 * @return 0 on success, otherwise a negative error value.
416 * @retval #TTS_SETTING_ERROR_NONE Success.
417 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter.
418 * @retval #TTS_SETTING_ERROR_INVALID_STATE Not initialized.
419 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Operation failure.
420 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED_FEATURE Not supported feature.
421 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
423 * @see tts_setting_get_pitch_range()
424 * @see tts_setting_get_pitch()
426 int tts_setting_set_pitch(int pitch);
429 * @brief Registers a callback function to be called when engine information is changed
431 * @param[in] callback The callback function to register
432 * @param[in] user_data The user data to be passed to the callback function
434 * @return 0 on success, otherwise a negative error value
435 * @retval #TTS_SETTING_ERROR_NONE Successful
436 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter
437 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
438 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
440 * @see tts_setting_engine_changed_cb()
441 * @see tts_setting_unset_engine_changed_cb()
443 int tts_setting_set_engine_changed_cb(tts_setting_engine_changed_cb callback, void* user_data);
446 * @brief Unregisters the callback function
448 * @return 0 on success, otherwise a negative error value
449 * @retval #TTS_SETTING_ERROR_NONE Successful
450 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
451 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
453 * @see tts_setting_set_engine_changed_cb()
455 int tts_setting_unset_engine_changed_cb();
458 * @brief Registers a callback function to be called when default voice is changed
460 * @param[in] callback The callback function to register
461 * @param[in] user_data The user data to be passed to the callback function
463 * @return 0 on success, otherwise a negative error value
464 * @retval #TTS_SETTING_ERROR_NONE Successful
465 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter
466 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
467 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
469 * @see tts_setting_voice_changed_cb()
470 * @see tts_setting_unset_voice_changed_cb()
472 int tts_setting_set_voice_changed_cb(tts_setting_voice_changed_cb callback, void* user_data);
475 * @brief Unregisters the callback function
477 * @return 0 on success, otherwise a negative error value
478 * @retval #TTS_SETTING_ERROR_NONE Successful
479 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
480 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
482 * @see tts_setting_set_voice_changed_cb()
484 int tts_setting_unset_voice_changed_cb();
487 * @brief Registers a callback function to be called when default speed is changed
489 * @param[in] callback The callback function to register
490 * @param[in] user_data The user data to be passed to the callback function
492 * @return 0 on success, otherwise a negative error value
493 * @retval #TTS_SETTING_ERROR_NONE Successful
494 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter
495 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
496 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
498 * @see tts_setting_speed_changed_cb()
499 * @see tts_setting_unset_speed_changed_cb()
501 int tts_setting_set_speed_changed_cb(tts_setting_speed_changed_cb callback, void* user_data);
504 * @brief Unregisters the callback function
506 * @return 0 on success, otherwise a negative error value
507 * @retval #TTS_SETTING_ERROR_NONE Successful
508 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
509 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
511 * @see tts_setting_set_speed_changed_cb()
513 int tts_setting_unset_speed_changed_cb();
516 * @brief Registers a callback function to be called when default pitch is changed
518 * @param[in] callback The callback function to register
519 * @param[in] user_data The user data to be passed to the callback function
521 * @return 0 on success, otherwise a negative error value
522 * @retval #TTS_SETTING_ERROR_NONE Successful
523 * @retval #TTS_SETTING_ERROR_INVALID_PARAMETER Invalid parameter
524 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
525 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
527 * @see tts_setting_pitch_changed_cb()
528 * @see tts_setting_unset_pitch_changed_cb()
530 int tts_setting_set_pitch_changed_cb(tts_setting_pitch_changed_cb callback, void* user_data);
533 * @brief Unregisters the callback function
535 * @return 0 on success, otherwise a negative error value
536 * @retval #TTS_SETTING_ERROR_NONE Successful
537 * @retval #TTS_SETTING_ERROR_OPERATION_FAILED Invalid state
538 * @retval #TTS_SETTING_ERROR_NOT_SUPPORTED TTS NOT supported
540 * @see tts_setting_set_pitch_changed_cb()
542 int tts_setting_unset_pitch_changed_cb();
553 #endif /* __TTS_SETTING_H__ */