@blackmagic-controller/core
Version:
An npm module for interfacing with the Blackmagic usb/bluetooth controllers
34 lines • 972 B
JavaScript
export function freezeDefinitions(controls) {
const seenIds = new Set();
for (const control of controls) {
const id = `${control.type}:${control.id}`;
if (seenIds.has(id)) {
throw new Error(`Duplicate control id "${id}"`);
}
seenIds.add(id);
}
return Object.freeze(controls.map((control) => Object.freeze(control)));
}
export function createRgbButtonDefinition(row, column, id, encodedIndex, ledBitIndex) {
return {
type: 'button',
row,
column,
id,
encodedIndex,
feedbackType: 'rgb',
ledBitIndex,
};
}
export function createBasicButtonDefinition(row, column, id, encodedIndex, ledBitIndex) {
return {
type: 'button',
row,
column,
id,
encodedIndex,
feedbackType: ledBitIndex != null ? 'on-off' : 'none',
ledBitIndex: ledBitIndex ?? 0,
};
}
//# sourceMappingURL=controlsGenerator.js.map