Merge pull request #15608 from zfox23/SUI/envVol

Fix environment volume slider (BUGZ-213); optimize sliders
This commit is contained in:
Zach Fox 2019-05-22 14:11:57 -07:00 committed by GitHub
commit ddb299a387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 12 deletions

View file

@ -68,57 +68,88 @@ Flickable {
SimplifiedControls.Slider { SimplifiedControls.Slider {
id: peopleVolume id: peopleVolume
property real lastValueSent
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin
height: 30 height: 30
labelText: "People Volume" labelText: "People Volume"
from: -60 from: -60.0
to: 10 to: 20.0
defaultValue: 0.0 defaultValue: 0.0
stepSize: 5.0
value: AudioScriptingInterface.getAvatarGain() value: AudioScriptingInterface.getAvatarGain()
live: true live: true
function updatePeopleGain(sliderValue) {
if (AudioScriptingInterface.getAvatarGain() !== sliderValue) {
AudioScriptingInterface.setAvatarGain(sliderValue);
}
}
onValueChanged: { onValueChanged: {
if (AudioScriptingInterface.getAvatarGain() != peopleVolume.value) { updatePeopleGain(value);
AudioScriptingInterface.setAvatarGain(peopleVolume.value); }
onPressedChanged: {
if (!pressed) {
updatePeopleGain(value);
} }
} }
} }
SimplifiedControls.Slider { SimplifiedControls.Slider {
id: environmentVolume id: environmentVolume
property real lastValueSent
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Layout.topMargin: 2 Layout.topMargin: 2
height: 30 height: 30
labelText: "Environment Volume" labelText: "Environment Volume"
from: -60 from: -60.0
to: 10 to: 20.0
defaultValue: 0.0 defaultValue: 0.0
stepSize: 5.0
value: AudioScriptingInterface.getInjectorGain() value: AudioScriptingInterface.getInjectorGain()
live: true live: true
function updateEnvironmentGain(sliderValue) {
if (AudioScriptingInterface.getInjectorGain() !== sliderValue) {
AudioScriptingInterface.setInjectorGain(sliderValue);
AudioScriptingInterface.setLocalInjectorGain(sliderValue);
}
}
onValueChanged: { onValueChanged: {
if (AudioScriptingInterface.getInjectorGain() != environmentVolume.value) { updateEnvironmentGain(value);
AudioScriptingInterface.setInjectorGain(environmentVolume.value); }
onPressedChanged: {
if (!pressed) {
updateEnvironmentGain(value);
} }
} }
} }
SimplifiedControls.Slider { SimplifiedControls.Slider {
id: systemSoundVolume id: systemSoundVolume
property real lastValueSent
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Layout.topMargin: 2 Layout.topMargin: 2
height: 30 height: 30
labelText: "System Sound Volume" labelText: "System Sound Volume"
from: -60 from: -60.0
to: 10 to: 20.0
defaultValue: 0.0 defaultValue: 0.0
stepSize: 5.0
value: AudioScriptingInterface.getSystemInjectorGain() value: AudioScriptingInterface.getSystemInjectorGain()
live: true live: true
function updateSystemGain(sliderValue) {
if (AudioScriptingInterface.getSystemInjectorGain() !== sliderValue) {
AudioScriptingInterface.setSystemInjectorGain(sliderValue);
}
}
onValueChanged: { onValueChanged: {
if (AudioScriptingInterface.getSystemInjectorGain() != systemSoundVolume.value) { updateSystemGain(value);
AudioScriptingInterface.setSystemInjectorGain(systemSoundVolume.value); }
onPressedChanged: {
if (!pressed) {
updateSystemGain(value);
} }
} }
} }

View file

@ -30,6 +30,7 @@ Item {
property alias live: sliderControl.live property alias live: sliderControl.live
property alias stepSize: sliderControl.stepSize property alias stepSize: sliderControl.stepSize
property alias snapMode: sliderControl.snapMode property alias snapMode: sliderControl.snapMode
property alias pressed: sliderControl.pressed
property real defaultValue: 0.0 property real defaultValue: 0.0
HifiStylesUit.GraphikRegular { HifiStylesUit.GraphikRegular {