mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +08:00
Issue #100 Add slider for master output volume
This commit is contained in:
@@ -268,16 +268,14 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CAfvClient::isMuted() const
|
bool CAfvClient::isMuted() const
|
||||||
{
|
{
|
||||||
const int v1 = this->getNormalizedOutputVolume(CComSystem::Com1);
|
const int v = this->getNormalizedMasterOutputVolume();
|
||||||
const int v2 = this->getNormalizedOutputVolume(CComSystem::Com2);
|
return v < 1;
|
||||||
return v1 < 1 && v2 < 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAfvClient::setMuted(bool mute)
|
void CAfvClient::setMuted(bool mute)
|
||||||
{
|
{
|
||||||
if (this->isMuted() == mute) { return; }
|
if (this->isMuted() == mute) { return; }
|
||||||
this->setNormalizedOutputVolume(CComSystem::Com1, mute ? 0 : 50);
|
this->setNormalizedMasterOutputVolume(mute ? 0 : 50);
|
||||||
this->setNormalizedOutputVolume(CComSystem::Com2, mute ? 0 : 50);
|
|
||||||
emit this->changedMute(mute);
|
emit this->changedMute(mute);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -768,7 +766,7 @@ namespace BlackCore
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
double CAfvClient::getOutputVolumeDb(CComSystem::ComUnit comUnit) const
|
double CAfvClient::getComOutputVolumeDb(CComSystem::ComUnit comUnit) const
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&m_mutexVolume);
|
QMutexLocker lock(&m_mutexVolume);
|
||||||
if (comUnit == CComSystem::Com1)
|
if (comUnit == CComSystem::Com1)
|
||||||
@@ -798,19 +796,19 @@ namespace BlackCore
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAfvClient::getNormalizedOutputVolume(CComSystem::ComUnit comUnit) const
|
int CAfvClient::getNormalizedMasterOutputVolume() const
|
||||||
{
|
{
|
||||||
double db = this->getOutputVolumeDb(comUnit);
|
QMutexLocker lock(&m_mutexVolume);
|
||||||
double range = MaxDbOut;
|
return m_outputMasterVolumeNormalized;
|
||||||
int v = 50;
|
}
|
||||||
if (db < 0)
|
|
||||||
{
|
int CAfvClient::getNormalizedComOutputVolume(CComSystem::ComUnit comUnit) const
|
||||||
v = 0;
|
{
|
||||||
db -= MinDbOut;
|
QMutexLocker lock(&m_mutexVolume);
|
||||||
range = qAbs(MinDbOut);
|
if (comUnit == CComSystem::Com1) { return m_outputVolumeCom1Normalized; }
|
||||||
}
|
else if (comUnit == CComSystem::Com2) { return m_outputVolumeCom2Normalized; }
|
||||||
v += qRound(db * 50 / range);
|
qFatal("Invalid ComUnit");
|
||||||
return v;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAfvClient::setNormalizedInputVolume(int volume)
|
bool CAfvClient::setNormalizedInputVolume(int volume)
|
||||||
@@ -824,11 +822,49 @@ namespace BlackCore
|
|||||||
return this->setInputVolumeDb(dB);
|
return this->setInputVolumeDb(dB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAfvClient::setNormalizedOutputVolume(CComSystem::ComUnit comUnit, int volume)
|
bool CAfvClient::setNormalizedMasterOutputVolume(int volume)
|
||||||
|
{
|
||||||
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
|
{
|
||||||
|
// call in background thread of AFVClient to avoid lock issues
|
||||||
|
QPointer<CAfvClient> myself(this);
|
||||||
|
QTimer::singleShot(0, this, [ = ]
|
||||||
|
{
|
||||||
|
if (!myself || !CAfvClient::hasContexts()) { return; }
|
||||||
|
myself->setNormalizedMasterOutputVolume(volume);
|
||||||
|
});
|
||||||
|
return true; // not exactly "true" as we do it async
|
||||||
|
}
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
{
|
||||||
|
QMutexLocker lock(&m_mutexVolume);
|
||||||
|
changed = m_outputMasterVolumeNormalized != volume;
|
||||||
|
if (changed) { m_outputMasterVolumeNormalized = volume; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger update of com volumes
|
||||||
|
int com1Normalized = getNormalizedComOutputVolume(CComSystem::Com1);
|
||||||
|
int com2Normalized = getNormalizedComOutputVolume(CComSystem::Com2);
|
||||||
|
setNormalizedComOutputVolume(CComSystem::Com1, com1Normalized);
|
||||||
|
setNormalizedComOutputVolume(CComSystem::Com2, com2Normalized);
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAfvClient::setNormalizedComOutputVolume(CComSystem::ComUnit comUnit, int volume)
|
||||||
{
|
{
|
||||||
if (volume < 0) { volume = 0; }
|
if (volume < 0) { volume = 0; }
|
||||||
else if (volume > 100) { volume = 100; }
|
else if (volume > 100) { volume = 100; }
|
||||||
|
|
||||||
|
// Save original volume
|
||||||
|
if (comUnit == CComSystem::Com1) { m_outputVolumeCom1Normalized = volume; }
|
||||||
|
else if (comUnit == CComSystem::Com2) { m_outputVolumeCom2Normalized = volume; }
|
||||||
|
else { qFatal("Invalid ComUnit"); }
|
||||||
|
|
||||||
|
// Calculate volume relative to master-output volume
|
||||||
|
volume = qRound((double)volume*getNormalizedMasterOutputVolume()/100);
|
||||||
|
|
||||||
// Asymetric
|
// Asymetric
|
||||||
double range = MaxDbOut;
|
double range = MaxDbOut;
|
||||||
double dB = 0;
|
double dB = 0;
|
||||||
@@ -844,7 +880,7 @@ namespace BlackCore
|
|||||||
dB += (volume * range / 50.0);
|
dB += (volume * range / 50.0);
|
||||||
|
|
||||||
// converted to MinDbOut-MaxDbOut
|
// converted to MinDbOut-MaxDbOut
|
||||||
this->setOutputVolumeDb(comUnit, dB);
|
return this->setComOutputVolumeDb(comUnit, dB);
|
||||||
}
|
}
|
||||||
|
|
||||||
double CAfvClient::getInputVolumePeakVU() const
|
double CAfvClient::getInputVolumePeakVU() const
|
||||||
@@ -1099,12 +1135,14 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
const CSettings audioSettings = m_audioSettings.get();
|
const CSettings audioSettings = m_audioSettings.get();
|
||||||
const int iv = audioSettings.getInVolume();
|
const int iv = audioSettings.getInVolume();
|
||||||
|
const int ov = audioSettings.getOutVolume();
|
||||||
const int ov1 = audioSettings.getOutVolumeCom1();
|
const int ov1 = audioSettings.getOutVolumeCom1();
|
||||||
const int ov2 = audioSettings.getOutVolumeCom2();
|
const int ov2 = audioSettings.getOutVolumeCom2();
|
||||||
|
|
||||||
this->setNormalizedInputVolume(iv);
|
this->setNormalizedInputVolume(iv);
|
||||||
this->setNormalizedOutputVolume(CComSystem::Com1, ov1);
|
this->setNormalizedMasterOutputVolume(ov);
|
||||||
this->setNormalizedOutputVolume(CComSystem::Com2, ov2);
|
this->setNormalizedComOutputVolume(CComSystem::Com1, ov1);
|
||||||
|
this->setNormalizedComOutputVolume(CComSystem::Com2, ov2);
|
||||||
this->setBypassEffects(!audioSettings.isAudioEffectsEnabled());
|
this->setBypassEffects(!audioSettings.isAudioEffectsEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1160,8 +1198,8 @@ namespace BlackCore
|
|||||||
const int vol1 = com1.getVolumeReceive();
|
const int vol1 = com1.getVolumeReceive();
|
||||||
const int vol2 = com2.getVolumeReceive();
|
const int vol2 = com2.getVolumeReceive();
|
||||||
|
|
||||||
this->setNormalizedOutputVolume(CComSystem::Com1, vol1);
|
this->setNormalizedComOutputVolume(CComSystem::Com1, vol1);
|
||||||
this->setNormalizedOutputVolume(CComSystem::Com2, vol2);
|
this->setNormalizedComOutputVolume(CComSystem::Com2, vol2);
|
||||||
|
|
||||||
// enable, we currently treat receive as enable
|
// enable, we currently treat receive as enable
|
||||||
// flight sim cockpits normally use rx and tx
|
// flight sim cockpits normally use rx and tx
|
||||||
@@ -1415,7 +1453,7 @@ namespace BlackCore
|
|||||||
return sApp && !sApp->isShuttingDown() && sApp->getIContextOwnAircraft() && sApp->getIContextNetwork() && sApp->getIContextSimulator();
|
return sApp && !sApp->isShuttingDown() && sApp->getIContextOwnAircraft() && sApp->getIContextNetwork() && sApp->getIContextSimulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAfvClient::setOutputVolumeDb(CComSystem::ComUnit comUnit, double valueDb)
|
bool CAfvClient::setComOutputVolumeDb(CComSystem::ComUnit comUnit, double valueDb)
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isInThisThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
@@ -1424,7 +1462,7 @@ namespace BlackCore
|
|||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!myself || !CAfvClient::hasContexts()) { return; }
|
if (!myself || !CAfvClient::hasContexts()) { return; }
|
||||||
myself->setOutputVolumeDb(comUnit, valueDb);
|
myself->setComOutputVolumeDb(comUnit, valueDb);
|
||||||
});
|
});
|
||||||
return true; // not exactly "true" as we do it async
|
return true; // not exactly "true" as we do it async
|
||||||
}
|
}
|
||||||
@@ -1464,7 +1502,7 @@ namespace BlackCore
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_outputSampleProvider)
|
if (m_soundcardSampleProvider)
|
||||||
{
|
{
|
||||||
changed = m_soundcardSampleProvider->setGainRatioForTransceiver(comUnit, gainRatio);
|
changed = m_soundcardSampleProvider->setGainRatioForTransceiver(comUnit, gainRatio);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,11 +234,11 @@ namespace BlackCore
|
|||||||
Q_INVOKABLE bool setInputVolumeDb(double valueDb);
|
Q_INVOKABLE bool setInputVolumeDb(double valueDb);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Output volume in dB, [MinDbOut, MaxDbOut]dB
|
//! Output volume for each COM in dB, [MinDbOut, MaxDbOut]dB
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
//! @{
|
//! @{
|
||||||
double getOutputVolumeDb(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const;
|
double getComOutputVolumeDb(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const;
|
||||||
Q_INVOKABLE bool setOutputVolumeDb(BlackMisc::Aviation::CComSystem::ComUnit comUnit, double valueDb);
|
Q_INVOKABLE bool setComOutputVolumeDb(BlackMisc::Aviation::CComSystem::ComUnit comUnit, double valueDb);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Gain ratio
|
//! Gain ratio
|
||||||
@@ -249,9 +249,11 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
//! @{
|
//! @{
|
||||||
int getNormalizedInputVolume() const;
|
int getNormalizedInputVolume() const;
|
||||||
int getNormalizedOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const;
|
int getNormalizedComOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const;
|
||||||
|
int getNormalizedMasterOutputVolume() const;
|
||||||
bool setNormalizedInputVolume(int volume);
|
bool setNormalizedInputVolume(int volume);
|
||||||
void setNormalizedOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit, int volume);
|
bool setNormalizedComOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit, int volume);
|
||||||
|
bool setNormalizedMasterOutputVolume(int volume);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! VU values, 0..1
|
//! VU values, 0..1
|
||||||
@@ -412,6 +414,9 @@ namespace BlackCore
|
|||||||
QDateTime m_startDateTimeUtc;
|
QDateTime m_startDateTimeUtc;
|
||||||
|
|
||||||
double m_inputVolumeDb = 0.0;
|
double m_inputVolumeDb = 0.0;
|
||||||
|
int m_outputMasterVolumeNormalized = 0;
|
||||||
|
int m_outputVolumeCom1Normalized = 0;
|
||||||
|
int m_outputVolumeCom2Normalized = 0;
|
||||||
double m_outputVolumeDbCom1 = 0.0;
|
double m_outputVolumeDbCom1 = 0.0;
|
||||||
double m_outputGainRatioCom1 = 1.0; //!< 0dB
|
double m_outputGainRatioCom1 = 1.0; //!< 0dB
|
||||||
double m_outputVolumeDbCom2 = 0.0;
|
double m_outputVolumeDbCom2 = 0.0;
|
||||||
|
|||||||
@@ -110,8 +110,7 @@ namespace BlackCore
|
|||||||
else if (parser.commandStartsWith("vol") && parser.countParts() > 1)
|
else if (parser.commandStartsWith("vol") && parser.countParts() > 1)
|
||||||
{
|
{
|
||||||
const int v = parser.toInt(1);
|
const int v = parser.toInt(1);
|
||||||
this->setVoiceOutputVolume(CComSystem::Com1, v);
|
this->setMasterOutputVolume(v);
|
||||||
this->setVoiceOutputVolume(CComSystem::Com2, v);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (afvClient() && parser.matchesCommand(".aliased") && parser.countParts() > 1)
|
else if (afvClient() && parser.matchesCommand(".aliased") && parser.countParts() > 1)
|
||||||
@@ -149,8 +148,9 @@ namespace BlackCore
|
|||||||
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
||||||
|
|
||||||
const CSettings as = m_audioSettings.getThreadLocal();
|
const CSettings as = m_audioSettings.getThreadLocal();
|
||||||
this->setVoiceOutputVolume(CComSystem::Com1, as.getOutVolumeCom1());
|
this->setMasterOutputVolume(as.getOutVolume());
|
||||||
this->setVoiceOutputVolume(CComSystem::Com2, as.getOutVolumeCom2());
|
this->setComOutputVolume(CComSystem::Com1, as.getOutVolumeCom1());
|
||||||
|
this->setComOutputVolume(CComSystem::Com2, as.getOutVolumeCom2());
|
||||||
m_selcalPlayer = new CSelcalPlayer(CAudioDeviceInfo::getDefaultOutputDevice(), this);
|
m_selcalPlayer = new CSelcalPlayer(CAudioDeviceInfo::getDefaultOutputDevice(), this);
|
||||||
|
|
||||||
myself->changeDeviceSettings();
|
myself->changeDeviceSettings();
|
||||||
@@ -421,22 +421,20 @@ namespace BlackCore
|
|||||||
m_voiceClient->startAudio(inputDevice, outputDevice);
|
m_voiceClient->startAudio(inputDevice, outputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioBase::setVoiceOutputVolume(CComSystem::ComUnit comUnit, int volume)
|
void CContextAudioBase::setMasterOutputVolume(int volume)
|
||||||
{
|
{
|
||||||
if (comUnit != CComSystem::Com1 && comUnit != CComSystem::Com2) { return; }
|
|
||||||
if (!m_voiceClient) { return; }
|
if (!m_voiceClient) { return; }
|
||||||
|
|
||||||
const bool wasMuted = this->isMuted();
|
const bool wasMuted = this->isMuted();
|
||||||
volume = CSettings::fixOutVolume(volume);
|
volume = CSettings::fixOutVolume(volume);
|
||||||
|
|
||||||
const int currentVolume = m_voiceClient->getNormalizedOutputVolume(comUnit);
|
const int currentVolume = m_voiceClient->getNormalizedMasterOutputVolume();
|
||||||
const bool changedVoiceOutput = (currentVolume != volume);
|
const bool changedVoiceOutput = (currentVolume != volume);
|
||||||
if (changedVoiceOutput)
|
if (changedVoiceOutput)
|
||||||
{
|
{
|
||||||
// TODO: KB 2020-05 the mute handling should entirely go to AFV client!
|
// TODO: KB 2020-05 the mute handling should entirely go to AFV client!
|
||||||
m_voiceClient->setNormalizedOutputVolume(comUnit, volume);
|
m_voiceClient->setNormalizedMasterOutputVolume(volume);
|
||||||
if (comUnit == CComSystem::Com1) { m_outVolumeBeforeMuteCom1 = volume; }
|
m_outMasterVolumeBeforeMute = volume;
|
||||||
if (comUnit == CComSystem::Com2) { m_outVolumeBeforeMuteCom2 = volume; }
|
|
||||||
|
|
||||||
emit this->changedAudioVolume(volume);
|
emit this->changedAudioVolume(volume);
|
||||||
if ((volume > 0 && wasMuted) || (volume < 1 && !wasMuted))
|
if ((volume > 0 && wasMuted) || (volume < 1 && !wasMuted))
|
||||||
@@ -446,6 +444,29 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSettings as(m_audioSettings.getThreadLocal());
|
||||||
|
if (as.getOutVolume() != volume)
|
||||||
|
{
|
||||||
|
as.setOutVolume(volume);
|
||||||
|
m_audioSettings.set(as);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CContextAudioBase::setComOutputVolume(CComSystem::ComUnit comUnit, int volume)
|
||||||
|
{
|
||||||
|
if (comUnit != CComSystem::Com1 && comUnit != CComSystem::Com2) { return; }
|
||||||
|
if (!m_voiceClient) { return; }
|
||||||
|
|
||||||
|
volume = CSettings::fixOutVolume(volume);
|
||||||
|
|
||||||
|
const int currentVolume = m_voiceClient->getNormalizedComOutputVolume(comUnit);
|
||||||
|
const bool changedVoiceOutput = (currentVolume != volume);
|
||||||
|
if (changedVoiceOutput)
|
||||||
|
{
|
||||||
|
m_voiceClient->setNormalizedComOutputVolume(comUnit, volume);
|
||||||
|
emit this->changedAudioVolume(volume);
|
||||||
|
}
|
||||||
|
|
||||||
CSettings as(m_audioSettings.getThreadLocal());
|
CSettings as(m_audioSettings.getThreadLocal());
|
||||||
if (comUnit == CComSystem::Com1 && as.getOutVolumeCom1() != volume)
|
if (comUnit == CComSystem::Com1 && as.getOutVolumeCom1() != volume)
|
||||||
{
|
{
|
||||||
@@ -459,10 +480,16 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CContextAudioBase::getVoiceOutputVolume(CComSystem::ComUnit comUnit) const
|
int CContextAudioBase::getMasterOutputVolume() const
|
||||||
{
|
{
|
||||||
if (!m_voiceClient) { return 0; }
|
if (!m_voiceClient) { return 0; }
|
||||||
return m_voiceClient->getNormalizedOutputVolume(comUnit);
|
return m_voiceClient->getNormalizedMasterOutputVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CContextAudioBase::getComOutputVolume(CComSystem::ComUnit comUnit) const
|
||||||
|
{
|
||||||
|
if (!m_voiceClient) { return 0; }
|
||||||
|
return m_voiceClient->getNormalizedComOutputVolume(comUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioBase::setMute(bool muted)
|
void CContextAudioBase::setMute(bool muted)
|
||||||
@@ -470,18 +497,11 @@ namespace BlackCore
|
|||||||
if (!m_voiceClient) { return; }
|
if (!m_voiceClient) { return; }
|
||||||
if (this->isMuted() == muted) { return; } // avoid roundtrips / unnecessary signals
|
if (this->isMuted() == muted) { return; } // avoid roundtrips / unnecessary signals
|
||||||
|
|
||||||
if (muted)
|
if (muted) { m_outMasterVolumeBeforeMute = m_voiceClient->getNormalizedMasterOutputVolume(); }
|
||||||
{
|
|
||||||
m_outVolumeBeforeMuteCom1 = m_voiceClient->getNormalizedOutputVolume(CComSystem::Com1);
|
|
||||||
m_outVolumeBeforeMuteCom2 = m_voiceClient->getNormalizedOutputVolume(CComSystem::Com2);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_voiceClient->setMuted(muted);
|
m_voiceClient->setMuted(muted);
|
||||||
if (!muted)
|
if (!muted) { m_voiceClient->setNormalizedMasterOutputVolume(m_outMasterVolumeBeforeMute); }
|
||||||
{
|
|
||||||
m_voiceClient->setNormalizedOutputVolume(CComSystem::Com1, m_outVolumeBeforeMuteCom1);
|
|
||||||
m_voiceClient->setNormalizedOutputVolume(CComSystem::Com2, m_outVolumeBeforeMuteCom2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// signal no longer need, signaled by m_voiceClient->setMuted
|
// signal no longer need, signaled by m_voiceClient->setMuted
|
||||||
// emit this->changedMute(muted);
|
// emit this->changedMute(muted);
|
||||||
@@ -594,8 +614,9 @@ 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(CComSystem::Com1, s.getOutVolumeCom1());
|
this->setMasterOutputVolume(s.getOutVolume());
|
||||||
this->setVoiceOutputVolume(CComSystem::Com2, s.getOutVolumeCom2());
|
this->setComOutputVolume(CComSystem::Com1, s.getOutVolumeCom1());
|
||||||
|
this->setComOutputVolume(CComSystem::Com2, s.getOutVolumeCom2());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioBase::onChangedVoiceSettings()
|
void CContextAudioBase::onChangedVoiceSettings()
|
||||||
@@ -607,19 +628,15 @@ namespace BlackCore
|
|||||||
void CContextAudioBase::audioIncreaseVolume(bool enabled)
|
void CContextAudioBase::audioIncreaseVolume(bool enabled)
|
||||||
{
|
{
|
||||||
if (!enabled) { return; }
|
if (!enabled) { return; }
|
||||||
const int v1 = qRound(this->getVoiceOutputVolume(CComSystem::Com1) * 1.05);
|
const int v = qRound(this->getMasterOutputVolume() * 1.05);
|
||||||
const int v2 = qRound(this->getVoiceOutputVolume(CComSystem::Com2) * 1.05);
|
this->setMasterOutputVolume(v);
|
||||||
this->setVoiceOutputVolume(CComSystem::Com1, v1);
|
|
||||||
this->setVoiceOutputVolume(CComSystem::Com2, v2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioBase::audioDecreaseVolume(bool enabled)
|
void CContextAudioBase::audioDecreaseVolume(bool enabled)
|
||||||
{
|
{
|
||||||
if (!enabled) { return; }
|
if (!enabled) { return; }
|
||||||
const int v1 = qRound(this->getVoiceOutputVolume(CComSystem::Com1) / 1.05);
|
const int v = qRound(this->getMasterOutputVolume() / 1.05);
|
||||||
const int v2 = qRound(this->getVoiceOutputVolume(CComSystem::Com2) / 1.05);
|
this->setMasterOutputVolume(v);
|
||||||
this->setVoiceOutputVolume(CComSystem::Com1, v1);
|
|
||||||
this->setVoiceOutputVolume(CComSystem::Com2, v2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioBase::xCtxNetworkConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
|
void CContextAudioBase::xCtxNetworkConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
|
||||||
|
|||||||
@@ -178,8 +178,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Volume
|
//! Volume
|
||||||
//! @{
|
//! @{
|
||||||
void setVoiceOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit, int volume);
|
void setMasterOutputVolume(int volume);
|
||||||
int getVoiceOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const;
|
void setComOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit, int volume);
|
||||||
|
int getMasterOutputVolume() const;
|
||||||
|
int getComOutputVolume(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const;
|
||||||
void setMute(bool muted);
|
void setMute(bool muted);
|
||||||
bool isMuted() const;
|
bool isMuted() const;
|
||||||
//! @}
|
//! @}
|
||||||
@@ -354,8 +356,7 @@ namespace BlackCore
|
|||||||
CActionBind m_actionAudioVolumeIncrease { BlackMisc::Input::audioVolumeIncreaseHotkeyAction(), BlackMisc::Input::audioVolumeIncreaseHotkeyIcon(), this, &CContextAudioBase::audioIncreaseVolume };
|
CActionBind m_actionAudioVolumeIncrease { BlackMisc::Input::audioVolumeIncreaseHotkeyAction(), BlackMisc::Input::audioVolumeIncreaseHotkeyIcon(), this, &CContextAudioBase::audioIncreaseVolume };
|
||||||
CActionBind m_actionAudioVolumeDecrease { BlackMisc::Input::audioVolumeDecreaseHotkeyAction(), BlackMisc::Input::audioVolumeDecreaseHotkeyIcon(), this, &CContextAudioBase::audioDecreaseVolume };
|
CActionBind m_actionAudioVolumeDecrease { BlackMisc::Input::audioVolumeDecreaseHotkeyAction(), BlackMisc::Input::audioVolumeDecreaseHotkeyIcon(), this, &CContextAudioBase::audioDecreaseVolume };
|
||||||
|
|
||||||
int m_outVolumeBeforeMuteCom1 = 90;
|
int m_outMasterVolumeBeforeMute = 50;
|
||||||
int m_outVolumeBeforeMuteCom2 = 90;
|
|
||||||
static constexpr int MinUnmuteVolume = 20; //!< minimum volume when unmuted
|
static constexpr int MinUnmuteVolume = 20; //!< minimum volume when unmuted
|
||||||
|
|
||||||
//! Do we use a local core
|
//! Do we use a local core
|
||||||
|
|||||||
@@ -48,11 +48,13 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->hs_VolumeIn, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
connect(ui->hs_VolumeIn, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||||
|
connect(ui->hs_VolumeOut, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||||
connect(ui->hs_VolumeOutCom1, &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->hs_VolumeOutCom2, &QSlider::valueChanged, this, &CAudioDeviceVolumeSetupComponent::onVolumeSliderChanged);
|
||||||
connect(ui->tb_RefreshInDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
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_RefreshOutDevice, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onReloadDevices, Qt::QueuedConnection);
|
||||||
connect(ui->tb_ResetInVolume, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeIn, 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->tb_ResetOutVolumeCom1, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom1, 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->tb_ResetOutVolumeCom2, &QToolButton::released, this, &CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom2, Qt::QueuedConnection);
|
||||||
|
|
||||||
@@ -64,6 +66,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
ui->hs_VolumeIn->setMaximum(CSettings::InMax);
|
ui->hs_VolumeIn->setMaximum(CSettings::InMax);
|
||||||
ui->hs_VolumeIn->setMinimum(CSettings::InMin);
|
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->setMaximum(CSettings::OutMax);
|
||||||
ui->hs_VolumeOutCom1->setMinimum(CSettings::OutMin);
|
ui->hs_VolumeOutCom1->setMinimum(CSettings::OutMin);
|
||||||
ui->hs_VolumeOutCom2->setMaximum(CSettings::OutMax);
|
ui->hs_VolumeOutCom2->setMaximum(CSettings::OutMax);
|
||||||
@@ -71,9 +75,11 @@ namespace BlackGui
|
|||||||
|
|
||||||
const CSettings as(m_audioSettings.getThreadLocal());
|
const CSettings as(m_audioSettings.getThreadLocal());
|
||||||
const int i = this->getInValue();
|
const int i = this->getInValue();
|
||||||
|
const int o = this->getOutValue();
|
||||||
const int o1 = this->getOutValueCom1();
|
const int o1 = this->getOutValueCom1();
|
||||||
const int o2 = this->getOutValueCom2();
|
const int o2 = this->getOutValueCom2();
|
||||||
ui->hs_VolumeIn->setValue(i);
|
ui->hs_VolumeIn->setValue(i);
|
||||||
|
ui->hs_VolumeOut->setValue(o);
|
||||||
ui->hs_VolumeOutCom1->setValue(o1);
|
ui->hs_VolumeOutCom1->setValue(o1);
|
||||||
ui->hs_VolumeOutCom2->setValue(o2);
|
ui->hs_VolumeOutCom2->setValue(o2);
|
||||||
ui->cb_SetupAudioLoopback->setChecked(false);
|
ui->cb_SetupAudioLoopback->setChecked(false);
|
||||||
@@ -97,6 +103,7 @@ namespace BlackGui
|
|||||||
});
|
});
|
||||||
|
|
||||||
this->setCheckBoxesReadOnly(this->isComIntegrated());
|
this->setCheckBoxesReadOnly(this->isComIntegrated());
|
||||||
|
this->setVolumeSlidersReadOnly(this->isComIntegrated());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::init()
|
void CAudioDeviceVolumeSetupComponent::init()
|
||||||
@@ -189,6 +196,13 @@ namespace BlackGui
|
|||||||
return qRound(ui->hs_VolumeIn->value() / r * tr);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
int CAudioDeviceVolumeSetupComponent::getOutValueCom1(int from, int to) const
|
int CAudioDeviceVolumeSetupComponent::getOutValueCom1(int from, int to) const
|
||||||
{
|
{
|
||||||
const double r = ui->hs_VolumeOutCom1->maximum() - ui->hs_VolumeOutCom1->minimum();
|
const double r = ui->hs_VolumeOutCom1->maximum() - ui->hs_VolumeOutCom1->minimum();
|
||||||
@@ -212,6 +226,15 @@ namespace BlackGui
|
|||||||
ui->hs_VolumeIn->setValue(qRound(value / tr * r));
|
ui->hs_VolumeIn->setValue(qRound(value / tr * r));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setOutValue(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 tr = to - from;
|
||||||
|
ui->hs_VolumeOut->setValue(qRound(value / tr * r));
|
||||||
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::setOutValueCom1(int value, int from, int to)
|
void CAudioDeviceVolumeSetupComponent::setOutValueCom1(int value, int from, int to)
|
||||||
{
|
{
|
||||||
if (value > to) { value = to; }
|
if (value > to) { value = to; }
|
||||||
@@ -255,6 +278,7 @@ namespace BlackGui
|
|||||||
this->setRxTxCheckboxes(rec1, tx1, rec2, tx2);
|
this->setRxTxCheckboxes(rec1, tx1, rec2, tx2);
|
||||||
ui->cb_IntegratedWithCom->setChecked(integrated);
|
ui->cb_IntegratedWithCom->setChecked(integrated);
|
||||||
this->setCheckBoxesReadOnly(integrated);
|
this->setCheckBoxesReadOnly(integrated);
|
||||||
|
this->setVolumeSlidersReadOnly(integrated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient()
|
void CAudioDeviceVolumeSetupComponent::setTransmitReceiveInUiFromVoiceClient()
|
||||||
@@ -282,10 +306,13 @@ namespace BlackGui
|
|||||||
this->setTransmitReceiveInUi(com1Tx, com1Rx, com2Tx, com2Rx, integrated);
|
this->setTransmitReceiveInUi(com1Tx, com1Rx, com2Tx, com2Rx, integrated);
|
||||||
|
|
||||||
// Set transmit volume in GUI
|
// Set transmit volume in GUI
|
||||||
const int vol1 = sGui->getCContextAudioBase()->getVoiceOutputVolume(CComSystem::Com1);
|
if (integrated)
|
||||||
const int vol2 = sGui->getCContextAudioBase()->getVoiceOutputVolume(CComSystem::Com2);
|
{
|
||||||
ui->hs_VolumeOutCom1->setValue(vol1);
|
const int vol1 = sGui->getCContextAudioBase()->getComOutputVolume(CComSystem::Com1);
|
||||||
ui->hs_VolumeOutCom2->setValue(vol2);
|
const int vol2 = sGui->getCContextAudioBase()->getComOutputVolume(CComSystem::Com2);
|
||||||
|
ui->hs_VolumeOutCom1->setValue(vol1);
|
||||||
|
ui->hs_VolumeOutCom2->setValue(vol2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::setCheckBoxesReadOnly(bool readonly)
|
void CAudioDeviceVolumeSetupComponent::setCheckBoxesReadOnly(bool readonly)
|
||||||
@@ -297,6 +324,23 @@ namespace BlackGui
|
|||||||
CGuiUtility::checkBoxReadOnly(ui->cb_2Rec, readonly);
|
CGuiUtility::checkBoxReadOnly(ui->cb_2Rec, readonly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::setVolumeSlidersReadOnly(bool readonly)
|
||||||
|
{
|
||||||
|
ui->hs_VolumeOutCom1->setDisabled(readonly);
|
||||||
|
ui->hs_VolumeOutCom2->setDisabled(readonly);
|
||||||
|
if (readonly)
|
||||||
|
{
|
||||||
|
// \fixme hardcoded stylesheet setting, should come from stylesheet")
|
||||||
|
ui->hs_VolumeOutCom1->setStyleSheet("background: rgb(40,40,40)");
|
||||||
|
ui->hs_VolumeOutCom2->setStyleSheet("background: rgb(40,40,40)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->hs_VolumeOutCom1->setStyleSheet("");
|
||||||
|
ui->hs_VolumeOutCom2->setStyleSheet("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CAfvClient *CAudioDeviceVolumeSetupComponent::afvClient()
|
CAfvClient *CAudioDeviceVolumeSetupComponent::afvClient()
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getCContextAudioBase()) { return nullptr; }
|
if (!sGui || sGui->isShuttingDown() || !sGui->getCContextAudioBase()) { return nullptr; }
|
||||||
@@ -308,6 +352,7 @@ namespace BlackGui
|
|||||||
const CSettings as(m_audioSettings.getThreadLocal());
|
const CSettings as(m_audioSettings.getThreadLocal());
|
||||||
ui->cb_DisableAudioEffects->setChecked(!as.isAudioEffectsEnabled());
|
ui->cb_DisableAudioEffects->setChecked(!as.isAudioEffectsEnabled());
|
||||||
this->setInValue(as.getInVolume());
|
this->setInValue(as.getInVolume());
|
||||||
|
this->setOutValue(as.getOutVolume());
|
||||||
this->setOutValueCom1(as.getOutVolumeCom1());
|
this->setOutValueCom1(as.getOutVolumeCom1());
|
||||||
this->setOutValueCom2(as.getOutVolumeCom2());
|
this->setOutValueCom2(as.getOutVolumeCom2());
|
||||||
}
|
}
|
||||||
@@ -341,10 +386,13 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CSettings as(m_audioSettings.getThreadLocal());
|
CSettings as(m_audioSettings.getThreadLocal());
|
||||||
const int i = this->getInValue();
|
const int i = this->getInValue();
|
||||||
|
const int o = this->getOutValue();
|
||||||
const int o1 = this->getOutValueCom1();
|
const int o1 = this->getOutValueCom1();
|
||||||
const int o2 = this->getOutValueCom2();
|
const int o2 = this->getOutValueCom2();
|
||||||
if (as.getInVolume() == i && as.getOutVolumeCom1() == o1 && as.getOutVolumeCom2() == o2) { return; }
|
if (as.getInVolume() == i && o == as.getOutVolume() &&
|
||||||
|
as.getOutVolumeCom1() == o1 && as.getOutVolumeCom2() == o2) { return; }
|
||||||
as.setInVolume(i);
|
as.setInVolume(i);
|
||||||
|
as.setOutVolume(o);
|
||||||
as.setOutVolumeCom1(o1);
|
as.setOutVolumeCom1(o1);
|
||||||
as.setOutVolumeCom2(o2);
|
as.setOutVolumeCom2(o2);
|
||||||
m_audioSettings.setAndSave(as);
|
m_audioSettings.setAndSave(as);
|
||||||
@@ -374,14 +422,19 @@ namespace BlackGui
|
|||||||
ui->hs_VolumeIn->setValue((ui->hs_VolumeIn->maximum() - ui->hs_VolumeIn->minimum()) / 2);
|
ui->hs_VolumeIn->setValue((ui->hs_VolumeIn->maximum() - ui->hs_VolumeIn->minimum()) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAudioDeviceVolumeSetupComponent::onResetVolumeOut()
|
||||||
|
{
|
||||||
|
ui->hs_VolumeOut->setValue((ui->hs_VolumeOut->maximum() - ui->hs_VolumeOut->minimum()) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom1()
|
void CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom1()
|
||||||
{
|
{
|
||||||
ui->hs_VolumeOutCom1->setValue((ui->hs_VolumeOutCom1->maximum() - ui->hs_VolumeOutCom1->minimum()) / 2);
|
ui->hs_VolumeOutCom1->setValue(ui->hs_VolumeOutCom1->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom2()
|
void CAudioDeviceVolumeSetupComponent::onResetVolumeOutCom2()
|
||||||
{
|
{
|
||||||
ui->hs_VolumeOutCom2->setValue((ui->hs_VolumeOutCom2->maximum() - ui->hs_VolumeOutCom2->minimum()) / 2);
|
ui->hs_VolumeOutCom2->setValue(ui->hs_VolumeOutCom2->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioDeviceVolumeSetupComponent::setAudioRunsWhere()
|
void CAudioDeviceVolumeSetupComponent::setAudioRunsWhere()
|
||||||
@@ -397,6 +450,7 @@ namespace BlackGui
|
|||||||
if (ui->cb_IntegratedWithCom->isChecked() == integrate) { return integrate; }
|
if (ui->cb_IntegratedWithCom->isChecked() == integrate) { return integrate; }
|
||||||
ui->cb_IntegratedWithCom->setChecked(integrate);
|
ui->cb_IntegratedWithCom->setChecked(integrate);
|
||||||
this->setCheckBoxesReadOnly(integrate);
|
this->setCheckBoxesReadOnly(integrate);
|
||||||
|
this->setVolumeSlidersReadOnly(integrate);
|
||||||
return integrate;
|
return integrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,6 +495,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!this->hasAudio()) { return; }
|
if (!this->hasAudio()) { return; }
|
||||||
this->setCheckBoxesReadOnly(checked);
|
this->setCheckBoxesReadOnly(checked);
|
||||||
|
this->setVolumeSlidersReadOnly(checked);
|
||||||
|
|
||||||
if (!this->hasSimulator()) { return; }
|
if (!this->hasSimulator()) { return; }
|
||||||
if (!sGui->getIContextSimulator()->isSimulatorAvailable()) { return; }
|
if (!sGui->getIContextSimulator()->isSimulatorAvailable()) { return; }
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace BlackGui
|
|||||||
//! Get input and output volume values
|
//! Get input and output volume values
|
||||||
//! @{
|
//! @{
|
||||||
int getInValue(int from = BlackMisc::Audio::CSettings::InMin, int to = BlackMisc::Audio::CSettings::InMax) const;
|
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 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;
|
int getOutValueCom2(int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax) const;
|
||||||
//! @}
|
//! @}
|
||||||
@@ -52,6 +53,7 @@ namespace BlackGui
|
|||||||
//! Set input and output volume values
|
//! Set input and output volume values
|
||||||
//! @{
|
//! @{
|
||||||
void setInValue(int value, int from = BlackMisc::Audio::CSettings::InMin, int to = BlackMisc::Audio::CSettings::InMax);
|
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::InMin, int to = BlackMisc::Audio::CSettings::InMax);
|
||||||
void setOutValueCom1(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);
|
void setOutValueCom2(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax);
|
||||||
//! @}
|
//! @}
|
||||||
@@ -114,6 +116,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void onReloadDevices();
|
void onReloadDevices();
|
||||||
void onResetVolumeIn();
|
void onResetVolumeIn();
|
||||||
|
void onResetVolumeOut();
|
||||||
void onResetVolumeOutCom1();
|
void onResetVolumeOutCom1();
|
||||||
void onResetVolumeOutCom2();
|
void onResetVolumeOutCom2();
|
||||||
|
|
||||||
@@ -142,6 +145,9 @@ namespace BlackGui
|
|||||||
//! Checkboxes readonly?
|
//! Checkboxes readonly?
|
||||||
void setCheckBoxesReadOnly(bool readonly);
|
void setCheckBoxesReadOnly(bool readonly);
|
||||||
|
|
||||||
|
//! Volume sliders readlonly?
|
||||||
|
void setVolumeSlidersReadOnly(bool readonly);
|
||||||
|
|
||||||
//! Direct access to client
|
//! Direct access to client
|
||||||
static BlackCore::Afv::Clients::CAfvClient *afvClient();
|
static BlackCore::Afv::Clients::CAfvClient *afvClient();
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="3">
|
<item row="11" column="3">
|
||||||
<widget class="QToolButton" name="tb_ResetOutVolumeCom1">
|
<widget class="QToolButton" name="tb_ResetOutVolume">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -136,6 +136,17 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="3">
|
<item row="12" 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="13" column="3">
|
||||||
<widget class="QToolButton" name="tb_ResetOutVolumeCom2">
|
<widget class="QToolButton" name="tb_ResetOutVolumeCom2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
@@ -147,13 +158,20 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0">
|
<item row="11" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_VolumeOut">
|
||||||
|
<property name="text">
|
||||||
|
<string>Out Master</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="0">
|
||||||
<widget class="QLabel" name="lbl_VolumeOutCom1">
|
<widget class="QLabel" name="lbl_VolumeOutCom1">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Out COM1</string>
|
<string>Out COM1</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="0">
|
<item row="13" column="0">
|
||||||
<widget class="QLabel" name="lbl_VolumeOutCom2">
|
<widget class="QLabel" name="lbl_VolumeOutCom2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Out COM2</string>
|
<string>Out COM2</string>
|
||||||
@@ -303,7 +321,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QSlider" name="hs_VolumeOutCom1">
|
<widget class="QSlider" name="hs_VolumeOut">
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>50</number>
|
<number>50</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -313,6 +331,16 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="12" column="1">
|
||||||
|
<widget class="QSlider" name="hs_VolumeOutCom1">
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="1">
|
||||||
<widget class="QSlider" name="hs_VolumeOutCom2">
|
<widget class="QSlider" name="hs_VolumeOutCom2">
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>50</number>
|
<number>50</number>
|
||||||
@@ -322,14 +350,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="0">
|
<item row="14" column="0">
|
||||||
<widget class="QLabel" name="lbl_OutLevelMeter">
|
<widget class="QLabel" name="lbl_OutLevelMeter">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Output</string>
|
<string>Output</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1">
|
<item row="14" column="1">
|
||||||
<widget class="BlackGui::CLevelMeter" name="wip_OutLevelMeter">
|
<widget class="BlackGui::CLevelMeter" name="wip_OutLevelMeter">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
|||||||
@@ -144,8 +144,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else if (senderButton == ui->pb_SoundMaxVolume && sGui->getIContextAudio())
|
else if (senderButton == ui->pb_SoundMaxVolume && sGui->getIContextAudio())
|
||||||
{
|
{
|
||||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(CComSystem::Com1, 100);
|
sGui->getCContextAudioBase()->setMasterOutputVolume(100);
|
||||||
sGui->getCContextAudioBase()->setVoiceOutputVolume(CComSystem::Com2, 100);
|
|
||||||
}
|
}
|
||||||
else if (senderButton == ui->pb_SoundMute && sGui->getIContextAudio())
|
else if (senderButton == ui->pb_SoundMute && sGui->getIContextAudio())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ namespace BlackMisc
|
|||||||
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettings::setOutVolume(int volume)
|
||||||
|
{
|
||||||
|
m_outVolume = fixOutVolume(volume);
|
||||||
|
}
|
||||||
|
|
||||||
void CSettings::setOutVolumeCom1(int volume)
|
void CSettings::setOutVolumeCom1(int volume)
|
||||||
{
|
{
|
||||||
m_outVolumeCom1 = fixOutVolume(volume);
|
m_outVolumeCom1 = fixOutVolume(volume);
|
||||||
|
|||||||
@@ -95,6 +95,12 @@ namespace BlackMisc
|
|||||||
//! Get volume (notifications)
|
//! Get volume (notifications)
|
||||||
int getNotificationVolume() const { return m_notificationVolume; }
|
int getNotificationVolume() const { return m_notificationVolume; }
|
||||||
|
|
||||||
|
//! Set volume (audio) 0..100
|
||||||
|
void setOutVolume(int volume);
|
||||||
|
|
||||||
|
//! Get volume (audio) 0..100
|
||||||
|
int getOutVolume() const { return m_outVolume; }
|
||||||
|
|
||||||
//! Set volume for com1 (audio) 0..100
|
//! Set volume for com1 (audio) 0..100
|
||||||
void setOutVolumeCom1(int volume);
|
void setOutVolumeCom1(int volume);
|
||||||
|
|
||||||
@@ -129,8 +135,9 @@ namespace BlackMisc
|
|||||||
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-90
|
int m_notificationVolume = 90; //!< 0-90
|
||||||
int m_outVolumeCom1 = 50; //!< 0-100, AFV
|
int m_outVolume = 40; //!< 0-100, AFV
|
||||||
int m_outVolumeCom2 = 50; //!< 0-100, AFV
|
int m_outVolumeCom1 = 100; //!< 0-100, AFV
|
||||||
|
int m_outVolumeCom2 = 100; //!< 0-100, AFV
|
||||||
int m_inVolume = 50; //!< AFV range
|
int m_inVolume = 50; //!< AFV range
|
||||||
bool m_audioEffects = true; //!< Audio effects en
|
bool m_audioEffects = true; //!< Audio effects en
|
||||||
void initNotificationFlags(); //!< init flags
|
void initNotificationFlags(); //!< init flags
|
||||||
@@ -140,6 +147,7 @@ namespace BlackMisc
|
|||||||
BLACK_METAMEMBER(notificationSoundDir),
|
BLACK_METAMEMBER(notificationSoundDir),
|
||||||
BLACK_METAMEMBER(notification),
|
BLACK_METAMEMBER(notification),
|
||||||
BLACK_METAMEMBER(notificationVolume),
|
BLACK_METAMEMBER(notificationVolume),
|
||||||
|
BLACK_METAMEMBER(outVolume),
|
||||||
BLACK_METAMEMBER(outVolumeCom1),
|
BLACK_METAMEMBER(outVolumeCom1),
|
||||||
BLACK_METAMEMBER(outVolumeCom2),
|
BLACK_METAMEMBER(outVolumeCom2),
|
||||||
BLACK_METAMEMBER(inVolume),
|
BLACK_METAMEMBER(inVolume),
|
||||||
|
|||||||
Reference in New Issue
Block a user