Modify noise-suppression API arguments 00/292800/4 accepted/tizen/unified/20230620.022507
authorJaechul Lee <jcsing.lee@samsung.com>
Mon, 15 May 2023 05:04:28 +0000 (14:04 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Fri, 16 Jun 2023 04:09:05 +0000 (13:09 +0900)
sound_noise_suppression_type was added to noise suppression API.
This parameter will select noise-suppression algorithm.

[Version] 0.7.4
[Issue Type] New Feature

Change-Id: Ib3cdc1b2a28adbf49fad129e9813c5b7fe3728a6
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
include/sound_manager_internal.h
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager_internal.c
src/sound_manager_private.c

index 6a59c9b..5444555 100644 (file)
@@ -145,6 +145,26 @@ typedef enum {
 
 /**
  * @internal
+ * @brief Enumeration for noise-suppression scenarios
+ * @since_tizen 8.0
+ */
+typedef enum {
+       SOUND_ACOUSTIC_ECHO_CANCEL_VOICE_CALL,
+       SOUND_ACOUSTIC_ECHO_CANCEL_REFERENCE_COPY,
+} sound_acoustic_echo_cancel_type_e;
+
+/**
+ * @internal
+ * @brief Enumeration for noise-suppression scenarios
+ * @since_tizen 8.0
+ */
+typedef enum {
+       SOUND_NOISE_SUPPRESSION_VOICE_CALL,
+       SOUND_NOISE_SUPPRESSION_VOICE_RECOGNITION,
+} sound_noise_suppression_type_e;
+
+/**
+ * @internal
  * @brief Gets the maximum master volume level.
  * @since_tizen 3.0
  * @param[out] max_level       The maximum volume level
@@ -1207,6 +1227,7 @@ int sound_manager_stop_discover_remote_device(void);
  *     If @a device is not supported by @a stream_info, #SOUND_MANAGER_ERROR_POLICY will be returned.
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  device  The reference device of echo-cancellation
+ * @param[in]  type The types of acoustic echo cancellation
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
@@ -1218,7 +1239,7 @@ int sound_manager_stop_discover_remote_device(void);
  * @see sound_manager_get_next_device()
  * @see sound_manager_free_device_list()
  */
-int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_info, sound_device_h device);
+int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_info, sound_device_h device, sound_acoustic_echo_cancel_type_e type);
 
 /**
  * @internal
@@ -1230,6 +1251,7 @@ int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_in
  *     sound_manager_get_next_device() and sound_manager_get_device_id().
  * @param[in]  stream_info     The handle of stream information
  * @param[out] device_id       The reference device id of echo-cancellation
+ * @param[in]  type            The types of acoustic echo cancellation
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
@@ -1239,13 +1261,14 @@ int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_in
  * @see sound_manager_get_next_device()
  * @see sound_manager_free_device_list()
  */
-int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_info, int *device_id);
+int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_info, int *device_id, sound_acoustic_echo_cancel_type_e *type);
 
 /**
  * @internal
  * @brief Sets noise suppression status
  * @since_tizen 7.5
  * @param[in]  stream_info     The handle of stream information
+ * @param[in]  type The type of noise suppression
  * @param[in]  enable  The 'noise_suppression' property value to set: (@c true = enable, @c false = disable)
  * @return @c 0 on success,
  *         otherwise a negative error value
@@ -1254,7 +1277,7 @@ int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_in
  * @see sound_manager_create_stream_information()
  * @see sound_manager_get_noise_suppression()
  */
-int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool enable);
+int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool enable, sound_noise_suppression_type_e type);
 
 /**
  * @internal
@@ -1262,6 +1285,7 @@ int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool en
  * @since_tizen 7.5
  * @param[in]  stream_info     The handle of stream information
  * @param[out] enabled The 'noise_suppression' property value : (@c true = enable, @c false = disable)
+ * @param[out] type The type of the noise_suppression scenario
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
@@ -1269,7 +1293,7 @@ int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool en
  * @see sound_manager_create_stream_information()
  * @see sound_manager_set_noise_suppression()
  */
