3
0
Fork 0
mirror of https://thingvellir.net/git/overte synced 2025-03-27 23:52:03 +01:00

Merge pull request from wayne-chen/useThresholdMutedWarning

Case 22447: The "MUTED" indicator (which warns when talking while muted) constantly flickers
This commit is contained in:
Wayne Chen 2019-05-06 13:55:59 -07:00 committed by GitHub
commit 845ad38106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,20 @@ Rectangle {
property var pushingToTalk: AudioScriptingInterface.pushingToTalk;
readonly property var userSpeakingLevel: 0.4;
property bool gated: false;
Timer {
// used to hold the muted warning.
id: mutedTimer
interval: 2000;
running: false;
repeat: false;
property bool isRunning: false;
onTriggered: {
isRunning = false;
}
}
Component.onCompleted: {
AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; });
AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; });
@ -54,7 +68,17 @@ Rectangle {
opacity: 0.7;
onLevelChanged: {
var rectOpacity = (muted && (level >= userSpeakingLevel)) ? 1.0 : 0.7;
var mutedAndSpeaking = (muted && (level >= userSpeakingLevel));
if (!mutedTimer.isRunning && !pushToTalk) {
if (mutedAndSpeaking) {
mutedTimer.start();
mutedTimer.isRunning = true;
statusText.text = "MUTED";
} else {
statusText.text = "";
}
}
var rectOpacity = mutedAndSpeaking ? 1.0 : 0.7;
if (pushToTalk && !pushingToTalk) {
rectOpacity = (mouseArea.containsMouse) ? 1.0 : 0.7;
} else if (mouseArea.containsMouse && rectOpacity != 1.0) {
@ -63,6 +87,10 @@ Rectangle {
micBar.opacity = rectOpacity;
}
onPushToTalkChanged: {
statusText.text = pushToTalk ? HMD.active ? "PTT" : "PTT-(T)" : "";
}
color: "#00000000";
border {
width: mouseArea.containsMouse || mouseArea.containsPress ? 2 : 0;
@ -190,7 +218,6 @@ Rectangle {
color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : (level >= userSpeakingLevel && muted) ? colors.mutedColor : colors.unmutedColor;
font.bold: true
text: pushToTalk ? (HMD.active ? "PTT" : "PTT-(T)") : (muted ? "MUTED" : "MUTE");
size: 12;
}
}