From 1baf38236e48681675e0229fb82cd6ee2ae1e7dc Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Mon, 16 Mar 2020 19:10:43 +0900 Subject: [PATCH 01/16] Added vc_mgr_send_utterance_status for voice control manager header. Change-Id: I7e3852a8ed721199a21acafb52ad8a7bb025f609 Signed-off-by: sungrae jo --- include/voice_control_manager.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 3d4ece3..2abd2c4 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -1758,6 +1758,31 @@ int vc_mgr_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, void* us */ int vc_mgr_unset_vc_tts_streaming_cb(void); +/** + * @platform + * @brief Sends the utterance status to the VC client. + * @since_tizen 6.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] pid The process id of the VC client + * @param[in] utt_id The utterance id + * @param[in] utt_status The utterance status + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation fail + * + * @pre The service state should be #VC_SERVICE_STATE_READY. + */ +int vc_mgr_send_utterance_status(int pid, int utt_id, vc_tts_utterance_status_e utt_status); + #ifdef __cplusplus } -- 2.7.4 From 0839f9266d89e1f4280db120c68a3d494be87ea3 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 1 Apr 2020 15:09:28 +0900 Subject: [PATCH 02/16] Update version to 1.60.7 Change-Id: Idb4c80b9b7f99d00aa1123345f97e44110736d18 --- CMakeLists.txt | 2 +- packaging/voice-control.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b63cf0..b8ccc24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.60.6) +SET(VERSION 1.60.7) FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index b099c4e..3328c35 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.60.6 +Version: 1.60.7 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From f67db1372a1e9acbac4f5b4604ed05f38e8918ca Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Mon, 13 Apr 2020 10:06:45 +0900 Subject: [PATCH 03/16] Initialize values after use Crash was happened due to memory corruption on fd handler. Because fd handler was deleted, but it was not initialized, it could be used even if it was checked by NULL. Change-Id: Ic261af84e52608f083ec10f12637579b4266b8dd --- common/vc_config_mgr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index 2a34402..c8988a8 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -1120,6 +1120,9 @@ int __vc_config_mgr_unregister_config_event() ecore_main_fd_handler_del(g_fd_handler_lang); inotify_rm_watch(g_fd_lang, g_wd_lang); close(g_fd_lang); + g_fd_handler_lang = NULL; + g_wd_lang = NULL; + g_fd_lang = NULL; vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb); } -- 2.7.4 From 3e5341178bab79d8ff5c442a0bb45a9ff0adf355 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 16 Apr 2020 10:09:03 +0900 Subject: [PATCH 04/16] Update version to 1.60.8 Change-Id: Ic1fb807db006a2cca0290bf114f556e449711f99 --- CMakeLists.txt | 2 +- packaging/voice-control.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8ccc24..686f357 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.60.7) +SET(VERSION 1.60.8) FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 3328c35..33499f2 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.60.7 +Version: 1.60.8 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From f59559eadfc7d96864087dae8a32f782ca9bc6d9 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 16 Apr 2020 14:09:34 +0900 Subject: [PATCH 05/16] Fix wrong initialize value Change-Id: I6889e8e2d3a8dcd1fccd66d2698707752c7064eb --- common/vc_config_mgr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index c8988a8..5d5fd12 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -63,8 +63,8 @@ static vc_config_s* g_config_info; static int g_lang_ref_count; static Ecore_Fd_Handler* g_fd_handler_lang = NULL; -static int g_fd_lang; -static int g_wd_lang; +static int g_fd_lang = -1; +static int g_wd_lang = -1; static GList* g_ino_list = NULL; @@ -577,12 +577,17 @@ Eina_Bool vc_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handle { SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Config changed callback event"); + if (g_fd_lang < 0) { + SLOG(LOG_WARN, vc_config_tag(), "[WARN] FD for config file is closed"); + SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); + return ECORE_CALLBACK_PASS_ON; + } + int length; struct inotify_event event; memset(&event, '\0', sizeof(struct inotify_event)); length = read(g_fd_lang, &event, sizeof(struct inotify_event)); - if (0 > length) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Empty Inotify event"); SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); @@ -1121,8 +1126,7 @@ int __vc_config_mgr_unregister_config_event() inotify_rm_watch(g_fd_lang, g_wd_lang); close(g_fd_lang); g_fd_handler_lang = NULL; - g_wd_lang = NULL; - g_fd_lang = NULL; + g_fd_lang = -1; vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb); } -- 2.7.4 From dbc1961a5ec3eb506588cd50cc95e57dad2f114c Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 16 Apr 2020 15:25:32 +0900 Subject: [PATCH 06/16] Use buffer size as minimum value of buffer_size and BUFFER_LENGTH buffer_size can be different from BUFFER_LENGTH. However, if buffer_size is bigger than BUFFER_LENGTH, buffer overflow can be occured. Thus, I use minimum value of buffer_size and BUFFER_LENGTH as parameter. And also, this patch pass the same variable to g_audio_cb and get_volume_decibel. Change-Id: I1231f056226415e820b079da3241e5ee82f8793d Signed-off-by: Suyeon Hwang --- server/vcd_recorder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index bfa8fd3..a2d2648 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -777,10 +777,12 @@ Eina_Bool __read_test_func(void *data) if (buffer_size != BUFFER_LENGTH) SLOG(LOG_DEBUG, TAG_VCD, "[Recorder test] Get data size(%d)", buffer_size); + buffer_size = MIN(buffer_size, BUFFER_LENGTH); + if (NULL != g_audio_cb && buffer_size != 0) g_audio_cb(buffer, buffer_size); - float vol_db = get_volume_decibel(buffer, BUFFER_LENGTH); + float vol_db = get_volume_decibel(buffer, buffer_size); if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) SLOG(LOG_ERROR, TAG_VCD, "[Recorder test] Fail to send recording volume(%f)", vol_db); -- 2.7.4 From d544da971e0a3c30676a2edf1af7bd19ad666aeb Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 16 Apr 2020 18:22:25 +0900 Subject: [PATCH 07/16] Update version to 1.60.9 Change-Id: I91b3abcb3241c1553fd5467c5c5ee517a1bd912b --- CMakeLists.txt | 2 +- packaging/voice-control.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 686f357..27c15fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.60.8) +SET(VERSION 1.60.9) FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 33499f2..7c5fcbd 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.60.8 +Version: 1.60.9 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From e8535fab6d2e44665cbcda01c43d58a02baf1dae Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 16 Apr 2020 21:23:11 +0900 Subject: [PATCH 08/16] Change type to 'unsigned char' Change-Id: Iaaf52f5cf85fcdd927524c61c951320f285abd44 --- client/vc_mgr.c | 2 +- client/vc_mgr_dbus.c | 2 +- client/vc_mgr_dbus.h | 2 +- include/voice_control_manager_internal.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 40e5d15..7acde3c 100755 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -4429,7 +4429,7 @@ static float __get_volume_decibel(char* data, int size) return db; } -int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, char* buffer, unsigned int len) +int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len) { SLOG(LOG_INFO, TAG_VCM, "[Manager] Send audio streaming to the engine service, event(%d)", event); diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 7eb61e8..f9a5493 100755 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -2306,7 +2306,7 @@ int vc_mgr_dbus_send_utterance_status(int pid, int utt_id, vc_tts_utterance_stat return 0; } -int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, char* buffer, unsigned int len) +int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len) { if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; diff --git a/client/vc_mgr_dbus.h b/client/vc_mgr_dbus.h index 0b3d87c..7d706f1 100644 --- a/client/vc_mgr_dbus.h +++ b/client/vc_mgr_dbus.h @@ -74,7 +74,7 @@ int vc_mgr_dbus_request_stop_feedback(int pid); int vc_mgr_dbus_send_utterance_status(int pid, int utt_id, vc_tts_utterance_status_e utt_status); -int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, char* buffer, unsigned int len); +int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len); int vc_mgr_dbus_change_system_volume(int pid, vc_system_volume_event_e volume_event); diff --git a/include/voice_control_manager_internal.h b/include/voice_control_manager_internal.h index 4d6cc27..627f025 100644 --- a/include/voice_control_manager_internal.h +++ b/include/voice_control_manager_internal.h @@ -103,7 +103,7 @@ int vc_mgr_set_domain(const char* domain); * @since_tizen 5.0 * */ -int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, char* buffer, unsigned int len); +int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len); int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e streaming_mode); -- 2.7.4 From 48f06a207625834664046ccb851a0530a7165f98 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 16 Apr 2020 21:32:36 +0900 Subject: [PATCH 09/16] Update version to 1.60.10 Change-Id: Ifd07f5baac75cce5b0c55c46c268c074397e8680 --- CMakeLists.txt | 2 +- packaging/voice-control.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27c15fb..adf6a88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.60.9) +SET(VERSION 1.60.10) FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 7c5fcbd..b5d2598 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.60.9 +Version: 1.60.10 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From f611b5e854674fbd9aed5e9244f68cebe42bf8a4 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Wed, 22 Apr 2020 13:24:58 +0900 Subject: [PATCH 10/16] Fix crash bug about tts text data Change-Id: I2653c67c44672b50261d7dcedbb84c16dd337c2a Signed-off-by: sungrae jo --- server/vcd_server.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/vcd_server.c b/server/vcd_server.c index 20934d8..b88f356 100755 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -2719,8 +2719,13 @@ int vcd_server_cancel_tts(int pid, int utt_id) if (0 != ret) { SLOG(LOG_WARN, TAG_VCD, "[Server WARN] No data in vcd tts text queue"); } else { - SLOG(LOG_INFO, TAG_VCD, "[Server] Clear tts text data, pid(%d), utt_id(%d), text(%s)", pid, utt_id, tts_text_data->text); - vcd_data_clear_tts_text_data(&tts_text_data); + if (tts_text_data) { + SLOG(LOG_INFO, TAG_VCD, "[Server] Clear tts text data, pid(%d), utt_id(%d), text(%s)", pid, utt_id, tts_text_data->text); + vcd_data_clear_tts_text_data(&tts_text_data); + tts_text_data = NULL; + } else { + SLOG(LOG_INFO, TAG_VCD, "[Server] Clear tts text data, pid(%d), utt_id(%d), text(nullptr)", pid, utt_id); + } } /* Request tts to engine */ -- 2.7.4 From feff5bb00f0c5e44002065ba6140a5bb1c04f660 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Fri, 17 Apr 2020 13:39:40 +0900 Subject: [PATCH 11/16] Add new APIs for VC-mgr - vc_mgr_send_audio_streaming() - vc_mgr_set_audio_streaming_mode() - vc_mgr_change_background_volume() - vc_mgr_recover_background_volume() - vc_mgr_set_background_volume_ratio() Change-Id: I09dbbdf6f64ea78cb4476cf3e77adae588cb3ef0 Signed-off-by: sungrae jo --- include/voice_control_manager.h | 170 +++++++++++++++++++++++++++++++ include/voice_control_manager_internal.h | 23 ----- 2 files changed, 170 insertions(+), 23 deletions(-) diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 1475dd7..49defd3 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -124,6 +124,36 @@ typedef enum { } vc_pre_result_event_e; /** + * @brief Enumeration of audio streaming event. + * @since_tizen 6.0 + */ +typedef enum { + VC_AUDIO_STREAMING_EVENT_FAIL = -1, /**< Failed */ + VC_AUDIO_STREAMING_EVENT_START = 1, /**< Start event */ + VC_AUDIO_STREAMING_EVENT_CONTINUE = 2, /**< Continue event */ + VC_AUDIO_STREAMING_EVENT_FINISH = 3 /**< Finish event */ +} vc_audio_streaming_event_e; + +/** + * @brief Enumeration of audio streaming mode. + * @since_tizen 6.0 + */ +typedef enum { + VC_AUDIO_STREAMING_MODE_VC_SERVICE = 0, /**< Use audio recording from VC service */ + VC_AUDIO_STREAMING_MODE_MULTI_ASSISTANT = 1, /**< Use audio streaming from multi-assistant */ + VC_AUDIO_STREAMING_MODE_OUTSIDE = 2, /**< Use audio streaming from outside */ +} vc_audio_streaming_mode_e; + +/** + * @brief Enumeration of background volume event. + * @since_tizen 6.0 + */ +typedef enum { + VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_NEARFIELD = 0, /**< Background volume event for near-field */ + VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_FARFIELD /**< Background volume event for far-field */ +} vc_background_volume_event_e; + +/** * @brief Called when client gets the all recognition results from voice control service. * @since_tizen 5.0 * @@ -1795,6 +1825,146 @@ int vc_mgr_unset_vc_tts_streaming_cb(void); */ int vc_mgr_send_utterance_status(int pid, int utt_id, vc_tts_utterance_status_e utt_status); +/** + * @platform + * @brief Sends audio streaming to the engine service. + * @details Using this function, the developer can send audio streaming after vc_mgr_start() function is called. + * @since_tizen 6.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] event Audio streaming event (e.g. #VC_AUDIO_STREAMING_EVENT_START, #VC_AUDIO_STREAMING_EVENT_CONTINUE) + * @param[in] buffer Audio streaming data + * @param[in] len Length of the audio streaming data + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation fail + * + * @pre The state should be #VC_SERVICE_STATE_RECORDING. + * + * @see vc_mgr_set_audio_streaming_mode() + */ +int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, unsigned char *buffer, unsigned int len); + +/** + * @platform + * @brief Sets audio streaming mode. + * @since_tizen 6.0 + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @remarks The default audio streaming mode is #VC_AUDIO_STREAMING_MODE_VC_SERVICE. \n + * If you want to use other mode, you can set mode with vc_mgr_set_audio_streaming_mode(). + * + * @param[in] mode Audio streaming mode + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation fail + * + * @pre The state should be #VC_STATE_INITIALIZED or #VC_SERVICE_STATE_READY. + * + * @see vc_mgr_send_audio_streaming() + */ +int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e mode); + +/** + * @platform + * @brief Changes background volume. + * @since_tizen 6.0 + * + * @privlevel public + * @privilege %http://tizen.org/privilege/volume.set + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @remarks If @a event is #VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_NEARFIELD, the background volume will be reduced by 70%. + * And, if @a event is #VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_FARFIELD, the background volume will be muted. + * + * @param[in] event The background volume event + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation fail + * + * @pre The state should be #VC_STATE_INITIALIZED or #VC_STATE_READY. + * + * @see vc_mgr_reset_background_volume() + * @see vc_mgr_change_background_volume_by_ratio() + */ +int vc_mgr_change_background_volume(vc_background_volume_event_e event); + +/** + * @platform + * @brief Changes background volume ratio. + * @details Calling this function sets the background volume to a given percentage of its current value. + * @since_tizen 6.0 + * + * @privlevel public + * @privilege %http://tizen.org/privilege/volume.set + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @param[in] ratio Current background volume ratio (Range 0.0 ~ 1.0) + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation fail + * + * @pre The state should be #VC_STATE_INITIALIZED or #VC_STATE_READY. + * + * @see vc_mgr_change_background_volume() + * @see vc_mgr_reset_background_volume() + */ +int vc_mgr_change_background_volume_by_ratio(double ratio); + +/** + * @platform + * @brief Resets background volume. + * @details This function reverts all changes made by vc_mgr_change_background_volume() and vc_mgr_change_background_volume_by_ratio(). + * @since_tizen 6.0 + * + * @privlevel public + * @privilege %http://tizen.org/privilege/volume.set + * + * @privlevel platform + * @privilege %http://tizen.org/privilege/voicecontrol.manager + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED VC not supported + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation fail + * + * @pre The state should be #VC_STATE_INITIALIZED or #VC_STATE_READY. + * + * @see vc_mgr_change_background_volume() + * @see vc_mgr_change_background_volume_by_ratio() + */ +int vc_mgr_reset_background_volume(void); #ifdef __cplusplus } diff --git a/include/voice_control_manager_internal.h b/include/voice_control_manager_internal.h index 627f025..b86be95 100644 --- a/include/voice_control_manager_internal.h +++ b/include/voice_control_manager_internal.h @@ -28,19 +28,6 @@ extern "C" #endif typedef enum { - VC_AUDIO_STREAMING_EVENT_FAIL = -1, /**< Failed */ - VC_AUDIO_STREAMING_EVENT_START = 1, /**< Start event */ - VC_AUDIO_STREAMING_EVENT_CONTINUE = 2, /**< Continue event */ - VC_AUDIO_STREAMING_EVENT_FINISH = 3 /**< Finish event */ -} vc_audio_streaming_event_e; - -typedef enum { - VC_AUDIO_STREAMING_MODE_VC_SERVICE = 0, /**< Use audio recording from vc service */ - VC_AUDIO_STREAMING_MODE_MULTI_ASSISTANT = 1, /**< Use audio streaming from multi-assistant */ - VC_AUDIO_STREAMING_MODE_OUTSIDE = 2, /**< Use audio streaming from outside */ -} vc_audio_streaming_mode_e; - -typedef enum { VC_SYSTEM_VOLUME_EVENT_CHANGE_FOR_NEARFIELD, VC_SYSTEM_VOLUME_EVENT_CHANGE_FOR_FARFIELD } vc_system_volume_event_e; @@ -99,16 +86,6 @@ int vc_mgr_unset_demandable_client_rule(void); int vc_mgr_set_domain(const char* domain); /** - * @brief Sends audio streaming to the engine service. - * @since_tizen 5.0 - * - */ -int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len); - -int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e streaming_mode); - - -/** * @brief Changes system volume. * @since_tizen 5.0 * -- 2.7.4 From c72d7d22a3ccd499defbf358d9b60797ceab74e8 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Mon, 27 Apr 2020 12:35:20 +0900 Subject: [PATCH 12/16] Update version to 1.60.11 Change-Id: Icbab8f7b541de2a5305d178eec389ec905ca8b2a Signed-off-by: sungrae jo --- CMakeLists.txt | 2 +- packaging/voice-control.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adf6a88..8574677 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 1.60.10) +SET(VERSION 1.60.11) FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index b5d2598..1d9f2d3 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.60.10 +Version: 1.60.11 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From 7b229a23544146fe989f5a1f16f266134ab4b7b4 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 12 May 2020 18:37:20 +0900 Subject: [PATCH 13/16] Temporary integration with ma_ap library Change-Id: Ib76300f7dfe19072669e43d1b33898a6ff8b5ce8 --- CMakeLists.txt | 4 ++-- packaging/voice-control.spec | 1 + server/vcd_recorder.c | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8574677..90fc56b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,12 +48,12 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 - capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api + capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api multi-assistant ) ELSE() pkg_check_modules(pkgs REQUIRED aul buxton2 capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 - capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf + capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf multi-assistant ) ENDIF() diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 1d9f2d3..78801c1 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -40,6 +40,7 @@ BuildRequires: pkgconfig(msfapi) BuildRequires: pkgconfig(farfield-voice-api) %endif BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(multi-assistant) BuildRequires: cmake %description diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index a2d2648..7a48d61 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -43,6 +43,8 @@ #include "vcd_recorder.h" #include "vcd_main.h" +#include + #define FRAME_LENGTH 160 #define BUFFER_LENGTH FRAME_LENGTH * 2 @@ -258,6 +260,25 @@ static void _ffv_audio_function_cb(void* data, unsigned int length, void* user_d } #endif +void audio_streaming_cb(ma_audio_streaming_event_e event, char* buffer, int len, void* user_data) +{ + if (0 == g_buffer_count || 0 == g_buffer_count % 50) { + SLOG(LOG_INFO, TAG_VCD, "[Recorder INFO] MA_ap audio function callback is invoked"); + + if (100000 == g_buffer_count) { + g_buffer_count = 0; + } + } + + g_buffer_count++; + + if (NULL != g_audio_cb) { + if (0 != g_audio_cb(buffer, len)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); + } + } +} + #if 1 static const char* __get_focus_changed_reason_code(sound_stream_focus_change_reason_e reason) { @@ -504,11 +525,15 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb SLOG(LOG_INFO, TAG_VCD, "[Recorder] Audio type : %s", g_current_audio_type); + ma_ap_initialize(); + ma_ap_set_audio_streaming_cb(audio_streaming_cb, NULL); + return 0; } int vcd_recorder_destroy() { + ma_ap_deinitialize(); if (VCD_RECORDER_STATE_RECORDING == g_recorder_state) { if (0 == strncmp(VCE_AUDIO_ID_BLUETOOTH, g_current_audio_type, strlen(VCE_AUDIO_ID_BLUETOOTH))) { #ifdef TV_BT_MODE -- 2.7.4 From 2385286d70ecf35b96fbcb4ae46c8d6d416c7e61 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 9 Jul 2020 10:57:17 +0900 Subject: [PATCH 14/16] Remove unnecessary header Change-Id: Iecef17f7ea56028bea23b250687cb502d4917d69 Signed-off-by: Suyeon Hwang --- server/vcd_recorder.c | 1 - server/vcd_server.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 7a48d61..c781470 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -21,7 +21,6 @@ #endif #include -#include #include #include #ifdef TV_PRODUCT diff --git a/server/vcd_server.c b/server/vcd_server.c index b88f356..d675240 100755 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -16,10 +16,6 @@ #include #include -#include -#include -#include -#include #include "vc_cmd_db.h" #include "vc_info_parser.h" -- 2.7.4 From 5db2de67c7f83bcc4ad2ea33cf81203619450e6e Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Thu, 30 Jul 2020 13:36:06 +0900 Subject: [PATCH 15/16] Fixed enum value for vc_tts_utterance_status_e Change-Id: I01fe0b9f25be912764cc8a2aeb98be053e97e8a3 Signed-off-by: sungrae jo --- client/vc_mgr.c | 2 +- include/voice_control_common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 7acde3c..3caa9ae 100755 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -4359,7 +4359,7 @@ int vc_mgr_send_utterance_status(int pid, int utt_id, vc_tts_utterance_status_e return VC_ERROR_PERMISSION_DENIED; } - if (VC_TTS_UTTERANCE_NONE > utt_status || VC_TTS_UTTERANCE_CANCELED < utt_status) { + if (VC_TTS_UTTERANCE_NONE > utt_status || VC_TTS_UTTERANCE_CANCELED < utt_status || 0 == utt_status) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] utt_status is not valid. (%d)", utt_status); return VC_ERROR_INVALID_PARAMETER; } diff --git a/include/voice_control_common.h b/include/voice_control_common.h index f8ca800..136e628 100644 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -138,7 +138,7 @@ typedef enum { * @since_tizen 5.5 */ typedef enum { - VC_TTS_UTTERANCE_NONE = 0, /**< None */ + VC_TTS_UTTERANCE_NONE = -1, /**< None */ VC_TTS_UTTERANCE_STARTED = 1, /**< Utterance started */ VC_TTS_UTTERANCE_COMPLETED = 2, /**< Utterance completed */ VC_TTS_UTTERANCE_CANCELED = 3 /**< Utterance canceled */ -- 2.7.4 From 0142ddac3902c466834d6665a0ab99b557537f30 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 31 Jul 2020 14:24:11 +0900 Subject: [PATCH 16/16] Add to send set volume in audio_streaming_cb Change-Id: If302fa2feebff6fe2f2ac4c54448cdcf9d36f4d5 Signed-off-by: sooyeon.kim --- server/vcd_recorder.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index c781470..dddc02c 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -276,6 +276,14 @@ void audio_streaming_cb(ma_audio_streaming_event_e event, char* buffer, int len, SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); } } + + /* Set volume */ + if (0 == g_buffer_count % 15) { + float vol_db = get_volume_decibel(buffer, len); + if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] Fail to send recording volume(%f)", vol_db); + } + } } #if 1 -- 2.7.4