mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T730, added voice server setup (settings for server URLs) to context
This commit is contained in:
committed by
Mat Sutcliffe
parent
2123529fd8
commit
d3c0e75248
@@ -33,8 +33,11 @@ namespace BlackCore
|
||||
namespace Context
|
||||
{
|
||||
IContextAudio::IContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) :
|
||||
IContext(mode, runtime), m_voiceClient("https://voice1.vatsim.uk", this)
|
||||
IContext(mode, runtime), m_voiceClient(CVoiceSetup().getAfvVoiceServerUrl(), this)
|
||||
{
|
||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||
m_voiceClient.updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||
|
||||
Q_ASSERT_X(CThreadUtils::isApplicationThread(m_voiceClient.thread()), Q_FUNC_INFO, "Should be in main thread");
|
||||
m_voiceClient.start();
|
||||
Q_ASSERT_X(m_voiceClient.owner() == this, Q_FUNC_INFO, "Wrong owner");
|
||||
@@ -178,6 +181,10 @@ namespace BlackCore
|
||||
if (!inputDevice.getName().isEmpty()) { m_inputDeviceSetting.setAndSave(inputDevice.getName()); }
|
||||
if (!outputDevice.getName().isEmpty()) { m_outputDeviceSetting.setAndSave(outputDevice.getName()); }
|
||||
const bool changed = m_voiceClient.restartWithNewDevices(inputDevice, outputDevice);
|
||||
|
||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||
m_voiceClient.updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||
|
||||
if (changed)
|
||||
{
|
||||
emit this->changedSelectedAudioDevices(this->getCurrentAudioDevices());
|
||||
@@ -345,6 +352,11 @@ namespace BlackCore
|
||||
this->setVoiceOutputVolume(s.getOutVolume());
|
||||
}
|
||||
|
||||
void IContextAudio::onChangedVoiceSettings()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
void IContextAudio::audioIncreaseVolume(bool enabled)
|
||||
{
|
||||
if (!enabled) { return; }
|
||||
@@ -405,6 +417,9 @@ namespace BlackCore
|
||||
BLACK_VERIFY_X(this->getIContextNetwork(), Q_FUNC_INFO, "Missing network context");
|
||||
if (to.isConnected() && this->getIContextNetwork())
|
||||
{
|
||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||
m_voiceClient.updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||
|
||||
const CUser connectedUser = this->getIContextNetwork()->getConnectedServer().getUser();
|
||||
m_voiceClient.connectTo(connectedUser.getId(), connectedUser.getPassword(), connectedUser.getCallsign().asString());
|
||||
m_voiceClient.startAudio(CAudioDeviceInfo::getDefaultInputDevice(), CAudioDeviceInfo::getDefaultOutputDevice(), {0, 1});
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
#include "blackmisc/audio/settings/voicesettings.h"
|
||||
#include "blackmisc/audio/ptt.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/aviation/comsystem.h"
|
||||
@@ -193,6 +193,9 @@ namespace BlackCore
|
||||
//! Changed audio settings
|
||||
void onChangedAudioSettings();
|
||||
|
||||
//! Changed voice settings
|
||||
void onChangedVoiceSettings();
|
||||
|
||||
//! Audio increase/decrease volume
|
||||
//! @{
|
||||
void audioIncreaseVolume(bool enabled);
|
||||
@@ -223,7 +226,9 @@ namespace BlackCore
|
||||
static constexpr int MinUnmuteVolume = 20; //!< minimum volume when unmuted
|
||||
|
||||
// settings
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &IContextAudio::onChangedAudioSettings };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &IContextAudio::onChangedAudioSettings };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::Settings::TVoiceSetup> m_voiceSettings { this, &IContextAudio::onChangedVoiceSettings };
|
||||
|
||||
BlackMisc::CSetting<Audio::TInputDevice> m_inputDeviceSetting { this, &IContextAudio::changeDeviceSettings };
|
||||
BlackMisc::CSetting<Audio::TOutputDevice> m_outputDeviceSetting { this, &IContextAudio::changeDeviceSettings };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user