From cab6c2657577dbefeadf66f584a08d06663bb5c0 Mon Sep 17 00:00:00 2001 From: Jaechul Lee Date: Mon, 23 Oct 2023 17:01:18 +0900 Subject: [PATCH] Add get ns/agc function AGC should be applied at the end of the pipe. So it should be separated and set to the property. [Version] 0.5.65 [Issue Type] Update Change-Id: I35bde1c564d7d5a36efd972916d3a5e3bf659556 Signed-off-by: Jaechul Lee --- include/CAudioInfo.h | 3 ++- packaging/capi-media-audio-io.spec | 2 +- src/cpp/CAudioInfo.cpp | 8 +++++++- src/cpp/CPulseAudioClient.cpp | 6 ++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/CAudioInfo.h b/include/CAudioInfo.h index fbe2439..3a86f07 100644 --- a/include/CAudioInfo.h +++ b/include/CAudioInfo.h @@ -149,7 +149,8 @@ namespace tizen_media_audio { /* Effect */ void setEffectMethod(int method) noexcept; - std::string getEffectMethod() const noexcept; + std::string getEffectNoiseSuppressionMethod() const noexcept; + std::string getEffectAutomaticGainControlMethod() const noexcept; void setEffectMethodWithReference(sound_effect_method_with_reference_e method, int id) noexcept; std::pair getEffectMethodWithReference() const noexcept; diff --git a/packaging/capi-media-audio-io.spec b/packaging/capi-media-audio-io.spec index c0ddac4..ff806c1 100644 --- a/packaging/capi-media-audio-io.spec +++ b/packaging/capi-media-audio-io.spec @@ -1,6 +1,6 @@ Name: capi-media-audio-io Summary: An Audio Input & Audio Output library in Tizen Native API -Version: 0.5.64 +Version: 0.5.65 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/cpp/CAudioInfo.cpp b/src/cpp/CAudioInfo.cpp index 8cf23d4..099451b 100644 --- a/src/cpp/CAudioInfo.cpp +++ b/src/cpp/CAudioInfo.cpp @@ -116,7 +116,7 @@ void CAudioInfo::setEffectMethod(int method) noexcept { __mEffectMethod = method; } -std::string CAudioInfo::getEffectMethod() const noexcept { +std::string CAudioInfo::getEffectNoiseSuppressionMethod() const noexcept { std::string method; if (__mEffectMethod & SOUND_EFFECT_NOISE_SUPPRESSION_VOIP) @@ -128,6 +128,12 @@ std::string CAudioInfo::getEffectMethod() const noexcept { if (__mEffectMethod & SOUND_EFFECT_NOISE_SUPPRESSION_DOORBELL) method += "ns-srid,"; + return method; +} + +std::string CAudioInfo::getEffectAutomaticGainControlMethod() const noexcept { + std::string method; + if (__mEffectMethod & SOUND_EFFECT_AUTOMATIC_GAIN_CONTROL_CAPTURE) method += "agc-speex,"; diff --git a/src/cpp/CPulseAudioClient.cpp b/src/cpp/CPulseAudioClient.cpp index 7c1796a..d143d94 100644 --- a/src/cpp/CPulseAudioClient.cpp +++ b/src/cpp/CPulseAudioClient.cpp @@ -400,9 +400,11 @@ void CPulseAudioClient::initialize() { if (__mDirection == EStreamDirection::STREAM_DIRECTION_RECORD) { /* Noise-suppression effect should be set first. */ - std::string method = __mSpec.getAudioInfo().getEffectMethod(); + std::string ns_method = __mSpec.getAudioInfo().getEffectNoiseSuppressionMethod(); auto [ method_reference, device_id ] = __mSpec.getAudioInfo().getEffectMethodWithReference(); - std::string method_all = method + method_reference; + std::string agc_method = __mSpec.getAudioInfo().getEffectAutomaticGainControlMethod(); + + std::string method_all = ns_method + method_reference + agc_method; if (!method_all.empty()) { pa_proplist_setf(__mpPropList, PA_PROP_MEDIA_PREPROCESSOR_METHOD, "%s", method_all.c_str()); -- 2.7.4