Skip to content

Commit 6a5ca7d

Browse files
authored
Merge pull request #54 from bitfocus:add-eq-enable-disable-command
Add EQ Enable/Disable Command
2 parents 09a3cbf + cadd9bb commit 6a5ca7d

File tree

7 files changed

+75
-0
lines changed

7 files changed

+75
-0
lines changed

src/actions/common.ts

+23
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export enum CommonActions {
5454
// Delay
5555
SetDelay = 'set-delay',
5656
SetDelayAmount = 'set-delay-amount',
57+
// EQ
58+
SetEqOn = 'set-eq-on',
5759

5860
//////////// SEND
5961
SetSendMute = 'set-send-mute',
@@ -631,6 +633,27 @@ export function createCommonActions(self: InstanceBaseExt<WingConfig>): Companio
631633
}
632634
},
633635
},
636+
[CommonActions.SetEqOn]: {
637+
name: 'Set EQ On',
638+
description: 'Enable, disable or toggle the on-state of an EQ on a channel, bus, aux, matrix or main.',
639+
options: [GetDropdown('Selection', 'sel', allChannels), GetOnOffToggleDropdown('enable', 'Enable')],
640+
callback: async (event) => {
641+
const sel = event.options.sel as string
642+
const cmd = ActionUtil.getEqEnableCommand(sel, getNodeNumber(event, 'sel'))
643+
const val = ActionUtil.getNumber(event, 'enable')
644+
const currentVal = StateUtil.getBooleanFromState(cmd, state)
645+
if (val < 2) {
646+
send(cmd, val)
647+
} else {
648+
send(cmd, Number(!currentVal))
649+
}
650+
},
651+
subscribe: (event) => {
652+
const sel = event.options.sel as string
653+
const cmd = ActionUtil.getSoloCommand(sel, getNodeNumber(event, 'sel'))
654+
ensureLoaded(cmd)
655+
},
656+
},
634657

635658
////////////////////////////////////////////////////////////////
636659
// Send Fader

src/actions/utils.ts

+16
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,22 @@ export function getTalkbackAssignCommand(talkback: string, destination: string):
317317
return cmd
318318
}
319319

320+
export function getEqEnableCommand(sel: string, val: number): string {
321+
let cmd = ''
322+
if (sel.startsWith('/ch')) {
323+
cmd = ChannelCommands.EqOn(val)
324+
} else if (sel.startsWith('/aux')) {
325+
cmd = AuxCommands.EqOn(val)
326+
} else if (sel.startsWith('/bus')) {
327+
cmd = BusCommands.EqOn(val)
328+
} else if (sel.startsWith('/mtx')) {
329+
cmd = MatrixCommands.EqOn(val)
330+
} else if (sel.startsWith('/main')) {
331+
cmd = MainCommands.EqOn(val)
332+
}
333+
return cmd
334+
}
335+
320336
export function getSetOrToggleValue(cmd: string, val: number, state: WingState, invert?: boolean): number {
321337
const inv = invert ?? false
322338
if (val >= 2) {

src/commands/auxes.ts

+8
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,12 @@ export namespace AuxCommands {
143143
export function SendPan(aux: number, send: number): string {
144144
return `${SendNode(aux, send)}/pan`
145145
}
146+
147+
export function EqNode(aux: number): string {
148+
return `${Node(aux)}/eq`
149+
}
150+
151+
export function EqOn(aux: number): string {
152+
return `${EqNode(aux)}/on`
153+
}
146154
}

src/commands/bus.ts

+8
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,12 @@ export namespace BusCommands {
127127
export function DelayAmount(bus: number): string {
128128
return `${DelayNode(bus)}/dly`
129129
}
130+
131+
export function EqNode(bus: number): string {
132+
return `${Node(bus)}/eq`
133+
}
134+
135+
export function EqOn(bus: number): string {
136+
return `${EqNode(bus)}/on`
137+
}
130138
}

src/commands/channel.ts

+4
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ export namespace ChannelCommands {
224224
return `${Node(channel)}/eq`
225225
}
226226

227+
export function EqOn(channel: number): string {
228+
return `${EqNode(channel)}/on`
229+
}
230+
227231
export function EqModel(channel: number): string {
228232
return `${EqNode(channel)}/mdl`
229233
}

src/commands/main.ts

+8
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,12 @@ export namespace MainCommands {
103103
export function DelayAmount(main: number): string {
104104
return `${DelayNode(main)}/dly`
105105
}
106+
107+
export function EqNode(main: number): string {
108+
return `${Node(main)}/eq`
109+
}
110+
111+
export function EqOn(main: number): string {
112+
return `${EqNode(main)}/on`
113+
}
106114
}

src/commands/matrix.ts

+8
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,12 @@ export namespace MatrixCommands {
115115
export function DelayAmount(matrix: number): string {
116116
return `${DelayNode(matrix)}/dly`
117117
}
118+
119+
export function EqNode(matrix: number): string {
120+
return `${Node(matrix)}/eq`
121+
}
122+
123+
export function EqOn(matrix: number): string {
124+
return `${EqNode(matrix)}/on`
125+
}
118126
}

0 commit comments

Comments
 (0)