diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index c13bd3281a..9ebde8b61f 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -36,6 +36,23 @@ Rectangle { return root.parent.objectName == "loader"; } + property bool showPeaks: true; + function enablePeakValues() { + Audio.devices.input.peakValuesEnabled = true; + Audio.devices.input.peakValuesEnabledChanged.connect(function(enabled) { + if (!enabled && root.showPeaks) { + Audio.devices.input.peakValuesEnabled = true; + } + }); + } + function disablePeakValues() { + root.showPeaks = false; + Audio.devices.input.peakValuesEnabled = false; + } + + Component.onCompleted: enablePeakValues(); + Component.onDestruction: disablePeakValues(); + Column { y: 16; // padding does not work spacing: 16; @@ -122,7 +139,7 @@ Rectangle { width: parent.width; AudioControls.CheckBox { - Layout.maximumWidth: parent.width - level.width - 40; + Layout.maximumWidth: parent.width - inputPeak.width - 40; text: display; wrap: false; checked: selected; @@ -131,11 +148,12 @@ Rectangle { checked = Qt.binding(function() { return selected; }); // restore binding } } - InputLevel { - id: level; + InputPeak { + id: inputPeak; + visible: Audio.devices.input.peakValuesAvailable; + peak: model.peak; Layout.alignment: Qt.AlignRight; Layout.rightMargin: 30; - visible: selected; } } } diff --git a/interface/resources/qml/hifi/audio/InputLevel.qml b/interface/resources/qml/hifi/audio/InputPeak.qml similarity index 95% rename from interface/resources/qml/hifi/audio/InputLevel.qml rename to interface/resources/qml/hifi/audio/InputPeak.qml index 58ce3a1ec7..4ff49091b1 100644 --- a/interface/resources/qml/hifi/audio/InputLevel.qml +++ b/interface/resources/qml/hifi/audio/InputPeak.qml @@ -1,5 +1,5 @@ // -// InputLevel.qml +// InputPeak.qml // qml/hifi/audio // // Created by Zach Pomerantz on 6/20/2017 @@ -15,7 +15,7 @@ import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 Rectangle { - readonly property var level: Audio.inputLevel; + property var peak; width: 70; height: 8; @@ -65,7 +65,7 @@ Rectangle { Rectangle { // mask id: mask; - width: parent.width * level; + width: parent.width * peak; radius: 5; anchors { bottom: parent.bottom;