/**
+ * @brief Enumeration for playing mode of TTS.
+ * @since_tizen 8.0
+*/
+typedef enum {
+ TTS_PLAYING_MODE_BY_SERVICE = 0, /**< Mode for TTS playing on TTS service */
+ TTS_PLAYING_MODE_BY_CLIENT = 1, /**< Mode for TTS playing on TTS client */
+} tts_playing_mode_e;
+
+
+/**
+ * @brief Enumeration for audio type.
+ * @since_tizen 8.0
+ */
+typedef enum {
+ TTS_AUDIO_TYPE_RAW_S16 = 0, /**< Signed 16-bit audio type */
+ TTS_AUDIO_TYPE_RAW_U8 /**< Unsigned 8-bit audio type */
+} tts_audio_type_e;
+
+
+/**
+ * @brief Enumeration for synthesized pcm event.
+ * @since_tizen 8.0
+*/
+typedef enum {
+ TTS_SYNTHESIZED_PCM_EVENT_FAIL = -1, /**< Event when the synthesized PCM is failed */
+ TTS_SYNTHESIZED_PCM_EVENT_START = 1, /**< Event when the synthesized PCM is received at first */
+ TTS_SYNTHESIZED_PCM_EVENT_CONTINUE = 2, /**< Event when the synthesized PCM is received, not first and not last */
+ TTS_SYNTHESIZED_PCM_EVENT_FINISH = 3 /**< Event when the synthesized PCM is received finally */
+} tts_synthesized_pcm_event_e;
+
+
+/**
* @brief Definition for automatic speaking speed.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
/**
* @brief Called when the state of TTS is changed.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @details If the daemon must stop player because of changing engine and
* the daemon must pause player because of other requests, this callback function is called.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] tts The TTS handle
* @param[in] previous The previous state
* @param[in] current The current state
/**
+ * @brief Called when the synthesized pcm data is come from the engine.
+ * @since_tizen 8.0
+ * @remarks The @a tts handle should not be destroyed in the callback.
+ * @param[in] tts The TTS handle, the same handle for which the callback was set.
+ * @param[in] utt_id The utterance ID
+ * @param[in] event The event type
+ * @param[in] pcm_data The synthesized pcm data. The @a pcm_data can be used only in the callback. To use outside, make a copy.
+ * @param[in] pcm_data_size The size of the pcm data
+ * @param[in] audio_type The audio type of pcm data
+ * @param[in] sample_rate The sampling rate of pcm data
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre An application registers this callback using tts_set_synthesized_pcm_cb() to get pcm data.
+ * @see tts_set_synthesized_pcm_cb()
+ * @see tts_unset_synthesized_pcm_cb()
+ */
+typedef void (*tts_synthesized_pcm_cb)(tts_h tts, int utt_id, tts_synthesized_pcm_event_e event, const char* pcm_data, int pcm_data_size, tts_audio_type_e audio_type, int sample_rate, void *user_data);
+
+
+/**
* @brief Creates a handle for TTS.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks If the function succeeds, @a tts handle must be released with tts_destroy().
* @details The private data is the setting parameter for applying keys provided by the engine.
* Using this API, the application can set the private data and use the corresponding key of the engine.
* For example, if the engine provides 'girl's voice' as a voice type, the application can set the private data as the following.
- * int ret = tts_set_private_data(tts_h, "voice_type", "GIRL");
+ * int ret = tts_set_private_data(#tts_h, "voice_type", "GIRL");
* @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
* @remarks If the engine is replaced with the other engine, the key may be ignored.
* @param[in] tts The TTS handle
*/
int tts_unset_screen_reader_changed_cb(tts_h tts);
+
/**
* @brief Sets a callback function to be called when the TTS service state changes.
* @since_tizen 7.0
*/
int tts_set_service_state_changed_cb(tts_h tts, tts_service_state_changed_cb callback, void* user_data);
+
/**
* @brief Unsets the callback function.
* @since_tizen 7.0
*/
int tts_unset_service_state_changed_cb(tts_h tts);
+
+/**
+ * @brief Sets the TTS playing mode.
+ * @since_tizen 8.0
+ * @param[in] tts The TTS handle
+ * @param[in] mode The mode
+ * @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
+ * @pre The state should be #TTS_STATE_CREATED.
+ * @see tts_get_playing_mode()
+ * @see tts_play()
+ */
+int tts_set_playing_mode(tts_h tts, tts_playing_mode_e mode);
+
+
+/**
+ * @brief Sets the callback function to receive the synthesized pcm data from the tts service.
+ * @since_tizen 8.0
+ * @param[in] tts The TTS handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be 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_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_INVALID_STATE Invalid state
+ * @pre The TTS state should be #TTS_STATE_CREATED.
+ * @see tts_synthesized_pcm_cb()
+ * @see tts_unset_synthesized_pcm_cb()
+ */
+int tts_set_synthesized_pcm_cb(tts_h tts, tts_synthesized_pcm_cb callback, void* user_data);
+
+
+/**
+ * @brief Unsets the callback function to receive synthesized PCM data from the tts service.
+ * @since_tizen 8.0
+ * @param[in] tts The TTS 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_INVALID_STATE Invalid state
+ * @pre The TTS state should be #TTS_STATE_CREATED.
+ * @see tts_set_synthesized_pcm_cb()
+ */
+int tts_unset_synthesized_pcm_cb(tts_h tts);
+
+
#ifdef __cplusplus
}
#endif
/**
- * @brief Enumration for playing mode of TTS.
- * @since_tizen 8.0
-*/
-typedef enum {
- TTS_PLAYING_MODE_BY_SERVICE = 0, /**< Mode for TTS playing on TTS service */
- TTS_PLAYING_MODE_BY_CLIENT = 1, /**< Mode for TTS playing on TTS client */
-} tts_playing_mode_e;
-
-
-/**
- * @brief Enumration for audio type.
- * @since_tizen 8.0
- */
-typedef enum {
- TTS_AUDIO_TYPE_RAW_S16 = 0, /**< Signed 16-bit audio type */
- TTS_AUDIO_TYPE_RAW_U8 /**< Unsigned 8-bit audio type */
-} tts_audio_type_e;
-
-
-/**
- * @brief Enumeration for synthesized pcm event.
- * @since_tizen 8.0
-*/
-typedef enum {
- TTS_SYNTHESIZED_PCM_EVENT_FAIL = -1, /**< Event when the synthesized PCM is failed */
- TTS_SYNTHESIZED_PCM_EVENT_START = 1, /**< Event when the synthesized PCM is received at first */
- TTS_SYNTHESIZED_PCM_EVENT_CONTINUE = 2, /**< Event when the synthesized PCM is received, not first and not last */
- TTS_SYNTHESIZED_PCM_EVENT_FINISH = 3 /**< Event when the synthesized PCM is received finally */
-} tts_synthesized_pcm_event_e;
-
-
-/**
* @brief Definition for TTS interrupt mode
*/
#define TTS_MODE_INTERRUPT 3
/**
- * @brief Called when the synthesized pcm data is come from the engine.
- * @since_tizen 8.0
- * @remarks The @a tts handle should not be destroyed in the callback.
- * @param[in] tts The TTS handle, the same handle for which the callback was set.
- * @param[in] utt_id The utterance ID
- * @param[in] event The event type
- * @param[in] pcm_data The synthesized pcm data
- * @param[in] pcm_data_size The size of the pcm data
- * @param[in] audio_type The audio type of pcm data
- * @param[in] sample_rate The sampling rate of pcm data
- * @param[in] user_data The user data passed from the callback registration function
- * @pre An application registers this callback using tts_set_synthesized_pcm_cb() to get pcm data.
- * @see tts_set_synthesized_pcm_cb()
- * @see tts_unset_synthesized_pcm_cb()
- */
-typedef void (*tts_synthesized_pcm_cb)(tts_h tts, int utt_id, tts_synthesized_pcm_event_e event, const char* pcm_data, int pcm_data_size, tts_audio_type_e audio_type, int sample_rate, void *user_data);
-
-
-/**
* @brief Sets server tts.
* @details Using this API, the application can ask server tts with a credential.
* The credential is a key to verify the authorization about using the engine based on server, not embedded engine.
int tts_stop_pcm(tts_h tts);
-/**
- * @brief Sets the TTS playing mode.
- * @since_tizen 8.0
- * @param[in] tts The TTS handle
- * @param[in] mode The mode
- * @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
- * @pre The state should be #TTS_STATE_CREATED.
- * @see tts_get_playing_mode()
- * @see tts_play()
- */
-int tts_set_playing_mode(tts_h tts, tts_playing_mode_e mode);
-
-
-/**
- * @brief Sets the default to be called when the synthesized pcm data is recieved.
- * @since_tizen 8.0
- * @param[in] tts The TTS handle
- * @param callback The callback function to register
- * @param user_data The user data to be 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_INVALID_PARAMETER Invalid parameter
- * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @pre The TTS state should be #TTS_STATE_CREATED.
- * @see tts_synthesized_pcm_cb()
- * @see tts_unset_synthesized_pcm_cb()
- */
-int tts_set_synthesized_pcm_cb(tts_h tts, tts_synthesized_pcm_cb callback, void* user_data);
-
-
-/**
- * @brief Unsets the callback function.
- * @since_tizen 8.0
- * @param tts The TTS 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_INVALID_STATE Invalid state
- * @pre The TTS state should be #TTS_STATE_CREATED.
- * @see tts_set_synthesized_pcm_cb()
- */
-int tts_unset_synthesized_pcm_cb(tts_h tts);
-
-
-
#ifdef __cplusplus
}
#endif