companion-module-puretech-p.../presets.js

136 lines
3.0 KiB
JavaScript

const { combineRgb } = require('@companion-module/base');
module.exports = {
getPresets() {
const presets = {};
// CROSSPOINTS
var outList = this.getOutputsList(false);
var iptList = this.getInputsList(false);
outList.forEach((out) => {
iptList.forEach((ipt) => {
presets[`xpt_${out.id}_${ipt.id}`] = {
type: 'button',
category: out.label+" - XPT",
style: {
text: `OUT#${out.id} \nIN#${ipt.id}`,
size: '16',
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(0, 0, 0)
},
steps: [{
down: [{
actionId: 'setCrosspoint',
options: { out: out.id, ipt: ipt.id }
}]
}],
feedbacks: [
{
feedbackId: 'crosspoint_status',
options: { outID: out.id, xpt: ipt.id },
style: { bgcolor: combineRgb(255, 0, 0) }
},
{
feedbackId: 'connect_status',
options: {},
isInverted: true,
style: { color: combineRgb(255, 80, 80), bgcolor: combineRgb(80, 0, 0) }
}
]
};
});
});
// RECALL PRESETS
var pstList = this.getPresetsList(false);
pstList.forEach((pst) => {
presets[`recall_pst${pst.id}`] = {
type: 'button',
category: "Preset - Recall",
style: {
text: `Recall \nPST#${pst.id}`,
size: '16',
color: combineRgb(24, 76, 119),
bgcolor: combineRgb(128, 198, 255)
},
steps: [{
down: [{
actionId: 'recallPreset',
options: { pst: pst.id }
}]
}],
feedbacks: [
{
feedbackId: 'last_pst',
options: { pst: pst.id },
style: { color: combineRgb(255, 255, 255), bgcolor: combineRgb(27, 158, 62) }
},
{
feedbackId: 'connect_status',
options: {},
isInverted: true,
style: { color: combineRgb(255, 80, 80), bgcolor: combineRgb(80, 0, 0) }
}
]
};
});
// SAVE PRESETS
pstList.forEach((pst) => {
presets[`save_pst${pst.id}`] = {
type: 'button',
category: "Preset - Save",
style: {
text: `Save \nPST#${pst.id}`,
size: '16',
color: combineRgb(0, 0, 0),
bgcolor: combineRgb(249, 177, 21)
},
steps: [{
down: [{
actionId: 'savePreset',
options: { pst: pst.id }
}]
}],
feedbacks: [
{
feedbackId: 'connect_status',
options: {},
isInverted: true,
style: { color: combineRgb(255, 80, 80), bgcolor: combineRgb(80, 0, 0) }
}
]
};
});
// CLEAR PRESETS
pstList.forEach((pst) => {
presets[`clear_pst${pst.id}`] = {
type: 'button',
category: "Preset - Clear",
style: {
text: `Clear \nPST#${pst.id}`,
size: '16',
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(213, 2, 2)
},
steps: [{
down: [{
actionId: 'clearPreset',
options: { pst: pst.id }
}]
}],
feedbacks: [
{
feedbackId: 'connect_status',
options: {},
isInverted: true,
style: { color: combineRgb(255, 80, 80), bgcolor: combineRgb(80, 0, 0) }
}
]
};
});
return presets;
}
};