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:
parent
72d335d7c5
commit
dde0f85e78
4 changed files with 6 additions and 2 deletions
|
|
@ -546,6 +546,7 @@ default, you must create it manually.
|
||||||
},
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"audioIncrement": 0.1,
|
"audioIncrement": 0.1,
|
||||||
|
"maxVolume": 1.0,
|
||||||
"defaultPlayer": "Spotify",
|
"defaultPlayer": "Spotify",
|
||||||
"gpuType": "",
|
"gpuType": "",
|
||||||
"playerAliases": [{ "from": "com.github.th_ch.youtube_music", "to": "YT Music" }],
|
"playerAliases": [{ "from": "com.github.th_ch.youtube_music", "to": "YT Music" }],
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ JsonObject {
|
||||||
property string gpuType: ""
|
property string gpuType: ""
|
||||||
property int visualiserBars: 45
|
property int visualiserBars: 45
|
||||||
property real audioIncrement: 0.1
|
property real audioIncrement: 0.1
|
||||||
|
property real maxVolume: 1.0
|
||||||
property bool smartScheme: true
|
property bool smartScheme: true
|
||||||
property string defaultPlayer: "Spotify"
|
property string defaultPlayer: "Spotify"
|
||||||
property list<var> playerAliases: [
|
property list<var> playerAliases: [
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ Item {
|
||||||
|
|
||||||
icon: Icons.getVolumeIcon(value, root.muted)
|
icon: Icons.getVolumeIcon(value, root.muted)
|
||||||
value: root.volume
|
value: root.volume
|
||||||
|
to: Config.services.maxVolume
|
||||||
onMoved: Audio.setVolume(value)
|
onMoved: Audio.setVolume(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -70,6 +71,7 @@ Item {
|
||||||
|
|
||||||
icon: Icons.getMicVolumeIcon(value, root.sourceMuted)
|
icon: Icons.getMicVolumeIcon(value, root.sourceMuted)
|
||||||
value: root.sourceVolume
|
value: root.sourceVolume
|
||||||
|
to: Config.services.maxVolume
|
||||||
onMoved: Audio.setSourceVolume(value)
|
onMoved: Audio.setSourceVolume(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ Singleton {
|
||||||
function setVolume(newVolume: real): void {
|
function setVolume(newVolume: real): void {
|
||||||
if (sink?.ready && sink?.audio) {
|
if (sink?.ready && sink?.audio) {
|
||||||
sink.audio.muted = false;
|
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 {
|
function setSourceVolume(newVolume: real): void {
|
||||||
if (source?.ready && source?.audio) {
|
if (source?.ready && source?.audio) {
|
||||||
source.audio.muted = false;
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue