diff options
author | Loïc Collignon <loic.collignon@iot.bzh> | 2018-03-13 08:56:37 +0100 |
---|---|---|
committer | Loïc Collignon <loic.collignon@iot.bzh> | 2018-06-14 11:36:47 +0200 |
commit | 6bf2ccbd72176a8cbdfb3cdb2c15ee1c2db594b8 (patch) | |
tree | 52d9432e8f74507e4aaf477ca5605de6812bdecf /app/Mixer.qml | |
parent | 47695d79a938eb52c116062c218147049b994246 (diff) |
make use of alsacore and hal bindings to control audio volume
Change-Id: Ib7e90a7d2a148a067566bc04929fda445b46ab45
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'app/Mixer.qml')
-rw-r--r-- | app/Mixer.qml | 161 |
1 files changed, 97 insertions, 64 deletions
diff --git a/app/Mixer.qml b/app/Mixer.qml index 96875e0..2b6d5cc 100644 --- a/app/Mixer.qml +++ b/app/Mixer.qml @@ -18,11 +18,21 @@ import QtQuick 2.6 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import AGL.Demo.Controls 1.0 -import PaControlModel 1.0 +import Mixer 1.0 ApplicationWindow { id: root + Mixer { + id: mixer + Component.objectName: { + mixer.open(bindingAddress) + } + onMasterVolumeChanged: sliderMasterVolume.value = masterVolume + onPcmVolumeChanged: sliderPcmVolume.value = pcmVolume + onMicrophoneVolumeChanged: sliderMicrophoneVolume.value = microphoneVolume + } + Label { id: title font.pixelSize: 48 @@ -30,69 +40,92 @@ ApplicationWindow { anchors.horizontalCenter: parent.horizontalCenter } - Component { - id: ctldesc - Label { - font.pixelSize: 32 - width: listView.width - wrapMode: Text.WordWrap - property var typeString: {modelType ? "Output" : "Input"} - text: "[" + typeString + " #" + modelCIndex + "]: " + modelDesc - } - } + ColumnLayout { + anchors.margins: 80 + anchors.top: title.bottom + anchors.left: parent.left + anchors.right: parent.right - Component { - id: empty - Item { - } - } + ComboBox { + id: soundCardSelector + anchors.left: parent.left + anchors.right: parent.right + model: mixer.hals + onCurrentIndexChanged: mixer.ActiveHal = currentIndex + } - ListView { - id: listView - anchors.left: parent.left - anchors.top: title.bottom - anchors.margins: 80 - anchors.fill: parent - model: PaControlModel { objectName: "pacm" } - delegate: ColumnLayout { - width: parent.width - spacing: 40 - Connections { - target: listView.model - onDataChanged: slider.value = volume - } - Loader { - property int modelType: type - property int modelCIndex: cindex - property string modelDesc: name - sourceComponent: (channel == 0) ? ctldesc : empty - } - RowLayout { - Layout.minimumHeight: 75 - Label { - font.pixelSize: 24 - text: cdesc - Layout.minimumWidth: 150 - } - Label { - font.pixelSize: 24 - text: "0 %" - } - Slider { - id: slider - Layout.fillWidth: true - from: 0 - to: 65536 - stepSize: 256 - snapMode: Slider.SnapOnRelease - onValueChanged: volume = value - Component.onCompleted: value = volume - } - Label { - font.pixelSize: 24 - text: "100 %" - } - } - } - } + RowLayout { + Layout.minimumHeight: 75 + Label { + font.pixelSize: 24 + text: "Master" + Layout.minimumWidth: 150 + } + Label { + id: textMasterVolume + font.pixelSize: 24 + text: "0 %" + } + Slider { + id: sliderMasterVolume + Layout.fillWidth: true + from: 0 + to: 100 + stepSize: 1 + snapMode: Slider.SnapOnRelease + onValueChanged: { + textMasterVolume.text = value + " %" + mixer.masterVolume = value + } + } + } +/* + RowLayout { + Layout.minimumHeight: 75 + Label { + font.pixelSize: 24 + text: "PCM" + Layout.minimumWidth: 150 + } + Label { + font.pixelSize: 24 + text: "0 %" + } + Slider { + id: sliderPcmVolume + Layout.fillWidth: true + from: 0 + to: 100 + stepSize: 1 + snapMode: Slider.SnapOnRelease + onValueChanged: mixer.pcmVolume = value + } + } +*/ + RowLayout { + Layout.minimumHeight: 75 + Label { + font.pixelSize: 24 + text: "Microphone" + Layout.minimumWidth: 150 + } + Label { + id: textMicrophoneVolume + font.pixelSize: 24 + text: "0 %" + } + Slider { + id: sliderMicrophoneVolume + Layout.fillWidth: true + from: 0 + to: 100 + stepSize: 1 + snapMode: Slider.SnapOnRelease + onValueChanged: { + textMicrophoneVolume.text = value + " %" + mixer.microphoneVolume = value + } + } + } + } } |