Add noise-suppression APIs 95/287995/6 accepted/tizen/unified/20230215.155627
authorJaechul Lee <jcsing.lee@samsung.com>
Thu, 9 Feb 2023 01:26:58 +0000 (10:26 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Tue, 14 Feb 2023 05:57:40 +0000 (14:57 +0900)
Turning on/off noise suppression APIs are added.

[Version] 0.7.3
[Issue Type] New Feature

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

index 9ba9e8abd59d6dd2028a844ce464270cee9513ed..6a59c9b0787a00b6d8c5426584c3322cfa1d619c 100644 (file)
@@ -1241,6 +1241,36 @@ int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_in
  */
 int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_info, int *device_id);
 
+/**
+ * @internal
+ * @brief Sets noise suppression status
+ * @since_tizen 7.5
+ * @param[in]  stream_info     The handle of stream information
+ * @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
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @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);
+
+/**
+ * @internal
+ * @brief Gets noise suppression status
+ * @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)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @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);
+
 /**
  * @internal
  * @brief Set force hdmi route
index 82b399ad502f5a6fa7615350ee556675b21a5bf5..bc9e4274ab587f537640f40199caa723a5f6f6be 100644 (file)
@@ -1196,6 +1196,36 @@ int sound_manager_set_echo_cancel_reference_device(sound_stream_info_h stream_in
  */
 int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_info, int *device_id);
 
+/**
+ * @internal
+ * @brief Sets noise suppression status
+ * @since_tizen 7.5
+ * @param[in]  stream_info     The handle of stream information
+ * @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
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @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);
+
+/**
+ * @internal
+ * @brief Gets noise suppression status
+ * @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)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @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);
+
 /**
  * @internal
  * @brief Gets the host volume level specified for a particular sound type.
index 16f136483014fff3615b3154f5c972a5079c97eb..912c6d2d0c78e9f4894986faf4caec4938cf3a97 100644 (file)
@@ -212,6 +212,7 @@ 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;
        pthread_mutex_t focus_state_mutex;
        pthread_mutex_t focus_cb_mutex;
        pthread_mutex_t vstream_mutex;
@@ -403,6 +404,10 @@ int _set_echo_cancel_reference_device(sound_stream_info_s *stream_info, sound_de
 
 int _get_echo_cancel_reference_device(sound_stream_info_s *stream_info, int *device_id);
 
+int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable);
+
+int _get_noise_suppression(sound_stream_info_s *stream_info, bool *enable);
+
 int _set_rpi_playback_route(sound_rpi_playback_route_type type);
 
 int _get_rpi_playback_route(sound_rpi_playback_route_type *type);
index e512f2e275b065f721bcd8f8de35add491b2b50f..a4a502fa455dca9cd85957986edd43bffe89ad2a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.7.2
+Version:    0.7.3
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index c369aa6db867c4b43103deeb3ceff1df69a98d03..58e0c2a26b266bc94bbbcf16a98fa077791f2287 100644 (file)
@@ -937,6 +937,16 @@ int sound_manager_get_echo_cancel_reference_device(sound_stream_info_h stream_in
        return _get_echo_cancel_reference_device((sound_stream_info_s*)stream_info, device_id);
 }
 
+int sound_manager_set_noise_suppression(sound_stream_info_h stream_info, bool enable)
+{
+       return _set_noise_suppression((sound_stream_info_s*)stream_info, enable);
+}
+
+int sound_manager_get_noise_suppression(sound_stream_info_h stream_info, bool *enabled)
+{
+       return _get_noise_suppression((sound_stream_info_s*)stream_info, enabled);
+}
+
 int sound_manager_set_rpi_playback_route(sound_rpi_playback_route_type type)
 {
        return _set_rpi_playback_route(type);
@@ -994,4 +1004,4 @@ int sound_manager_get_current_media_playback_device_id(int *device_id)
        SM_ARG_CHECK(device_id);
 
        return _get_current_media_routing_path("out", device_id, &unused);
-}
\ No newline at end of file
+}
index 126674a455903b9d5392580e5f53f27a35b9050e..27ed60654607961a88c7fa360e27d50db5bb0082 100644 (file)
@@ -2524,6 +2524,36 @@ int _get_echo_cancel_reference_device(sound_stream_info_s *stream_info, int *dev
        return SOUND_MANAGER_ERROR_NONE;
 }
 
+int _set_noise_suppression(sound_stream_info_s *stream_info, bool enable)
+{
+       SM_ARG_CHECK(stream_info);
+
+       if (!stream_info->stream_conf_info.avail_in_devices[0]) {
+               LOGE("stream_info[%p, %s] does not support any input devices", stream_info, stream_info->stream_type);
+               return SOUND_MANAGER_ERROR_POLICY;
+       }
+
+       stream_info->noise_suppression = enable;
+
+       LOGI("stream_info[%p, %s] noise_suppression[%d]",
+               stream_info, stream_info->stream_type, stream_info->noise_suppression);
+
+       return SOUND_MANAGER_ERROR_NONE;
+}
+
+int _get_noise_suppression(sound_stream_info_s *stream_info, bool *enabled)
+{
+       SM_ARG_CHECK(stream_info);
+       SM_ARG_CHECK(enabled);
+
+       *enabled = stream_info->noise_suppression;
+
+       LOGI("stream_info[%p, %s] noise_suppression[%d]",
+               stream_info, stream_info->stream_type, *enabled);
+
+       return SOUND_MANAGER_ERROR_NONE;
+}
+
 int _set_rpi_playback_route(sound_rpi_playback_route_type type)
 {
        int ret;
@@ -3893,4 +3923,4 @@ int _get_host_volume_level(const char *direction, const char *volume_type, unsig
 
        return ret;
 }
-//LCOV_EXCL_STOP
\ No newline at end of file
+//LCOV_EXCL_STOP