diff --git a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp index 59c60b0c..12257f9b 100644 --- a/include/f1x/openauto/autoapp/Configuration/Configuration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/Configuration.hpp @@ -43,6 +43,8 @@ class Configuration: public IConfiguration HandednessOfTrafficType getHandednessOfTrafficType() const override; void showClock(bool value) override; bool showClock() const override; + void audioAvoidInterference(bool value) override; + bool audioAvoidInterference() const override; aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override; void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) override; @@ -70,6 +72,7 @@ class Configuration: public IConfiguration HandednessOfTrafficType handednessOfTrafficType_; bool showClock_; + bool audioAvoidInterference_; aasdk::proto::enums::VideoFPS::Enum videoFPS_; aasdk::proto::enums::VideoResolution::Enum videoResolution_; size_t screenDPI_; @@ -82,6 +85,7 @@ class Configuration: public IConfiguration static const std::string cConfigFileName; static const std::string cGeneralShowClockKey; + static const std::string cAudioAvoidInterferenceKey; static const std::string cGeneralHandednessOfTrafficTypeKey; static const std::string cVideoFPSKey; diff --git a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp index e3bd23f9..53863c9a 100644 --- a/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp +++ b/include/f1x/openauto/autoapp/Configuration/IConfiguration.hpp @@ -50,6 +50,8 @@ class IConfiguration virtual HandednessOfTrafficType getHandednessOfTrafficType() const = 0; virtual void showClock(bool value) = 0; virtual bool showClock() const = 0; + virtual void audioAvoidInterference(bool value) = 0; + virtual bool audioAvoidInterference() const = 0; virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0; virtual void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) = 0; diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index 1d149545..46f5e62b 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -33,6 +33,8 @@ const std::string Configuration::cConfigFileName = "openauto.ini"; const std::string Configuration::cGeneralShowClockKey = "General.ShowClock"; const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType"; +const std::string Configuration::cAudioAvoidInterferenceKey = "Audio.AvoidInterference"; + const std::string Configuration::cVideoFPSKey = "Video.FPS"; const std::string Configuration::cVideoResolutionKey = "Video.Resolution"; const std::string Configuration::cVideoScreenDPIKey = "Video.ScreenDPI"; @@ -76,6 +78,8 @@ void Configuration::load() static_cast(HandednessOfTrafficType::LEFT_HAND_DRIVE))); showClock_ = iniConfig.get(cGeneralShowClockKey, true); + audioAvoidInterference_ = iniConfig.get(cAudioAvoidInterferenceKey, true); + videoFPS_ = static_cast(iniConfig.get(cVideoFPSKey, aasdk::proto::enums::VideoFPS::_60)); @@ -105,6 +109,7 @@ void Configuration::reset() { handednessOfTrafficType_ = HandednessOfTrafficType::LEFT_HAND_DRIVE; showClock_ = true; + audioAvoidInterference_ = false; videoFPS_ = aasdk::proto::enums::VideoFPS::_60; videoResolution_ = aasdk::proto::enums::VideoResolution::_480p; screenDPI_ = 140; @@ -120,6 +125,7 @@ void Configuration::save() boost::property_tree::ptree iniConfig; iniConfig.put(cGeneralHandednessOfTrafficTypeKey, static_cast(handednessOfTrafficType_)); iniConfig.put(cGeneralShowClockKey, showClock_); + iniConfig.put(cAudioAvoidInterferenceKey, audioAvoidInterference_); iniConfig.put(cVideoFPSKey, static_cast(videoFPS_)); iniConfig.put(cVideoResolutionKey, static_cast(videoResolution_)); @@ -154,6 +160,16 @@ bool Configuration::showClock() const return showClock_; } +void Configuration::audioAvoidInterference(bool value) +{ + audioAvoidInterference_ = value; +} + +bool Configuration::audioAvoidInterference() const +{ + return audioAvoidInterference_; +} + aasdk::proto::enums::VideoFPS::Enum Configuration::getVideoFPS() const { return videoFPS_; diff --git a/src/autoapp/Projection/ServiceFactory.cpp b/src/autoapp/Projection/ServiceFactory.cpp index 410263ca..84e91f4a 100644 --- a/src/autoapp/Projection/ServiceFactory.cpp +++ b/src/autoapp/Projection/ServiceFactory.cpp @@ -62,18 +62,22 @@ ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messeng IAudioInput::Pointer audioInput(new AudioInput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(audioInput))); - IAudioOutput::Pointer mediaAudioOutput(new AudioOutput(2, 16, 48000), std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(mediaAudioOutput))); - - IAudioOutput::Pointer speechAudioOutput(new AudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); - serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(speechAudioOutput))); - IAudioOutput::Pointer systemAudioOutput(new AudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(systemAudioOutput))); + if (!configuration_->audioAvoidInterference()) { + IAudioOutput::Pointer mediaAudioOutput(new AudioOutput(2, 16, 48000), std::bind(&QObject::deleteLater, std::placeholders::_1)); + serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(mediaAudioOutput))); + + IAudioOutput::Pointer speechAudioOutput(new AudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1)); + serviceList.emplace_back(std::make_shared(ioService_, messenger, std::move(speechAudioOutput))); + } + serviceList.emplace_back(std::make_shared(ioService_, messenger)); serviceList.emplace_back(this->createVideoService(messenger)); + serviceList.emplace_back(this->createBluetoothService(messenger)); + serviceList.emplace_back(this->createInputService(messenger)); return serviceList; diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index c5203986..7726bf2c 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -56,6 +56,7 @@ void SettingsWindow::onSave() { configuration_->setHandednessOfTrafficType(ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); configuration_->showClock(ui_->checkBoxShowClock->isChecked()); + configuration_->audioAvoidInterference(ui_->checkBoxAudioAvoidInterference->isChecked()); configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60); if(ui_->radioButton480p->isChecked()) @@ -117,6 +118,7 @@ void SettingsWindow::load() ui_->radioButtonLeftHandDrive->setChecked(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE); ui_->radioButtonRightHandDrive->setChecked(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE); ui_->checkBoxShowClock->setChecked(configuration_->showClock()); + ui_->checkBoxAudioAvoidInterference->setChecked(configuration_->audioAvoidInterference()); ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30); ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_60); diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index c678f3de..f9b51803 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -132,6 +132,19 @@ color: rgb(238, 238, 236); Show clock + + + + 10 + 160 + 601 + 23 + + + + [Experimental] Avoid taking over the phone's normal audio path + +