Alarm: snapshot active volume at start to fix pre-alarm volume restore#1563
Merged
michaelherger merged 1 commit intoLMS-Community:public/9.2from May 6, 2026
Merged
Conversation
For alarms using the default volume, the restore check in stop() called
$self->volume dynamically, which reads alarmDefaultVolume live. If that
setting changed mid-alarm the check would fail and the pre-alarm volume
would never be restored, even though the user hadn't touched the player.
Fix: capture $self->volume into $self->{_activeVolume} in sound() and
compare against that snapshot in stop(). The // fallback handles alarm
objects created before this field existed.
Signed-off-by: Bartosz Oudekerk <lot+github@unreachablehost.net>
Member
|
I don't follow. There's only one volume setting. There is no per-alarm setting, is there? |
Contributor
Author
|
It looks like the per-alarm setting is simply not being exposed: slimserver/Slim/Utils/Alarm.pm Line 317 in 20b20dd slimserver/Slim/Utils/Alarm.pm Line 353 in 20b20dd |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
For alarms that use the default volume (i.e. no per-alarm volume override), the restore check in
stop()calls$self->volumedynamically. That method falls through todefaultVolume()which reads thealarmDefaultVolumepreference live.If the user changes the default alarm volume in settings while an alarm is active,
$self->volumenow returns a different value than the one that was set at alarm start. The guard condition:then fails, and the pre-alarm volume is never restored — even though the user never touched the player volume during the alarm.
Fix
Snapshot
$self->volumeinto$self->{_activeVolume}insound()and compare against that snapshot instop(). The//fallback handles alarm objects that were created before this field existed.This does not change behaviour when the user manually adjusts volume during an alarm: the current volume will differ from
_activeVolume, so the restore is correctly skipped.