Ref T730, Ref T739, first implementation of "Mute" for CAfvClient

This commit is contained in:
Klaus Basan
2019-10-10 02:29:19 +02:00
committed by Mat Sutcliffe
parent b632232566
commit 11a3fa873d
2 changed files with 10 additions and 4 deletions

View File

@@ -160,12 +160,12 @@ namespace BlackCore
bool CAfvClient::isMuted() const bool CAfvClient::isMuted() const
{ {
return !this->isStarted(); return this->getNormalizedOutputVolume() < 1;
} }
void CAfvClient::setMuted(bool mute) void CAfvClient::setMuted(bool mute)
{ {
Q_UNUSED(mute) this->setNormalizedOutputVolume(mute ? 0 : 50);
} }
bool CAfvClient::restartWithNewDevices(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice) bool CAfvClient::restartWithNewDevices(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice)
@@ -480,7 +480,7 @@ namespace BlackCore
void CAfvClient::setInputVolumeDb(double valueDb) void CAfvClient::setInputVolumeDb(double valueDb)
{ {
if (valueDb > MaxDbIn) { valueDb = MaxDbIn; } if (valueDb > MaxDbIn) { valueDb = MaxDbIn; }
if (valueDb < MinDbIn) { valueDb = MinDbIn; } else if (valueDb < MinDbIn) { valueDb = MinDbIn; }
QMutexLocker lock(&m_mutex); QMutexLocker lock(&m_mutex);
m_inputVolumeDb = valueDb; m_inputVolumeDb = valueDb;

View File

@@ -229,8 +229,14 @@ 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 (m_voiceClient->isMuted() == muted) { return; } if (muted)
{
const int nv = m_voiceClient->getNormalizedOutputVolume();
m_outVolumeBeforeMute = nv;
}
m_voiceClient->setMuted(muted); m_voiceClient->setMuted(muted);
if (!muted) { m_voiceClient->setNormalizedOutputVolume(m_outVolumeBeforeMute); }
// signal // signal
emit this->changedMute(muted); emit this->changedMute(muted);