Configurable scroll wheel volume logic

This commit is contained in:
Maikiwi 2022-01-26 20:31:22 -08:00
parent e220cfb7bc
commit 992887eecf
2 changed files with 13 additions and 5 deletions

View file

@ -32,6 +32,9 @@ export class ConfigStore {
"normalization": false,
"spatial": false,
"maxVolume": 1,
"volumePrecision": 0.1,
"volumeRoundMax": 0.9,
"volumeRoundMin": 0.1,
"spatial_properties": {
"presets": [],
"gain": 0.8,

View file

@ -3079,18 +3079,23 @@ const app = new Vue({
})
},
volumeWheel(event) {
if (this.cfg.audio.maxVolume < 1.0 && this.cfg.audio.maxVolume > 0.01) {
this.cfg.audio.volumePrecision = 0.01
this.cfg.audio.volumeRoundMax = this.cfg.audio.maxVolume - 0.01
this.cfg.audio.volumeRoundMin = 0.01
}
if (event.deltaY < 0) {
if (this.mk.volume < 1) {
if (this.mk.volume <= 0.9) {
this.mk.volume += 0.1
if (this.mk.volume < this.cfg.audio.maxVolume) {
if (this.mk.volume <= this.cfg.audio.volumeRoundMax) {
this.mk.volume += this.cfg.audio.volumePrecision
} else {
this.mk.volume = this.cfg.audio.maxVolume
}
}
} else if (event.deltaY > 0) {
if (this.mk.volume > 0) {
if (this.mk.volume >= 0.1) {
this.mk.volume -= 0.1
if (this.mk.volume >= this.cfg.audio.volumeRoundMin) {
this.mk.volume -= this.cfg.audio.volumePrecision
} else {
this.mk.volume = 0
}