mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 20:25:34 +08:00
Issue #100 Seperate COM1/2 output volumes
This commit is contained in:
committed by
Mat Sutcliffe
parent
577431ae49
commit
c1b75f7532
@@ -47,12 +47,14 @@ namespace BlackGui
|
||||
ui(new Ui::CAudioDeviceVolumeSetupComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->hs_VolumeIn, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->hs_VolumeOut, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->tb_RefreshInDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_RefreshOutDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetInVolume, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeIn, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetOutVolume, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeOut, Qt::QueuedConnection);
|
||||
connect(ui->hs_VolumeIn, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->hs_VolumeOutCom1, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->hs_VolumeOutCom2, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||
connect(ui->tb_RefreshInDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_RefreshOutDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetInVolume, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeIn, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetOutVolumeCom1, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom1, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetOutVolumeCom2, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom2, Qt::QueuedConnection);
|
||||
|
||||
connect(ui->cb_1Tx, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onRxTxChanged, Qt::QueuedConnection);
|
||||
connect(ui->cb_2Tx, &QCheckBox::toggled, this, &CAudioDeviceVolumeSetupComponent::onRxTxChanged, Qt::QueuedConnection);
|
||||
@@ -62,14 +64,18 @@ namespace BlackGui
|
||||
|
||||
ui->hs_VolumeIn->setMaximum(CSettings::InMax);
|
||||
ui->hs_VolumeIn->setMinimum(CSettings::InMin);
|
||||
ui->hs_VolumeOut->setMaximum(CSettings::OutMax);
|
||||
ui->hs_VolumeOut->setMinimum(CSettings::OutMin);
|
||||
ui->hs_VolumeOutCom1->setMaximum(CSettings::OutMax);
|
||||
ui->hs_VolumeOutCom1->setMinimum(CSettings::OutMin);
|
||||
ui->hs_VolumeOutCom2->setMaximum(CSettings::OutMax);
|
||||
ui->hs_VolumeOutCom2->setMinimum(CSettings::OutMin);
|
||||
|
||||
const CSettings as(m_audioSettings.getThreadLocal());
|
||||
const int i = this->getInValue();
|
||||
const int o = this->getOutValue();
|
||||
const int o1 = this->getOutValueCom1();
|
||||
const int o2 = this->getOutValueCom2();
|
||||
ui->hs_VolumeIn->setValue(i);
|
||||
ui->hs_VolumeOut->setValue(o);
|
||||
ui->hs_VolumeOutCom1->setValue(o1);
|
||||
ui->hs_VolumeOutCom2->setValue(o2);
|
||||
ui->cb_SetupAudioLoopback->setChecked(false);
|
||||
ui->cb_DisableAudioEffects->setChecked(!as.isAudioEffectsEnabled());
|
||||
|
||||
@@ -183,11 +189,18 @@ namespace BlackGui
|
||||
return qRound(ui->hs_VolumeIn->value() / r * tr);
|
||||
}
|
||||
|
||||
int CAudioDeviceVolumeSetupComponent::getOutValue(int from, int to) const
|
||||
int CAudioDeviceVolumeSetupComponent::getOutValueCom1(int from, int to) const
|
||||
{
|
||||
const double r = ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum();
|
||||
const double r = ui->hs_VolumeOutCom1->maximum() - ui->hs_VolumeOutCom1->minimum();
|
||||
const double tr = to - from;
|
||||
return qRound(ui->hs_VolumeOut->value() / r * tr);
|
||||
return qRound(ui->hs_VolumeOutCom1->value() / r * tr);
|
||||
}
|
||||
|
||||
int CAudioDeviceVolumeSetupComponent::getOutValueCom2(int from, int to) const
|
||||
{
|
||||
const double r = ui->hs_VolumeOutCom2->maximum() - ui->hs_VolumeOutCom2->minimum();
|
||||
const double tr = to - from;
|
||||
return qRound(ui->hs_VolumeOutCom2->value() / r * tr);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setInValue(int value, int from, int to)
|
||||
@@ -199,13 +212,22 @@ namespace BlackGui
|
||||
ui->hs_VolumeIn->setValue(qRound(value / tr * r));
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setOutValue(int value, int from, int to)
|
||||
void CAudioDeviceVolumeSetupComponent::setOutValueCom1(int value, int from, int to)
|
||||
{
|
||||
if (value > to) { value = to; }
|
||||
else if (value < from) { value = from; }
|
||||
const double r = ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum();
|
||||
const double r = ui->hs_VolumeOutCom1->maximum() - ui->hs_VolumeOutCom1->minimum();
|
||||
const double tr = to - from;
|
||||
ui->hs_VolumeOut->setValue(qRound(value / tr * r));
|
||||
ui->hs_VolumeOutCom1->setValue(qRound(value / tr * r));
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setOutValueCom2(int value, int from, int to)
|
||||
{
|
||||
if (value > to) { value = to; }
|
||||
else if (value < from) { value = from; }
|
||||
const double r = ui->hs_VolumeOutCom2->maximum() - ui->hs_VolumeOutCom2->minimum();
|
||||
const double tr = to - from;
|
||||
ui->hs_VolumeOutCom2->setValue(qRound(value / tr * r));
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setInLevel(double value)
|
||||
@@ -258,6 +280,12 @@ namespace BlackGui
|
||||
|
||||
const bool integrated = this->isComIntegrated();
|
||||
this->setTransmitReceiveInUi(com1Tx, com1Rx, com2Tx, com2Rx, integrated);
|
||||
|
||||
// Set transmit volume in GUI
|
||||
const int vol1 = sGui->getCContextAudioBase()->getVoiceOutputVolume(CComSystem::Com1);
|
||||
const int vol2 = sGui->getCContextAudioBase()->getVoiceOutputVolume(CComSystem::Com2);
|
||||
ui->hs_VolumeOutCom1->setValue(vol1);
|
||||
ui->hs_VolumeOutCom2->setValue(vol2);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setCheckBoxesReadOnly(bool readonly)
|
||||
@@ -280,7 +308,8 @@ namespace BlackGui
|
||||
const CSettings as(m_audioSettings.getThreadLocal());
|
||||
ui->cb_DisableAudioEffects->setChecked(!as.isAudioEffectsEnabled());
|
||||
this->setInValue(as.getInVolume());
|
||||
this->setOutValue(as.getOutVolume());
|
||||
this->setOutValueCom1(as.getOutVolumeCom1());
|
||||
this->setOutValueCom2(as.getOutVolumeCom2());
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::initAudioDeviceLists()
|
||||
@@ -312,10 +341,12 @@ namespace BlackGui
|
||||
{
|
||||
CSettings as(m_audioSettings.getThreadLocal());
|
||||
const int i = this->getInValue();
|
||||
const int o = this->getOutValue();
|
||||
if (as.getInVolume() == i && as.getOutVolume() == o) { return; }
|
||||
const int o1 = this->getOutValueCom1();
|
||||
const int o2 = this->getOutValueCom2();
|
||||
if (as.getInVolume() == i && as.getOutVolumeCom1() == o1 && as.getOutVolumeCom2() == o2) { return; }
|
||||
as.setInVolume(i);
|
||||
as.setOutVolume(o);
|
||||
as.setOutVolumeCom1(o1);
|
||||
as.setOutVolumeCom2(o2);
|
||||
m_audioSettings.setAndSave(as);
|
||||
}
|
||||
|
||||
@@ -343,9 +374,14 @@ namespace BlackGui
|
||||
ui->hs_VolumeIn->setValue((ui->hs_VolumeIn->maximum() - ui->hs_VolumeIn->minimum()) / 2);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onResetVolumeOut()
|
||||
void CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom1()
|
||||
{
|
||||
ui->hs_VolumeOut->setValue((ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum()) / 2);
|
||||
ui->hs_VolumeOutCom1->setValue((ui->hs_VolumeOutCom1->maximum() - ui->hs_VolumeOutCom1->minimum()) / 2);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom2()
|
||||
{
|
||||
ui->hs_VolumeOutCom2->setValue((ui->hs_VolumeOutCom2->maximum() - ui->hs_VolumeOutCom2->minimum()) / 2);
|
||||
}
|
||||
|
||||
void CAudioDeviceVolumeSetupComponent::setAudioRunsWhere()
|
||||
|
||||
@@ -45,13 +45,15 @@ namespace BlackGui
|
||||
//! Get input and output volume values
|
||||
//! @{
|
||||
int getInValue(int from = BlackMisc::Audio::CSettings::InMin, int to = BlackMisc::Audio::CSettings::InMax) const;
|
||||
int getOutValue(int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax) const;
|
||||
int getOutValueCom1(int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax) const;
|
||||
int getOutValueCom2(int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax) const;
|
||||
//! @}
|
||||
|
||||
//! Set input and output volume values
|
||||
//! @{
|
||||
void setInValue(int value, int from = BlackMisc::Audio::CSettings::InMin, int to = BlackMisc::Audio::CSettings::InMax);
|
||||
void setOutValue(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax);
|
||||
void setOutValueCom1(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax);
|
||||
void setOutValueCom2(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax);
|
||||
//! @}
|
||||
|
||||
//! Set input and output level values 0..1
|
||||
@@ -112,7 +114,8 @@ namespace BlackGui
|
||||
|
||||
void onReloadDevices();
|
||||
void onResetVolumeIn();
|
||||
void onResetVolumeOut();
|
||||
void onResetVolumeOutCom1();
|
||||
void onResetVolumeOutCom2();
|
||||
|
||||
void setAudioRunsWhere();
|
||||
|
||||
|
||||
@@ -26,11 +26,15 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="9" column="0">
|
||||
<item row="8" column="3">
|
||||
<widget class="QToolButton" name="tb_ResetInVolume">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/pastel/icons/pastel/16/undo.png</normaloff>:/pastel/icons/pastel/16/undo.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
@@ -120,17 +124,39 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QToolButton" name="tb_ResetOutVolume">
|
||||
<item row="11" column="3">
|
||||
<widget class="QToolButton" name="tb_ResetOutVolumeCom1">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/pastel/icons/pastel/16/undo.png</normaloff>:/pastel/icons/pastel/16/undo.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="3">
|
||||
<widget class="QToolButton" name="tb_ResetOutVolumeCom2">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/pastel/icons/pastel/16/undo.png</normaloff>:/pastel/icons/pastel/16/undo.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="lbl_VolumeOut">
|
||||
<widget class="QLabel" name="lbl_VolumeOutCom1">
|
||||
<property name="text">
|
||||
<string>Out</string>
|
||||
<string>Out COM1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="lbl_VolumeOutCom2">
|
||||
<property name="text">
|
||||
<string>Out COM2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -277,7 +303,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QSlider" name="hs_VolumeOut">
|
||||
<widget class="QSlider" name="hs_VolumeOutCom1">
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
@@ -287,6 +313,23 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QSlider" name="hs_VolumeOutCom2">
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="lbl_OutLevelMeter">
|
||||
<property name="text">
|
||||
<string>Output</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="BlackGui::CLevelMeter" name="wip_OutLevelMeter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
@@ -296,6 +339,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="lbl_InLevelMeter">
|
||||
<property name="text">
|
||||
<string>Input</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="BlackGui::CLevelMeter" name="wip_InLevelMeter">
|
||||
<property name="sizePolicy">
|
||||
@@ -344,8 +394,10 @@
|
||||
<tabstop>cb_SetupAudioLoopback</tabstop>
|
||||
<tabstop>hs_VolumeIn</tabstop>
|
||||
<tabstop>tb_ResetInVolume</tabstop>
|
||||
<tabstop>hs_VolumeOut</tabstop>
|
||||
<tabstop>tb_ResetOutVolume</tabstop>
|
||||
<tabstop>hs_VolumeOutCom1</tabstop>
|
||||
<tabstop>tb_ResetOutVolumeCom1</tabstop>
|
||||
<tabstop>hs_VolumeOutCom2</tabstop>
|
||||
<tabstop>tb_ResetOutVolumeCom2</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
|
||||
@@ -1,155 +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 "audiovolumecomponent.h"
|
||||
#include "blackcore/context/contextaudio.h"
|
||||
#include "blackgui/components/audiovolumecomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/audio/audioutils.h"
|
||||
#include "ui_audiovolumecomponent.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Context;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CAudioVolumeComponent::CAudioVolumeComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CAudioVolumeComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
const int volume = sGui && sGui->getIContextAudio() ?
|
||||
sGui->getCContextAudioBase()->getVoiceOutputVolume() :
|
||||
100;
|
||||
ui->hs_Volume->setValue(volumeToSliderValue(volume));
|
||||
ui->sb_Volume->setValue(volume);
|
||||
|
||||
bool c = connect(ui->pb_ShowWinMixer, &QPushButton::pressed, this, &CAudioVolumeComponent::onWindowsMixerRequested);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
c = connect(ui->hs_Volume, &QSlider::valueChanged, this, &CAudioVolumeComponent::changeOutputVolumeFromSlider);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
c = connect(ui->sb_Volume, qOverload<int>(&QSpinBox::valueChanged), this, &CAudioVolumeComponent::changeOutputVolumeFromSpinBox);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
c = connect(ui->pb_Volume100, &QPushButton::clicked, this, &CAudioVolumeComponent::setVolume100);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
|
||||
c = connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedMute, this, &CAudioVolumeComponent::onMuteChanged);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
connect(sGui->getCContextAudioBase(), &CContextAudioBase::changedAudioVolume, this, &CAudioVolumeComponent::onOutputVolumeChanged);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
|
||||
// to audio audio context
|
||||
c = connect(ui->pb_Mute, &QPushButton::toggled, sGui->getCContextAudioBase(), &CContextAudioBase::setMute);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c)
|
||||
|
||||
if (sGui->getIContextAudio()->isUsingImplementingObject())
|
||||
{
|
||||
ui->lbl_ContextLocation->setText("local");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lbl_ContextLocation->setText("remote");
|
||||
}
|
||||
|
||||
// init volume
|
||||
this->changeOutputVolumeFromSpinBox(volume); // init volume
|
||||
}
|
||||
|
||||
CAudioVolumeComponent::~CAudioVolumeComponent()
|
||||
{ }
|
||||
|
||||
void CAudioVolumeComponent::onMuteChanged(bool muted)
|
||||
{
|
||||
if (muted == ui->pb_Mute->isChecked()) { return; } // avoid roundtrips
|
||||
ui->pb_Mute->setChecked(muted);
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::onOutputVolumeChanged(int volume)
|
||||
{
|
||||
ui->hs_Volume->setToolTip(QString::number(volume));
|
||||
|
||||
// comparisons to avoid rountrips
|
||||
const QString v = QString::number(volume);
|
||||
if (volume != ui->sb_Volume->value())
|
||||
{
|
||||
ui->sb_Volume->setValue(volume);
|
||||
ui->sb_Volume->setToolTip(v);
|
||||
}
|
||||
|
||||
if (volume != ui->hs_Volume->value())
|
||||
{
|
||||
ui->hs_Volume->setValue(volumeToSliderValue(volume));
|
||||
ui->hs_Volume->setToolTip(v);
|
||||
}
|
||||
}
|
||||
|
||||
int CAudioVolumeComponent::volumeToSliderValue(int volume)
|
||||
{
|
||||
if (volume <= 100) { return volume; }
|
||||
const int vol = volume - 100;
|
||||
return 100 + vol / 5;
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::setVolume100()
|
||||
{
|
||||
this->onOutputVolumeChanged(100);
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::changeOutputVolumeFromSlider(int volume)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
if (volume > 100)
|
||||
{
|
||||
// 100 -> 100, 120 -> 200, 140 -> 300
|
||||
const int v = volume - 100;
|
||||
volume = 100 + v * 5;
|
||||
}
|
||||
ui->hs_Volume->setToolTip(QString::number(volume));
|
||||
|
||||
if (sGui->getCContextAudioBase()->getVoiceOutputVolume() != volume)
|
||||
{
|
||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::changeOutputVolumeFromSpinBox(int volume)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
ui->sb_Volume->setToolTip(QString::number(volume));
|
||||
Q_ASSERT(sGui->getIContextAudio());
|
||||
if (sGui->getCContextAudioBase()->getVoiceOutputVolume() != volume)
|
||||
{
|
||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::onWindowsMixerRequested()
|
||||
{
|
||||
startWindowsMixer();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,64 +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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_AUDIOVOLUME_H
|
||||
#define BLACKGUI_AUDIOVOLUME_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CAudioVolumeComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
//! Audio volume, mixer
|
||||
class BLACKGUI_EXPORT CAudioVolumeComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAudioVolumeComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAudioVolumeComponent() override;
|
||||
|
||||
private:
|
||||
//! Mute toggleBlackGui::Components::CHotkeyDialog
|
||||
void onMuteChanged(bool muted);
|
||||
|
||||
//! Volumes changed (elsewhere)
|
||||
void onOutputVolumeChanged(int volume);
|
||||
|
||||
//! Set volume to 100
|
||||
void setVolume100();
|
||||
|
||||
//! Change values because of volume GUI controls
|
||||
void changeOutputVolumeFromSlider(int volume);
|
||||
|
||||
//! Change values because of volume GUI controls
|
||||
void changeOutputVolumeFromSpinBox(int volume);
|
||||
|
||||
//! Requested windows mixer
|
||||
void onWindowsMixerRequested();
|
||||
|
||||
//! slider value
|
||||
static int volumeToSliderValue(int volume);
|
||||
|
||||
QScopedPointer<Ui::CAudioVolumeComponent> ui;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
@@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAudioVolumeComponent</class>
|
||||
<widget class="QFrame" name="CAudioVolumeComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>193</width>
|
||||
<height>50</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_AudioVolumeComponent">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="1" column="1" colspan="6">
|
||||
<widget class="QSlider" name="hs_Volume">
|
||||
<property name="maximum">
|
||||
<number>140</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="sliderPosition">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksAbove</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QLabel" name="lbl_ContextLocation">
|
||||
<property name="text">
|
||||
<string>local</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_AudioSound">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QSpinBox" name="sb_Volume">
|
||||
<property name="maximum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>90</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Volume">
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QWidget" name="wi_AudioSoundButtons" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_AudioSoundButtons">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pb_ShowWinMixer">
|
||||
<property name="toolTip">
|
||||
<string>Windows sound mixer</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/diagona/icons/diagona/icons/speaker--pencil.png</normaloff>:/diagona/icons/diagona/icons/speaker--pencil.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pb_Mute">
|
||||
<property name="toolTip">
|
||||
<string>Toggle mute</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/diagona/icons/diagona/icons/speaker-volume.png</normaloff>
|
||||
<normalon>:/diagona/icons/diagona/icons/speaker-volume-control-mute.png</normalon>:/diagona/icons/diagona/icons/speaker-volume.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pb_Volume100">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>100%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -144,7 +144,8 @@ namespace BlackGui
|
||||
}
|
||||
else if (senderButton == ui->pb_SoundMaxVolume && sGui->getIContextAudio())
|
||||
{
|
||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(100);
|
||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(CComSystem::Com1, 100);
|
||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(CComSystem::Com2, 100);
|
||||
}
|
||||
else if (senderButton == ui->pb_SoundMute && sGui->getIContextAudio())
|
||||
{
|
||||
|
||||
@@ -205,6 +205,8 @@ namespace BlackGui
|
||||
this->addOrUpdateLiveDataByName(QStringLiteral("COM2 active"), c2.getFrequencyActive().toQString(), iconRadio);
|
||||
this->addOrUpdateLiveDataByName(QStringLiteral("COM1 standby"), c1.getFrequencyStandby().toQString(), iconRadio);
|
||||
this->addOrUpdateLiveDataByName(QStringLiteral("COM2 standby"), c2.getFrequencyStandby().toQString(), iconRadio);
|
||||
this->addOrUpdateLiveDataByName(QStringLiteral("COM1 volume"), QString::number(c1.getVolumeReceive()) , iconRadio);
|
||||
this->addOrUpdateLiveDataByName(QStringLiteral("COM2 volume"), QString::number(c2.getVolumeReceive()), iconRadio);
|
||||
this->addOrUpdateLiveDataByName(QStringLiteral("Transponder"), ownAircraft.getTransponderCodeFormatted(), iconRadio);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user