Compare commits
No commits in common. "f85551ae02f70cb2f94a02dcbc466f6061b31459" and "c73cf88081065b7cd1d3668e3c456d945027206f" have entirely different histories.
f85551ae02
...
c73cf88081
22
src/main.go
22
src/main.go
@ -95,7 +95,7 @@ func setup(client *streamdeck.Client) {
|
||||
return err
|
||||
}
|
||||
|
||||
return setFeedback(ctx, client, newSettings)
|
||||
return setFeedbackIfNeeded(ctx, client, newSettings)
|
||||
})
|
||||
|
||||
action.RegisterHandler(streamdeck.WillDisappear, func(ctx context.Context, client *streamdeck.Client, event streamdeck.Event) error {
|
||||
@ -119,14 +119,17 @@ func setup(client *streamdeck.Client) {
|
||||
ctx := context.Background()
|
||||
ctx = sdcontext.WithContext(ctx, ctxStr)
|
||||
|
||||
setFeedback(ctx, client, newSettings)
|
||||
setFeedbackIfNeeded(ctx, client, newSettings)
|
||||
}
|
||||
_currentSettings = newSettings
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func setFeedback(ctx context.Context, client *streamdeck.Client, newSettings *volume.VolumeSettings) error {
|
||||
func setFeedbackIfNeeded(ctx context.Context, client *streamdeck.Client, newSettings *volume.VolumeSettings) error {
|
||||
|
||||
if _currentSettings.OutputVolume == newSettings.OutputVolume && _currentSettings.OutputMuted == newSettings.OutputMuted {
|
||||
return nil
|
||||
}
|
||||
|
||||
payload := FeedbackPayload{}
|
||||
|
||||
@ -148,17 +151,8 @@ func setFeedback(ctx context.Context, client *streamdeck.Client, newSettings *vo
|
||||
|
||||
payload.Icon = ValueWithOpacity[any]{nil, opacity}
|
||||
|
||||
return client.SetFeedback(ctx, payload)
|
||||
}
|
||||
|
||||
func setFeedbackIfNeeded(ctx context.Context, client *streamdeck.Client, newSettings *volume.VolumeSettings) error {
|
||||
|
||||
if _currentSettings.OutputVolume == newSettings.OutputVolume && _currentSettings.OutputMuted == newSettings.OutputMuted {
|
||||
return nil
|
||||
}
|
||||
|
||||
_currentSettings = newSettings
|
||||
return setFeedback(ctx, client, newSettings)
|
||||
return client.SetFeedback(ctx, payload)
|
||||
}
|
||||
|
||||
type FeedbackPayload struct {
|
||||
|
Loading…
Reference in New Issue
Block a user