SOUND_SAMPLE_RATE_192000, /**< 192000 Hz sample rate */
} sound_sample_rate_e;
+/**
+ * @brief Definition for the value indicating that the reference device for the stream information was not set.
+ * @since_tizen 8.0
+ * @see sound_manager_get_effect_reference_device()
+ */
+#define SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE 0
+
+/**
+* @brief Enumeration for sound effects that need a reference device.
+* @since_tizen 8.0
+*/
+typedef enum {
+ SOUND_EFFECT_REFERENCE_COPY, /** < including reference source */
+ SOUND_EFFECT_ACOUSTIC_ECHO_CANCEL_SPEEX, /** < acoustic echo cancel with speex */
+ SOUND_EFFECT_ACOUSTIC_ECHO_CANCEL_WEBRTC, /** < acoustic echo cancel with webrtc */
+} sound_effect_reference_method_e;
+
+/**
+* @brief Enumeration for sound effects.
+* @since_tizen 8.0
+*/
+typedef enum {
+ SOUND_EFFECT_NOISE_SUPPRESSION_VOICECALL = 0x0100, /** < noise suppression with rnnoise */
+ SOUND_EFFECT_NOISE_SUPPRESSION_VOICERECOGNITION = 0x0200, /** < noise suppression with pse */
+ SOUND_EFFECT_NOISE_SUPPRESSION_VERSATILE = 0x0400, /** < noise suppression with versatile */
+} sound_effect_method_e;
+
/**
* @}
*/
*/
int sound_manager_remove_device_running_changed_cb(int id);
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_STREAM_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets sound effect methods
+ * @since_tizen 8.0
+ * @remark This function isn't allow more than 2 acoustic echo cancellation effects.\n
+ * If @a method is set with more than 2 acoustic echo cancellation effects,\n
+ * It will return #SOUND_MANAGER_ERROR_INVALID_PARAMETER.
+ * @param[in] stream_info The handle of stream information
+ * @param[in] method The method of audio effect, values of #sound_effect_method_e combined with bitwise 'or'
+ * @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()
+ */
+int sound_manager_set_effect_method(sound_stream_info_h stream_info, int method);
+
+/**
+ * @brief Gets sound effect methods
+ * @since_tizen 8.0
+ * @param[in] stream_info The handle of stream information
+ * @param[out] method The methods of audio effect
+ * @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_audio_effect_method()
+ */
+int sound_manager_get_effect_method(sound_stream_info_h stream_info, int *method);
+
+/**
+ * @brief Sets a reference device for audio-effects that must need a reference
+ * @since_tizen 8.0
+ * @remark You can get a device handle by using sound_manager_get_device_list() and sound_manager_get_next_device()\n
+ * If @a device is not supported by @a stream_info, #SOUND_MANAGER_ERROR_POLICY will be returned.\n
+ * If a sort of a method of acoustic echo cancellation isn't set, It will return ##SOUND_MANAGER_ERROR_INTERNAL.
+ * @param[in] stream_info The handle of stream information
+ * @param[in] device The reference device of echo-cancellation
+ * @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
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @pre Call sound_manager_set_effect_method() before calling this function.
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_get_device_list()
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_set_effect_reference_device(sound_stream_info_h stream_info, sound_device_h device);
+
+/**
+ * @brief Gets a reference device
+ * @since_tizen 8.0
+ * @remarks If there is no reference device that has been set, the output value will be set to
+ * #SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE.\n
+ * You can get a device handle of the id value by using sound_manager_get_device_list(),
+ * 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
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Call sound_manager_set_effect_method() before calling this function.
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_get_device_list()
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_get_effect_reference_device(sound_stream_info_h stream_info, int *device_id);
+
+/**
+ * @brief Sets sound effect methods that must need a reference device such as acoustic echo cancellation
+ * @since_tizen 8.0
+ * @remark This function isn't allow more than 2 acoustic echo cancellation effects.\n
+ * If @a method is set with more than 2 acoustic echo cancellation effects,\n
+ * It will return #SOUND_MANAGER_ERROR_INVALID_PARAMETER.
+ * @param[in] stream_info The handle of stream information
+ * @param[in] method The method of #sound_effect_reference_method_e
+ * @param[in] device The reference device
+ * @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()
+ */
+int sound_manager_set_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_reference_method_e method, sound_device_h device);
+
+int sound_manager_get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_reference_method_e method, int *device_id);
+
+int sound_manager_set_effect_method(sound_stream_info_h stream_info, int method);
+
+int sound_manager_get_effect_method(sound_stream_info_h stream_info, int *method);
+
+
+/**
+ * @}
+ */
+
/**
* @}
*/
return ret;
}
+
+int sound_manager_set_audio_effect_method(sound_stream_info_h stream_info, int method)
+{
+ 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;
+ }
+
+ stream_h->audio_effect.method = method;
+
+ LOGI("stream_h[%p, %s] method[0x%x]", stream_h, stream_h->stream_type, method);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_get_audio_effect_method(sound_stream_info_h stream_info, int *method)
+{
+ sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+ SM_ARG_CHECK(stream_h);
+ SM_ARG_CHECK(method);
+
+ *method = stream_h->audio_effect.method;
+
+ LOGI("stream_h[%p, %s] method[0x%x]",
+ stream_h, stream_h->stream_type, *method);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_set_audio_effect_reference_device(sound_stream_info_h stream_info, sound_device_h device)
+{
+ int ret;
+ int device_id;
+ char *device_name;
+ sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+ SM_ARG_CHECK(stream_h);
+ SM_ARG_CHECK(device);
+
+ 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;
+ }
+
+ /* FIXME: check if the PA sink supports to pump the reference data to AEC module */
+ if ((ret = mm_sound_get_device_id(device, &device_id)) != MM_ERROR_NONE)
+ return _convert_sound_manager_error_code(__func__, ret);
+
+ if ((ret = mm_sound_get_device_name(device, &device_name)) != MM_ERROR_NONE)
+ return _convert_sound_manager_error_code(__func__, ret);
+
+ stream_h->audio_effect.reference_device = device_id;
+
+ LOGI("stream_h[%p, %s] audio effect reference device[id:%d, name:%s]",
+ stream_h, stream_h->stream_type, device_id, device_name);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_get_audio_effect_reference_device(sound_stream_info_h stream_info, int *device_id)
+{
+ sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+ SM_ARG_CHECK(stream_h);
+ SM_ARG_CHECK(device_id);
+
+ *device_id = stream_h->audio_effect.reference_device;
+
+ LOGI("stream_h[%p, %s] reference device_id[%d]",
+ stream_h, stream_h->stream_type, *device_id);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}