__mChannel(EChannel::CHANNEL_MONO),
__mSampleType(ESampleType::SAMPLE_TYPE_U8),
__mAudioType(EAudioType::AUDIO_IN_TYPE_MEDIA),
- __mAudioIndex(-1) {
+ __mAudioIndex(-1),
+ __mReferenceDeviceId(0),
+ __mNoiseSuppression(false) {
}
CAudioInfo::CAudioInfo(unsigned int sampleRate, EChannel channel, ESampleType sampleType, EAudioType audioType, int audioIndex) :
__mChannel(channel),
__mSampleType(sampleType),
__mAudioType(audioType),
- __mAudioIndex(audioIndex) {
+ __mAudioIndex(audioIndex),
+ __mReferenceDeviceId(0),
+ __mNoiseSuppression(false) {
// Check to invalid AudioInfo
if (sampleRate < CAudioInfo::MIN_SYSTEM_SAMPLERATE ||
sampleRate > CAudioInfo::MAX_SYSTEM_SAMPLERATE)
return bytes_in_sample * static_cast<int>(__mChannel);
}
+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;
+}
+
+int CAudioInfo::getEchoCancelReferenceDeviceId() noexcept {
+ return __mReferenceDeviceId;
+}
+
+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;
+}
+
+std::string& CAudioInfo::getProcessorProperty() noexcept {
+ return __mProcessorProperty;
+}
+
const char* CAudioInfo::getConvertedStreamType() {
if (__mAudioType < CAudioInfo::EAudioType::AUDIO_IN_TYPE_MEDIA ||
__mAudioType >= CAudioInfo::EAudioType::AUDIO_TYPE_MAX)
}
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE,
"The streamType of output is not supported [streamType:%s]", streamType);
-}
\ No newline at end of file
+}