diff --git a/docs/superpowers/specs/2026-04-05-volume-increment-setting-design.md b/docs/superpowers/specs/2026-04-05-volume-increment-setting-design.md new file mode 100644 index 0000000..6f7125a --- /dev/null +++ b/docs/superpowers/specs/2026-04-05-volume-increment-setting-design.md @@ -0,0 +1,48 @@ +# Volume Increment Setting — Design + +## Overview + +Expose the volume increment for the Volume Up and Volume Down actions as a configurable setting. A global default applies to all volume buttons; individual buttons can override it. + +## Requirements + +- Global default increment: `10` (min: `1`, no enforced max) +- Per-button override: optional; absent means "use global" +- Volume range hint displayed in UI: "Volume range: 0–100" +- Fix manifest tooltips: "by 2" → "by 10" + +## Architecture + +### Global settings (`PiComponent.vue` + `PluginComponent.vue`) + +Add `adjustVolumeIncrement` to the global settings payload: + +- **PI (`PiComponent.vue`):** Add a number input in the Global Settings accordion, below the existing timeout/interval inputs. Label: "Volume Increment (Up/Down)". Helper text: "Volume range: 0–100". Min: 1. +- **`saveGlobalSettings()`:** Include `adjustVolumeIncrement` in the payload saved via `streamDeckConnection.value.saveGlobalSettings()`. +- **`PluginComponent.vue`:** On `globalsettings`, extract `inGlobalSettings.adjustVolumeIncrement` (defaulting to `10`) into a reactive ref `adjustVolumeIncrement`, mirroring the existing `deviceTimeoutDuration` pattern. + +### Per-button settings (`PiComponent.vue`) + +For `actionName === 'volume-up'` and `actionName === 'volume-down'`, show an action-specific section with a number input for `adjustVolumeIncrement`. Label: "Volume Increment". Helper: "Volume range: 0–100. Leave blank to use the global default." Min: 1. The field is optional — only written to `actionSettings` when the user provides a value; absent/null means inherit from global. + +The `saveSettings()` function already writes all `actionSettings` fields unconditionally. The per-button `adjustVolumeIncrement` should only be included when the user has set a value (i.e. the ref is non-null/non-empty). + +### Action handlers (`src/modules/actions/sonosController.js`) + +Add `globalAdjustVolumeIncrement` as a named parameter to `volume_up_action` and `volume_down_action`. Resolution: + +```js +const increment = parseInt(inActionSettings.adjustVolumeIncrement) || globalAdjustVolumeIncrement; +``` + +Remove the existing `|| 10` fallback — the global value is always present. + +### Passing global value to actions (`PluginComponent.vue`) + +Where action handlers are called, pass `globalAdjustVolumeIncrement: adjustVolumeIncrement.value` alongside the existing `deviceTimeoutDuration`, mirroring that pattern exactly. + +## Manifest fix + +In `public/manifest.json`, remove the hardcoded increment from both tooltips (it would become inaccurate once the setting is configurable): +- Volume Up `Tooltip`: `"Increase volume by 2"` → `"Increase volume"` +- Volume Down `Tooltip`: `"Decrease volume by 2"` → `"Decrease volume"` diff --git a/public/manifest.json b/public/manifest.json index f92c0cb..b393f50 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -212,7 +212,7 @@ "Icon": "images/actions/volume_up", "Name": "Volume Up", "PropertyInspectorPath": "pi.html", - "Tooltip": "Increase volume by 2", + "Tooltip": "Increase volume", "UUID": "com.r-teller.sonoscontroller.volume-up", "Controllers": [ "Keypad" @@ -233,7 +233,7 @@ "Icon": "images/actions/volume_down", "Name": "Volume Down", "PropertyInspectorPath": "pi.html", - "Tooltip": "Decrease volume by 2", + "Tooltip": "Decrease volume", "UUID": "com.r-teller.sonoscontroller.volume-down", "Controllers": [ "Keypad" diff --git a/src/components/PiComponent.vue b/src/components/PiComponent.vue index af71f2f..c82743a 100644 --- a/src/components/PiComponent.vue +++ b/src/components/PiComponent.vue @@ -97,6 +97,23 @@ +
+

Volume Increment

+
+ + Volume range: 0–100 + +
+
+

Equalizer Target

@@ -155,6 +172,15 @@ >Note: This interval is used to check the status of the device selected for this action (in seconds) + + Note: Volume range is 0–100. Used by Volume Up and Volume Down actions unless overridden per-button. +