mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 20:23:06 +02: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;
|
property var pushingToTalk: AudioScriptingInterface.pushingToTalk;
|
||||||
readonly property var userSpeakingLevel: 0.4;
|
readonly property var userSpeakingLevel: 0.4;
|
||||||
property bool gated: false;
|
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: {
|
Component.onCompleted: {
|
||||||
AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; });
|
AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; });
|
||||||
AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; });
|
AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; });
|
||||||
|
@ -54,7 +68,17 @@ Rectangle {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
|
||||||
onLevelChanged: {
|
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) {
|
if (pushToTalk && !pushingToTalk) {
|
||||||
rectOpacity = (mouseArea.containsMouse) ? 1.0 : 0.7;
|
rectOpacity = (mouseArea.containsMouse) ? 1.0 : 0.7;
|
||||||
} else if (mouseArea.containsMouse && rectOpacity != 1.0) {
|
} else if (mouseArea.containsMouse && rectOpacity != 1.0) {
|
||||||
|
@ -63,6 +87,10 @@ Rectangle {
|
||||||
micBar.opacity = rectOpacity;
|
micBar.opacity = rectOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPushToTalkChanged: {
|
||||||
|
statusText.text = pushToTalk ? HMD.active ? "PTT" : "PTT-(T)" : "";
|
||||||
|
}
|
||||||
|
|
||||||
color: "#00000000";
|
color: "#00000000";
|
||||||
border {
|
border {
|
||||||
width: mouseArea.containsMouse || mouseArea.containsPress ? 2 : 0;
|
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;
|
color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : (level >= userSpeakingLevel && muted) ? colors.mutedColor : colors.unmutedColor;
|
||||||
font.bold: true
|
font.bold: true
|
||||||
|
|
||||||
text: pushToTalk ? (HMD.active ? "PTT" : "PTT-(T)") : (muted ? "MUTED" : "MUTE");
|
|
||||||
size: 12;
|
size: 12;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue