From be3aa8ac754d825aae1687d17455391a8ebb8641 Mon Sep 17 00:00:00 2001 From: Ferdinand Malcher Date: Fri, 25 Oct 2024 21:43:12 +0200 Subject: [PATCH] feat: add support for FX BPM setting --- examples/page12-fx-settings.companionconfig | 226 ++++++++++++++++++++ src/actions.ts | 41 ++++ 2 files changed, 267 insertions(+) create mode 100644 examples/page12-fx-settings.companionconfig diff --git a/examples/page12-fx-settings.companionconfig b/examples/page12-fx-settings.companionconfig new file mode 100644 index 0000000..8bd6c46 --- /dev/null +++ b/examples/page12-fx-settings.companionconfig @@ -0,0 +1,226 @@ +{ + "version": 4, + "type": "page", + "page": { + "name": "FX Settings", + "controls": { + "0": { + "0": { + "type": "pageup" + }, + "1": { + "type": "button", + "style": { + "text": "BPM 120\\nFX 2,3,4", + "textExpression": false, + "size": "14", + "png64": null, + "alignment": "center:center", + "pngalignment": "center:center", + "color": 16777215, + "bgcolor": 0, + "show_topbar": "default" + }, + "options": { + "relativeDelay": false, + "rotaryActions": false, + "stepAutoProgress": true + }, + "feedbacks": [], + "steps": { + "0": { + "action_sets": { + "down": [ + { + "id": "OARPe-Gg6irO-VAkLJbRH", + "action": "setfxbpm", + "instance": "K5mVTsGHIPgqYkyqYxEWS", + "options": { + "fx": [ + 2, + 3, + 4 + ], + "bpm": 120 + }, + "delay": 0 + } + ], + "up": [] + }, + "options": { + "runWhileHeld": [] + } + } + } + }, + "2": { + "type": "button", + "style": { + "text": "BPM 60\\nFX 2,3,4", + "textExpression": false, + "size": "14", + "png64": null, + "alignment": "center:center", + "pngalignment": "center:center", + "color": 16777215, + "bgcolor": 0, + "show_topbar": "default" + }, + "options": { + "relativeDelay": false, + "rotaryActions": false, + "stepAutoProgress": true + }, + "feedbacks": [], + "steps": { + "0": { + "action_sets": { + "down": [ + { + "id": "lFiVLFdmrjX8IckLqnsqR", + "action": "setfxbpm", + "instance": "K5mVTsGHIPgqYkyqYxEWS", + "options": { + "fx": [ + 2, + 3, + 4 + ], + "bpm": 60 + }, + "delay": 0 + } + ], + "up": [] + }, + "options": { + "runWhileHeld": [] + } + } + } + }, + "3": { + "type": "button", + "style": { + "text": "BPM 80\\nFX 4", + "textExpression": false, + "size": "14", + "png64": null, + "alignment": "center:center", + "pngalignment": "center:center", + "color": 16777215, + "bgcolor": 0, + "show_topbar": "default" + }, + "options": { + "relativeDelay": false, + "rotaryActions": false, + "stepAutoProgress": true + }, + "feedbacks": [], + "steps": { + "0": { + "action_sets": { + "down": [ + { + "id": "TQS54cQ8UDbp8u2TNzDGo", + "action": "setfxbpm", + "instance": "K5mVTsGHIPgqYkyqYxEWS", + "options": { + "fx": [ + 4 + ], + "bpm": 80 + }, + "delay": 0 + } + ], + "up": [] + }, + "options": { + "runWhileHeld": [] + } + } + } + }, + "4": { + "type": "button", + "style": { + "text": "BPM 100\\nFX 3", + "textExpression": false, + "size": "14", + "png64": null, + "alignment": "center:center", + "pngalignment": "center:center", + "color": 16777215, + "bgcolor": 0, + "show_topbar": "default" + }, + "options": { + "relativeDelay": false, + "rotaryActions": false, + "stepAutoProgress": true + }, + "feedbacks": [], + "steps": { + "0": { + "action_sets": { + "down": [ + { + "id": "YYPIz5BL2opF6x84x9VIX", + "action": "setfxbpm", + "instance": "K5mVTsGHIPgqYkyqYxEWS", + "options": { + "fx": [ + 3 + ], + "bpm": 100 + }, + "delay": 0 + } + ], + "up": [] + }, + "options": { + "runWhileHeld": [] + } + } + } + } + }, + "1": { + "0": { + "type": "pagenum" + } + }, + "2": { + "0": { + "type": "pagedown" + } + } + }, + "gridSize": { + "minColumn": 0, + "maxColumn": 7, + "minRow": 0, + "maxRow": 3 + } + }, + "instances": { + "K5mVTsGHIPgqYkyqYxEWS": { + "instance_type": "soundcraft-ui", + "sortOrder": 2, + "label": "ui24", + "isFirstInit": false, + "config": { + "product": "UI24", + "host": "10.75.23.95", + "import_to": "M56cJZPf5-" + }, + "enabled": true, + "lastUpgradeIndex": 1 + } + }, + "oldPageNumber": 96 +} \ No newline at end of file diff --git a/src/actions.ts b/src/actions.ts index 50c9200..30714e5 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -45,6 +45,9 @@ export enum ActionId { ChangeFxChannelValue = 'changefxchannelvalue', FadeFxChannel = 'fadefxchannel', + // FX Settings + SetFxBPM = 'setfxbpm', + // Volume Buses (SOLO, Headphone) SetVolumeBusValue = 'setvolumebusvalue', ChangeVolumeBusValue = 'changevolumebusvalue', @@ -496,6 +499,44 @@ export function GetActionsList(conn: SoundcraftUI): CompanionActionDefinitions { }, }, + /** + * FX Settings + */ + [ActionId.SetFxBPM]: { + name: 'FX: Set BPM', + description: 'Set BPM value for FX processors', + options: [ + { + type: 'multidropdown', + label: 'FX', + id: 'fx', + choices: [ + { id: 1, label: 'FX 1' }, + { id: 2, label: 'FX 2' }, + { id: 3, label: 'FX 3' }, + { id: 4, label: 'FX 4' }, + ], + default: [2, 3, 4], + minSelection: 1, + }, + { + type: 'number', + label: 'BPM', + id: 'bpm', + min: 20, + max: 400, + default: 120, + }, + ], + callback: (action) => { + const bpm = Number(action.options.bpm) + const chosenFx = action.options.fx as number[] + chosenFx.forEach((fxNo) => { + conn.fx(fxNo).setBpm(bpm) + }) + }, + }, + /** * Media Player */