Add noise suppression functionality
[platform/core/api/audio-io.git] / src / cpp / CAudioIO.cpp
index 0907dcf..0131b4e 100644 (file)
@@ -226,11 +226,19 @@ void CAudioIO::setStreamInfo(sound_stream_info_h stream_info) {
 
     if (mDirection == CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN) {
         int device_id;
+        bool enabled;
 
         if ((errorCode = sound_manager_get_echo_cancel_reference_device(stream_info, &device_id)) != SOUND_MANAGER_ERROR_NONE)
             THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Can't get reference device [ret:%d]", errorCode); //LCOV_EXCL_LINE
 
         if (device_id != SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE)
             getAudioInfo().bindEchoCancelReferenceDeviceId(device_id);
+
+        if ((errorCode = sound_manager_get_noise_suppression(stream_info, &enabled)) != SOUND_MANAGER_ERROR_NONE)
+            THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Can't get noise suppression status [ret:%d]", errorCode); //LCOV_EXCL_LINE
+
+        if (enabled)
+            getAudioInfo().setNoiseSuppression(enabled);
+
     }
 }