Add set_effect_method by id API for C# 54/317654/2 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20240924.153213 accepted/tizen/unified/x/20240925.015918
authorJaechul Lee <jcsing.lee@samsung.com>
Fri, 13 Sep 2024 02:05:01 +0000 (11:05 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Fri, 13 Sep 2024 02:49:13 +0000 (11:49 +0900)
set_effect_method_by_id apiis added in order to support
set_effect_method API on C# layer

Change-Id: If739294ac53c9008147bf843718b0fe87a7ed500
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 c44fcba..b05d062 100644 (file)
@@ -1349,6 +1349,25 @@ int sound_manager_get_device_channels(sound_device_h device, int *channels);
 int sound_manager_get_current_media_playback_device_id(int *device_id);
 
 /**
 int sound_manager_get_current_media_playback_device_id(int *device_id);
 
 /**
+ * @internal
+ * @brief Sets sound effect methods that must need a reference device such as acoustic echo cancellation.
+ * @since_tizen 8.0
+ * @param[in]  stream_info     The handle of stream information
+ * @param[in]  method  The method of #sound_effect_method_with_reference_e
+ * @param[in]  device_id       The reference device id
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @pre Get a device by calling sound_manager_get_device_list() and sound_manager_get_next_device().
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_set_effect_method()
+ * @see sound_manager_get_effect_method_with_reference()
+ */
+int sound_manager_set_effect_method_with_reference_by_id(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, int device_id);
+
+/**
  * @}
  */
 
  * @}
  */
 
index 8abe53c..972dbd5 100644 (file)
@@ -415,6 +415,8 @@ int _get_host_volume_level(const char *direction, const char *volume_type, unsig
 
 int _set_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, sound_device_h device);
 
 
 int _set_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, sound_device_h device);
 
+int _set_effect_method_with_reference_by_id(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, int device_id);
+
 int _get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e *method, int *device_id);
 
 int _set_effect_method(sound_stream_info_h stream_info, int method);
 int _get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e *method, int *device_id);
 
 int _set_effect_method(sound_stream_info_h stream_info, int method);
index 9e9113f..e514d56 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.7.11
+Version:    0.7.12
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 6cd49ad..c378b50 100644 (file)
@@ -985,3 +985,8 @@ int sound_manager_get_current_media_playback_device_id(int *device_id)
 
        return _get_current_media_routing_path("out", device_id, &unused);
 }
 
        return _get_current_media_routing_path("out", device_id, &unused);
 }
+
+int sound_manager_set_effect_method_with_reference_by_id(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, int device_id)
+{
+       return _set_effect_method_with_reference_by_id(stream_info, method, device_id);
+}
index 6aedc65..4f6fa60 100644 (file)
@@ -3890,6 +3890,30 @@ int _set_effect_method_with_reference(sound_stream_info_h stream_info, sound_eff
        return SOUND_MANAGER_ERROR_NONE;
 }
 
        return SOUND_MANAGER_ERROR_NONE;
 }
 
+int _set_effect_method_with_reference_by_id(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, int device_id)
+{
+       sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+       SM_ARG_CHECK(stream_h);
+
+       if (!stream_h->stream_conf_info.avail_in_devices[0]) {
+               LOGE("stream_h[%p, %s] does not support any input devices", stream_h, stream_h->stream_type);
+               return SOUND_MANAGER_ERROR_POLICY;
+       }
+
+       if (method == SOUND_MANAGER_STREAM_NO_METHOD ||
+               device_id == SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE)
+               return SOUND_MANAGER_ERROR_INVALID_PARAMETER;
+
+       stream_h->sound_effect.reference_method = method;
+       stream_h->sound_effect.reference_device_id = device_id;
+
+       LOGI("set a effect. stream_h[%p, %s], method[%d], reference device[id:%d]",
+               stream_h, stream_h->stream_type, method, device_id);
+
+       return SOUND_MANAGER_ERROR_NONE;
+}
+
 int _get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e *method, int *device_id)
 {
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
 int _get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e *method, int *device_id)
 {
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;