Preprocesing functionality was added.
There were two pair of functions for supporting audio effects such as
noise-suppression and acoustic echo cancellation.
- sound_manager_set_effect_method_with_reference
- sound_manager_get_effect_method_with_reference
- sound_manager_set_effect_method
- sound_manager_get_effect_method
[Version] 0.7.9
[Issue Type] Public API
Change-Id: I28026a39615fed8790f1f2b3f3e062d417c56750
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
SOUND_SAMPLE_RATE_192000, /**< 192000 Hz sample rate */
} sound_sample_rate_e;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_STREAM_POLICY_MODULE
+ * @{
+ */
+
+/**
+* @brief Enumeration for sound effects that need a reference device.
+* @since_tizen 8.0
+*/
+typedef enum {
+ SOUND_EFFECT_REFERENCE_COPY = 0x0001, /**< Including reference source */
+ SOUND_EFFECT_ACOUSTIC_ECHO_CANCEL_SPEEX = 0x0002, /**< Acoustic echo cancel with speex */
+ SOUND_EFFECT_ACOUSTIC_ECHO_CANCEL_WEBRTC = 0x0004, /**< Acoustic echo cancel with webrtc */
+} sound_effect_method_with_reference_e;
+
+/**
+* @brief Enumeration for sound effects.
+* @since_tizen 8.0
+*/
+typedef enum {
+ SOUND_EFFECT_NOISE_SUPPRESSION_VOIP = 0x0001, /**< Noise suppression for voice call */
+ SOUND_EFFECT_AUTOMATIC_GAIN_CONTROL_CAPTURE = 0x0002, /**< Auto Gain Control for normal capturing */
+} 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 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 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
+ * @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(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, sound_device_h device);
+
+/**
+ * @brief Gets 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[out] method The method of #sound_effect_method_with_reference_e
+ * @param[out] 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_INVALID_OPERATION Invalid operation
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_set_effect_method_with_reference()
+ */
+int sound_manager_get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e *method, int *device_id);
+
+/**
+ * @brief Sets sound effect methods.
+ * @since_tizen 8.0
+ * @param[in] stream_info The handle of stream information
+ * @param[in] method The methods of #sound_effect_method_e, 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
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_set_effect_method_with_reference()
+ */
+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 #sound_effect_method_e, 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
+ * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_set_effect_method()
+ */
+int sound_manager_get_effect_method(sound_stream_info_h stream_info, int *method);
+
+/**
+ * @}
+ */
+
/**
* @}
*/
SOUND_NOISE_SUPPRESSION_VOICE_RECOGNITION,
} sound_noise_suppression_type_e;
+/**
+* @brief Enumeration for sound effects.
+* @since_tizen 8.0
+*/
+typedef enum {
+ SOUND_EFFECT_NOISE_SUPPRESSION_DOORBELL = 0x0100, /**< Noise suppression for doorbell */
+ SOUND_EFFECT_NOISE_SUPPRESSION_VOICE_RECOGNITION = 0x0200, /**< Noise suppression for voice recognition */
+} sound_effect_method_internal_e;
+
/**
* @internal
* @brief Gets the maximum master volume level.
int out;
} preferred_device_info_s;
+typedef struct _sound_effect {
+ sound_effect_method_with_reference_e reference_method;
+ int method;
+ int reference_device_id;
+} sound_effect_s;
+
typedef struct _virtual_stream_info_s virtual_sound_stream_info_s;
typedef struct _sound_stream_info_s {
sound_acoustic_echo_cancel_type_e echo_cancel_type;
bool noise_suppression_enable;
sound_noise_suppression_type_e noise_suppression_type;
+ sound_effect_s sound_effect;
pthread_mutex_t focus_state_mutex;
pthread_mutex_t focus_cb_mutex;
pthread_mutex_t vstream_mutex;
int _get_host_volume_level(const char *direction, const char *volume_type, unsigned int *level);
+int _set_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, sound_device_h device);
+
+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(sound_stream_info_h stream_info, int *method);
+
#ifdef __cplusplus
}
#endif
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.7.8
+Version: 0.7.9
Release: 0
Group: Multimedia/API
License: Apache-2.0
return ret;
}
+
+int sound_manager_set_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, sound_device_h device)
+{
+ return _set_effect_method_with_reference(stream_info, method, device);
+}
+
+int sound_manager_get_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e *method, int *device_id)
+{
+ return _get_effect_method_with_reference(stream_info, method, device_id);
+}
+
+int sound_manager_set_effect_method(sound_stream_info_h stream_info, int method)
+{
+ return _set_effect_method(stream_info, method);
+}
+
+int sound_manager_get_effect_method(sound_stream_info_h stream_info, int *method)
+{
+ return _get_effect_method(stream_info, method);
+}
+
if (!strncmp(x_sound_type, "bixby", strlen(x_sound_type))) \
return x_error; \
+#define SOUND_MANAGER_STREAM_NO_METHOD 0
+#define SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE 0
+
//LCOV_EXCL_START
int _convert_dbus_error(const char *error_msg)
{
return ret;
}
+
+int _set_effect_method_with_reference(sound_stream_info_h stream_info, sound_effect_method_with_reference_e method, sound_device_h device)
+{
+ sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+ int ret;
+ int device_id;
+ char *device_name;
+
+ 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;
+ }
+
+ 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);
+
+ 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, name:%s]",
+ stream_h, stream_h->stream_type, method, device_id, device_name);
+
+ 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;
+
+ SM_ARG_CHECK(stream_h);
+ SM_ARG_CHECK(method);
+ SM_ARG_CHECK(device_id);
+
+ if (stream_h->sound_effect.reference_method == SOUND_MANAGER_STREAM_NO_METHOD) {
+ LOGI("reference method isn't set yet");
+ return SOUND_MANAGER_ERROR_INVALID_OPERATION;
+ }
+
+ if (stream_h->sound_effect.reference_device_id == SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE) {
+ LOGI("reference method device isn't set yet");
+ return SOUND_MANAGER_ERROR_INVALID_OPERATION;
+ }
+
+ *method = stream_h->sound_effect.reference_method;
+ *device_id = stream_h->sound_effect.reference_device_id;
+
+ LOGI("get a effect. stream_h[%p, %s] get sound effect. method(%d), reference device[id:%d]",
+ stream_h, stream_h->stream_type, *method, *device_id);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int _set_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;
+ }
+
+ if (method == SOUND_MANAGER_STREAM_NO_METHOD)
+ return SOUND_MANAGER_ERROR_INVALID_PARAMETER;
+
+ stream_h->sound_effect.method = method;
+
+ LOGI("set effects. stream_h[%p, %s] method[0x%x]", stream_h, stream_h->stream_type, method);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int _get_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);
+
+ if (stream_h->sound_effect.method == SOUND_MANAGER_STREAM_NO_METHOD) {
+ LOGI("method aren't set yet");
+ return SOUND_MANAGER_ERROR_INVALID_OPERATION;
+ }
+
+ *method = stream_h->sound_effect.method;
+
+ LOGI("get effects. stream_h[%p, %s] method[0x%x]", stream_h, stream_h->stream_type, *method);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
//LCOV_EXCL_STOP