From: sungwook79.park Date: Tue, 30 Apr 2024 02:50:42 +0000 (+0900) Subject: Move synthesis parameter apis from internal header to c header X-Git-Tag: accepted/tizen/unified/toolchain/20240610.173109~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F310490%2F3;p=platform%2Fcore%2Fuifw%2Ftts.git Move synthesis parameter apis from internal header to c header Change-Id: Id0d1cd46753eb8bd4d17bb8341abf764ab3cda99 Signed-off-by: sungwook79.park --- diff --git a/include/tts.h b/include/tts.h index b49b15a5..7e622c61 100644 --- a/include/tts.h +++ b/include/tts.h @@ -137,6 +137,13 @@ typedef enum { #define TTS_SPEED_AUTO 0 +/** + * @brief Definition for automatic speaking pitch. + * @since_tizen 9.0 +*/ +#define TTS_PITCH_AUTO 0 + + /** * @brief Definition for automatic voice type. * @since_tizen 2.3 @@ -165,6 +172,13 @@ typedef enum { #define TTS_VOICE_TYPE_CHILD 3 +/** + * @brief Definition for personal voice type. + * @since_tizen 9.0 +*/ +#define TTS_VOICE_TYPE_PERSONAL 4 + + /** * @brief The TTS handle. * @since_tizen 2.3 @@ -172,6 +186,13 @@ typedef enum { typedef struct tts_s *tts_h; +/** + * @brief The TTS synthesis parameter handle. + * @since_tizen 9.0 +*/ +typedef struct tts_synthesis_parameter_s *tts_synthesis_parameter_h; + + /** * @brief Called when the state of TTS is changed. * @details If the daemon must stop player because of changing engine and @@ -1143,6 +1164,194 @@ int tts_unset_synthesized_pcm_cb(tts_h tts); */ int tts_add_silent_utterance(tts_h tts, unsigned int duration_in_msec, int* utt_id); + +/** + * @brief Creates a handle for TTS synthesis paramter. + * @since_tizen 9.0 + * @remarks If the function succeeds, @a paramter handle must be released with tts_synthesis_parameter_destroy(). + * @param[out] parameter The TTS synthesis parameter handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory + * @see tts_synthesis_parameter_destroy() +*/ +int tts_synthesis_parameter_create(tts_synthesis_parameter_h *parameter); + +/** + * @brief Destroys the TTS synthesis paramter handle. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @see tts_synthesis_parameter_create() +*/ +int tts_synthesis_parameter_destroy(tts_synthesis_parameter_h parameter); + +/** + * @brief Sets the language. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US') + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TTS_ERROR_OPERATION_FAILED Operation failure + * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory +*/ +int tts_synthesis_parameter_set_language(tts_synthesis_parameter_h parameter, const char *language); + +/** + * @brief Sets the voice type. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter +*/ +int tts_synthesis_parameter_set_voice_type(tts_synthesis_parameter_h parameter, int voice_type); + +/** + * @brief Sets the id for personal voice data. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] ptts_id The id for personal voice data + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory +*/ +int tts_synthesis_parameter_set_personal_voice(tts_synthesis_parameter_h parameter, const char *ptts_id); + +/** + * @brief Sets the speed. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range()) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @see tts_get_speed_range() +*/ +int tts_synthesis_parameter_set_speed(tts_synthesis_parameter_h parameter, int speed); + +/** + * @brief Sets the pitch. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] pitch A speaking pitch (e.g. #TTS_PITCH_AUTO or the value from tts_get_pitch_range()) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @see tts_get_pitch_range() +*/ +int tts_synthesis_parameter_set_pitch(tts_synthesis_parameter_h parameter, int pitch); + +/** + * @brief Sets the volume. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] volume A speaking volume ratio (e.g. #TTS_VOLUME_AUTO or the value from tts_get_volume_range()) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @see tts_get_volume_range() +*/ +int tts_synthesis_parameter_set_volume(tts_synthesis_parameter_h parameter, double volume); + +/** + * @brief Sets the background volume ratio. + * @since_tizen 9.0 + * @param[in] parameter The TTS synthesis parameter handle + * @param[in] background_volume_ratio A background volume ratio ratio (Range 0.0 ~ 1.0) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter +*/ +int tts_synthesis_parameter_set_background_volume_ratio(tts_synthesis_parameter_h parameter, double background_volume_ratio); + +/** + * @brief Gets the pitch range. + * @since_tizen 9.0 + * @param[in] tts The TTS handle + * @param[out] min The minimum pitch value + * @param[out] normal The normal pitch value + * @param[out] max The maximum pitch value + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TTS_ERROR_INVALID_STATE Invalid state + * @retval #TTS_ERROR_OPERATION_FAILED Operation failure + * @pre The state should be #TTS_STATE_READY. + * @see tts_synthesis_parameter_set_pitch() +*/ +int tts_get_pitch_range(tts_h tts, int* min, int* normal, int* max); + +/** + * @brief Gets the volume range. + * @since_tizen 9.0 + * @param[in] tts The TTS handle + * @param[out] min The minimum volume value + * @param[out] max The maximum volume value + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TTS_ERROR_INVALID_STATE Invalid state + * @retval #TTS_ERROR_OPERATION_FAILED Operation failure + * @pre The state should be #TTS_STATE_READY. + * @see tts_synthesis_parameter_set_volume() +*/ +int tts_get_volume_range(tts_h tts, int* min, int* max); + +/** + * @brief Adds a text to the queue with synthesis parameter. + * @since_tizen 9.0 + * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check. + * @param[in] tts The TTS handle + * @param[in] text An input text based utf8 + * @param[in] parameter The TTS synthesis parameter handle + * @param[out] utt_id The utterance ID passed to the callback function + * @return @c 0 on success, + * otherwise a negative error value + * @retval #TTS_ERROR_NONE Successful + * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported + * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied + * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TTS_ERROR_INVALID_STATE Invalid state + * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type + * @retval #TTS_ERROR_OPERATION_FAILED Operation failure + * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off + * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED. + * @see tts_get_max_text_size() + * @see tts_set_credential() +*/ +int tts_add_text_with_synthesis_parameter(tts_h tts, const char* text, tts_synthesis_parameter_h parameter, int* utt_id); + #ifdef __cplusplus } #endif diff --git a/include/tts_internal.h b/include/tts_internal.h index 859c22f3..30647077 100644 --- a/include/tts_internal.h +++ b/include/tts_internal.h @@ -33,24 +33,6 @@ extern "C" */ #define TTS_MODE_INTERRUPT 3 -/** - * @brief Definition for automatic speaking pitch. - * @since_tizen 9.0 -*/ -#define TTS_PITCH_AUTO 0 - -/** - * @brief Definition for personal voice type. - * @since_tizen 9.0 -*/ -#define TTS_VOICE_TYPE_PERSONAL 4 - -/** - * @brief The TTS synthesis parameter handle. - * @since_tizen 9.0 -*/ -typedef struct tts_synthesis_parameter_s *tts_synthesis_parameter_h; - /** * @brief Sets server tts. @@ -140,193 +122,6 @@ int tts_play_pcm(tts_h tts); */ int tts_stop_pcm(tts_h tts); -/** - * @brief Creates a handle for TTS synthesis paramter. - * @since_tizen 9.0 - * @remarks If the function succeeds, @a paramter handle must be released with tts_synthesis_parameter_destroy(). - * @param[out] parameter The TTS synthesis parameter handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory - * @see tts_synthesis_parameter_destroy() -*/ -int tts_synthesis_parameter_create(tts_synthesis_parameter_h *parameter); - -/** - * @brief Destroys the TTS synthesis paramter handle. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @see tts_synthesis_parameter_create() -*/ -int tts_synthesis_parameter_destroy(tts_synthesis_parameter_h parameter); - -/** - * @brief Sets the language. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US') - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TTS_ERROR_OPERATION_FAILED Operation failure - * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory -*/ -int tts_synthesis_parameter_set_language(tts_synthesis_parameter_h parameter, const char *language); - -/** - * @brief Sets the voice type. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter -*/ -int tts_synthesis_parameter_set_voice_type(tts_synthesis_parameter_h parameter, int voice_type); - -/** - * @brief Sets the id for personal voice data. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] ptts_id The id for personal voice data - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory -*/ -int tts_synthesis_parameter_set_personal_voice(tts_synthesis_parameter_h parameter, const char *ptts_id); - -/** - * @brief Sets the speed. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range()) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @see tts_get_speed_range() -*/ -int tts_synthesis_parameter_set_speed(tts_synthesis_parameter_h parameter, int speed); - -/** - * @brief Sets the pitch. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] pitch A speaking pitch (e.g. #TTS_PITCH_AUTO or the value from tts_get_pitch_range()) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @see tts_get_pitch_range() -*/ -int tts_synthesis_parameter_set_pitch(tts_synthesis_parameter_h parameter, int pitch); - -/** - * @brief Sets the volume. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] volume A speaking volume ratio (e.g. #TTS_VOLUME_AUTO or the value from tts_get_volume_range()) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @see tts_get_volume_range() -*/ -int tts_synthesis_parameter_set_volume(tts_synthesis_parameter_h parameter, double volume); - -/** - * @brief Sets the background volume ratio. - * @since_tizen 9.0 - * @param[in] parameter The TTS synthesis parameter handle - * @param[in] background_volume_ratio A background volume ratio ratio (Range 0.0 ~ 1.0) - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter -*/ -int tts_synthesis_parameter_set_background_volume_ratio(tts_synthesis_parameter_h parameter, double background_volume_ratio); - -/** - * @brief Gets the pitch range. - * @since_tizen 9.0 - * @param[in] tts The TTS handle - * @param[out] min The minimum pitch value - * @param[out] normal The normal pitch value - * @param[out] max The maximum pitch value - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TTS_ERROR_INVALID_STATE Invalid state - * @retval #TTS_ERROR_OPERATION_FAILED Operation failure - * @pre The state should be #TTS_STATE_READY. - * @see tts_synthesis_parameter_set_pitch() -*/ -int tts_get_pitch_range(tts_h tts, int* min, int* normal, int* max); - -/** - * @brief Gets the volume range. - * @since_tizen 9.0 - * @param[in] tts The TTS handle - * @param[out] min The minimum volume value - * @param[out] max The maximum volume value - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TTS_ERROR_INVALID_STATE Invalid state - * @retval #TTS_ERROR_OPERATION_FAILED Operation failure - * @pre The state should be #TTS_STATE_READY. - * @see tts_synthesis_parameter_set_volume() -*/ -int tts_get_volume_range(tts_h tts, int* min, int* max); - -/** - * @brief Adds a text to the queue with synthesis parameter. - * @since_tizen 9.0 - * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check. - * @param[in] tts The TTS handle - * @param[in] text An input text based utf8 - * @param[in] parameter The TTS synthesis parameter handle - * @param[out] utt_id The utterance ID passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TTS_ERROR_NONE Successful - * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported - * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied - * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TTS_ERROR_INVALID_STATE Invalid state - * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type - * @retval #TTS_ERROR_OPERATION_FAILED Operation failure - * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off - * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED. - * @see tts_get_max_text_size() - * @see tts_set_credential() -*/ -int tts_add_text_with_synthesis_parameter(tts_h tts, const char* text, tts_synthesis_parameter_h parameter, int* utt_id); - #ifdef __cplusplus } #endif