Merge pull request #15625 from zfox23/SUI/BUGZ-336

Fix BUGZ-336: Microphone test does not stop unless you press the button to "stop test"
This commit is contained in:
Shannon Romano 2019-05-23 15:17:37 -07:00 committed by GitHub
commit aaf4bef34e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 18 deletions

View file

@ -247,6 +247,7 @@ Flickable {
} }
SimplifiedControls.Button { SimplifiedControls.Button {
id: audioLoopbackButton
property bool audioLoopedBack: AudioScriptingInterface.getLocalEcho() property bool audioLoopedBack: AudioScriptingInterface.getLocalEcho()
function startAudioLoopback() { function startAudioLoopback() {
@ -262,17 +263,14 @@ Flickable {
} }
} }
Timer { Component.onDestruction: stopAudioLoopback();
id: loopbackTimer
interval: 8000 onVisibleChanged: {
running: false if (!visible) {
repeat: false
onTriggered: {
stopAudioLoopback(); stopAudioLoopback();
} }
} }
id: testYourMicButton
enabled: !HMD.active enabled: !HMD.active
Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin
width: 160 width: 160
@ -280,10 +278,8 @@ Flickable {
text: audioLoopedBack ? "STOP TESTING" : "TEST YOUR MIC" text: audioLoopedBack ? "STOP TESTING" : "TEST YOUR MIC"
onClicked: { onClicked: {
if (audioLoopedBack) { if (audioLoopedBack) {
loopbackTimer.stop();
stopAudioLoopback(); stopAudioLoopback();
} else { } else {
loopbackTimer.restart();
startAudioLoopback(); startAudioLoopback();
} }
} }

View file

@ -236,6 +236,7 @@ Flickable {
} }
SimplifiedControls.Button { SimplifiedControls.Button {
id: audioLoopbackButton
property bool audioLoopedBack: AudioScriptingInterface.getLocalEcho() property bool audioLoopedBack: AudioScriptingInterface.getLocalEcho()
function startAudioLoopback() { function startAudioLoopback() {
@ -251,17 +252,14 @@ Flickable {
} }
} }
Timer { Component.onDestruction: stopAudioLoopback();
id: loopbackTimer
interval: 8000 onVisibleChanged: {
running: false if (!visible) {
repeat: false
onTriggered: {
stopAudioLoopback(); stopAudioLoopback();
} }
} }
id: testYourMicButton
enabled: HMD.active enabled: HMD.active
Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin
width: 160 width: 160
@ -269,10 +267,8 @@ Flickable {
text: audioLoopedBack ? "STOP TESTING" : "TEST YOUR MIC" text: audioLoopedBack ? "STOP TESTING" : "TEST YOUR MIC"
onClicked: { onClicked: {
if (audioLoopedBack) { if (audioLoopedBack) {
loopbackTimer.stop();
stopAudioLoopback(); stopAudioLoopback();
} else { } else {
loopbackTimer.restart();
startAudioLoopback(); startAudioLoopback();
} }
} }