/**
* @brief Called when the engine service user sets the personal tts id of TTS engine.
* @since_tizen 9.0
-* @remarks This callback function is mandatory and must be registered using ttse_main().
+* @remarks This callback function is optional and is registered using ttse_set_personal_tts_id_set_cb().
* @param[in] ptts_id The personal tts id
* @return @c 0 on success,
* otherwise a negative error value
* @retval #TTSE_ERROR_INVALID_STATE Not initialized
* @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
*/
-typedef int (*ttse_set_personal_tts_id)(const char* ptts_id);
+typedef int (*ttse_set_personal_tts_id_cb)(const char* ptts_id);
/**
ttse_foreach_supported_voices_cb foreach_voices; /**< Called when the engine service user gets the whole supported voice list */
ttse_is_valid_voice_cb is_valid_voice; /**< Called when the engine service user checks whether the voice is valid or not in TTS engine */
ttse_set_pitch_cb set_pitch; /**< Called when the engine service user sets the default pitch of TTS engine */
- ttse_set_personal_tts_id set_personal_tts_id; /**< Called when the engine service user sets the personal tts of TTS engine */
ttse_load_voice_cb load_voice; /**< Called when the engine service user requests to load the corresponding voice type for the first time */
ttse_unload_voice_cb unload_voice; /**< Called when the engine service user requests to unload the corresponding voice type or to stop using voice */
int ttse_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback);
+/**
+* @brief Sets a callback function to be called when a personal TTS id is set.
+* @since_tizen 9.0
+* @remarks The ttse_set_personal_tts_id_cb() function is called when the activated TTS modes are changed.
+* @param[in] callback ttse_activated_mode_changed event callback function
+* @return @c 0 on success,
+* otherwise a negative error value
+* @retval #TTSE_ERROR_NONE Successful
+* @retval #TTSE_ERROR_NOT_SUPPORTED TTS NOT supported
+* @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
+* @retval #TTSE_ERROR_INVALID_STATE Not initialized
+* @pre The ttse_main() function should be invoked before this function is called.
+* @see ttse_activated_mode_changed_cb()
+* @see ttse_get_activated_mode()
+*/
+int ttse_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback);
+
+
#ifdef __cplusplus
}
#endif
return ret;
}
+ if (NULL == g_engine_info->callbacks->set_personal_tts_id) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Personal tts is not supported. Fail to set personal tts id.");
+ return TTSD_ERROR_NOT_SUPPORTED_FEATURE;
+ }
+
ret = g_engine_info->callbacks->set_personal_tts_id(ptts_id);
if (0 != ret) {
SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to set personal tts id : ptts_id(%s), result(%s)",
return TTSD_ERROR_NONE;
}
+
+int ttsd_engine_agent_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback)
+{
+ if (false == __is_agent_initialized()) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Not Initialized");
+ return TTSD_ERROR_INVALID_STATE;
+ }
+
+ g_engine_info->callbacks->set_personal_tts_id = callback;
+
+ return TTSD_ERROR_NONE;
+}
\ No newline at end of file
int ttsd_engine_agent_set_private_data_set_cb(ttse_private_data_set_cb callback);
int ttsd_engine_agent_set_private_data_requested_cb(ttse_private_data_requested_cb callback);
int ttsd_engine_agent_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback);
+int ttsd_engine_agent_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback);
/** Unload current engine */
int ttsd_engine_agent_unload_current_engine();
ttse_foreach_supported_voices_cb foreach_voices;
ttse_is_valid_voice_cb is_valid_voice;
ttse_set_pitch_cb set_pitch;
- ttse_set_personal_tts_id set_personal_tts_id;
+ ttse_set_personal_tts_id_cb set_personal_tts_id;
ttse_load_voice_cb load_voice;
ttse_unload_voice_cb unload_voice;
return ret;
}
+int ttsd_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback)
+{
+ int ret = ttsd_engine_agent_set_personal_tts_id_set_cb(callback);
+ if (TTSD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set personal tts id set cb : ret(%d)", ret);
+ }
+
+ return ret;
+}
+
int ttsd_server_play_pcm(unsigned int uid)
{
app_tts_state_e state = ttsd_data_get_client_state(uid);
int ttsd_get_activated_mode(int* activated_mode);
int ttsd_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback);
+int ttsd_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback);
+
+
/*
* Server API for client
*/
return ret;
}
+
+int ttse_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback)
+{
+ if (false == is_feature_enabled()) {
+ return TTSE_ERROR_NOT_SUPPORTED;
+ }
+
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid parameter");
+ return TTSE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (false == g_is_started) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Service engine is not started.");
+ return TTSE_ERROR_INVALID_STATE;
+ }
+
+ int ret = ttsd_set_personal_tts_id_set_cb(callback);
+ if (TTSD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to set personal tts id set cb. ret(%d/%s)", ret, get_error_message(ret));
+ }
+
+ return ret;
+}