mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 11:24:12 +02:00
add peak values to qml
This commit is contained in:
parent
5353437f59
commit
9b72ab96ff
2 changed files with 25 additions and 7 deletions
|
@ -36,6 +36,23 @@ Rectangle {
|
||||||
return root.parent.objectName == "loader";
|
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 {
|
Column {
|
||||||
y: 16; // padding does not work
|
y: 16; // padding does not work
|
||||||
spacing: 16;
|
spacing: 16;
|
||||||
|
@ -122,7 +139,7 @@ Rectangle {
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
|
|
||||||
AudioControls.CheckBox {
|
AudioControls.CheckBox {
|
||||||
Layout.maximumWidth: parent.width - level.width - 40;
|
Layout.maximumWidth: parent.width - inputPeak.width - 40;
|
||||||
text: display;
|
text: display;
|
||||||
wrap: false;
|
wrap: false;
|
||||||
checked: selected;
|
checked: selected;
|
||||||
|
@ -131,11 +148,12 @@ Rectangle {
|
||||||
checked = Qt.binding(function() { return selected; }); // restore binding
|
checked = Qt.binding(function() { return selected; }); // restore binding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InputLevel {
|
InputPeak {
|
||||||
id: level;
|
id: inputPeak;
|
||||||
|
visible: Audio.devices.input.peakValuesAvailable;
|
||||||
|
peak: model.peak;
|
||||||
Layout.alignment: Qt.AlignRight;
|
Layout.alignment: Qt.AlignRight;
|
||||||
Layout.rightMargin: 30;
|
Layout.rightMargin: 30;
|
||||||
visible: selected;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// InputLevel.qml
|
// InputPeak.qml
|
||||||
// qml/hifi/audio
|
// qml/hifi/audio
|
||||||
//
|
//
|
||||||
// Created by Zach Pomerantz on 6/20/2017
|
// Created by Zach Pomerantz on 6/20/2017
|
||||||
|
@ -15,7 +15,7 @@ import QtQuick.Layouts 1.3
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
readonly property var level: Audio.inputLevel;
|
property var peak;
|
||||||
|
|
||||||
width: 70;
|
width: 70;
|
||||||
height: 8;
|
height: 8;
|
||||||
|
@ -65,7 +65,7 @@ Rectangle {
|
||||||
|
|
||||||
Rectangle { // mask
|
Rectangle { // mask
|
||||||
id: mask;
|
id: mask;
|
||||||
width: parent.width * level;
|
width: parent.width * peak;
|
||||||
radius: 5;
|
radius: 5;
|
||||||
anchors {
|
anchors {
|
||||||
bottom: parent.bottom;
|
bottom: parent.bottom;
|
Loading…
Reference in a new issue