/**
* class CAudioIO
*/
-//LCOV_EXCL_START
-CAudioIO::CAudioIO() :
- mpPulseAudioClient(nullptr),
- __mIsInit(false) {
- mDirection = CAudioInfo::EAudioDirection::AUDIO_DIRECTION_MAX;
- mState = CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE;
- mStatePrev = CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE;
- mByPolicy = false;
-}
-//LCOV_EXCL_STOP
CAudioIO::CAudioIO(CAudioInfo& audioInfo) :
- mpPulseAudioClient(nullptr),
- __mIsInit(false) {
- mAudioInfo = audioInfo;
- mDirection = CAudioInfo::EAudioDirection::AUDIO_DIRECTION_MAX;
- mState = CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE;
- mStatePrev = CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE;
- mByPolicy = false;
+ mAudioInfo(audioInfo) {
}
void CAudioIO::setInit(bool flag) {
if (mDirection == CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN) {
int device_id;
- bool noise_suppression_enabled;
- sound_acoustic_echo_cancel_type_e aec_type;
- sound_noise_suppression_type_e ns_type;
+ int method;
+ sound_effect_method_with_reference_e method_reference;
- if ((errorCode = sound_manager_get_echo_cancel_reference_device(stream_info, &device_id, &aec_type)) != 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 (sound_manager_get_effect_method(stream_info, &method) == SOUND_MANAGER_ERROR_NONE)
+ getAudioInfo().setEffectMethod(method);
- if (device_id != SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE)
- getAudioInfo().bindEchoCancelReferenceDeviceId(device_id, aec_type);
+ if (sound_manager_get_effect_method_with_reference(stream_info, &method_reference, &device_id) == SOUND_MANAGER_ERROR_NONE)
+ getAudioInfo().setEffectMethodWithReference(method_reference, device_id);
+ }
+}
- if ((errorCode = sound_manager_get_noise_suppression(stream_info, &noise_suppression_enabled, &ns_type)) != 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
+void CAudioIO::onCorked(CPulseAudioClient* pClient, bool corked) {
+ assert(__mIsInit);
+ assert(pClient);
- if (noise_suppression_enabled)
- getAudioInfo().setNoiseSuppression(noise_suppression_enabled, ns_type);
- }
+ AUDIO_IO_LOGD("pClient(%p), corked(%d)", pClient, corked);
}