feat: configurable max volume (#723)

* feat: configurable max volume

- Add maxVolume config option to ServiceConfig
- Add maxValue property to FilledSlider component
- Update OSD sliders to respect maxVolume setting
- Update example config in README

* fix: remove redundant maxValue prop
This commit is contained in:
Robin Seger 2025-10-13 13:50:56 +02:00 committed by GitHub
parent 72d335d7c5
commit dde0f85e78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View file

@ -546,6 +546,7 @@ default, you must create it manually.
},
"services": {
"audioIncrement": 0.1,
"maxVolume": 1.0,
"defaultPlayer": "Spotify",
"gpuType": "",
"playerAliases": [{ "from": "com.github.th_ch.youtube_music", "to": "YT Music" }],

View file

@ -8,6 +8,7 @@ JsonObject {
property string gpuType: ""
property int visualiserBars: 45
property real audioIncrement: 0.1
property real maxVolume: 1.0
property bool smartScheme: true
property string defaultPlayer: "Spotify"
property list<var> playerAliases: [

View file

@ -46,6 +46,7 @@ Item {
icon: Icons.getVolumeIcon(value, root.muted)
value: root.volume
to: Config.services.maxVolume
onMoved: Audio.setVolume(value)
}
}
@ -70,6 +71,7 @@ Item {
icon: Icons.getMicVolumeIcon(value, root.sourceMuted)
value: root.sourceVolume
to: Config.services.maxVolume
onMoved: Audio.setSourceVolume(value)
}
}

View file

@ -44,7 +44,7 @@ Singleton {
function setVolume(newVolume: real): void {
if (sink?.ready && sink?.audio) {
sink.audio.muted = false;
sink.audio.volume = Math.max(0, Math.min(1, newVolume));
sink.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume));
}
}
@ -59,7 +59,7 @@ Singleton {
function setSourceVolume(newVolume: real): void {
if (source?.ready && source?.audio) {
source.audio.muted = false;
source.audio.volume = Math.max(0, Math.min(1, newVolume));
source.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume));
}
}