mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T731, connected AFV client signals with UI
This commit is contained in:
committed by
Mat Sutcliffe
parent
dc5cc4c7b0
commit
11275d3560
@@ -80,6 +80,9 @@ namespace BlackCore
|
||||
//! Destructor
|
||||
virtual ~CContextAudio() override;
|
||||
|
||||
//! Reference to voice client
|
||||
BlackCore::Afv::Clients::CAfvClient &voiceClient() { return m_voiceClient; }
|
||||
|
||||
public slots:
|
||||
// Interface implementations
|
||||
//! \publicsection
|
||||
@@ -127,11 +130,13 @@ namespace BlackCore
|
||||
bool canTalk() const;
|
||||
BlackMisc::Aviation::CCallsignSet getRoomCallsigns(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue) const;
|
||||
|
||||
//! @deprecated old voice @{
|
||||
void initVoiceChannels();
|
||||
void initInputDevice();
|
||||
void initOutputDevice();
|
||||
void initAudioMixer();
|
||||
void initVoiceVatlib(bool allocateInput = true);
|
||||
//! @}
|
||||
|
||||
//! \copydoc IVoice::connectionStatusChanged
|
||||
//! \sa IContextAudio::changedVoiceRooms
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackcore/context/contextaudio.h"
|
||||
#include "blackgui/components/audiodevicevolumesetupcomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
|
||||
#include "blackcore/afv/clients/afvclient.h"
|
||||
#include "blackcore/context/contextaudioimpl.h"
|
||||
|
||||
#include "blackmisc/audio/audiodeviceinfo.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
@@ -23,6 +26,7 @@
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Afv::Clients;
|
||||
using namespace BlackCore::Context;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -84,8 +88,16 @@ namespace BlackGui
|
||||
Q_ASSERT(c);
|
||||
c = connect(sGui->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioDeviceVolumeSetupComponent::onCurrentAudioDevicesChanged, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
|
||||
if (sGui->getIContextAudio()->isUsingImplementingObject())
|
||||
{
|
||||
CAfvClient &afvClient = sGui->getCoreFacade()->getCContextAudio()->voiceClient();
|
||||
connect(&afvClient, &CAfvClient::outputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onOutputVU);
|
||||
connect(&afvClient, &CAfvClient::inputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onInputVU);
|
||||
}
|
||||
|
||||
}
|
||||
Q_UNUSED(c);
|
||||
Q_UNUSED(c)
|
||||
}
|
||||
|
||||
CAudioDeviceVolumeSetupComponent::~CAudioDeviceVolumeSetupComponent()
|
||||
@@ -177,7 +189,7 @@ namespace BlackGui
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged(int v)
|
||||
{
|
||||
Q_UNUSED(v);
|
||||
Q_UNUSED(v)
|
||||
m_volumeSliderChanged.inputSignal();
|
||||
}
|
||||
|
||||
@@ -192,6 +204,16 @@ namespace BlackGui
|
||||
m_audioSettings.setAndSave(as);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onOutputVU(double vu)
|
||||
{
|
||||
this->setOutLevel(qRound(vu * 100.0), 0, 100);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onInputVU(double vu)
|
||||
{
|
||||
this->setInLevel(qRound(vu * 100.0), 0, 100);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onAudioDeviceSelected(int index)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
|
||||
@@ -50,8 +50,8 @@ namespace BlackGui
|
||||
//! @}
|
||||
|
||||
//! Set input and output level values @{
|
||||
void setInLevel(int value, int from = BlackMisc::Audio::CSettings::InMin, int to = BlackMisc::Audio::CSettings::InMax);
|
||||
void setOutLevel(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax);
|
||||
void setInLevel(int value, int from, int to);
|
||||
void setOutLevel(int value, int from, int to);
|
||||
//! @}
|
||||
|
||||
//! Info string
|
||||
@@ -92,6 +92,9 @@ namespace BlackGui
|
||||
//! Save the audio volumes
|
||||
void saveVolumes();
|
||||
|
||||
void onOutputVU(double vu);
|
||||
void onInputVU(double vu);
|
||||
|
||||
QScopedPointer<Ui::CAudioDeviceVolumeSetupComponent> ui;
|
||||
BlackMisc::CDigestSignal m_volumeSliderChanged { this, &CAudioDeviceVolumeSetupComponent::saveVolumes, 1000, 10 };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CAudioDeviceVolumeSetupComponent::reloadSettings };
|
||||
|
||||
Reference in New Issue
Block a user