mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
[AFV] Ref T730, changed to "startedAudio" signal, relayed from CAfvClient (and not like before emitted in context)
Since start can be async (in another thread) it was possible the "old" signal was emitted too early
This commit is contained in:
@@ -46,11 +46,12 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
||||||
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
||||||
|
|
||||||
connect(m_voiceClient, &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
|
connect(m_voiceClient, &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU, Qt::QueuedConnection);
|
||||||
connect(m_voiceClient, &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
|
connect(m_voiceClient, &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU, Qt::QueuedConnection);
|
||||||
connect(m_voiceClient, &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
|
connect(m_voiceClient, &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged, Qt::QueuedConnection);
|
||||||
connect(m_voiceClient, &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
|
connect(m_voiceClient, &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit, Qt::QueuedConnection);
|
||||||
connect(m_voiceClient, &CAfvClient::ptt, this, &IContextAudio::ptt);
|
connect(m_voiceClient, &CAfvClient::startedAudio, this, &IContextAudio::startedAudio, Qt::QueuedConnection);
|
||||||
|
connect(m_voiceClient, &CAfvClient::ptt, this, &IContextAudio::ptt, Qt::QueuedConnection);
|
||||||
|
|
||||||
const CSettings as = m_audioSettings.getThreadLocal();
|
const CSettings as = m_audioSettings.getThreadLocal();
|
||||||
this->setVoiceOutputVolume(as.getOutVolume());
|
this->setVoiceOutputVolume(as.getOutVolume());
|
||||||
@@ -190,8 +191,7 @@ namespace BlackCore
|
|||||||
if (!inputDevice.getName().isEmpty()) { m_inputDeviceSetting.setAndSave(inputDevice.getName()); }
|
if (!inputDevice.getName().isEmpty()) { m_inputDeviceSetting.setAndSave(inputDevice.getName()); }
|
||||||
if (!outputDevice.getName().isEmpty()) { m_outputDeviceSetting.setAndSave(outputDevice.getName()); }
|
if (!outputDevice.getName().isEmpty()) { m_outputDeviceSetting.setAndSave(outputDevice.getName()); }
|
||||||
|
|
||||||
m_voiceClient->restartWithNewDevices(inputDevice, outputDevice);
|
m_voiceClient->startAudio(inputDevice, outputDevice);
|
||||||
emit this->changedSelectedAudioDevices(this->getCurrentAudioDevices());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IContextAudio::setVoiceOutputVolume(int volume)
|
void IContextAudio::setVoiceOutputVolume(int volume)
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ namespace BlackCore
|
|||||||
//! Changed audio devices (e.g. device enabled/disable)
|
//! Changed audio devices (e.g. device enabled/disable)
|
||||||
void changedAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
void changedAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||||
|
|
||||||
//! Changed slection of audio devices
|
//! Audio started with
|
||||||
void changedSelectedAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
void startedAudio(const BlackMisc::Audio::CAudioDeviceInfo &input, const BlackMisc::Audio::CAudioDeviceInfo &output);
|
||||||
|
|
||||||
//! VU levels @{
|
//! VU levels @{
|
||||||
void inputVolumePeakVU(double value);
|
void inputVolumePeakVU(double value);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace BlackGui
|
|||||||
// context
|
// context
|
||||||
c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioDeviceVolumeSetupComponent::onAudioDevicesChanged, Qt::QueuedConnection);
|
c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioDeviceVolumeSetupComponent::onAudioDevicesChanged, Qt::QueuedConnection);
|
||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
c = connect(sGui->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioDeviceVolumeSetupComponent::onCurrentAudioDevicesChanged, Qt::QueuedConnection);
|
c = connect(sGui->getIContextAudio(), &IContextAudio::startedAudio, this, &CAudioDeviceVolumeSetupComponent::onAudioStarted, Qt::QueuedConnection);
|
||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
|
|
||||||
c = connect(sGui->getIContextAudio(), &IContextAudio::outputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onOutputVU, Qt::QueuedConnection);
|
c = connect(sGui->getIContextAudio(), &IContextAudio::outputVolumePeakVU, this, &CAudioDeviceVolumeSetupComponent::onOutputVU, Qt::QueuedConnection);
|
||||||
@@ -193,6 +193,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient()
|
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient()
|
||||||
{
|
{
|
||||||
|
if (!this->hasAudio()) { return; }
|
||||||
const bool com1Enabled = sGui->getIContextAudio()->isEnabledComUnit(CComSystem::Com1);
|
const bool com1Enabled = sGui->getIContextAudio()->isEnabledComUnit(CComSystem::Com1);
|
||||||
const bool com2Enabled = sGui->getIContextAudio()->isEnabledComUnit(CComSystem::Com2);
|
const bool com2Enabled = sGui->getIContextAudio()->isEnabledComUnit(CComSystem::Com2);
|
||||||
|
|
||||||
@@ -218,7 +219,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!this->hasAudio()) { return; }
|
if (!this->hasAudio()) { return; }
|
||||||
this->onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices());
|
this->onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices());
|
||||||
this->onCurrentAudioDevicesChanged(sGui->getIContextAudio()->getCurrentAudioDevices());
|
const CAudioDeviceInfoList currentDevices = sGui->getIContextAudio()->getCurrentAudioDevices();
|
||||||
|
this->onAudioStarted(currentDevices.getInputDevices().frontOrDefault(), currentDevices.getOutputDevices().frontOrDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioDeviceVolumeSetupComponent::hasAudio() const
|
bool CAudioDeviceVolumeSetupComponent::hasAudio() const
|
||||||
@@ -306,19 +308,10 @@ namespace BlackGui
|
|||||||
sGui->getIContextAudio()->setCurrentAudioDevices(in, out);
|
sGui->getIContextAudio()->setCurrentAudioDevices(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
void CAudioDeviceVolumeSetupComponent::onAudioStarted(const CAudioDeviceInfo &input, const CAudioDeviceInfo &output)
|
||||||
{
|
{
|
||||||
for (auto &device : devices)
|
ui->cb_SetupAudioInputDevice->setCurrentText(input.toQString(true));
|
||||||
{
|
ui->cb_SetupAudioOutputDevice->setCurrentText(output.toQString(true));
|
||||||
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
|
||||||
{
|
|
||||||
ui->cb_SetupAudioInputDevice->setCurrentText(device.toQString(true));
|
|
||||||
}
|
|
||||||
else if (device.getType() == CAudioDeviceInfo::OutputDevice)
|
|
||||||
{
|
|
||||||
ui->cb_SetupAudioOutputDevice->setCurrentText(device.toQString(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::onAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
void CAudioDeviceVolumeSetupComponent::onAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace BlackGui
|
|||||||
void onAudioDeviceSelected(int index);
|
void onAudioDeviceSelected(int index);
|
||||||
|
|
||||||
//! Current audio devices changed
|
//! Current audio devices changed
|
||||||
void onCurrentAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
void onAudioStarted(const BlackMisc::Audio::CAudioDeviceInfo &input, const BlackMisc::Audio::CAudioDeviceInfo &output);
|
||||||
|
|
||||||
//! Audio devices changed
|
//! Audio devices changed
|
||||||
void onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
void onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||||
|
|||||||
Reference in New Issue
Block a user