Modify noise suppression functionality
[platform/core/api/audio-io.git] / src / cpp / CAudioInfo.cpp
index 1fb506b..f5d2666 100644 (file)
@@ -125,7 +125,15 @@ int CAudioInfo::getSampleSize() noexcept {
     return bytes_in_sample * static_cast<int>(__mChannel);
 }
 
-void CAudioInfo::bindEchoCancelReferenceDeviceId(int id) noexcept {
+void CAudioInfo::bindEchoCancelReferenceDeviceId(int id, sound_acoustic_echo_cancel_type_e type) {
+    if (type == SOUND_ACOUSTIC_ECHO_CANCEL_VOICE_CALL)
+        __mProcessorProperty += "webrtc,";
+    else if (type == SOUND_ACOUSTIC_ECHO_CANCEL_REFERENCE_COPY)
+        __mProcessorProperty += "reference_copy,";
+    else
+        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE,
+                               "The echo cancel is not supported [type:%d]", type);
+
     __mReferenceDeviceId = id;
 }
 
@@ -133,12 +141,21 @@ int CAudioInfo::getEchoCancelReferenceDeviceId() noexcept {
     return __mReferenceDeviceId;
 }
 
-void CAudioInfo::setNoiseSuppression(bool enable) noexcept {
+void CAudioInfo::setNoiseSuppression(bool enable, sound_noise_suppression_type_e type) {
+    if (type == SOUND_NOISE_SUPPRESSION_VOICE_CALL) {
+        __mProcessorProperty += "rnnoise,";
+    } else if (type == SOUND_NOISE_SUPPRESSION_VOICE_RECOGNITION) {
+        __mProcessorProperty += "pse,";
+    } else {
+        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE,
+                               "The noise suppression type is not supported [type:%d]", type);
+    }
+
     __mNoiseSuppression = enable;
 }
 
-bool CAudioInfo::getNoiseSuppression() noexcept {
-    return __mNoiseSuppression;
+std::string& CAudioInfo::getProcessorProperty() noexcept {
+    return __mProcessorProperty;
 }
 
 const char* CAudioInfo::getConvertedStreamType() {