Add set_effect_method by id API for C# 54/317654/2 accepted/tizen_9.0_unified accepted/tizen_unified_toolchain tizen_9.0 accepted/tizen/9.0/unified/20241030.235506 accepted/tizen/unified/20240924.153213 accepted/tizen/unified/toolchain/20241004.101504 accepted/tizen/unified/x/20240925.015918 accepted/tizen/unified/x/asan/20241013.235822 tizen_9.0_m2_release
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 c44fcba08d7dade38dcd3027b05f78e96be4855b..b05d062de15aeeea297d76868e8ca93b73f672ee 100644 (file)
@@ -1348,6 +1348,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);
 
+/**
+ * @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 8abe53c8664fbbda3156441a5e44b872b0176fcb..972dbd566bf5709bd23281f373409120cb4db2cf 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_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);
index 9e9113ffcad9d3749fa1cb83c886e16fad39ee06..e514d56b7a4135e9e3f8cf0467203387e2ad19de 100644 (file)
@@ -1,6 +1,6 @@
 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
index 6cd49ade4a8e276463e635f40731c7a8075e071b..c378b508c9c744961f704a92f4647da22a2c2fef 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);
 }
+
+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 6aedc65dca3f2b058cf0b6609a0f8fe91783665b..4f6fa60c2d2e953ee1a4765aeb2cf9538dd6988f 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;
 }
 
+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;