Skip to content

Commit

Permalink
Merge branch 'develop' into device-icon-v1m
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoluc committed Apr 24, 2024
2 parents 19f09e5 + d103456 commit 1742d55
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 39 deletions.
31 changes: 9 additions & 22 deletions src/device-configs/behringer_xtouch-one.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ 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 { EncoderDisplayMode, LedPushEncoder } from "/decorators/surface-elements/LedPushEncoder";
import { LedPushEncoder } from "/decorators/surface-elements/LedPushEncoder";
import { TouchSensitiveMotorFader } from "/decorators/surface-elements/TouchSensitiveFader";
import * as encoderPageConfigs from "/mapping/encoders/page-configs";
import { BehringerColorManager } from "/midi/managers/colors/BehringerColorManager";
import { createElements } from "/util";

Expand Down Expand Up @@ -164,38 +165,24 @@ export const deviceConfig: DeviceConfig = {
};
},

configureEncoderMapping(defaultEncoderMapping, page) {
configureEncoderMapping() {
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),
),
encoderPageConfigs.pan,
encoderPageConfigs.monitor,
encoderPageConfigs.inputGain,
encoderPageConfigs.lowCut,
encoderPageConfigs.highCut,
],
},

// 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,
};
}),
pages: createElements(3, (slotId) => encoderPageConfigs.sendSlot(slotId)),
},
];
},
Expand Down
22 changes: 6 additions & 16 deletions src/device-configs/ssl_uf1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import { DeviceConfig } from ".";
import { JogWheel } from "/decorators/surface-elements/JogWheel";
import { LedButton } from "/decorators/surface-elements/LedButton";
import { EncoderDisplayMode, LedPushEncoder } from "/decorators/surface-elements/LedPushEncoder";
import { LedPushEncoder } from "/decorators/surface-elements/LedPushEncoder";
import { TouchSensitiveMotorFader } from "/decorators/surface-elements/TouchSensitiveFader";
import { focusedQuickControls as makeFocusedQuickControlsEncoderPageConfig } from "/mapping/encoders/page-configs";
import { createElements } from "/util";

export const deviceConfig: DeviceConfig = {
Expand Down Expand Up @@ -217,24 +218,13 @@ export const deviceConfig: DeviceConfig = {
};
},

configureEncoderMapping(defaultEncoderMappings, page) {
const focusedQuickControls = page.mHostAccess.mFocusedQuickControls;

const instrumentEncoderMapping = defaultEncoderMappings.pop()!;
configureEncoderMapping(defaultEncoderMapping, page) {
const instrumentEncoderMapping = defaultEncoderMapping.pop()!;

// Replace the instrument encoder assignment with quick controls
instrumentEncoderMapping.pages[0] = {
name: "Quick Controls",
assignments: (_mixerChannel, channelIndex) => {
return {
encoderValue: focusedQuickControls.getByIndex(channelIndex),
displayMode: EncoderDisplayMode.SingleDot,
};
},
areAssignmentsChannelRelated: false,
};
instrumentEncoderMapping.pages[0] = makeFocusedQuickControlsEncoderPageConfig(page.mHostAccess);

// Make it the default encoder mapping by defining it first
return [instrumentEncoderMapping, ...defaultEncoderMappings];
return [instrumentEncoderMapping, ...defaultEncoderMapping];
},
};
2 changes: 1 addition & 1 deletion src/mapping/encoders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function bindEncoders(
},

// Plug-In
pageConfigs.pluginMappingConfig(page, (device) => selectAssignButtons(device).send),
pageConfigs.pluginMappingConfig(page, (device) => selectAssignButtons(device).plugin),

// Instrument
{
Expand Down
16 changes: 16 additions & 0 deletions src/mapping/encoders/page-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,19 @@ export const focusedQuickControls = (hostAccess: MR_HostAccess): EncoderPageConf
},
areAssignmentsChannelRelated: false,
});

export const sendSlot = (slotId: number): EncoderPageConfig => ({
name: "Send Slot",
assignments: (channel) => {
const sendSlot = channel.mSends.getByIndex(slotId);

return {
encoderValue: sendSlot.mLevel,
encoderValueName: `Send ${slotId + 1}`,
displayMode: EncoderDisplayMode.Wrap,
encoderValueDefault: 0.7890865802764893,
pushToggleValue: sendSlot.mOn,
};
},
areAssignmentsChannelRelated: true,
});

0 comments on commit 1742d55

Please sign in to comment.