@@ -5,16 +5,45 @@ import { CommonActions } from './actions/common.js'
55import { FeedbackId } from './feedbacks.js'
66
77export function GetPresets ( _instance : InstanceBaseExt < WingConfig > ) : CompanionPresetDefinitions {
8+ const model = _instance . model
9+
810 const presets : {
911 [ id : string ] : CompanionButtonPresetDefinition | undefined
1012 } = { }
1113
12- presets [ 'mute-button' ] = {
14+ for ( let i = 1 ; i <= model . channels ; i ++ ) {
15+ presets [ `ch${ i } -mute-button` ] = getMutePreset ( 'ch' , i )
16+ presets [ `ch${ i } -solo-button` ] = getSoloPreset ( 'ch' , i )
17+ }
18+
19+ for ( let i = 1 ; i <= model . auxes ; i ++ ) {
20+ presets [ `aux${ i } -mute-button` ] = getMutePreset ( 'aux' , i )
21+ presets [ `aux${ i } -solo-button` ] = getSoloPreset ( 'aux' , i )
22+ }
23+
24+ for ( let i = 1 ; i <= model . busses ; i ++ ) {
25+ presets [ `bus${ i } -mute-button` ] = getMutePreset ( 'bus' , i )
26+ }
27+
28+ for ( let i = 1 ; i <= model . matrices ; i ++ ) {
29+ presets [ `mtx${ i } -mute-button` ] = getMutePreset ( 'mtx' , i )
30+ }
31+
32+ for ( let i = 1 ; i <= model . mains ; i ++ ) {
33+ presets [ `main${ i } -mute-button` ] = getMutePreset ( 'main' , i )
34+ }
35+
36+ return presets
37+ }
38+
39+ function getMutePreset ( base : string , val : number ) : CompanionButtonPresetDefinition {
40+ const path = `/${ base } /${ val } `
41+ return {
1342 name : 'Mute Button' ,
14- category : 'Channel ' ,
43+ category : 'Mute ' ,
1544 type : 'button' ,
1645 style : {
17- text : ' Mute\\n$(wing:ch1_name)' ,
46+ text : ` Mute\\n$(wing:${ base } ${ val } _name)` ,
1847 size : 'auto' ,
1948 color : combineRgb ( 255 , 255 , 255 ) ,
2049 bgcolor : combineRgb ( 0 , 0 , 0 ) ,
@@ -27,7 +56,7 @@ export function GetPresets(_instance: InstanceBaseExt<WingConfig>): CompanionPre
2756 down : [
2857 {
2958 actionId : CommonActions . SetMute ,
30- options : { sel : '/ch/1' , mute : 2 } ,
59+ options : { sel : path , mute : 2 } ,
3160 } ,
3261 ] ,
3362 up : [ ] ,
@@ -36,21 +65,24 @@ export function GetPresets(_instance: InstanceBaseExt<WingConfig>): CompanionPre
3665 feedbacks : [
3766 {
3867 feedbackId : FeedbackId . Mute ,
39- options : { sel : '/ch/1' , mute : 1 } ,
68+ options : { sel : path , mute : 1 } ,
4069 style : {
4170 color : combineRgb ( 255 , 255 , 255 ) ,
4271 bgcolor : combineRgb ( 255 , 0 , 0 ) ,
4372 } ,
4473 } ,
4574 ] ,
4675 }
76+ }
4777
48- presets [ 'solo-button' ] = {
78+ function getSoloPreset ( base : string , val : number ) : CompanionButtonPresetDefinition {
79+ const path = `/${ base } /${ val } `
80+ return {
4981 name : 'Solo Button' ,
50- category : 'Channel ' ,
82+ category : 'Solo ' ,
5183 type : 'button' ,
5284 style : {
53- text : ' Solo CH1' ,
85+ text : ` Solo\\n$(wing: ${ base } ${ val } _name)` ,
5486 size : 'auto' ,
5587 color : combineRgb ( 255 , 255 , 255 ) ,
5688 bgcolor : combineRgb ( 0 , 0 , 0 ) ,
@@ -61,10 +93,14 @@ export function GetPresets(_instance: InstanceBaseExt<WingConfig>): CompanionPre
6193 steps : [
6294 {
6395 down : [
96+ {
97+ actionId : CommonActions . StoreFader ,
98+ options : { sel : path } ,
99+ } ,
64100 {
65101 actionId : CommonActions . DeltaFader ,
66102 options : {
67- sel : '/ch/1' ,
103+ sel : path ,
68104 delta : 3 ,
69105 fadeDuration : 1000 ,
70106 fadeAlgorithm : 'quadratic' ,
@@ -73,31 +109,29 @@ export function GetPresets(_instance: InstanceBaseExt<WingConfig>): CompanionPre
73109 } ,
74110 {
75111 actionId : CommonActions . StorePanorama ,
76- options : { sel : '/ch/1' } ,
112+ options : { sel : path } ,
77113 } ,
78114 {
79115 actionId : CommonActions . SetPanorama ,
80- options : { sel : '/ch/1' , pan : 0 , fadeDuration : 1000 , fadeAlgorithm : 'quadratic' , fadeType : 'ease-in-out' } ,
116+ options : { sel : path , pan : 0 , fadeDuration : 1000 , fadeAlgorithm : 'quadratic' , fadeType : 'ease-in-out' } ,
81117 } ,
82118 ] ,
83119 up : [ ] ,
84120 } ,
85121 {
86122 down : [
87123 {
88- actionId : CommonActions . UndoDeltaFader ,
89- options : { sel : '/ch/1' , fadeDuration : 1000 , fadeAlgorithm : 'quadratic' , fadeType : 'ease-in-out' } ,
124+ actionId : CommonActions . RestoreFader ,
125+ options : { sel : path , fadeDuration : 1000 , fadeAlgorithm : 'quadratic' , fadeType : 'ease-in-out' } ,
90126 } ,
91127 {
92128 actionId : CommonActions . RestorePanorama ,
93- options : { sel : '/ch/1' , fadeDuration : 1000 , fadeAlgorithm : 'quadratic' , fadeType : 'ease-in-out' } ,
129+ options : { sel : path , fadeDuration : 1000 , fadeAlgorithm : 'quadratic' , fadeType : 'ease-in-out' } ,
94130 } ,
95131 ] ,
96132 up : [ ] ,
97133 } ,
98134 ] ,
99135 feedbacks : [ ] ,
100136 }
101-
102- return presets
103137}
0 commit comments