mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Prototype an updated Audio tab with 3 independent volume controls
This commit is contained in:
parent
3d7c3e7b6f
commit
7b56bef838
3 changed files with 158 additions and 32 deletions
|
@ -87,8 +87,19 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMyAvatarGainFromQML(sliderValue, isReleased) {
|
function updateMyAvatarGainFromQML(sliderValue, isReleased) {
|
||||||
if (Users.getAvatarGain(myAvatarUuid) != sliderValue) {
|
if (AudioScriptingInterface.getAvatarGain() != sliderValue) {
|
||||||
Users.setAvatarGain(myAvatarUuid, sliderValue);
|
AudioScriptingInterface.setAvatarGain(sliderValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function updateInjectorGainFromQML(sliderValue, isReleased) {
|
||||||
|
if (AudioScriptingInterface.getInjectorGain() != sliderValue) {
|
||||||
|
AudioScriptingInterface.setInjectorGain(sliderValue); // server side
|
||||||
|
AudioScriptingInterface.setLocalInjectorGain(sliderValue); // client side
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function updateSystemInjectorGainFromQML(sliderValue, isReleased) {
|
||||||
|
if (AudioScriptingInterface.getSystemInjectorGain() != sliderValue) {
|
||||||
|
AudioScriptingInterface.setSystemInjectorGain(sliderValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,6 +345,7 @@ Rectangle {
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
text: qsTr("Choose input device");
|
text: qsTr("Choose input device");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
|
@ -462,22 +474,22 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: gainContainer
|
id: avatarGainContainer
|
||||||
x: margins.paddings;
|
x: margins.paddings;
|
||||||
anchors.top: outputView.bottom;
|
anchors.top: outputView.bottom;
|
||||||
anchors.topMargin: 10;
|
anchors.topMargin: 10;
|
||||||
width: parent.width - margins.paddings*2
|
width: parent.width - margins.paddings*2
|
||||||
height: gainSliderTextMetrics.height
|
height: avatarGainSliderTextMetrics.height
|
||||||
|
|
||||||
HifiControlsUit.Slider {
|
HifiControlsUit.Slider {
|
||||||
id: gainSlider
|
id: avatarGainSlider
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: 200
|
width: 200
|
||||||
minimumValue: -60.0
|
minimumValue: -60.0
|
||||||
maximumValue: 20.0
|
maximumValue: 20.0
|
||||||
stepSize: 5
|
stepSize: 5
|
||||||
value: Users.getAvatarGain(myAvatarUuid)
|
value: AudioScriptingInterface.getAvatarGain()
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
updateMyAvatarGainFromQML(value, false);
|
updateMyAvatarGainFromQML(value, false);
|
||||||
}
|
}
|
||||||
|
@ -493,7 +505,7 @@ Rectangle {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
onDoubleClicked: {
|
onDoubleClicked: {
|
||||||
gainSlider.value = 0.0
|
avatarGainSlider.value = 0.0
|
||||||
}
|
}
|
||||||
onPressed: {
|
onPressed: {
|
||||||
// Pass through to Slider
|
// Pass through to Slider
|
||||||
|
@ -507,13 +519,13 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: gainSliderTextMetrics
|
id: avatarGainSliderTextMetrics
|
||||||
text: gainSliderText.text
|
text: avatarGainSliderText.text
|
||||||
font: gainSliderText.font
|
font: avatarGainSliderText.font
|
||||||
}
|
}
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
// The slider for my card is special, it controls the master gain
|
// The slider for my card is special, it controls the master gain
|
||||||
id: gainSliderText;
|
id: avatarGainSliderText;
|
||||||
text: "Avatar volume";
|
text: "Avatar volume";
|
||||||
size: 16;
|
size: 16;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -523,15 +535,129 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: injectorGainContainer
|
||||||
|
x: margins.paddings;
|
||||||
|
width: parent.width - margins.paddings*2
|
||||||
|
height: injectorGainSliderTextMetrics.height
|
||||||
|
|
||||||
|
HifiControlsUit.Slider {
|
||||||
|
id: injectorGainSlider
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: parent.height
|
||||||
|
width: 200
|
||||||
|
minimumValue: -60.0
|
||||||
|
maximumValue: 20.0
|
||||||
|
stepSize: 5
|
||||||
|
value: AudioScriptingInterface.getInjectorGain()
|
||||||
|
onValueChanged: {
|
||||||
|
updateInjectorGainFromQML(value, false);
|
||||||
|
}
|
||||||
|
onPressedChanged: {
|
||||||
|
if (!pressed) {
|
||||||
|
updateInjectorGainFromQML(value, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onWheel: {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
onDoubleClicked: {
|
||||||
|
injectorGainSlider.value = 0.0
|
||||||
|
}
|
||||||
|
onPressed: {
|
||||||
|
// Pass through to Slider
|
||||||
|
mouse.accepted = false
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
// the above mouse.accepted seems to make this
|
||||||
|
// never get called, nonetheless...
|
||||||
|
mouse.accepted = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TextMetrics {
|
||||||
|
id: injectorGainSliderTextMetrics
|
||||||
|
text: injectorGainSliderText.text
|
||||||
|
font: injectorGainSliderText.font
|
||||||
|
}
|
||||||
|
RalewayRegular {
|
||||||
|
id: injectorGainSliderText;
|
||||||
|
text: "Environment volume";
|
||||||
|
size: 16;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
color: hifi.colors.white;
|
||||||
|
horizontalAlignment: Text.AlignLeft;
|
||||||
|
verticalAlignment: Text.AlignTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: systemInjectorGainContainer
|
||||||
|
x: margins.paddings;
|
||||||
|
width: parent.width - margins.paddings*2
|
||||||
|
height: systemInjectorGainSliderTextMetrics.height
|
||||||
|
|
||||||
|
HifiControlsUit.Slider {
|
||||||
|
id: systemInjectorGainSlider
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: parent.height
|
||||||
|
width: 200
|
||||||
|
minimumValue: -60.0
|
||||||
|
maximumValue: 20.0
|
||||||
|
stepSize: 5
|
||||||
|
value: AudioScriptingInterface.getSystemInjectorGain()
|
||||||
|
onValueChanged: {
|
||||||
|
updateSystemInjectorGainFromQML(value, false);
|
||||||
|
}
|
||||||
|
onPressedChanged: {
|
||||||
|
if (!pressed) {
|
||||||
|
updateSystemInjectorGainFromQML(value, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onWheel: {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
onDoubleClicked: {
|
||||||
|
systemInjectorGainSlider.value = 0.0
|
||||||
|
}
|
||||||
|
onPressed: {
|
||||||
|
// Pass through to Slider
|
||||||
|
mouse.accepted = false
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
// the above mouse.accepted seems to make this
|
||||||
|
// never get called, nonetheless...
|
||||||
|
mouse.accepted = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TextMetrics {
|
||||||
|
id: systemInjectorGainSliderTextMetrics
|
||||||
|
text: systemInjectorGainSliderText.text
|
||||||
|
font: systemInjectorGainSliderText.font
|
||||||
|
}
|
||||||
|
RalewayRegular {
|
||||||
|
id: systemInjectorGainSliderText;
|
||||||
|
text: "System Sound volume";
|
||||||
|
size: 16;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
color: hifi.colors.white;
|
||||||
|
horizontalAlignment: Text.AlignLeft;
|
||||||
|
verticalAlignment: Text.AlignTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AudioControls.PlaySampleSound {
|
AudioControls.PlaySampleSound {
|
||||||
id: playSampleSound
|
id: playSampleSound
|
||||||
x: margins.paddings
|
x: margins.paddings
|
||||||
anchors.top: gainContainer.bottom;
|
anchors.top: systemInjectorGainContainer.bottom;
|
||||||
anchors.topMargin: 10;
|
anchors.topMargin: 10;
|
||||||
|
|
||||||
visible: (bar.currentIndex === 1 && isVR) ||
|
|
||||||
(bar.currentIndex === 0 && !isVR);
|
|
||||||
anchors { left: parent.left; leftMargin: margins.paddings }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ RowLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
text: audioLoopedBack ? qsTr("STOP TESTING YOUR VOICE") : qsTr("TEST YOUR VOICE");
|
text: audioLoopedBack ? qsTr("STOP TESTING") : qsTr("TEST YOUR VOICE");
|
||||||
color: audioLoopedBack ? hifi.buttons.red : hifi.buttons.blue;
|
color: audioLoopedBack ? hifi.buttons.red : hifi.buttons.blue;
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (audioLoopedBack) {
|
if (audioLoopedBack) {
|
||||||
|
@ -57,11 +57,11 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewayRegular {
|
// RalewayRegular {
|
||||||
Layout.leftMargin: 2;
|
// Layout.leftMargin: 2;
|
||||||
size: 14;
|
// size: 14;
|
||||||
color: "white";
|
// color: "white";
|
||||||
font.italic: true
|
// font.italic: true
|
||||||
text: audioLoopedBack ? qsTr("Speak in your input") : "";
|
// text: audioLoopedBack ? qsTr("Speak in your input") : "";
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,16 +56,16 @@ RowLayout {
|
||||||
HifiConstants { id: hifi; }
|
HifiConstants { id: hifi; }
|
||||||
|
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
text: isPlaying ? qsTr("STOP TESTING YOUR SOUND") : qsTr("TEST YOUR SOUND");
|
text: isPlaying ? qsTr("STOP TESTING") : qsTr("TEST YOUR SOUND");
|
||||||
color: isPlaying ? hifi.buttons.red : hifi.buttons.blue;
|
color: isPlaying ? hifi.buttons.red : hifi.buttons.blue;
|
||||||
onClicked: isPlaying ? stopSound() : playSound();
|
onClicked: isPlaying ? stopSound() : playSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewayRegular {
|
// RalewayRegular {
|
||||||
Layout.leftMargin: 2;
|
// Layout.leftMargin: 2;
|
||||||
size: 14;
|
// size: 14;
|
||||||
color: "white";
|
// color: "white";
|
||||||
font.italic: true
|
// font.italic: true
|
||||||
text: isPlaying ? qsTr("Listen to your output") : "";
|
// text: isPlaying ? qsTr("Listen to your output") : "";
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue