diff --git a/mkspecs/features/libraries.pri b/mkspecs/features/libraries.pri index d489569f6..bd7c012a2 100644 --- a/mkspecs/features/libraries.pri +++ b/mkspecs/features/libraries.pri @@ -44,7 +44,7 @@ blackgui { blackcore { addLibraryDependency(blackcore) - LIBS *= -lblackcore -lvatlib + LIBS *= -lblackcore } blacksound { diff --git a/src/blackcore/audiodevice.h b/src/blackcore/audiodevice.h deleted file mode 100644 index 4a9bdf150..000000000 --- a/src/blackcore/audiodevice.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 2014 - * 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 BLACKCORE_AUDIODEVICE_H -#define BLACKCORE_AUDIODEVICE_H - -#include "blackcoreexport.h" -#include "blackmisc/audio/audiodeviceinfo.h" -#include "blackmisc/audio/audiodeviceinfolist.h" - -#include - -namespace BlackCore -{ - //! Audio Input Device - //! \todo Settings classes to store hardware settings (hardware device) - //! \deprecated will be removed as we use Qt classes now - class BLACKCORE_EXPORT IAudioInputDevice : public QObject - { - Q_OBJECT - - public: - - //! Constructor - IAudioInputDevice(QObject *parent = nullptr) : QObject(parent) {} - - //! Destructor - virtual ~IAudioInputDevice() {} - - //! Get available input devices - virtual const BlackMisc::Audio::CAudioDeviceInfoList &getInputDevices() const = 0; - - //! Current input device - virtual const BlackMisc::Audio::CAudioDeviceInfo &getCurrentInputDevice() const = 0; - - //! Set new input device - virtual void setInputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) = 0; - - //! Is this a real or dummy device? - virtual bool isDummyDevice() const = 0; - }; - - //! Dummy inout device - class BLACKCORE_EXPORT CAudioInputDeviceDummy : public IAudioInputDevice - { - Q_OBJECT - - public: - //! Constructor - CAudioInputDeviceDummy(QObject *parent = nullptr) : IAudioInputDevice(parent) {} - - //! Destructor - virtual ~CAudioInputDeviceDummy() override = default; - - //! \copydoc IAudioInputDevice::getInputDevices - virtual const BlackMisc::Audio::CAudioDeviceInfoList &getInputDevices() const override { return m_devices; } - - //! \copydoc IAudioInputDevice::getCurrentInputDevice - virtual const BlackMisc::Audio::CAudioDeviceInfo &getCurrentInputDevice() const override { return m_currentDevice; } - - //! \copydoc IAudioInputDevice::setInputDevice - virtual void setInputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) override { m_currentDevice = device; } - - //! \copydoc IAudioInputDevice::isDummyDevice - virtual bool isDummyDevice() const override { return true; } - - private: - BlackMisc::Audio::CAudioDeviceInfoList m_devices; /*!< in and output devices */ - BlackMisc::Audio::CAudioDeviceInfo m_currentDevice; - }; - - //! Audio Output Device - class IAudioOutputDevice : public QObject - { - Q_OBJECT - - public: - - //! Constructor - IAudioOutputDevice(QObject *parent = nullptr) : QObject(parent) {} - - //! Destructor - virtual ~IAudioOutputDevice() {} - - //! Get available output devices - virtual const BlackMisc::Audio::CAudioDeviceInfoList &getOutputDevices() const = 0; - - //! Current output device - virtual const BlackMisc::Audio::CAudioDeviceInfo &getCurrentOutputDevice() const = 0; - - //! Set new output device - virtual void setOutputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) = 0; - - //! Set output volume between 0 ... 300% - virtual void setOutputVolume(int volume) = 0; - - //! Get output volume between 0 ... 300% - virtual int getOutputVolume() const = 0; - }; -} // ns - -#endif // guard diff --git a/src/blackcore/audiomixer.cpp b/src/blackcore/audiomixer.cpp deleted file mode 100644 index a769d0f59..000000000 --- a/src/blackcore/audiomixer.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2014 - * 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. - */ - -#include "blackcore/audiomixer.h" - -namespace BlackCore -{ - IAudioMixer::IAudioMixer(QObject *parent) : QObject(parent) - { } - - bool IAudioMixer::makeOrRemoveConnection(IAudioMixer::InputPort inputPort, IAudioMixer::OutputPort outputPort, bool make) - { - return make ? - this->makeMixerConnectionIfNotExisting(inputPort, outputPort) : - this->removeMixerConnectionIfExisting(inputPort, outputPort); - } - - bool IAudioMixer::makeMixerConnectionIfNotExisting(IAudioMixer::InputPort inputPort, IAudioMixer::OutputPort outputPort) - { - if (this->hasMixerConnection(inputPort, outputPort)) { return false; } - this->makeMixerConnection(inputPort, outputPort); - return true; - } - - bool IAudioMixer::removeMixerConnectionIfExisting(IAudioMixer::InputPort inputPort, IAudioMixer::OutputPort outputPort) - { - if (!this->hasMixerConnection(inputPort, outputPort)) { return false; } - this->removeMixerConnection(inputPort, outputPort); - return true; - } -} diff --git a/src/blackcore/audiomixer.h b/src/blackcore/audiomixer.h deleted file mode 100644 index 64e569d11..000000000 --- a/src/blackcore/audiomixer.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 2014 - * 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 BLACKCORE_AUDIOMIXER_H -#define BLACKCORE_AUDIOMIXER_H - -#include -#include "blackcore/blackcoreexport.h" - -namespace BlackCore -{ - //! Interface to an audio mixer - class BLACKCORE_EXPORT IAudioMixer : public QObject - { - Q_OBJECT - - public: - - //! Audio mixer input ports - enum InputPort - { - InputMicrophone, - InputVoiceChannel1, - InputVoiceChannel2, - }; - - //! Audio mixer output ports - enum OutputPort - { - OutputDevice1, - OutputVoiceChannel1, - OutputVoiceChannel2, - }; - - //! Default constructor - IAudioMixer(QObject *parent = nullptr); - - //! Virtual destructor. - virtual ~IAudioMixer() {} - - //! Connect mixer input to a mixer output. This causes audio to be routed from the input to output - virtual void makeMixerConnection(InputPort inputPort, OutputPort outputPort) = 0; - - //! Remove the mixer connection from input to output - virtual void removeMixerConnection(InputPort inputPort, OutputPort outputPort) = 0; - - //! Returns true if input port and output port are connected - virtual bool hasMixerConnection(InputPort inputPort, OutputPort outputPort) = 0; - - //! Make or remove connection - bool makeOrRemoveConnection(InputPort inputPort, OutputPort outputPort, bool make); - - //! Safe versions of make/remove @{ - bool makeMixerConnectionIfNotExisting(InputPort inputPort, OutputPort outputPort); - bool removeMixerConnectionIfExisting(InputPort inputPort, OutputPort outputPort); - //! @} - }; - -} // ns - -#endif // guard diff --git a/src/blackcore/blackcore.pro b/src/blackcore/blackcore.pro index 171058b36..75f1ca330 100644 --- a/src/blackcore/blackcore.pro +++ b/src/blackcore/blackcore.pro @@ -48,7 +48,6 @@ SOURCES += $$PWD/afv/connection/*.cpp SOURCES += $$PWD/afv/model/*.cpp LIBS *= \ - -lvatlib \ -lvatsimauth \ -lsodium \ diff --git a/src/blackcore/context/contextaudioempty.h b/src/blackcore/context/contextaudioempty.h index b399ba90f..166ab0d54 100644 --- a/src/blackcore/context/contextaudioempty.h +++ b/src/blackcore/context/contextaudioempty.h @@ -13,7 +13,6 @@ #include "blackcoreexport.h" #include "contextaudio.h" -#include "voice.h" // clazy:excludeall=const-signal-or-slot diff --git a/src/blackcore/context/contextaudioimpl.cpp b/src/blackcore/context/contextaudioimpl.cpp index c860b7557..5fa8c12fa 100644 --- a/src/blackcore/context/contextaudioimpl.cpp +++ b/src/blackcore/context/contextaudioimpl.cpp @@ -12,9 +12,7 @@ #include "blackcore/context/contextownaircraft.h" // for COM integration #include "blackcore/context/contextsimulator.h" // for COM intergration #include "blackcore/application.h" -#include "blackcore/audiodevice.h" #include "blackcore/corefacade.h" -#include "blackcore/voice.h" #include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/audio/audiodeviceinfo.h" #include "blackmisc/audio/notificationsounds.h" @@ -303,29 +301,6 @@ namespace BlackCore this->setVoiceTransmission(enabled, COMActive); } - void CContextAudio::onConnectionStatusChanged( - IVoiceChannel::ConnectionStatus oldStatus, - IVoiceChannel::ConnectionStatus newStatus) - { - Q_UNUSED(oldStatus) - - switch (newStatus) - { - case IVoiceChannel::Connected: - break; - case IVoiceChannel::Disconnecting: break; - case IVoiceChannel::Connecting: break; - case IVoiceChannel::ConnectingFailed: - case IVoiceChannel::DisconnectedError: - CLogMessage(this).warning(u"Voice channel disconnecting error"); - Q_FALLTHROUGH(); - case IVoiceChannel::Disconnected: - break; - default: - break; - } - } - void CContextAudio::changeDeviceSettings() { const QString inputDeviceName = m_inputDeviceSetting.get(); diff --git a/src/blackcore/context/contextaudioimpl.h b/src/blackcore/context/contextaudioimpl.h index 297da2950..bd65757bc 100644 --- a/src/blackcore/context/contextaudioimpl.h +++ b/src/blackcore/context/contextaudioimpl.h @@ -15,8 +15,6 @@ #include "blackcore/audio/audiosettings.h" #include "blackcore/actionbind.h" #include "blackcore/corefacadeconfig.h" -#include "blackcore/voicechannel.h" -#include "blackcore/audiomixer.h" #include "blackcore/blackcoreexport.h" #include "blackcore/afv/clients/afvclient.h" #include "blackmisc/audio/audiosettings.h" @@ -57,11 +55,6 @@ namespace BlackMisc namespace BlackCore { class CCoreFacade; - class IAudioInputDevice; - class IAudioMixer; - class IAudioOutputDevice; - class IVoice; - class IVoiceChannel; namespace Context { @@ -122,10 +115,6 @@ namespace BlackCore CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server); private: - //! \copydoc IVoice::connectionStatusChanged - //! \sa IContextAudio::changedVoiceRooms - void onConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus); - //! Enable/disable voice transmission, nornally used with hotkey @{ void setVoiceTransmission(bool enable, BlackMisc::Audio::PTTCOM com); void setVoiceTransmissionCom1(bool enabled); diff --git a/src/blackcore/registermetadata.cpp b/src/blackcore/registermetadata.cpp index dfe67c08e..33d4fd00a 100644 --- a/src/blackcore/registermetadata.cpp +++ b/src/blackcore/registermetadata.cpp @@ -14,7 +14,6 @@ #include "blackcore/db/databasereader.h" #include "blackcore/vatsim/vatsimsettings.h" #include "blackcore/fsd/fsdclient.h" -#include "blackcore/voicechannel.h" #include "blackcore/webreaderflags.h" #include "blackcore/aircraftmatcher.h" #include "blackmisc/dbus.h" @@ -32,7 +31,6 @@ namespace BlackCore { // not really clear when a type here has to be registered with qRegisterMetaType // however, does not harm if it is redundant - qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); @@ -40,13 +38,11 @@ namespace BlackCore qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); - qDBusRegisterMetaType(); qRegisterMetaTypeStreamOperators(); qRegisterMetaTypeStreamOperators(); qRegisterMetaTypeStreamOperators(); qRegisterMetaTypeStreamOperators(); - qRegisterMetaTypeStreamOperators(); Db::CDatabaseReaderConfig::registerMetadata(); Db::CDatabaseReaderConfigList::registerMetadata(); diff --git a/src/blackcore/voice.cpp b/src/blackcore/voice.cpp deleted file mode 100644 index 20baba059..000000000 --- a/src/blackcore/voice.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 2013 - * 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. - */ - -#include "blackcore/voice.h" - -namespace BlackCore -{ - IVoice::IVoice(QObject *parent) : QObject(parent) - { } -} diff --git a/src/blackcore/voice.h b/src/blackcore/voice.h deleted file mode 100644 index 8a697abc0..000000000 --- a/src/blackcore/voice.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (C) 2013 - * 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. - */ - -#ifndef BLACKCORE_VOICE_H -#define BLACKCORE_VOICE_H - -#include "blackcore/audiomixer.h" -#include "blackcore/blackcoreexport.h" -#include "blackmisc/audio/voicesetup.h" - -#include -#include -#include - -namespace BlackCore -{ - class IAudioInputDevice; - class IAudioOutputDevice; - class IVoiceChannel; - - //! Interface to a connection to a ATC voice server for use in flight simulation. - class BLACKCORE_EXPORT IVoice : public QObject - { - Q_OBJECT - - public: - - /*! - * \brief Default constructor with parent - * \param parent - */ - IVoice(QObject *parent = nullptr); - - //! Virtual destructor. - virtual ~IVoice() {} - - //! Set voice setup - virtual void setVoiceSetup(const BlackMisc::Audio::CVoiceSetup &setup) = 0; - - //! Get voice setup - virtual BlackMisc::Audio::CVoiceSetup getVoiceSetup() const = 0; - - //! Create voice channel object - virtual QSharedPointer createVoiceChannel() = 0; - - //! Create input device object - virtual std::unique_ptr createInputDevice() = 0; - - //! Create output device object - virtual std::unique_ptr createOutputDevice() = 0; - - //! Create audio mixer object - virtual std::unique_ptr createAudioMixer() = 0; - - //! Connect audio input device to audio mixer - virtual void connectVoice(IAudioInputDevice *device, IAudioMixer *mixer, IAudioMixer::InputPort inputPort) = 0; - - //! Connect voice channel to audio mixer - virtual void connectVoice(IVoiceChannel *channel, IAudioMixer *mixer, IAudioMixer::InputPort inputPort) = 0; - - //! Connect audio mixer to audio output device - virtual void connectVoice(IAudioMixer *mixer, IAudioMixer::OutputPort outputPort, IAudioOutputDevice *device) = 0; - - //! Connect audio mixer to audio input device - virtual void connectVoice(IAudioMixer *mixer, IAudioMixer::OutputPort outputPort, IVoiceChannel *channel) = 0; - - //! Disconnect input device - virtual void disconnectVoice(IAudioInputDevice *device) = 0; - - //! Disconnect voice channel - virtual void disconnectVoice(IVoiceChannel *channel) = 0; - - //! Disconnect audio mixer output port - virtual void disconnectVoice(IAudioMixer *mixer, IAudioMixer::OutputPort outputPort) = 0; - }; - -} // namespace BlackCore - -#endif // guard diff --git a/src/blackcore/voicechannel.h b/src/blackcore/voicechannel.h deleted file mode 100644 index d1d1680fc..000000000 --- a/src/blackcore/voicechannel.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2014 - * 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 BLACKCORE_VOICE_CHANNEL_H -#define BLACKCORE_VOICE_CHANNEL_H - -#include "blackcoreexport.h" -#include "blackmisc/statusmessage.h" -#include "blackmisc/audio/voiceroomlist.h" -#include "blackmisc/aviation/callsignset.h" - -#include -#include - -namespace BlackCore -{ - //! Interface to a voice channel - class BLACKCORE_EXPORT IVoiceChannel : public QObject - { - Q_OBJECT - - public: - //! Com status - enum ConnectionStatus - { - Disconnected = 0, //!< Not connected - Disconnecting, //!< In transition to disconnected - DisconnectedError, //!< Disconnected due to socket error - Connecting, //!< Connection initiated but not established - Connected, //!< Connection established - ConnectingFailed //!< Failed to connect - }; - Q_ENUM(ConnectionStatus) - - //! Constructor - IVoiceChannel(QObject *parent = nullptr) : QObject(parent) {} - - //! Destructor - virtual ~IVoiceChannel() {} - - //! Join voice room - virtual void joinVoiceRoom(const BlackMisc::Audio::CVoiceRoom &voiceRoom) = 0; - - //! Leave voice room - virtual void leaveVoiceRoom() = 0; - - //! Get voice room callsings - virtual BlackMisc::Aviation::CCallsignSet getVoiceRoomCallsigns() const = 0; - - //! Set own aircraft's callsign - virtual void setOwnAircraftCallsign(const BlackMisc::Aviation::CCallsign &callsign) = 0; - - //! Set user id - virtual void setUserId(const QString &id) = 0; - - //! Get voice room - virtual BlackMisc::Audio::CVoiceRoom getVoiceRoom() const = 0; - - //! Is channel muted? - virtual bool isMuted() const = 0; - - //! Set channel volume 0..100 - virtual void setVolume(int volume) = 0; - - //! Get channel volume 0..100 - virtual int getVolume() const = 0; - - signals: - - //! We sent a message about the status of the network connection, for the attention of the user. - void statusMessage(const BlackMisc::CStatusMessage &message); - - //! The status of a room has changed. - void connectionStatusChanged(BlackCore::IVoiceChannel::ConnectionStatus oldStatus, - BlackCore::IVoiceChannel::ConnectionStatus newStatus); - - // Signals about users joining and leaving - - //! User with callsign joined room - void userJoinedRoom(const BlackMisc::Aviation::CCallsign &callsign); - - //! User with callsign left room - void userLeftRoom(const BlackMisc::Aviation::CCallsign &callsign); - - // Audio signals - - //! Audio for given unit started - void audioStarted(); - - //! Audio for given unit stopped - void audioStopped(); - - protected: - - }; -} // ns - -Q_DECLARE_METATYPE(BlackCore::IVoiceChannel::ConnectionStatus) - -#endif // guard