-int sound_manager_get_noise_suppression(sound_stream_info_h stream_info, bool *enabled);
+int sound_manager_get_noise_suppression(sound_stream_info_h stream_info, bool *enabled, sound_noise_suppression_type_e *type);
 
 /**
  * @internal
index 912c6d2..53c897f 100644 (file)
@@ -212,7 +212,9 @@ typedef struct _sound_stream_info_s {
        manual_route_info_s manual_route_info;
        preferred_device_info_s preferred_device_info;
        int echo_cancel_reference_device;
-       bool noise_suppression;
+       sound_acoustic_echo_cancel_type_e echo_cancel_type;
+       bool noise_suppression_enable;
+       sound_noise_suppression_type_e noise_suppression_type;
        pthread_mutex_t focus_state_mutex;
        pthread_mutex_t focus_cb_mutex;
        pthread_mutex_t vstream_mutex;
@@ -400,13 +402,13 @@ int _get_preemptive_device(sound_stream_type_e stream_type, int *in_device_id, i
 
 int _get_latest_stream_pid(int stream_type, unsigned int *pid);
 
-int _set_echo_cancel_reference_device(sound_stream_info_s *stream_info, sound_device_h device);
+int _set_echo_cancel_reference_device(sound_stream_info_s *stream_info, sound_device_h device, sound_acoustic_echo_cancel_type_e type);
 
-int _get_echo_cancel_reference_device(sound_stream_info_s *stream_info, int *device_id);
+int _get_echo_cancel_reference_device(sound_stream_info_s *stream_info, int *device_id, sound_acoustic_echo_cancel_type_e *type);
 
-int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable);
+int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable, sound_noise_suppression_type_e type);
 
-int _get_noise_suppression(sound_stream_info_s *stream_info, bool *enable);
+int _get_noise_suppression(sound_stream_info_s *stream_info, bool *enable, sound_noise_suppression_type_e *type);
 
 int _set_rpi_playback_route(sound_rpi_playback_route_type type);
 
index c8798ba..e4d7eec 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.7.4
+Version:    0.7.5
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 58e0c2a..b341d3f 100644 (file)
@@ -927,24 +927,24 @@ int sound_manager_set_remote_permission(int id, bool allowed)
        return _set_remote_permission(id, allowed);
 }
 
-int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_info, sound_device_h device)
+int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_info, sound_device_h device, sound_acoustic_echo_cancel_type_e type)
 {
-       return _set_echo_cancel_reference_device((sound_stream_info_s*)stream_info, device);
+       return _set_echo_cancel_reference_device((sound_stream_info_s*)stream_info, device, type);
 }
 
-int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_info, int *device_id)
+int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_info, int *device_id, sound_acoustic_echo_cancel_type_e *type)
 {
-       return _get_echo_cancel_reference_device((sound_stream_info_s*)stream_info, device_id);
+       return _get_echo_cancel_reference_device((sound_stream_info_s*)stream_info, device_id, type);
 }
 
-int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool enable)
+int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool enable, sound_noise_suppression_type_e type)
 {
-       return _set_noise_suppression((sound_stream_info_s*)stream_info, enable);
+       return _set_noise_suppression((sound_stream_info_s*)stream_info, enable, type);
 }
 
-int sound_manager_get_noise_suppression(sound_stream_info_h stream_info, bool *enabled)
+int sound_manager_get_noise_suppression(sound_stream_info_h stream_info, bool *enabled, sound_noise_suppression_type_e *type)
 {
-       return _get_noise_suppression((sound_stream_info_s*)stream_info, enabled);
+       return _get_noise_suppression((sound_stream_info_s*)stream_info, enabled, type);
 }
 
 int sound_manager_set_rpi_playback_route(sound_rpi_playback_route_type type)
index 27ed606..d2e58cd 100644 (file)
@@ -2482,7 +2482,7 @@ int _set_remote_permission(int id, bool allowed)
        return ret;
 }
 
-int _set_echo_cancel_reference_device(sound_stream_info_s *stream_info, sound_device_h device)
+int _set_echo_cancel_reference_device(sound_stream_info_s *stream_info, sound_device_h device, sound_acoustic_echo_cancel_type_e type)
 {
        int ret;
        int device_id;
@@ -2504,27 +2504,30 @@ int _set_echo_cancel_reference_device(sound_stream_info_s *stream_info, sound_de
                return _convert_sound_manager_error_code(__func__, ret);
 
        stream_info->echo_cancel_reference_device = device_id;
+       stream_info->echo_cancel_type = type;
 
-       LOGI("stream_info[%p, %s] EC reference device[id:%d, name:%s]",
-               stream_info, stream_info->stream_type, device_id, device_name);
+       LOGI("stream_info[%p, %s] EC reference device[id:%d, name:%s type:%d]",
+               stream_info, stream_info->stream_type, device_id, device_name, stream_info->echo_cancel_type);
 
        return SOUND_MANAGER_ERROR_NONE;
 }
 
-int _get_echo_cancel_reference_device(sound_stream_info_s *stream_info, int *device_id)
+int _get_echo_cancel_reference_device(sound_stream_info_s *stream_info, int *device_id, sound_acoustic_echo_cancel_type_e *type)
 {
        SM_ARG_CHECK(stream_info);
        SM_ARG_CHECK(device_id);
+       SM_ARG_CHECK(type);
 
        *device_id = stream_info->echo_cancel_reference_device;
+       *type = stream_info->echo_cancel_type;
 
-       LOGI("stream_info[%p, %s] reference device_id[%d]",
-               stream_info, stream_info->stream_type, *device_id);
+       LOGI("stream_info[%p, %s] reference device_id[%d], type[%d]",
+               stream_info, stream_info->stream_type, *device_id, *type);
 
        return SOUND_MANAGER_ERROR_NONE;
 }
 
-int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable)
+int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable, sound_noise_suppression_type_e type)
 {
        SM_ARG_CHECK(stream_info);
 
@@ -2533,23 +2536,26 @@ int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable)
                return SOUND_MANAGER_ERROR_POLICY;
        }
 
-       stream_info->noise_suppression = enable;
+       stream_info->noise_suppression_enable = enable;
+       stream_info->noise_suppression_type = type;
 
-       LOGI("stream_info[%p, %s] noise_suppression[%d]",
-               stream_info, stream_info->stream_type, stream_info->noise_suppression);
+       LOGI("stream_info[%p, %s] noise_suppression[%d], type[%d]",
+               stream_info, stream_info->stream_type, stream_info->noise_suppression_enable, stream_info->noise_suppression_type);
 
        return SOUND_MANAGER_ERROR_NONE;
 }
 
-int _get_noise_suppression(sound_stream_info_s *stream_info, bool *enabled)
+int _get_noise_suppression(sound_stream_info_s *stream_info, bool *enabled, sound_noise_suppression_type_e *type)
 {
        SM_ARG_CHECK(stream_info);
        SM_ARG_CHECK(enabled);
+       SM_ARG_CHECK(type);
 
-       *enabled = stream_info->noise_suppression;
+       *enabled = stream_info->noise_suppression_enable;
+       *type = stream_info->noise_suppression_type;
 
-       LOGI("stream_info[%p, %s] noise_suppression[%d]",
-               stream_info, stream_info->stream_type, *enabled);
+       LOGI("stream_info[%p, %s] noise_suppression[%d], type[%d]",
+               stream_info, stream_info->stream_type, *enabled, *type);
 
        return SOUND_MANAGER_ERROR_NONE;
 }