From 11011e58d68cf893024ea2723416d9e0ff33d3c8 Mon Sep 17 00:00:00 2001 From: bjoluc Date: Sun, 31 Mar 2024 21:31:42 +0200 Subject: [PATCH] chore: Add encoder assignments to function buttons in X-Touch One script --- readme.md | 4 ++- src/device-configs/behringer_xtouch-one.ts | 38 +++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 3383572..e64fb2c 100644 --- a/readme.md +++ b/readme.md @@ -172,7 +172,9 @@ Current limitations of the MIDI Remote API: X-Touch One - The X-Touch One script does not provide a `devices` config option. If you want to use an X-Touch One with an extender, please use the X-Touch One script and the X-Touch script separately. -- Since the X-Touch One does not have encoder assign buttons, the push encoder always controls the selected channel's panorama (unless overridden by user mappings). +- The X-Touch One does not have encoder assign buttons. To make up for this, the F1 and F2 buttons are mapped to cycle through the following encoder assignments: + - F1: Pan, Monitor, Pre Gain, Low-Cut Frequency / Enabled, High-Cut Frequency / Enabled + - F2: Send levels/active 1-3 diff --git a/src/device-configs/behringer_xtouch-one.ts b/src/device-configs/behringer_xtouch-one.ts index 34cc242..3c5383c 100644 --- a/src/device-configs/behringer_xtouch-one.ts +++ b/src/device-configs/behringer_xtouch-one.ts @@ -7,7 +7,7 @@ import { DeviceConfig } from "."; import { JogWheel } from "/decorators/surface-elements/JogWheel"; import { Lamp } from "/decorators/surface-elements/Lamp"; import { LedButton } from "/decorators/surface-elements/LedButton"; -import { LedPushEncoder } from "/decorators/surface-elements/LedPushEncoder"; +import { EncoderDisplayMode, LedPushEncoder } from "/decorators/surface-elements/LedPushEncoder"; import { TouchSensitiveMotorFader } from "/decorators/surface-elements/TouchSensitiveFader"; import { createElements } from "/util"; @@ -162,4 +162,40 @@ export const deviceConfig: DeviceConfig = { }, }; }, + + configureEncoderAssignments(defaultEncoderMapping, page) { + return [ + // Pan, Monitor, Gain, LC, HC (F1) + { + activatorButtonSelector: (device) => device.controlSectionElements.buttons.function[0], + pages: [ + ...[...defaultEncoderMapping[0].pages, ...defaultEncoderMapping[1].pages].filter((page) => + ["Pan", "Monitor", "Input Gain", "Low Cut", "High Cut"].includes(page.name), + ), + ], + }, + + // Sends 1-3 (F2) + { + activatorButtonSelector: (device) => device.controlSectionElements.buttons.function[1], + pages: createElements(3, (slotId) => { + return { + name: `Send Slot`, + assignments: (channel) => { + const sendSlot = channel.mSends.getByIndex(slotId); + + return { + encoderValue: sendSlot.mLevel, + encoderValueName: `Send ${slotId + 1}`, + displayMode: EncoderDisplayMode.SingleDot, + encoderValueDefault: 0.7890865802764893, + pushToggleValue: sendSlot.mOn, + }; + }, + areAssignmentsChannelRelated: true, + }; + }), + }, + ]; + }, };