diff --git a/src/blackcore/afv/clients/afvclient.cpp b/src/blackcore/afv/clients/afvclient.cpp index 3f4d67ad2..f05cc660e 100644 --- a/src/blackcore/afv/clients/afvclient.cpp +++ b/src/blackcore/afv/clients/afvclient.cpp @@ -16,6 +16,7 @@ using namespace BlackCore::Context; using namespace BlackCore::Afv::Audio; using namespace BlackCore::Afv::Connection; using namespace BlackMisc; +using namespace BlackMisc::Audio; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Simulation; using namespace BlackSound::SampleProvider; @@ -302,9 +303,14 @@ namespace BlackCore qDebug() << "PTT:" << active; } + void CAfvClient::setPttForCom(bool active, PTTCOM com) + { + this->setPtt(active); + } + void CAfvClient::setInputVolumeDb(double value) { - if (value > 18) { value = 18; } + if (value > 18) { value = 18; } if (value < -18) { value = -18; } m_inputVolumeDb = value; m_input->setVolume(qPow(10, value / 20)); diff --git a/src/blackcore/afv/clients/afvclient.h b/src/blackcore/afv/clients/afvclient.h index 6b9ffa8b8..269783dd5 100644 --- a/src/blackcore/afv/clients/afvclient.h +++ b/src/blackcore/afv/clients/afvclient.h @@ -16,9 +16,11 @@ #include "blackcore/afv/audio/output.h" #include "blackcore/afv/audio/soundcardsampleprovider.h" #include "blackcore/afv/dto.h" -#include "blackcore/blackcoreexport.h" #include "blackcore/context/contextownaircraft.h" +#include "blackcore/blackcoreexport.h" + +#include "blackmisc/audio/ptt.h" #include "blacksound/sampleprovider/volumesampleprovider.h" #include @@ -87,7 +89,12 @@ namespace BlackCore void setTransmittingTransceivers(quint16 transceiverID); void setTransmittingTransceivers(const QVector &transceivers); + //! Push to talk @{ Q_INVOKABLE void setPtt(bool active); + void setPttForCom(bool active, BlackMisc::Audio::PTTCOM com); + //! @} + + Q_INVOKABLE void setLoopBack(bool on) { m_loopbackOn = on; } //! Input volume in DB, +-18DB @{ diff --git a/src/blackcore/context/contextaudioimpl.cpp b/src/blackcore/context/contextaudioimpl.cpp index 55c2c9602..5a2d8af3d 100644 --- a/src/blackcore/context/contextaudioimpl.cpp +++ b/src/blackcore/context/contextaudioimpl.cpp @@ -456,7 +456,7 @@ namespace BlackCore // changed not yet used, but I keep it for debugging // changedVoiceRooms called by connectionStatusChanged; - Q_UNUSED(changed); + Q_UNUSED(changed) } CCallsignSet CContextAudio::getRoomCallsigns(CComSystem::ComUnit comUnitValue) const @@ -556,7 +556,7 @@ namespace BlackCore bool CContextAudio::parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) { - Q_UNUSED(originator); + Q_UNUSED(originator) if (commandLine.isEmpty()) { return false; } CSimpleCommandParser parser( { @@ -585,8 +585,12 @@ namespace BlackCore return false; } - void CContextAudio::setVoiceTransmission(bool enable, COM com) + void CContextAudio::setVoiceTransmission(bool enable, PTTCOM com) { + m_voiceClient.setPttForCom(enable, com); + + /** + // first apporach of T609 multiple COM QSharedPointer voiceChannelCom = nullptr; CComSystem::ComUnit usedUnit = CComSystem::Com1; @@ -614,6 +618,8 @@ namespace BlackCore m_audioMixer->removeMixerConnection(IAudioMixer::InputMicrophone, mixerOutputPort); } + **/ + /** fixme KB 201908 to be removed if the above works if (!m_voiceChannelMapping.contains(CComSystem::Com1)) { return; } QSharedPointer voiceChannelCom1 = m_voiceChannelMapping.value(CComSystem::Com1); @@ -650,7 +656,7 @@ namespace BlackCore IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus) { - Q_UNUSED(oldStatus); + Q_UNUSED(oldStatus) switch (newStatus) { diff --git a/src/blackcore/context/contextaudioimpl.h b/src/blackcore/context/contextaudioimpl.h index 60198d040..e4a8468ab 100644 --- a/src/blackcore/context/contextaudioimpl.h +++ b/src/blackcore/context/contextaudioimpl.h @@ -23,6 +23,7 @@ #include "blackmisc/audio/audiodeviceinfolist.h" #include "blackmisc/audio/notificationsounds.h" #include "blackmisc/audio/voiceroomlist.h" +#include "blackmisc/audio/ptt.h" #include "blackmisc/input/actionhotkeydefs.h" #include "blackmisc/aviation/callsignset.h" #include "blackmisc/aviation/comsystem.h" @@ -121,15 +122,6 @@ namespace BlackCore CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server); private: - //! Voice COM channel - enum COM - { - COM1, - COM2, - COMActive, - COMUnspecified - }; - BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const; BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const; bool canTalk() const; @@ -146,7 +138,7 @@ namespace BlackCore void onConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus); //! Enable/disable voice transmission, nornally used with hotkey @{ - void setVoiceTransmission(bool enable, COM com); + void setVoiceTransmission(bool enable, BlackMisc::Audio::PTTCOM com); void setVoiceTransmissionCom1(bool enabled); void setVoiceTransmissionCom2(bool enabled); void setVoiceTransmissionComActive(bool enabled); diff --git a/src/blackmisc/audio/ptt.h b/src/blackmisc/audio/ptt.h new file mode 100644 index 000000000..a38244170 --- /dev/null +++ b/src/blackmisc/audio/ptt.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2019 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, + * or distributed except according to the terms contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKMISC_AUDIO_PTT_H +#define BLACKMISC_AUDIO_PTT_H + +#include + +namespace BlackMisc +{ + namespace Audio + { + //! Voice COM channel + enum PTTCOM + { + COM1, + COM2, + COMActive, + COMUnspecified + }; + } +} + +Q_DECLARE_METATYPE(BlackMisc::Audio::PTTCOM) + +#endif // guard + + diff --git a/src/blackmisc/audio/registermetadataaudio.cpp b/src/blackmisc/audio/registermetadataaudio.cpp index ac34ce265..67822bf7f 100644 --- a/src/blackmisc/audio/registermetadataaudio.cpp +++ b/src/blackmisc/audio/registermetadataaudio.cpp @@ -8,6 +8,7 @@ #include "registermetadataaudio.h" #include "audio.h" +#include "ptt.h" #include namespace BlackMisc @@ -25,6 +26,7 @@ namespace BlackMisc CVoiceSetup::registerMetadata(); // ENUMs + qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); qRegisterMetaTypeStreamOperators();