diff --git a/src/blackcore/context/contextaudioimpl.cpp b/src/blackcore/context/contextaudioimpl.cpp index 3ccde9e07..259173a4a 100644 --- a/src/blackcore/context/contextaudioimpl.cpp +++ b/src/blackcore/context/contextaudioimpl.cpp @@ -713,6 +713,22 @@ namespace BlackCore this->setVoiceOutputVolume(v); } + CComSystem CContextAudio::getOwnComSystem(CComSystem::ComUnit unit) const + { + if (!this->getIContextOwnAircraft()) + { + // context not available + switch (unit) + { + case CComSystem::Com1: return CComSystem::getCom1System(122.800, 122.800); + case CComSystem::Com2: return CComSystem::getCom2System(122.800, 122.800); + default: break; + } + return CComSystem::getCom1System(122.800, 122.800); + } + return this->getIContextOwnAircraft()->getOwnComSystem(unit); + } + QSharedPointer CContextAudio::getVoiceChannelBy(const CVoiceRoom &voiceRoom) { QSharedPointer voiceChannel; diff --git a/src/blackcore/context/contextaudioimpl.h b/src/blackcore/context/contextaudioimpl.h index 8da052d14..be605d74f 100644 --- a/src/blackcore/context/contextaudioimpl.h +++ b/src/blackcore/context/contextaudioimpl.h @@ -167,6 +167,12 @@ namespace BlackCore void audioDecreaseVolume(bool enabled); //! @} + //! Get current COM unit from cockpit + //! \remark cross context + //! @{ + BlackMisc::Aviation::CComSystem getOwnComSystem(BlackMisc::Aviation::CComSystem::ComUnit unit) const; + //! @} + //! Voice channel by room QSharedPointer getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom);