mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 10:25:36 +08:00
Remove all obsolete vatlib voice classes
This commit is contained in:
committed by
Mat Sutcliffe
parent
c759d45bb0
commit
8656131eb1
@@ -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 <QObject>
|
||||
|
||||
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
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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 <QObject>
|
||||
#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
|
||||
@@ -48,7 +48,6 @@ SOURCES += $$PWD/afv/connection/*.cpp
|
||||
SOURCES += $$PWD/afv/model/*.cpp
|
||||
|
||||
LIBS *= \
|
||||
-lvatlib \
|
||||
-lvatsimauth \
|
||||
-lsodium \
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "blackcoreexport.h"
|
||||
#include "contextaudio.h"
|
||||
#include "voice.h"
|
||||
|
||||
// clazy:excludeall=const-signal-or-slot
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<IVoiceChannel::ConnectionStatus>();
|
||||
qRegisterMetaType<CWebReaderFlags::WebReader>();
|
||||
qRegisterMetaType<CWebReaderFlags::WebReaderFlag>();
|
||||
|
||||
@@ -40,13 +38,11 @@ namespace BlackCore
|
||||
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
||||
qDBusRegisterMetaType<Context::CSettingsDictionary>();
|
||||
qDBusRegisterMetaType<BlackMisc::Network::CLoginMode>();
|
||||
qDBusRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
||||
|
||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionHash>();
|
||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionPair>();
|
||||
qRegisterMetaTypeStreamOperators<Context::CSettingsDictionary>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::Network::CLoginMode>();
|
||||
qRegisterMetaTypeStreamOperators<IVoiceChannel::ConnectionStatus>();
|
||||
|
||||
Db::CDatabaseReaderConfig::registerMetadata();
|
||||
Db::CDatabaseReaderConfigList::registerMetadata();
|
||||
|
||||
@@ -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)
|
||||
{ }
|
||||
}
|
||||
@@ -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 <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <memory>
|
||||
|
||||
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<IVoiceChannel> createVoiceChannel() = 0;
|
||||
|
||||
//! Create input device object
|
||||
virtual std::unique_ptr<IAudioInputDevice> createInputDevice() = 0;
|
||||
|
||||
//! Create output device object
|
||||
virtual std::unique_ptr<IAudioOutputDevice> createOutputDevice() = 0;
|
||||
|
||||
//! Create audio mixer object
|
||||
virtual std::unique_ptr<IAudioMixer> 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
|
||||
@@ -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 <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user