mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
adding timer for muted warning
This commit is contained in:
parent
c1ee4deb12
commit
d31ed9ac22
1 changed files with 29 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue