From f79e7ceeca331cbb31fb606ff21c142b61891efa Mon Sep 17 00:00:00 2001 From: devgianlu Date: Tue, 19 Nov 2024 19:15:31 +0100 Subject: [PATCH] fix: always notify volume changes Fixes #146 --- cmd/daemon/controls.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/daemon/controls.go b/cmd/daemon/controls.go index 6e5a916..cb12a57 100644 --- a/cmd/daemon/controls.go +++ b/cmd/daemon/controls.go @@ -589,7 +589,7 @@ func (p *AppPlayer) apiVolume() uint32 { return uint32(math.Ceil(float64(p.state.device.Volume*p.app.cfg.VolumeSteps) / player.MaxStateVolume)) } -// Set the player volume to the new volume. +// Set the player volume to the new volume, also notifies about the change. func (p *AppPlayer) updateVolume(newVal uint32) { if newVal > player.MaxStateVolume { newVal = player.MaxStateVolume @@ -599,6 +599,8 @@ func (p *AppPlayer) updateVolume(newVal uint32) { log.Debugf("update volume to %d/%d", newVal, player.MaxStateVolume) p.player.SetVolume(newVal) + + p.volumeUpdate <- float32(newVal) / player.MaxStateVolume } // Send notification that the volume changed.