From: Jaechul Lee Date: Fri, 13 Sep 2024 02:05:01 +0000 (+0900) Subject: Add set_effect_method by id API for C# X-Git-Tag: accepted/tizen/unified/20240924.153213^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;p=platform%2Fcore%2Fapi%2Fsound-manager.git Add set_effect_method by id API for C# 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 --- diff --git a/include/sound_manager_internal.h b/include/sound_manager_internal.h index c44fcba..b05d062 100644 --- a/include/sound_manager_internal.h +++ b/include/sound_manager_internal.h @@ -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); /** + * @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); + +/** * @} */ diff --git a/include/sound_manager_private.h b/include/sound_manager_private.h index 8abe53c..972dbd5 100644 --- a/include/sound_manager_private.h +++ b/include/sound_manager_private.h @@ -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); diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 9e9113f..e514d56 100644 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -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 diff --git a/src/sound_manager_internal.c b/src/sound_manager_internal.c index 6cd49ad..c378b50 100644 --- a/src/sound_manager_internal.c +++ b/src/sound_manager_internal.c @@ -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); +} diff --git a/src/sound_manager_private.c b/src/sound_manager_private.c index 6aedc65..4f6fa60 100644 --- a/src/sound_manager_private.c +++ b/src/sound_manager_private.c @@ -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;