mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
AFV initial commit
This commit is contained in:
committed by
Mat Sutcliffe
parent
7030302e73
commit
b5a2f2ad13
@@ -29,6 +29,7 @@
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/simplecommandparser.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "blacksound/soundgenerator.h"
|
||||
|
||||
#include <QTimer>
|
||||
@@ -43,6 +44,7 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Input;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackSound;
|
||||
@@ -55,7 +57,8 @@ namespace BlackCore
|
||||
CContextAudio::CContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) :
|
||||
IContextAudio(mode, runtime),
|
||||
CIdentifiable(this),
|
||||
m_voice(new CVoiceVatlib())
|
||||
m_voice(new CVoiceVatlib()),
|
||||
m_voiceClient(("https://voice1.vatsim.uk"))
|
||||
{
|
||||
initVoiceChannels();
|
||||
initInputDevice();
|
||||
@@ -777,6 +780,24 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CContextAudio::xCtxNetworkConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
|
||||
{
|
||||
Q_UNUSED(from);
|
||||
BLACK_VERIFY_X(this->getIContextNetwork(), Q_FUNC_INFO, "Missing network context");
|
||||
if (to.isConnected() && this->getIContextNetwork())
|
||||
{
|
||||
CUser connectedUser = this->getIContextNetwork()->getConnectedServer().getUser();
|
||||
m_voiceClient.setContextOwnAircraft(getIContextOwnAircraft());
|
||||
m_voiceClient.connectTo(connectedUser.getId(), connectedUser.getPassword(), connectedUser.getCallsign().asString());
|
||||
m_voiceClient.start(QAudioDeviceInfo::defaultInputDevice(), QAudioDeviceInfo::defaultOutputDevice(), {0, 1});
|
||||
}
|
||||
else if (to.isDisconnected())
|
||||
{
|
||||
m_voiceClient.stop();
|
||||
m_voiceClient.disconnectFrom();
|
||||
}
|
||||
}
|
||||
|
||||
QSharedPointer<IVoiceChannel> CContextAudio::getVoiceChannelBy(const CVoiceRoom &voiceRoom)
|
||||
{
|
||||
QSharedPointer<IVoiceChannel> voiceChannel;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "blackcore/voicechannel.h"
|
||||
#include "blackcore/audiomixer.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/afv/clients/afvclient.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
@@ -32,6 +33,7 @@
|
||||
#include "blackmisc/network/userlist.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/network/connectionstatus.h"
|
||||
#include "blacksound/selcalplayer.h"
|
||||
#include "blacksound/notificationplayer.h"
|
||||
|
||||
@@ -181,6 +183,9 @@ namespace BlackCore
|
||||
//! \remark cross context
|
||||
void xCtxChangedAircraftCockpit(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
//! Network connection status
|
||||
void xCtxNetworkConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to);
|
||||
|
||||
//! Voice channel by room
|
||||
QSharedPointer<IVoiceChannel> getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom);
|
||||
|
||||
@@ -216,6 +221,9 @@ namespace BlackCore
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CContextAudio::onChangedAudioSettings };
|
||||
BlackMisc::CSetting<BlackCore::Audio::TInputDevice> m_inputDeviceSetting { this, &CContextAudio::changeDeviceSettings };
|
||||
BlackMisc::CSetting<BlackCore::Audio::TOutputDevice> m_outputDeviceSetting { this, &CContextAudio::changeDeviceSettings };
|
||||
|
||||
// AFV
|
||||
AFVClient m_voiceClient;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -187,6 +187,9 @@ namespace BlackCore
|
||||
|
||||
void CContextOwnAircraft::resolveVoiceRooms()
|
||||
{
|
||||
// If VVL supported is disabled, do nothing
|
||||
if (true) { return; }
|
||||
|
||||
if (!this->getIContextNetwork() || !this->getIContextAudio() || !this->getIContextApplication()) { return; } // no chance to resolve rooms
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
|
||||
@@ -796,7 +796,7 @@ namespace BlackCore
|
||||
m_simulatorPlugin.second->changeRemoteAircraftEnabled(aircraft);
|
||||
}
|
||||
|
||||
void CContextSimulator::xCtxNetworkConnectionStatusChanged(CConnectionStatus from, CConnectionStatus to)
|
||||
void CContextSimulator::xCtxNetworkConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
|
||||
{
|
||||
Q_UNUSED(from);
|
||||
BLACK_VERIFY_X(this->getIContextNetwork(), Q_FUNC_INFO, "Missing network context");
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace BlackCore
|
||||
void xCtxChangedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
//! Network connection status
|
||||
void xCtxNetworkConnectionStatusChanged(BlackMisc::Network::CConnectionStatus from, BlackMisc::Network::CConnectionStatus to);
|
||||
void xCtxNetworkConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to);
|
||||
|
||||
//! Update simulator cockpit from context, because someone else has changed cockpit (e.g. GUI, 3rd party)
|
||||
void xCtxUpdateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
Reference in New Issue
Block a user