From 3aae1d7bc6248da171d05d8441398082fdf56553 Mon Sep 17 00:00:00 2001 From: Yauhen Pahrabniak Date: Thu, 26 Oct 2023 15:47:11 +0200 Subject: [PATCH] Test app changes --- examples/devicetests.cpp | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/examples/devicetests.cpp b/examples/devicetests.cpp index 2813bb5..293e91d 100644 --- a/examples/devicetests.cpp +++ b/examples/devicetests.cpp @@ -68,21 +68,43 @@ int main() //AV_DestroySoundInput(soundInput); + bool noiseSuppression = true; + bool normalizationEnabled = true; + for(;;) { int nextDeviceIndex = 0; - std::cin >> nextDeviceIndex; + std::string input; + std::cin >> input; - if (nextDeviceIndex < inputDevices.size()) + if (input == "n") + { + noiseSuppression = !noiseSuppression; + soundInput->SetNoiseSuppressionEnabled(noiseSuppression); + } + else if (input == "o") { - auto err = soundInput->SelectDeviceByUID(inputDevices[nextDeviceIndex].c_str()); - if (err != AltVoiceError::Ok) - { - std::cout << AV_GetVoiceErrorText(err) << std::endl; + normalizationEnabled = !normalizationEnabled; + soundInput->SetNormalizatonEnabled(normalizationEnabled); + } + else { + try { + nextDeviceIndex = std::stoi(input); + if (nextDeviceIndex < inputDevices.size()) + { + auto err = soundInput->SelectDeviceByUID(inputDevices[nextDeviceIndex].c_str()); + if (err != AltVoiceError::Ok) + { + std::cout << AV_GetVoiceErrorText(err) << std::endl; + } + else + { + std::cout << soundInput->GetCurrentDeviceUID() << std::endl; + } + } } - else - { - std::cout << soundInput->GetCurrentDeviceUID() << std::endl; + catch(...) { + std::cout << "Unknown argument. Possible: n, o, [number]" << std::endl; } } }