diff --git a/src/blackcore/afv/clients/afvclient.cpp b/src/blackcore/afv/clients/afvclient.cpp index 76b24e707..9e1044e90 100644 --- a/src/blackcore/afv/clients/afvclient.cpp +++ b/src/blackcore/afv/clients/afvclient.cpp @@ -9,6 +9,7 @@ #include "afvclient.h" #include "blackcore/context/contextownaircraft.h" #include "blackcore/context/contextnetwork.h" +#include "blackcore/context/contextsimulator.h" #include "blackcore/application.h" #include "blacksound/audioutilities.h" #include "blackmisc/audio/audiodeviceinfolist.h" @@ -784,7 +785,8 @@ namespace BlackCore if (hasContext()) { // for pilot client - this->updateFromOwnAircraft(sApp->getIContextOwnAircraft()->getOwnAircraft(), false); + const CSimulatedAircraft aircraft = sApp->getIContextOwnAircraft()->getOwnAircraft(); + this->updateFromOwnAircraft(aircraft, false); // disconnect if NOT connected this->autoLogoffWithoutFsdNetwork(); @@ -845,10 +847,25 @@ namespace BlackCore transceiverCom1.frequencyHz = this->getAliasFrequencyHz(f1); transceiverCom2.frequencyHz = this->getAliasFrequencyHz(f2); - const bool tx1 = com1.isTransmitEnabled(); - const bool rx1 = com1.isReceiveEnabled(); - const bool tx2 = com2.isTransmitEnabled(); // we only allow one (1) transmit - const bool rx2 = com2.isReceiveEnabled(); + bool tx1 = true; + bool rx1 = true; + bool tx2 = false; + bool rx2 = true; + + // make sure to use defaults with COM integration disabled + if (hasContext()) + { + const bool integrated = sApp->getIContextSimulator()->getSimulatorSettings().isComIntegrated(); + m_integratedComUnit = integrated; + } + + if (m_integratedComUnit) + { + tx1 = com1.isTransmitEnabled(); + rx1 = com1.isReceiveEnabled(); + tx2 = com2.isTransmitEnabled(); // we only allow one (1) transmit + rx2 = com2.isReceiveEnabled(); + } // enable, we currently treat receive as enable // flight sim cockpits normally use rx and tx @@ -965,7 +982,7 @@ namespace BlackCore bool CAfvClient::hasContext() { - return sApp && !sApp->isShuttingDown() && sApp->getIContextOwnAircraft() && sApp->getIContextNetwork(); + return sApp && !sApp->isShuttingDown() && sApp->getIContextOwnAircraft() && sApp->getIContextNetwork() && sApp->getIContextSimulator(); } bool CAfvClient::setOutputVolumeDb(double valueDb) diff --git a/src/blackcore/afv/clients/afvclient.h b/src/blackcore/afv/clients/afvclient.h index a70143fbc..06120640f 100644 --- a/src/blackcore/afv/clients/afvclient.h +++ b/src/blackcore/afv/clients/afvclient.h @@ -184,7 +184,7 @@ namespace BlackCore //! \threadsafe //! @{ Q_INVOKABLE void setLoopBack(bool on) { m_loopbackOn = on; } - Q_INVOKABLE bool isLoopback() const { return m_loopbackOn; } + Q_INVOKABLE bool isLoopback() const { return m_loopbackOn; } //! @} //! Input volume in dB, +-18dB @@ -324,7 +324,9 @@ namespace BlackCore std::atomic_int m_connectMismatches { 0 }; std::atomic_bool m_isStarted { false }; std::atomic_bool m_loopbackOn { false }; - std::atomic_bool m_winCoInitialized { false }; //!< Windows only CoInitializeEx + std::atomic_bool m_winCoInitialized { false }; //!< Windows only CoInitializeEx + std::atomic_bool m_integratedComUnit {false}; //!< is COM unit sychr + QDateTime m_startDateTimeUtc; double m_inputVolumeDb = 0.0; diff --git a/src/blackcore/context/contextownaircraftimpl.cpp b/src/blackcore/context/contextownaircraftimpl.cpp index 7e4fdb4b6..3c7bcd6d9 100644 --- a/src/blackcore/context/contextownaircraftimpl.cpp +++ b/src/blackcore/context/contextownaircraftimpl.cpp @@ -298,7 +298,7 @@ namespace BlackCore return changed; } - bool CContextOwnAircraft::updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const CTransponder &transponder, const CIdentifier &originator) + bool CContextOwnAircraft::updateCockpit(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder, const CIdentifier &originator) { if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; } bool changed; diff --git a/src/blackgui/components/settingssimulatorcomponent.cpp b/src/blackgui/components/settingssimulatorcomponent.cpp index f88d36f16..7bc85548e 100644 --- a/src/blackgui/components/settingssimulatorcomponent.cpp +++ b/src/blackgui/components/settingssimulatorcomponent.cpp @@ -319,9 +319,9 @@ namespace BlackGui void CSettingsSimulatorComponent::onApplyComSync() { bool ok = false; - CSimulatorSettings settings = getSimulatorSettings(ok); + CSimulatorSettings settings = this->getSimulatorSettings(ok); if (!ok || !settings.setComIntegrated(ui->cb_ComSync->isChecked())) { return; } - setSimulatorSettings(settings); + this->setSimulatorSettings(settings); } void CSettingsSimulatorComponent::onApplyCGSource() @@ -330,7 +330,7 @@ namespace BlackGui const CSimulatorSettings::CGSource source = ui->comp_CGSourceSelector->getValue(); CSimulatorSettings settings = getSimulatorSettings(ok); if (!ok || !settings.setCGSource(source)) { return; } - setSimulatorSettings(settings); + this->setSimulatorSettings(settings); } void CSettingsSimulatorComponent::onApplyRecordGnd()