mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Ref T731, adjusted audio settings for AFV and added functions in UI component
This commit is contained in:
committed by
Mat Sutcliffe
parent
d944d0f6ee
commit
4a578110b0
@@ -65,7 +65,7 @@ namespace BlackCore
|
|||||||
initOutputDevice();
|
initOutputDevice();
|
||||||
initAudioMixer();
|
initAudioMixer();
|
||||||
|
|
||||||
this->setVoiceOutputVolume(m_audioSettings.getThreadLocal().getAudioVolume());
|
this->setVoiceOutputVolume(m_audioSettings.getThreadLocal().getOutVolume());
|
||||||
m_selcalPlayer = new CSelcalPlayer(QAudioDeviceInfo::defaultOutputDevice(), this);
|
m_selcalPlayer = new CSelcalPlayer(QAudioDeviceInfo::defaultOutputDevice(), this);
|
||||||
|
|
||||||
this->changeDeviceSettings();
|
this->changeDeviceSettings();
|
||||||
@@ -289,7 +289,7 @@ namespace BlackCore
|
|||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << volume; }
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << volume; }
|
||||||
|
|
||||||
const bool wasMuted = isMuted();
|
const bool wasMuted = isMuted();
|
||||||
volume = qMin(CSettings::MaxAudioVolume, volume);
|
// volume = qMin(CSettings::MaxAudioVolume, volume);
|
||||||
|
|
||||||
bool changedVoiceOutput = m_voiceOutputDevice->getOutputVolume() != volume;
|
bool changedVoiceOutput = m_voiceOutputDevice->getOutputVolume() != volume;
|
||||||
if (changedVoiceOutput)
|
if (changedVoiceOutput)
|
||||||
@@ -306,9 +306,9 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSettings as(m_audioSettings.getThreadLocal());
|
CSettings as(m_audioSettings.getThreadLocal());
|
||||||
if (as.getAudioVolume() != volume)
|
if (as.getOutVolume() != volume)
|
||||||
{
|
{
|
||||||
as.setAudioVolume(volume);
|
as.setOutVolume(volume);
|
||||||
m_audioSettings.set(as);
|
m_audioSettings.set(as);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -580,11 +580,7 @@ namespace BlackCore
|
|||||||
else if (parser.commandStartsWith("vol") && parser.countParts() > 1)
|
else if (parser.commandStartsWith("vol") && parser.countParts() > 1)
|
||||||
{
|
{
|
||||||
int v = parser.toInt(1);
|
int v = parser.toInt(1);
|
||||||
if (v >= 0 && v <= CSettings::MaxAudioVolume)
|
this->setVoiceOutputVolume(v);
|
||||||
{
|
|
||||||
this->setVoiceOutputVolume(v);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -719,7 +715,7 @@ namespace BlackCore
|
|||||||
const CSettings s = m_audioSettings.get();
|
const CSettings s = m_audioSettings.get();
|
||||||
const QString dir = s.getNotificationSoundDirectory();
|
const QString dir = s.getNotificationSoundDirectory();
|
||||||
m_notificationPlayer.updateDirectory(dir);
|
m_notificationPlayer.updateDirectory(dir);
|
||||||
this->setVoiceOutputVolume(s.getAudioVolume());
|
this->setVoiceOutputVolume(s.getOutVolume());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudio::audioIncreaseVolume(bool enabled)
|
void CContextAudio::audioIncreaseVolume(bool enabled)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace BlackGui
|
|||||||
ui(new Ui::CAudioDeviceVolumeSetupComponent)
|
ui(new Ui::CAudioDeviceVolumeSetupComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
connect(ui->hs_VolumeIn, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||||
|
connect(ui->hs_VolumeOut, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||||
|
|
||||||
// deferred init, because in a distributed swift system
|
// deferred init, because in a distributed swift system
|
||||||
// it takes a moment until the settings are sychronized
|
// it takes a moment until the settings are sychronized
|
||||||
@@ -64,7 +66,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
if (audio)
|
if (audio)
|
||||||
{
|
{
|
||||||
ui->le_ExtraInfo->setText(audio ? sGui->getIContextAudio()->audioRunsWhereInfo() : "No audio, cannot change.");
|
ui->le_Info->setText(audio ? sGui->getIContextAudio()->audioRunsWhereInfo() : "No audio, cannot change.");
|
||||||
|
|
||||||
this->initAudioDeviceLists();
|
this->initAudioDeviceLists();
|
||||||
|
|
||||||
@@ -89,9 +91,76 @@ namespace BlackGui
|
|||||||
CAudioDeviceVolumeSetupComponent::~CAudioDeviceVolumeSetupComponent()
|
CAudioDeviceVolumeSetupComponent::~CAudioDeviceVolumeSetupComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
int CAudioDeviceVolumeSetupComponent::getInValue(int from, int to) const
|
||||||
|
{
|
||||||
|
const double r = ui->hs_VolumeIn->maximum() - ui->hs_VolumeIn->minimum();
|
||||||
|
const double tr = to - from;
|
||||||
|
return qRound(ui->hs_VolumeIn->value() / r * tr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAudioDeviceVolumeSetupComponent::getOutValue(int from, int to) const
|
||||||
|
{
|
||||||
|
const double r = ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum();
|
||||||
|
const double tr = to - from;
|
||||||
|
return qRound(ui->hs_VolumeOut->value() / r * tr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setInValue(int value, int from, int to)
|
||||||
|
{
|
||||||
|
if (value > to) { value = to; }
|
||||||
|
if (value < from) { value = from; }
|
||||||
|
const double r = ui->hs_VolumeIn->maximum() - ui->hs_VolumeIn->minimum();
|
||||||
|
const double tr = to - from;
|
||||||
|
ui->hs_VolumeIn->setValue(qRound(value / tr * r));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setOutValue(int value, int from, int to)
|
||||||
|
{
|
||||||
|
if (value > to) { value = to; }
|
||||||
|
if (value < from) { value = from; }
|
||||||
|
const double r = ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum();
|
||||||
|
const double tr = to - from;
|
||||||
|
ui->hs_VolumeOut->setValue(qRound(value / tr * r));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setInLevel(int value, int from, int to)
|
||||||
|
{
|
||||||
|
if (value > to) { value = to; }
|
||||||
|
if (value < from) { value = from; }
|
||||||
|
const double r = ui->pb_LevelIn->maximum() - ui->pb_LevelIn->minimum();
|
||||||
|
const double tr = to - from;
|
||||||
|
ui->pb_LevelIn->setValue(qRound(value / tr * r));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setOutLevel(int value, int from, int to)
|
||||||
|
{
|
||||||
|
if (value > to) { value = to; }
|
||||||
|
if (value < from) { value = from; }
|
||||||
|
const double r = ui->pb_LevelOut->maximum() - ui->pb_LevelOut->minimum();
|
||||||
|
const double tr = to - from;
|
||||||
|
ui->pb_LevelOut->setValue(qRound(value / tr * r));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setInfo(const QString &info)
|
||||||
|
{
|
||||||
|
ui->le_Info->setText(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setTransmitReceive(bool tx1, bool rec1, bool tx2, bool rec2)
|
||||||
|
{
|
||||||
|
ui->cb_1Tx->setChecked(tx1);
|
||||||
|
ui->cb_2Tx->setChecked(tx2);
|
||||||
|
ui->cb_1Rec->setChecked(rec1);
|
||||||
|
ui->cb_2Rec->setChecked(rec2);
|
||||||
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::reloadSettings()
|
void CAudioDeviceVolumeSetupComponent::reloadSettings()
|
||||||
{
|
{
|
||||||
const CSettings as(m_audioSettings.getThreadLocal());
|
const CSettings as(m_audioSettings.getThreadLocal());
|
||||||
|
ui->cb_DisableAudioEffects->setChecked(as.isAudioEffectsEnabled());
|
||||||
|
|
||||||
|
this->setInValue(as.getInVolume());
|
||||||
|
this->setOutValue(as.getInVolume());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::initAudioDeviceLists()
|
void CAudioDeviceVolumeSetupComponent::initAudioDeviceLists()
|
||||||
@@ -106,6 +175,23 @@ namespace BlackGui
|
|||||||
return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject();
|
return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged(int v)
|
||||||
|
{
|
||||||
|
Q_UNUSED(v);
|
||||||
|
m_volumeSliderChanged.inputSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::saveVolumes()
|
||||||
|
{
|
||||||
|
CSettings as(m_audioSettings.getThreadLocal());
|
||||||
|
const int i = this->getInValue();
|
||||||
|
const int o = this->getOutValue();
|
||||||
|
if (as.getInVolume() == i && as.getOutVolume() == o) { return; }
|
||||||
|
as.setInVolume(i);
|
||||||
|
as.setOutVolume(o);
|
||||||
|
m_audioSettings.setAndSave(as);
|
||||||
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::onAudioDeviceSelected(int index)
|
void CAudioDeviceVolumeSetupComponent::onAudioDeviceSelected(int index)
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "blackmisc/audio/audiosettings.h"
|
#include "blackmisc/audio/audiosettings.h"
|
||||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||||
#include "blackmisc/settingscache.h"
|
#include "blackmisc/settingscache.h"
|
||||||
|
#include "blackmisc/digestsignal.h"
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@@ -38,6 +39,27 @@ namespace BlackGui
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CAudioDeviceVolumeSetupComponent() override;
|
virtual ~CAudioDeviceVolumeSetupComponent() override;
|
||||||
|
|
||||||
|
//! 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;
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! 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);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! 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);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! Info string
|
||||||
|
void setInfo(const QString &info);
|
||||||
|
|
||||||
|
//! Transmit and receive state
|
||||||
|
void setTransmitReceive(bool tx1, bool rec1, bool tx2, bool rec2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Init
|
//! Init
|
||||||
void init();
|
void init();
|
||||||
@@ -58,16 +80,20 @@ namespace BlackGui
|
|||||||
//! Loopback toggled
|
//! Loopback toggled
|
||||||
void onLoopbackToggled(bool loopback);
|
void onLoopbackToggled(bool loopback);
|
||||||
|
|
||||||
//! Notification flags toggled
|
|
||||||
void onNotificationsToggled(bool checked);
|
|
||||||
|
|
||||||
//! Audio device lists from settings
|
//! Audio device lists from settings
|
||||||
void initAudioDeviceLists();
|
void initAudioDeviceLists();
|
||||||
|
|
||||||
//! Audio is optional, check if available
|
//! Audio is optional, check if available
|
||||||
bool hasAudio() const;
|
bool hasAudio() const;
|
||||||
|
|
||||||
|
//! Volume slider has been changed
|
||||||
|
void onVolumeSliderChanged(int v);
|
||||||
|
|
||||||
|
//! Save the audio volumes
|
||||||
|
void saveVolumes();
|
||||||
|
|
||||||
QScopedPointer<Ui::CAudioDeviceVolumeSetupComponent> ui;
|
QScopedPointer<Ui::CAudioDeviceVolumeSetupComponent> ui;
|
||||||
|
BlackMisc::CDigestSignal m_volumeSliderChanged { this, &CAudioDeviceVolumeSetupComponent::saveVolumes, 1000, 10 };
|
||||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CAudioDeviceVolumeSetupComponent::reloadSettings };
|
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CAudioDeviceVolumeSetupComponent::reloadSettings };
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>194</width>
|
<width>307</width>
|
||||||
<height>216</height>
|
<height>254</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="le_ExtraInfo">
|
<widget class="QLineEdit" name="le_Info">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@@ -24,92 +24,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QProgressBar" name="pb_LevelOut">
|
|
||||||
<property name="value">
|
|
||||||
<number>24</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="cb_SetupAudioOutputDevice">
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_VolumeOut">
|
|
||||||
<property name="text">
|
|
||||||
<string>Out</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_SetupAudioInputDevice">
|
|
||||||
<property name="text">
|
|
||||||
<string>In</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_SetupAudioOutputDevice">
|
|
||||||
<property name="text">
|
|
||||||
<string>Out</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QSlider" name="hs_VolumeOut">
|
|
||||||
<property name="value">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
|
<widget class="QCheckBox" name="cb_DisableAudioEffects">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable realistic audio simulation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
<widget class="QCheckBox" name="cb_SetupAudioLoopback">
|
<widget class="QCheckBox" name="cb_SetupAudioLoopback">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Loopback, test sound in- to output</string>
|
<string>Loopback, test sound in- to output</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="QComboBox" name="cb_SetupAudioInputDevice">
|
<widget class="QProgressBar" name="pb_LevelOut">
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frame">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QProgressBar" name="pb_LevelIn">
|
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>24</number>
|
<number>24</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_VolumeIn">
|
|
||||||
<property name="text">
|
|
||||||
<string>In</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QSlider" name="hs_VolumeIn">
|
|
||||||
<property name="value">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="lbl_Info">
|
<widget class="QLabel" name="lbl_Info">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -117,27 +52,136 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="6" column="1">
|
||||||
|
<widget class="QSlider" name="hs_VolumeIn">
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_SetupAudioInputDevice">
|
||||||
|
<property name="text">
|
||||||
|
<string>In</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="cb_SetupAudioOutputDevice">
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_SetupAudioOutputDevice">
|
||||||
|
<property name="text">
|
||||||
|
<string>Out</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_VolumeIn">
|
||||||
|
<property name="text">
|
||||||
|
<string>In</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="cb_SetupAudioInputDevice">
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frame">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="lbl_SetupAudioLoopback">
|
<widget class="QLabel" name="lbl_SetupAudioLoopback">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Test</string>
|
<string>Test</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QCheckBox" name="checkBox">
|
<widget class="QProgressBar" name="pb_LevelIn">
|
||||||
<property name="text">
|
<property name="value">
|
||||||
<string>Disable realistic audio simulation</string>
|
<number>50</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_VolumeOut">
|
||||||
|
<property name="text">
|
||||||
|
<string>Out</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QSlider" name="hs_VolumeOut">
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QFrame" name="fr_TxRec">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_1Tx">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tx1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_1Rec">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rec1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_2Tx">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tx2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_2Rec">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rec2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>le_ExtraInfo</tabstop>
|
<tabstop>le_Info</tabstop>
|
||||||
|
<tabstop>cb_1Tx</tabstop>
|
||||||
|
<tabstop>cb_1Rec</tabstop>
|
||||||
|
<tabstop>cb_2Tx</tabstop>
|
||||||
|
<tabstop>cb_2Rec</tabstop>
|
||||||
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
||||||
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
||||||
<tabstop>checkBox</tabstop>
|
<tabstop>cb_DisableAudioEffects</tabstop>
|
||||||
<tabstop>cb_SetupAudioLoopback</tabstop>
|
<tabstop>cb_SetupAudioLoopback</tabstop>
|
||||||
<tabstop>hs_VolumeIn</tabstop>
|
<tabstop>hs_VolumeIn</tabstop>
|
||||||
<tabstop>hs_VolumeOut</tabstop>
|
<tabstop>hs_VolumeOut</tabstop>
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Audio
|
namespace Audio
|
||||||
{
|
{
|
||||||
constexpr int CSettings::MaxAudioVolume;
|
|
||||||
|
|
||||||
CSettings::CSettings()
|
CSettings::CSettings()
|
||||||
{
|
{
|
||||||
this->initDefaultValues();
|
this->initDefaultValues();
|
||||||
@@ -64,13 +62,6 @@ namespace BlackMisc
|
|||||||
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettings::setAudioVolume(int volume)
|
|
||||||
{
|
|
||||||
m_audioVolume = volume;
|
|
||||||
if (m_audioVolume < 0) { m_audioVolume = 0; }
|
|
||||||
else if (m_audioVolume > MaxAudioVolume) { m_audioVolume = MaxAudioVolume; }
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CSettings::convertToQString(bool i18n) const
|
QString CSettings::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
|
|||||||
@@ -30,6 +30,13 @@ namespace BlackMisc
|
|||||||
class BLACKMISC_EXPORT CSettings : public CValueObject<CSettings>
|
class BLACKMISC_EXPORT CSettings : public CValueObject<CSettings>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//! Ranges for audio @{
|
||||||
|
static constexpr int InMax = 100;
|
||||||
|
static constexpr int InMin = 0;
|
||||||
|
static constexpr int OutMax = 100;
|
||||||
|
static constexpr int OutMin = 0;
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CSettings();
|
CSettings();
|
||||||
|
|
||||||
@@ -69,11 +76,23 @@ namespace BlackMisc
|
|||||||
//! Get volume (notifications)
|
//! Get volume (notifications)
|
||||||
int getNotificationVolume() const { return m_notificationVolume; }
|
int getNotificationVolume() const { return m_notificationVolume; }
|
||||||
|
|
||||||
//! Set volume (audio)
|
//! Set volume (audio) 0..100
|
||||||
void setAudioVolume(int volume);
|
void setOutVolume(int volume);
|
||||||
|
|
||||||
//! Get volume (audio)
|
//! Get volume (audio) 0..100
|
||||||
int getAudioVolume() const { return m_audioVolume; }
|
int getOutVolume() const { return m_outVolume; }
|
||||||
|
|
||||||
|
//! Set mic.volume 0..100
|
||||||
|
void setInVolume(int volume);
|
||||||
|
|
||||||
|
//! Get mic.volume (audio 0..100)
|
||||||
|
int getInVolume() const { return m_inVolume; }
|
||||||
|
|
||||||
|
//! Audio effects enabled?
|
||||||
|
bool isAudioEffectsEnabled() const { return m_audioEffects; }
|
||||||
|
|
||||||
|
//! Audio effects
|
||||||
|
void setAudioEffectsEnabled(bool enabled) { m_audioEffects = enabled; }
|
||||||
|
|
||||||
//! Init with meaningful default values
|
//! Init with meaningful default values
|
||||||
void initDefaultValues();
|
void initDefaultValues();
|
||||||
@@ -81,21 +100,22 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
static constexpr int MaxAudioVolume = 300; //!< Max.audio volume 0..300
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_notificationSoundDir;
|
QString m_notificationSoundDir;
|
||||||
int m_notification = static_cast<int>(CNotificationSounds::DefaultNotifications); //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
|
int m_notification = static_cast<int>(CNotificationSounds::DefaultNotifications); //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
|
||||||
int m_notificationVolume = 90; //!< 0-100
|
int m_notificationVolume = 90; //!< 0-90
|
||||||
int m_audioVolume = 100; //!< 0-300
|
int m_outVolume = 100; //!< 0-300, AFV
|
||||||
void initNotificationFlags(); //!< init flags
|
int m_inVolume = 0; //!< AFV range
|
||||||
|
bool m_audioEffects = true; //!< Audio effects en
|
||||||
|
void initNotificationFlags(); //!< init flags
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CSettings,
|
CSettings,
|
||||||
BLACK_METAMEMBER(notificationSoundDir),
|
BLACK_METAMEMBER(notificationSoundDir),
|
||||||
BLACK_METAMEMBER(notification),
|
BLACK_METAMEMBER(notification),
|
||||||
BLACK_METAMEMBER(notificationVolume),
|
BLACK_METAMEMBER(notificationVolume),
|
||||||
BLACK_METAMEMBER(audioVolume)
|
BLACK_METAMEMBER(outVolume),
|
||||||
|
BLACK_METAMEMBER(inVolume)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user