Use Companion's native Gauge element for level displays
Companion 5.1 marks image-buffer feedbacks as deprecated, and its layered buttons have a Gauge element that follows a number directly. So: - New numeric value feedbacks for gauges: fader/level position 0-100 for inputs, busses, matrix outputs, control groups, aux sends and matrix sends (one shared fader taper: 0 dB at 75 %, -inf at 0), raw pan 0..1 for a symmetric gauge, GEQ band dB, and input meter position. - Every knob and meter preset is now a layered preset: background box, channel name, live dB text and a Gauge bound to $(local:pos); on/off and mute tint the background. Meters use a vertical green/amber/red gauge. Text uses size 100 with shrink-to-fit (14 rendered tiny on 5.1) and the level gauge is white so it stays visible on a green background. - The old image-bar feedbacks keep working and are labelled "(legacy image)"; HELP.md explains how to add a gauge to your own button. - A sleeping iPad no longer logs a relay send error every few seconds: one warning per iPad per 10 minutes. Checked on the booth Companion 5.1: the layered knob previews show live names, levels and gauge fills. npm test: 392 checks pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { combineRgb } from '@companion-module/base'
|
||||
import { GEQ_RANGE, LEVEL, METERS, PARAMS, clamp, fmtDb, fmtPan, fmtValue, meterId } from '../protocol.js'
|
||||
import { GEQ_RANGE, LEVEL, METERS, PARAMS, clamp, faderPosition, fmtDb, fmtPan, fmtValue, meterId } from '../protocol.js'
|
||||
import { horizontalBar, verticalMeter } from '../image.js'
|
||||
import { opt, paramEntities, paramEntityOption } from './actions.js'
|
||||
|
||||
@@ -259,6 +259,24 @@ export function getFeedbackDefinitions(inst) {
|
||||
}),
|
||||
matrix_send_level_value: value('Matrix send: level (dB text)', msendOptions(), msendKey, ({ options }) => fmtDb(msendOf(options).level) || '--'),
|
||||
geq_band_value: value('Graphic EQ: band gain (dB text)', [opt.geq(inst), opt.band()], geqGainKey, ({ options }) => fmtDb(geqGainOf(options)) || '--'),
|
||||
// Numbers for Companion's native Gauge element (use as a button local variable, see the Gauges section of the help)
|
||||
input_fader_pos: value('Input: fader position (0-100, for gauges)', [opt.channel(inst)], entityKey('input', 'channel'), ({ options }) => faderPosition(s.getFader('input', n(options.channel)))),
|
||||
buss_fader_pos: value('Buss: fader position (0-100, for gauges)', [opt.buss(inst)], entityKey('buss', 'buss'), ({ options }) => faderPosition(s.getFader('buss', n(options.buss)))),
|
||||
matrix_fader_pos: value('Matrix output: fader position (0-100, for gauges)', [opt.matrix(inst)], entityKey('matrix', 'matrix'), ({ options }) => faderPosition(s.getFader('matrix', n(options.matrix)))),
|
||||
cg_fader_pos: value('Control group: fader position (0-100, for gauges)', [opt.cg(inst)], entityKey('cg', 'cg'), ({ options }) => faderPosition(s.getFader('cg', n(options.cg)))),
|
||||
send_level_pos: value('Aux send: level position (0-100, for gauges)', [opt.channel(inst), opt.buss(inst, 'aux')], sendKey, ({ options }) => {
|
||||
inst.ensureSend(n(options.channel), n(options.buss))
|
||||
return faderPosition(s.getSend(n(options.channel), n(options.buss)).level)
|
||||
}),
|
||||
matrix_send_level_pos: value('Matrix send: level position (0-100, for gauges)', msendOptions(), msendKey, ({ options }) => faderPosition(msendOf(options).level)),
|
||||
// pan is the raw 0..1 value (0.5 = centre) for a symmetric gauge with origin 0.5; unknown reads as centre
|
||||
input_pan_num: value('Input: pan (0-1, 0.5 = centre, for gauges)', [opt.channel(inst)], entityKey('input', 'channel'), ({ options }) => s.getPan(n(options.channel)) ?? 0.5),
|
||||
send_pan_num: value('Aux send: pan (0-1, 0.5 = centre, for gauges)', [opt.channel(inst), opt.buss(inst, 'aux')], sendKey, ({ options }) => {
|
||||
inst.ensureSendPan(n(options.channel), n(options.buss))
|
||||
return s.getSend(n(options.channel), n(options.buss)).pan ?? 0.5
|
||||
}),
|
||||
geq_band_db: value('Graphic EQ: band gain (dB number -12..12, for gauges)', [opt.geq(inst), opt.band()], geqGainKey, ({ options }) => geqGainOf(options) ?? 0),
|
||||
input_meter_pos: value('Input meter: position (0-100, for gauges)', [opt.channel(inst), meterOption], meterKey, ({ options }) => ((meterOf(options)?.value ?? 0) / 127) * 100),
|
||||
snapshot_name_value: value('Snapshot: current name', [], () => watchKey.snapshot, () => s.snapshotName(s.snapshots.current) ?? '--'),
|
||||
input_meter_value: value(
|
||||
'Input meter: value',
|
||||
@@ -283,38 +301,38 @@ export function getFeedbackDefinitions(inst) {
|
||||
},
|
||||
),
|
||||
|
||||
input_fader_bar: bar('Input: fader bar', [opt.channel(inst)], entityKey('input', 'channel'), (fb, image) => {
|
||||
input_fader_bar: bar('Input: fader bar (legacy image)', [opt.channel(inst)], entityKey('input', 'channel'), (fb, image) => {
|
||||
const v = s.getFader('input', n(fb.options.channel))
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: levelFraction(v), color: fb.options.color })
|
||||
}),
|
||||
send_level_bar: bar('Aux send: level bar', [opt.channel(inst), opt.buss(inst, 'aux')], sendKey, (fb, image) => {
|
||||
send_level_bar: bar('Aux send: level bar (legacy image)', [opt.channel(inst), opt.buss(inst, 'aux')], sendKey, (fb, image) => {
|
||||
inst.ensureSend(n(fb.options.channel), n(fb.options.buss))
|
||||
const v = s.getSend(n(fb.options.channel), n(fb.options.buss)).level
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: levelFraction(v), color: fb.options.color })
|
||||
}),
|
||||
buss_fader_bar: bar('Buss: fader bar', [opt.buss(inst)], entityKey('buss', 'buss'), (fb, image) => {
|
||||
buss_fader_bar: bar('Buss: fader bar (legacy image)', [opt.buss(inst)], entityKey('buss', 'buss'), (fb, image) => {
|
||||
const v = s.getFader('buss', n(fb.options.buss))
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: levelFraction(v), color: fb.options.color })
|
||||
}),
|
||||
matrix_fader_bar: bar('Matrix output: fader bar', [opt.matrix(inst)], entityKey('matrix', 'matrix'), (fb, image) => {
|
||||
matrix_fader_bar: bar('Matrix output: fader bar (legacy image)', [opt.matrix(inst)], entityKey('matrix', 'matrix'), (fb, image) => {
|
||||
const v = s.getFader('matrix', n(fb.options.matrix))
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: levelFraction(v), color: fb.options.color })
|
||||
}),
|
||||
cg_fader_bar: bar('Control group: fader bar', [opt.cg(inst)], entityKey('cg', 'cg'), (fb, image) => {
|
||||
cg_fader_bar: bar('Control group: fader bar (legacy image)', [opt.cg(inst)], entityKey('cg', 'cg'), (fb, image) => {
|
||||
const v = s.getFader('cg', n(fb.options.cg))
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: levelFraction(v), color: fb.options.color })
|
||||
}),
|
||||
matrix_send_level_bar: bar('Matrix send: level bar', msendOptions(), msendKey, (fb, image) => {
|
||||
matrix_send_level_bar: bar('Matrix send: level bar (legacy image)', msendOptions(), msendKey, (fb, image) => {
|
||||
const v = msendOf(fb.options).level
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: levelFraction(v), color: fb.options.color })
|
||||
}),
|
||||
geq_band_bar: bar('Graphic EQ: band gain bar', [opt.geq(inst), opt.band()], geqGainKey, (fb, image) => {
|
||||
geq_band_bar: bar('Graphic EQ: band gain bar (legacy image)', [opt.geq(inst), opt.band()], geqGainKey, (fb, image) => {
|
||||
const v = geqGainOf(fb.options)
|
||||
return v === undefined ? {} : horizontalBar({ ...image, fraction: geqFraction(v), color: fb.options.color })
|
||||
}),
|
||||
input_meter_bar: {
|
||||
type: 'advanced',
|
||||
name: 'Input meter: bar (right edge)',
|
||||
name: 'Input meter: bar at the right edge (legacy image)',
|
||||
affectedProperties: ['imageBuffer'],
|
||||
options: [opt.channel(inst), meterOption],
|
||||
callback: tracked(meterKey, (fb) => {
|
||||
@@ -362,23 +380,23 @@ export function feedbackIdsForEvent(ev) {
|
||||
case 'fader':
|
||||
return (
|
||||
{
|
||||
input: ['input_fader_value', 'input_fader_bar', 'level_compare'],
|
||||
buss: ['buss_fader_value', 'buss_fader_bar', 'level_compare'],
|
||||
matrix: ['matrix_fader_value', 'matrix_fader_bar', 'level_compare'],
|
||||
cg: ['cg_fader_value', 'cg_fader_bar', 'level_compare'],
|
||||
input: ['input_fader_value', 'input_fader_pos', 'input_fader_bar', 'level_compare'],
|
||||
buss: ['buss_fader_value', 'buss_fader_pos', 'buss_fader_bar', 'level_compare'],
|
||||
matrix: ['matrix_fader_value', 'matrix_fader_pos', 'matrix_fader_bar', 'level_compare'],
|
||||
cg: ['cg_fader_value', 'cg_fader_pos', 'cg_fader_bar', 'level_compare'],
|
||||
}[ev.ent] || []
|
||||
)
|
||||
case 'pan':
|
||||
return ['input_pan_value']
|
||||
return ['input_pan_value', 'input_pan_num']
|
||||
case 'send':
|
||||
if (ev.field === 'level') return ['send_level_value', 'send_level_bar', 'send_level_compare']
|
||||
if (ev.field === 'level') return ['send_level_value', 'send_level_pos', 'send_level_bar', 'send_level_compare']
|
||||
if (ev.field === 'on') return ['send_on', 'send_on_value']
|
||||
if (ev.field === 'pan') return ['send_pan_value']
|
||||
if (ev.field === 'pan') return ['send_pan_value', 'send_pan_num']
|
||||
return []
|
||||
case 'msend':
|
||||
return ev.field === 'level' ? ['matrix_send_level_value', 'matrix_send_level_bar'] : ['matrix_send_on']
|
||||
return ev.field === 'level' ? ['matrix_send_level_value', 'matrix_send_level_pos', 'matrix_send_level_bar'] : ['matrix_send_on']
|
||||
case 'geq':
|
||||
return ev.field === 'on' ? ['geq_on'] : ['geq_band_value', 'geq_band_bar']
|
||||
return ev.field === 'on' ? ['geq_on'] : ['geq_band_value', 'geq_band_db', 'geq_band_bar']
|
||||
case 'group':
|
||||
return ['group_assigned']
|
||||
case 'param':
|
||||
|
||||
+139
-75
@@ -4,7 +4,19 @@ import { COLORS } from './feedbacks.js'
|
||||
export const MAX_PRESETS = 3000
|
||||
export const MAX_PRESET_BYTES = 4 * 1024 * 1024
|
||||
|
||||
const { white: WHITE, dark: DARK, red: RED, green: GREEN, amber: AMBER, bar: BAR } = COLORS
|
||||
const { white: WHITE, dark: DARK, red: RED, green: GREEN, amber: AMBER } = COLORS
|
||||
|
||||
// Layered presets (native gauges). Colours are 0xRRGGBB numbers.
|
||||
const BLACK = 0x000000
|
||||
const TEXT = 0xffffff
|
||||
const GAUGE_GREEN = 0x00b050
|
||||
/** Level gauge fill: white, so it stays visible on a green (send on) or red (muted) background. */
|
||||
const GAUGE_LEVEL = 0xffffff
|
||||
const METER_AMBER = 0xf0a000
|
||||
const METER_RED = 0xe00000
|
||||
const ON_GREEN = 0x00a050 // a send is on / an input is assigned
|
||||
const MUTED_RED = 0xb01010 // muted, peak
|
||||
const SIGNAL_BG = 0x00501e // signal present on a meter button
|
||||
|
||||
const fb = (feedbackId, options, bg, color = WHITE) => ({ feedbackId, options, style: { bgcolor: bg, color } })
|
||||
const act = (actionId, options) => ({ actionId, options })
|
||||
@@ -29,21 +41,82 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
feedbacks,
|
||||
...extra,
|
||||
})
|
||||
/** Rotary preset: press = `press`, turning = `adjust` with ∓1 (the action's delta option). */
|
||||
const knob = (name, text, press, adjustActionId, adjustOptions, localVariables, feedbacks) => ({
|
||||
type: 'simple',
|
||||
/** A rotary step: press = `press`, turning = `adjust` with the action's delta option set to -1 / +1. */
|
||||
const knobSteps = (press, adjustActionId, adjustOptions) => [
|
||||
{
|
||||
down: press,
|
||||
up: [],
|
||||
rotate_left: [act(adjustActionId, { ...adjustOptions, delta: -1 })],
|
||||
rotate_right: [act(adjustActionId, { ...adjustOptions, delta: 1 })],
|
||||
},
|
||||
]
|
||||
const text = (id, x, y, width, height, value) => ({ type: 'text', id, x, y, width, height, text: value, fontsize: 100, fontsizeAllowShrink: true, color: TEXT, halign: 'center', valign: 'center' })
|
||||
/** Boolean feedback on a layered preset: it colours the background box. */
|
||||
const tint = (feedbackId, options, color) => ({ feedbackId, options, styleOverrides: [{ elementId: 'bg', elementProperty: 'color', override: color }] })
|
||||
/**
|
||||
* Layered rotary preset with a native Companion gauge along the bottom: black background, the entity name on top, the
|
||||
* dB text below it, and a gauge fed by the `pos` local variable. `level` and `pos` are the text and the numeric value
|
||||
* feedbacks for the same thing.
|
||||
*/
|
||||
const layeredKnob = ({ name, title, press, adjust: [adjustActionId, adjustOptions], level: [levelId, levelOptions], pos: [posId, posOptions], feedbacks }) => ({
|
||||
type: 'layered',
|
||||
name,
|
||||
style: { text, size: 'auto', color: WHITE, bgcolor: DARK },
|
||||
steps: [
|
||||
elements: [
|
||||
{ type: 'box', id: 'bg', x: 0, y: 0, width: 100, height: 100, color: BLACK },
|
||||
text('title', 0, 0, 100, 55, title),
|
||||
text('level', 0, 52, 100, 32, '$(local:level) dB'),
|
||||
{
|
||||
down: press,
|
||||
up: [],
|
||||
rotate_left: [act(adjustActionId, { ...adjustOptions, delta: -1 })],
|
||||
rotate_right: [act(adjustActionId, { ...adjustOptions, delta: 1 })],
|
||||
type: 'gauge',
|
||||
id: 'gauge',
|
||||
x: 0,
|
||||
y: 84,
|
||||
width: 100,
|
||||
height: 16,
|
||||
value: { isExpression: true, value: '$(local:pos)' },
|
||||
min: 0,
|
||||
max: 100,
|
||||
orientation: 'horizontal',
|
||||
trackStyle: 'dimmed',
|
||||
fillEnabled: true,
|
||||
multiColour: false,
|
||||
stops: [{ value: 0, color: GAUGE_LEVEL, gradient: false }],
|
||||
},
|
||||
],
|
||||
steps: knobSteps(press, adjustActionId, adjustOptions),
|
||||
feedbacks,
|
||||
localVariables,
|
||||
localVariables: [localFeedback('level', levelId, levelOptions), localFeedback('pos', posId, posOptions)],
|
||||
})
|
||||
/** Layered input meter: name on the left, a vertical gauge (green / amber / red zones) at the right edge. */
|
||||
const layeredMeter = ({ name, title, options }) => ({
|
||||
type: 'layered',
|
||||
name,
|
||||
elements: [
|
||||
{ type: 'box', id: 'bg', x: 0, y: 0, width: 100, height: 100, color: BLACK },
|
||||
text('title', 0, 0, 86, 100, title),
|
||||
{
|
||||
type: 'gauge',
|
||||
id: 'gauge',
|
||||
x: 86,
|
||||
y: 0,
|
||||
width: 14,
|
||||
height: 100,
|
||||
value: { isExpression: true, value: '$(local:pos)' },
|
||||
min: 0,
|
||||
max: 100,
|
||||
orientation: 'vertical',
|
||||
trackStyle: 'dimmed',
|
||||
fillEnabled: true,
|
||||
multiColour: true,
|
||||
stops: [
|
||||
{ value: 0, color: GAUGE_GREEN, gradient: false },
|
||||
{ value: 70, color: METER_AMBER, gradient: false },
|
||||
{ value: 90, color: METER_RED, gradient: false },
|
||||
],
|
||||
},
|
||||
],
|
||||
steps: [{ down: [], up: [] }],
|
||||
feedbacks: [tint('input_signal', { ...options, threshold: 5 }, SIGNAL_BG), tint('input_peak', { ...options, hold: 2 }, MUTED_RED)],
|
||||
localVariables: [localFeedback('pos', 'input_meter_pos', options)],
|
||||
})
|
||||
const group = (id, name, ids) => ({ id, type: 'simple', name, presets: ids })
|
||||
|
||||
@@ -57,15 +130,15 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
const name = s.displayName('input', n)
|
||||
const tag = `${n} · ${name}`
|
||||
presets[`input_mute_${n}`] = simple(`Mute: ${tag}`, nameVar('input', n), [act('input_mute', { channels: [n], state: 'toggle' })], [fb('input_muted', { channel: n }, RED)])
|
||||
presets[`input_knob_${n}`] = knob(
|
||||
`Fader knob: ${tag}`,
|
||||
`${nameVar('input', n)}\\n$(local:level) dB`,
|
||||
[act('input_mute', { channels: [n], state: 'toggle' })],
|
||||
'input_fader_adjust',
|
||||
{ channel: n },
|
||||
[localFeedback('level', 'input_fader_value', { channel: n })],
|
||||
[fb('input_muted', { channel: n }, RED), { feedbackId: 'input_fader_bar', options: { channel: n, color: BAR } }],
|
||||
)
|
||||
presets[`input_knob_${n}`] = layeredKnob({
|
||||
name: `Fader knob: ${tag}`,
|
||||
title: nameVar('input', n),
|
||||
press: [act('input_mute', { channels: [n], state: 'toggle' })],
|
||||
adjust: ['input_fader_adjust', { channel: n }],
|
||||
level: ['input_fader_value', { channel: n }],
|
||||
pos: ['input_fader_pos', { channel: n }],
|
||||
feedbacks: [tint('input_muted', { channel: n }, MUTED_RED)],
|
||||
})
|
||||
presets[`input_solo_${n}`] = simple(`Solo: ${tag}`, `${nameVar('input', n)}\\nSOLO`, [act('input_solo', { channels: [n], state: 'toggle' })], [fb('input_solo', { channel: n }, AMBER, COLORS.black)])
|
||||
for (const [meter, prefix, label] of [
|
||||
['level', 'input_meter', 'Meter'],
|
||||
@@ -73,16 +146,7 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
['comp', 'input_comp_gr', 'Compressor reduction'],
|
||||
]) {
|
||||
if (meter !== 'level' && !grMeters) continue
|
||||
presets[`${prefix}_${n}`] = simple(
|
||||
`${label}: ${tag}`,
|
||||
nameVar('input', n),
|
||||
[],
|
||||
[
|
||||
{ feedbackId: 'input_meter_bar', options: { channel: n, meter } },
|
||||
fb('input_signal', { channel: n, meter, threshold: 5 }, GREEN),
|
||||
fb('input_peak', { channel: n, meter, hold: 2 }, RED),
|
||||
],
|
||||
)
|
||||
presets[`${prefix}_${n}`] = layeredMeter({ name: `${label}: ${tag}`, title: nameVar('input', n), options: { channel: n, meter } })
|
||||
meterIds[meter].push(`${prefix}_${n}`)
|
||||
}
|
||||
muteIds.push(`input_mute_${n}`)
|
||||
@@ -114,15 +178,15 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
for (const n of s.named('buss')) {
|
||||
const tag = `${n} · ${s.displayName('buss', n)} (${s.bussMode(n)})`
|
||||
presets[`buss_mute_${n}`] = simple(`Master mute: ${tag}`, nameVar('buss', n), [act('buss_mute', { busses: [n], state: 'toggle' })], [fb('buss_muted', { buss: n }, RED)])
|
||||
presets[`buss_knob_${n}`] = knob(
|
||||
`Master fader (knob): ${tag}`,
|
||||
`${nameVar('buss', n)}\\n$(local:level) dB`,
|
||||
[act('buss_mute', { busses: [n], state: 'toggle' })],
|
||||
'buss_fader_adjust',
|
||||
{ buss: n },
|
||||
[localFeedback('level', 'buss_fader_value', { buss: n })],
|
||||
[fb('buss_muted', { buss: n }, RED), { feedbackId: 'buss_fader_bar', options: { buss: n, color: BAR } }],
|
||||
)
|
||||
presets[`buss_knob_${n}`] = layeredKnob({
|
||||
name: `Master fader (knob): ${tag}`,
|
||||
title: nameVar('buss', n),
|
||||
press: [act('buss_mute', { busses: [n], state: 'toggle' })],
|
||||
adjust: ['buss_fader_adjust', { buss: n }],
|
||||
level: ['buss_fader_value', { buss: n }],
|
||||
pos: ['buss_fader_pos', { buss: n }],
|
||||
feedbacks: [tint('buss_muted', { buss: n }, MUTED_RED)],
|
||||
})
|
||||
muteIds.push(`buss_mute_${n}`)
|
||||
knobIds.push(`buss_knob_${n}`)
|
||||
}
|
||||
@@ -145,15 +209,15 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
presets[`send_on_${ch}_${b}`] = simple(`Send on/off: ${tag}`, text, [act('send_on', { channel: ch, buss: b, state: 'toggle' })], [fb('send_on', { channel: ch, buss: b }, GREEN)], { localVariables: lv })
|
||||
onIds.push(`send_on_${ch}_${b}`)
|
||||
if (withSendKnobs) {
|
||||
presets[`send_knob_${ch}_${b}`] = knob(
|
||||
`Send level (knob): ${tag}`,
|
||||
text,
|
||||
[act('send_on', { channel: ch, buss: b, state: 'toggle' })],
|
||||
'send_level_adjust',
|
||||
{ channel: ch, buss: b },
|
||||
lv,
|
||||
[fb('send_on', { channel: ch, buss: b }, GREEN), { feedbackId: 'send_level_bar', options: { channel: ch, buss: b, color: BAR } }],
|
||||
)
|
||||
presets[`send_knob_${ch}_${b}`] = layeredKnob({
|
||||
name: `Send level (knob): ${tag}`,
|
||||
title: nameVar('input', ch),
|
||||
press: [act('send_on', { channel: ch, buss: b, state: 'toggle' })],
|
||||
adjust: ['send_level_adjust', { channel: ch, buss: b }],
|
||||
level: ['send_level_value', { channel: ch, buss: b }],
|
||||
pos: ['send_level_pos', { channel: ch, buss: b }],
|
||||
feedbacks: [tint('send_on', { channel: ch, buss: b }, ON_GREEN)],
|
||||
})
|
||||
knobIds.push(`send_knob_${ch}_${b}`)
|
||||
}
|
||||
}
|
||||
@@ -185,15 +249,15 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
for (const n of s.named('matrix')) {
|
||||
const tag = `${n} · ${s.displayName('matrix', n)}`
|
||||
presets[`matrix_mute_${n}`] = simple(`Mute: ${tag}`, nameVar('matrix', n), [act('matrix_mute', { matrix: n, state: 'toggle' })], [fb('matrix_muted', { matrix: n }, RED)])
|
||||
presets[`matrix_knob_${n}`] = knob(
|
||||
`Fader (knob): ${tag}`,
|
||||
`${nameVar('matrix', n)}\\n$(local:level) dB`,
|
||||
[act('matrix_mute', { matrix: n, state: 'toggle' })],
|
||||
'matrix_fader_adjust',
|
||||
{ matrix: n },
|
||||
[localFeedback('level', 'matrix_fader_value', { matrix: n })],
|
||||
[fb('matrix_muted', { matrix: n }, RED)],
|
||||
)
|
||||
presets[`matrix_knob_${n}`] = layeredKnob({
|
||||
name: `Fader (knob): ${tag}`,
|
||||
title: nameVar('matrix', n),
|
||||
press: [act('matrix_mute', { matrix: n, state: 'toggle' })],
|
||||
adjust: ['matrix_fader_adjust', { matrix: n }],
|
||||
level: ['matrix_fader_value', { matrix: n }],
|
||||
pos: ['matrix_fader_pos', { matrix: n }],
|
||||
feedbacks: [tint('matrix_muted', { matrix: n }, MUTED_RED)],
|
||||
})
|
||||
muteIds.push(`matrix_mute_${n}`)
|
||||
knobIds.push(`matrix_knob_${n}`)
|
||||
}
|
||||
@@ -205,15 +269,15 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
for (const n of s.named('cg')) {
|
||||
const tag = `${n} · ${s.displayName('cg', n)}`
|
||||
presets[`cg_mute_${n}`] = simple(`Mute: ${tag}`, nameVar('cg', n), [act('cg_mute', { cg: n, state: 'toggle' })], [fb('cg_muted', { cg: n }, RED)])
|
||||
presets[`cg_knob_${n}`] = knob(
|
||||
`Fader (knob): ${tag}`,
|
||||
`${nameVar('cg', n)}\\n$(local:level) dB`,
|
||||
[act('cg_mute', { cg: n, state: 'toggle' })],
|
||||
'cg_fader_adjust',
|
||||
{ cg: n },
|
||||
[localFeedback('level', 'cg_fader_value', { cg: n })],
|
||||
[fb('cg_muted', { cg: n }, RED)],
|
||||
)
|
||||
presets[`cg_knob_${n}`] = layeredKnob({
|
||||
name: `Fader (knob): ${tag}`,
|
||||
title: nameVar('cg', n),
|
||||
press: [act('cg_mute', { cg: n, state: 'toggle' })],
|
||||
adjust: ['cg_fader_adjust', { cg: n }],
|
||||
level: ['cg_fader_value', { cg: n }],
|
||||
pos: ['cg_fader_pos', { cg: n }],
|
||||
feedbacks: [tint('cg_muted', { cg: n }, MUTED_RED)],
|
||||
})
|
||||
muteIds.push(`cg_mute_${n}`)
|
||||
knobIds.push(`cg_knob_${n}`)
|
||||
}
|
||||
@@ -231,15 +295,15 @@ function build(inst, { grMeters = true, sendKnobs: withSendKnobs = true } = {})
|
||||
const options = { matrixIn: inN, matrixOut: out }
|
||||
const lv = [localFeedback('level', 'matrix_send_level_value', options)]
|
||||
presets[`msend_on_${inN}_${out}`] = simple(`Matrix send on/off: ${tag}`, text, [act('matrix_send_on', { ...options, state: 'toggle' })], [fb('matrix_send_on', options, GREEN)], { localVariables: lv })
|
||||
presets[`msend_knob_${inN}_${out}`] = knob(
|
||||
`Matrix send level (knob): ${tag}`,
|
||||
text,
|
||||
[act('matrix_send_on', { ...options, state: 'toggle' })],
|
||||
'matrix_send_level_adjust',
|
||||
options,
|
||||
lv,
|
||||
[fb('matrix_send_on', options, GREEN), { feedbackId: 'matrix_send_level_bar', options: { ...options, color: BAR } }],
|
||||
)
|
||||
presets[`msend_knob_${inN}_${out}`] = layeredKnob({
|
||||
name: `Matrix send level (knob): ${tag}`,
|
||||
title: `Matrix In ${inN}`,
|
||||
press: [act('matrix_send_on', { ...options, state: 'toggle' })],
|
||||
adjust: ['matrix_send_level_adjust', options],
|
||||
level: ['matrix_send_level_value', options],
|
||||
pos: ['matrix_send_level_pos', options],
|
||||
feedbacks: [tint('matrix_send_on', options, ON_GREEN)],
|
||||
})
|
||||
onIds.push(`msend_on_${inN}_${out}`)
|
||||
knobIds.push(`msend_knob_${inN}_${out}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user