Added push-to-mute for microphone.
This commit is contained in:
@@ -65,6 +65,7 @@ namespace advsettings {
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup(getSettingsName());
|
||||
setMicProximitySensorCanMute(settings->value("micProximitySensorCanMute", false).toBool(), false);
|
||||
setMicReversePtt(settings->value("micReversePtt", false).toBool(), false);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
@@ -72,6 +73,7 @@ namespace advsettings {
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup(getSettingsName());
|
||||
settings->setValue("micProximitySensorCanMute", micProximitySensorCanMute());
|
||||
settings->setValue("micReversePtt", micReversePtt());
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
}
|
||||
@@ -100,6 +102,10 @@ namespace advsettings {
|
||||
return m_micProximitySensorCanMute;
|
||||
}
|
||||
|
||||
bool AudioTabController::micReversePtt() const {
|
||||
return m_micReversePtt;
|
||||
}
|
||||
|
||||
void AudioTabController::eventLoopTick() {
|
||||
if (!eventLoopMutex.try_lock()) {
|
||||
return;
|
||||
@@ -155,15 +161,27 @@ namespace advsettings {
|
||||
}
|
||||
|
||||
void AudioTabController::onPttStart() {
|
||||
setMicMuted(false);
|
||||
if (m_micReversePtt) {
|
||||
setMicMuted(true);
|
||||
} else {
|
||||
setMicMuted(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioTabController::onPttEnabled() {
|
||||
setMicMuted(true);
|
||||
if (m_micReversePtt) {
|
||||
setMicMuted(false);
|
||||
} else {
|
||||
setMicMuted(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioTabController::onPttStop() {
|
||||
setMicMuted(true);
|
||||
if (m_micReversePtt) {
|
||||
setMicMuted(false);
|
||||
} else {
|
||||
setMicMuted(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioTabController::onPttDisabled() {
|
||||
@@ -233,6 +251,24 @@ namespace advsettings {
|
||||
}
|
||||
}
|
||||
|
||||
void AudioTabController::setMicReversePtt(bool value, bool notify) {
|
||||
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
|
||||
if (value != m_micReversePtt) {
|
||||
m_micReversePtt = value;
|
||||
saveAudioSettings();
|
||||
if (m_pttEnabled) {
|
||||
if (m_pttActive) {
|
||||
setMicMuted(value);
|
||||
} else {
|
||||
setMicMuted(!value);
|
||||
}
|
||||
}
|
||||
if (notify) {
|
||||
emit micReversePttChanged(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioTabController::onNewRecordingDevice() {
|
||||
findMicDeviceIndex(audioManager->getMicDevId());
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace advsettings {
|
||||
Q_PROPERTY(float micVolume READ micVolume WRITE setMicVolume NOTIFY micVolumeChanged)
|
||||
Q_PROPERTY(bool micMuted READ micMuted WRITE setMicMuted NOTIFY micMutedChanged)
|
||||
Q_PROPERTY(bool micProximitySensorCanMute READ micProximitySensorCanMute WRITE setMicProximitySensorCanMute NOTIFY micProximitySensorCanMuteChanged)
|
||||
Q_PROPERTY(bool micReversePtt READ micReversePtt WRITE setMicReversePtt NOTIFY micReversePttChanged)
|
||||
|
||||
private:
|
||||
OverlayController* parent;
|
||||
@@ -44,6 +45,7 @@ namespace advsettings {
|
||||
float m_micVolume = 1.0;
|
||||
bool m_micMuted = false;
|
||||
bool m_micProximitySensorCanMute = false;
|
||||
bool m_micReversePtt = false;
|
||||
|
||||
unsigned settingsUpdateCounter = 0;
|
||||
|
||||
@@ -83,6 +85,7 @@ namespace advsettings {
|
||||
float micVolume() const;
|
||||
bool micMuted() const;
|
||||
bool micProximitySensorCanMute() const;
|
||||
bool micReversePtt() const;
|
||||
|
||||
Q_INVOKABLE int getPlaybackDeviceCount();
|
||||
Q_INVOKABLE QString getPlaybackDeviceName(int index);
|
||||
@@ -102,6 +105,7 @@ namespace advsettings {
|
||||
void setMicVolume(float value, bool notify = true);
|
||||
void setMicMuted(bool value, bool notify = true);
|
||||
void setMicProximitySensorCanMute(bool value, bool notify = true);
|
||||
void setMicReversePtt(bool value, bool notify = true);
|
||||
|
||||
void setPlaybackDeviceIndex(int value, bool notify = true);
|
||||
void setMirrorDeviceIndex(int value, bool notify = true);
|
||||
@@ -118,6 +122,7 @@ namespace advsettings {
|
||||
void micVolumeChanged(float value);
|
||||
void micMutedChanged(bool value);
|
||||
void micProximitySensorCanMuteChanged(bool value);
|
||||
void micReversePttChanged(bool value);
|
||||
|
||||
void playbackDeviceListChanged();
|
||||
void recordingDeviceListChanged();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace advsettings {
|
||||
Q_PROPERTY(bool pttLeftControllerEnabled READ pttLeftControllerEnabled WRITE setPttLeftControllerEnabled NOTIFY pttLeftControllerEnabledChanged)
|
||||
Q_PROPERTY(bool pttRightControllerEnabled READ pttRightControllerEnabled WRITE setPttRightControllerEnabled NOTIFY pttRightControllerEnabledChanged)
|
||||
|
||||
private:
|
||||
protected:
|
||||
bool m_pttEnabled = false;
|
||||
bool m_pttActive = false;
|
||||
bool m_pttShowNotification = false;
|
||||
|
||||
Reference in New Issue
Block a user