45
45
#define MAX_HIZS 2
46
46
#define MAX_PADS 4
47
47
#define MAX_AIRS 2
48
+ #define MAX_PHANTOM_POWERS 1
48
49
49
50
typedef struct {
50
51
char name [64 ];
@@ -58,6 +59,7 @@ typedef struct {
58
59
unsigned num_hiz ;
59
60
unsigned num_pad ;
60
61
unsigned num_air ;
62
+ unsigned num_phantom_power ;
61
63
bool pads_are_switches ;
62
64
bool matrix_mix_column_major ;
63
65
unsigned matrix_mix_offset ;
@@ -71,6 +73,7 @@ typedef struct {
71
73
int hiz_map [MAX_HIZS ];
72
74
int pad_map [MAX_PADS ];
73
75
int air_map [MAX_AIRS ];
76
+ int phantom_power_map [MAX_PHANTOM_POWERS ];
74
77
} Device ;
75
78
76
79
static Device devices [] = {
@@ -83,6 +86,7 @@ static Device devices[] = {
83
86
.num_hiz = 2 ,
84
87
.num_pad = 0 ,
85
88
.num_air = 0 ,
89
+ .num_phantom_power = 0 ,
86
90
.pads_are_switches = false,
87
91
.matrix_mix_column_major = false,
88
92
.matrix_mix_offset = 33 , .matrix_mix_stride = 7 ,
@@ -103,6 +107,7 @@ static Device devices[] = {
103
107
.num_hiz = 2 ,
104
108
.num_pad = 4 ,
105
109
.num_air = 0 ,
110
+ .num_phantom_power = 0 ,
106
111
.pads_are_switches = false,
107
112
.matrix_mix_column_major = false,
108
113
.matrix_mix_offset = 40 , .matrix_mix_stride = 9 , // < Matrix 01 Mix A
@@ -123,6 +128,7 @@ static Device devices[] = {
123
128
.num_hiz = 2 ,
124
129
.num_pad = 4 , // XXX does the device have pad? bug in kernel-driver?
125
130
.num_air = 0 ,
131
+ .num_phantom_power = 0 ,
126
132
.pads_are_switches = false,
127
133
.matrix_mix_column_major = false,
128
134
.matrix_mix_offset = 26 , .matrix_mix_stride = 9 , // XXX stride should be 7, bug in kernel-driver ?!
@@ -143,6 +149,7 @@ static Device devices[] = {
143
149
.num_hiz = 0 ,
144
150
.num_pad = 0 ,
145
151
.num_air = 0 ,
152
+ .num_phantom_power = 0 ,
146
153
.pads_are_switches = false,
147
154
.matrix_mix_column_major = false,
148
155
.matrix_mix_offset = 50 , .matrix_mix_stride = 9 ,
@@ -161,8 +168,9 @@ static Device devices[] = {
161
168
.smst = 0 ,
162
169
.samo = 4 ,
163
170
.num_hiz = 2 ,
164
- .num_pad = 2 ,
165
- .num_air = 2 ,
171
+ .num_pad = 2 ,
172
+ .num_air = 2 ,
173
+ .num_phantom_power = 0 ,
166
174
.pads_are_switches = true,
167
175
.matrix_mix_column_major = true,
168
176
.matrix_mix_offset = 20 , .matrix_mix_stride = 8 ,
@@ -184,6 +192,7 @@ static Device devices[] = {
184
192
.num_hiz = 2 ,
185
193
.num_pad = 2 ,
186
194
.num_air = 2 ,
195
+ .num_phantom_power = 1 ,
187
196
.pads_are_switches = true,
188
197
.matrix_mix_column_major = true,
189
198
.matrix_mix_offset = 21 , .matrix_mix_stride = 8 ,
@@ -195,6 +204,7 @@ static Device devices[] = {
195
204
.hiz_map = { 15 , 19 },
196
205
.pad_map = { 16 , 20 , -1 , -1 },
197
206
.air_map = { 14 , 18 },
207
+ .phantom_power_map = { 17 },
198
208
},
199
209
};
200
210
@@ -232,6 +242,7 @@ typedef struct {
232
242
RobTkCBtn * * btn_hiz ;
233
243
RobTkCBtn * * btn_pad ;
234
244
RobTkCBtn * * btn_air ;
245
+ RobTkCBtn * * btn_phantom_power ;
235
246
RobTkPBtn * btn_reset ;
236
247
237
248
RobTkLbl * heading [3 ];
@@ -380,6 +391,13 @@ static Mctrl* air (RobTkApp *ui, unsigned c)
380
391
return & ui -> ctrl [ui -> device -> air_map [c ]];
381
392
}
382
393
394
+ /* Phantom power switches */
395
+ static Mctrl * phantom_power (RobTkApp * ui , unsigned c )
396
+ {
397
+ assert (c < ui -> device -> num_phantom_power );
398
+ return & ui -> ctrl [ui -> device -> phantom_power_map [c ]];
399
+ }
400
+
383
401
/* master gain */
384
402
static Mctrl * mst_gain (RobTkApp * ui )
385
403
{
@@ -602,6 +620,8 @@ static int open_mixer (RobTkApp* ui, const char* card, int opts)
602
620
d .pads_are_switches = true;
603
621
} else if (strstr (c -> name , " Air" )) {
604
622
d .air_map [d .num_air ++ ] = i ;
623
+ } else if (strstr (c -> name , " Phantom Power" )) {
624
+ d .phantom_power_map [d .num_phantom_power ++ ] = i ;
605
625
}
606
626
} else {
607
627
if (strstr (c -> name , "Line 0" ) || strstr (c -> name , "Line 1" )) {
@@ -896,6 +916,15 @@ static bool cb_set_air (RobWidget* w, void* handle) {
896
916
return TRUE;
897
917
}
898
918
919
+ static bool cb_set_phantom_power (RobWidget * w , void * handle ) {
920
+ RobTkApp * ui = (RobTkApp * )handle ;
921
+ if (ui -> disable_signals ) return TRUE;
922
+ for (uint32_t i = 0 ; i < ui -> device -> num_phantom_power ; ++ i ) {
923
+ set_switch (phantom_power (ui , i ), robtk_cbtn_get_active (ui -> btn_phantom_power [i ]));
924
+ }
925
+ return TRUE;
926
+ }
927
+
899
928
static bool cb_src_sel (RobWidget * w , void * handle ) {
900
929
RobTkApp * ui = (RobTkApp * )handle ;
901
930
if (ui -> disable_signals ) return TRUE;
@@ -1195,6 +1224,11 @@ static RobWidget* toplevel (RobTkApp* ui, void* const top) {
1195
1224
} else {
1196
1225
ui -> btn_air = NULL ;
1197
1226
}
1227
+ if (ui -> device -> num_phantom_power > 0 ) {
1228
+ ui -> btn_phantom_power = malloc (ui -> device -> num_phantom_power * sizeof (RobTkCBtn * ));
1229
+ } else {
1230
+ ui -> btn_phantom_power = NULL ;
1231
+ }
1198
1232
1199
1233
const int c0 = 4 ; // matrix column offset
1200
1234
const int rb = 2 + ui -> device -> smi ; // matrix bottom
@@ -1429,6 +1463,15 @@ static RobWidget* toplevel (RobTkApp* ui, void* const top) {
1429
1463
i , i + 1 , 5 , 6 , 0 , 0 , RTK_SHRINK , RTK_SHRINK );
1430
1464
}
1431
1465
1466
+ /* Phantom Power */
1467
+ for (unsigned int i = 0 ; i < ui -> device -> num_phantom_power ; ++ i ) {
1468
+ ui -> btn_phantom_power [i ] = robtk_cbtn_new ("Phantom" , GBT_LED_LEFT , false);
1469
+ robtk_cbtn_set_active (ui -> btn_phantom_power [i ], get_switch (phantom_power (ui , i )) == 1 );
1470
+ robtk_cbtn_set_callback (ui -> btn_phantom_power [i ], cb_set_phantom_power , ui );
1471
+ rob_table_attach (ui -> output , robtk_cbtn_widget (ui -> btn_phantom_power [i ]),
1472
+ i , i + 1 , 6 , 7 , 0 , 0 , RTK_SHRINK , RTK_SHRINK );
1473
+ }
1474
+
1432
1475
/* output selectors */
1433
1476
for (unsigned int o = 0 ; o < ui -> device -> sout ; ++ o ) {
1434
1477
int row = 4 * floor (o / 10 ); // beware of bleed into Hi-Z, Pads
@@ -1525,6 +1568,10 @@ static void gui_cleanup (RobTkApp* ui) {
1525
1568
robtk_cbtn_destroy (ui -> btn_air [i ]);
1526
1569
}
1527
1570
1571
+ for (int i = 0 ; i < ui -> device -> num_phantom_power ; i ++ ) {
1572
+ robtk_cbtn_destroy (ui -> btn_phantom_power [i ]);
1573
+ }
1574
+
1528
1575
robtk_sep_destroy (ui -> sep_v );
1529
1576
robtk_sep_destroy (ui -> sep_h );
1530
1577
robtk_sep_destroy (ui -> spc_v [0 ]);
@@ -1554,6 +1601,7 @@ static void gui_cleanup (RobTkApp* ui) {
1554
1601
free (ui -> btn_hiz );
1555
1602
free (ui -> btn_pad );
1556
1603
free (ui -> btn_air );
1604
+ free (ui -> btn_phantom_power );
1557
1605
}
1558
1606
1559
1607
static char * lookup_device ()
0 commit comments