@@ -22,10 +22,14 @@ import { WingConfig } from '../config.js'
2222import * as ActionUtil from './utils.js'
2323import { StateUtil } from '../state/index.js'
2424import { FadeDurationChoice } from '../choices/fades.js'
25+ import { getIdLabelPair } from '../choices/utils.js'
2526
2627export enum CommonActions {
27- SetColor = 'set-color' ,
28+ SetScribbleLight = 'set-scribble-light' ,
29+ SetScribbleLightColor = 'set-scribble-light-color' ,
2830 SetName = 'set-name' ,
31+ SetSolo = 'set-solo' ,
32+ ClearSolo = 'clear-solo' ,
2933 // Gain
3034 SetGain = 'set-gain' ,
3135 StoreGain = 'store-gain' ,
@@ -46,9 +50,7 @@ export enum CommonActions {
4650 RestorePanorama = 'restore-panorama' ,
4751 DeltaPanorama = 'panorama-delta' ,
4852 UndoDeltaPanorama = 'undo-panorama' ,
49- // Solo
50- SetSolo = 'set-solo' ,
51- ClearSolo = 'clear-solo' ,
53+
5254 //////////// SEND
5355 SetSendMute = 'set-send-mute' ,
5456 // Send Fader
@@ -89,9 +91,40 @@ export function createCommonActions(self: InstanceBaseExt<WingConfig>): Companio
8991 const allSendSources = [ ...state . namedChoices . channels , ...state . namedChoices . auxes , ...state . namedChoices . busses ]
9092
9193 const actions : { [ id in CommonActions ] : CompanionActionWithCallback | undefined } = {
92- [ CommonActions . SetColor ] : {
93- name : 'Set Color' ,
94- description : 'Set the scribble strip color of a channel, aux, bus, matrix or main.' ,
94+ // TODO: add DCAs once merged
95+ [ CommonActions . SetScribbleLight ] : {
96+ name : 'Set Scribble Light' ,
97+ description : 'Set or toggle the scribble light state of a channel, aux, bus, matrix or main.' ,
98+ options : [
99+ GetDropdown ( 'Selection' , 'sel' , [ ...allChannels ] ) ,
100+ GetDropdown (
101+ 'Scribble Light' ,
102+ 'led' ,
103+ [ getIdLabelPair ( '1' , 'On' ) , getIdLabelPair ( '0' , 'Off' ) , getIdLabelPair ( '2' , 'Toggle' ) ] ,
104+ '1' ,
105+ ) ,
106+ ] ,
107+ callback : async ( event ) => {
108+ const sel = event . options . sel as string
109+ const cmd = ActionUtil . getScribblelightCommand ( sel , getNodeNumber ( event , 'sel' ) )
110+ const val = ActionUtil . getNumber ( event , 'led' )
111+ const currentVal = StateUtil . getBooleanFromState ( cmd , state )
112+ if ( val < 2 ) {
113+ send ( cmd , val )
114+ } else {
115+ send ( cmd , Number ( ! currentVal ) )
116+ }
117+ } ,
118+ subscribe : ( event ) => {
119+ const sel = event . options . sel as string
120+ const cmd = ActionUtil . getScribblelightCommand ( sel , getNodeNumber ( event , 'sel' ) )
121+ ensureLoaded ( cmd )
122+ } ,
123+ } ,
124+ // TODO: add dca's
125+ [ CommonActions . SetScribbleLightColor ] : {
126+ name : 'Set Scribble Light Color' ,
127+ description : 'Set the scribble light color of a channel, aux, bus, matrix or main.' ,
95128 options : [ GetDropdown ( 'Selection' , 'sel' , allChannels ) , GetColorDropdown ( 'color' , 'Color' ) ] ,
96129 callback : async ( event ) => {
97130 const sel = event . options . sel as string
0 commit comments