@@ -540,8 +540,9 @@ static int open_mixer (RobTkApp* ui, const char* card, int opts)
540540 }
541541 if ((strstr (c -> name , "Matrix " ) || (strstr (c -> name , "Mixer " ))) && strstr (c -> name , " Input" )) {
542542 ++ d .smi ;
543- if (strstr (c -> name , "Mixer " ) && (d .smi == 2 ))
543+ if (strstr (c -> name , "Mixer " ) && (d .smi == 2 )) {
544544 d .matrix_in_stride = i - d .matrix_in_offset ;
545+ }
545546 }
546547 if (strstr (c -> name , "Master " ) || strstr (c -> name , " Output" )) { // Source enum
547548 char * t1 = strstr (c -> name , " Output" );
@@ -605,8 +606,7 @@ static int open_mixer (RobTkApp* ui, const char* card, int opts)
605606 d .matrix_mix_stride = d .smo + 1 ;
606607 d .matrix_in_stride = d .smo + 1 ;
607608 }
608- } else
609- if (strstr (c -> name , "Mix " ) && strstr (c -> name , " Input " )) {
609+ } else if (strstr (c -> name , "Mix " ) && strstr (c -> name , " Input " )) {
610610 int last = c -> name [4 ] - 'A' + 1 ;
611611 assert (last > 0 && last <= 20 );
612612 if (last > d .smo ) {
@@ -638,7 +638,15 @@ static int open_mixer (RobTkApp* ui, const char* card, int opts)
638638 dump_device_desc (ui -> device );
639639 }
640640 }
641- if ((opts & OPT_DETECT ) && (d .smi != 0 && d .smo != 0 && d .sin != 0 && d .sout != 0 && (d .smst != 0 || d .samo != 0 ) && d .matrix_in_offset != 0 && d .matrix_mix_offset != 0 )) {
641+ if ((opts & OPT_DETECT )
642+ /* test is all relevant offsets have been detected */
643+ && ( d .smi != 0 && d .smo != 0
644+ && d .sin != 0 && d .sout != 0
645+ && d .matrix_in_offset != 0 && d .matrix_mix_offset != 0
646+ && (d .smst != 0 || d .samo != 0 )
647+ )
648+ )
649+ {
642650 if (verbose ) {
643651 printf ("Using autodetected mapping.\n" );
644652 }
@@ -1285,9 +1293,8 @@ static RobWidget* toplevel (RobTkApp* ui, void* const top) {
12851293
12861294 /* master level */
12871295 if (ui -> device -> smst ) {
1288- ui -> out_mst = robtk_lbl_new ("Master" );
1289- rob_table_attach (ui -> output , robtk_lbl_widget (ui -> out_mst ), 0 , 2 , 0 , 1 , 2 , 2 , RTK_SHRINK , RTK_SHRINK );
1290- {
1296+ ui -> out_mst = robtk_lbl_new ("Master" );
1297+ rob_table_attach (ui -> output , robtk_lbl_widget (ui -> out_mst ), 0 , 2 , 0 , 1 , 2 , 2 , RTK_SHRINK , RTK_SHRINK );
12911298 Mctrl * ctrl = mst_gain (ui );
12921299 ui -> mst_gain = robtk_dial_new_with_size (
12931300 0 , 1 , 1.f / 80.f ,
@@ -1305,7 +1312,6 @@ static RobWidget* toplevel (RobTkApp* ui, void* const top) {
13051312 robtk_dial_annotation_callback (ui -> mst_gain , dial_annotation_db , ui );
13061313 rob_table_attach (ui -> output , robtk_dial_widget (ui -> mst_gain ), 0 , 2 , 1 , 3 , 2 , 0 , RTK_SHRINK , RTK_SHRINK );
13071314 }
1308- }
13091315
13101316 /* output level + labels */
13111317 for (unsigned int o = 0 ; o < ui -> device -> smst ; ++ o ) {
@@ -1383,10 +1389,11 @@ static RobWidget* toplevel (RobTkApp* ui, void* const top) {
13831389 /* Pads */
13841390 for (unsigned int i = 0 ; i < ui -> device -> num_pad ; ++ i ) {
13851391 ui -> btn_pad [i ] = robtk_cbtn_new ("Pad" , GBT_LED_LEFT , false);
1386- if (ui -> device -> pads_are_switches )
1392+ if (ui -> device -> pads_are_switches ) {
13871393 robtk_cbtn_set_active (ui -> btn_pad [i ], get_switch (pad (ui , i )) == 1 );
1388- else
1394+ } else {
13891395 robtk_cbtn_set_active (ui -> btn_pad [i ], get_enum (pad (ui , i )) == 1 );
1396+ }
13901397 robtk_cbtn_set_callback (ui -> btn_pad [i ], cb_set_pad , ui );
13911398 rob_table_attach (ui -> output , robtk_cbtn_widget (ui -> btn_pad [i ]),
13921399 i , i + 1 , 4 , 5 , 0 , 0 , RTK_SHRINK , RTK_SHRINK );
0 commit comments