Subversion Repositories svn.mios32

Rev

Rev 2531 | Rev 2533 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2531 Rev 2532
Line 1... Line 1...
1
// $Id: seq_ui.c 2531 2017-10-11 22:55:38Z tk $
1
// $Id: seq_ui.c 2532 2017-10-12 21:50:45Z tk $
2
/*
2
/*
3
 * User Interface Routines
3
 * User Interface Routines
4
 *
4
 *
5
 * ==========================================================================
5
 * ==========================================================================
6
 *
6
 *
Line 66... Line 66...
66
u8 ui_selected_trg_layer;
66
u8 ui_selected_trg_layer;
67
u8 ui_selected_instrument;
67
u8 ui_selected_instrument;
68
u8 ui_selected_step_view;
68
u8 ui_selected_step_view;
69
u8 ui_selected_step;
69
u8 ui_selected_step;
70
u8 ui_selected_item;
70
u8 ui_selected_item;
-
 
71
u8 ui_selected_bookmark;
-
 
72
u8 ui_selected_phrase;
71
u16 ui_selected_gp_buttons;
73
u16 ui_selected_gp_buttons;
72
74
73
u8 ui_selected_item;
75
u8 ui_selected_item;
74
76
75
u16 ui_hold_msg_ctr;
77
u16 ui_hold_msg_ctr;
Line 78... Line 80...
78
seq_ui_page_t ui_page;
80
seq_ui_page_t ui_page;
79
seq_ui_page_t ui_selected_page;
81
seq_ui_page_t ui_selected_page;
80
seq_ui_page_t ui_stepview_prev_page;
82
seq_ui_page_t ui_stepview_prev_page;
81
seq_ui_page_t ui_trglayer_prev_page;
83
seq_ui_page_t ui_trglayer_prev_page;
82
seq_ui_page_t ui_parlayer_prev_page;
84
seq_ui_page_t ui_parlayer_prev_page;
-
 
85
seq_ui_page_t ui_inssel_prev_page;
-
 
86
seq_ui_page_t ui_tracksel_prev_page;
-
 
87
seq_ui_page_t ui_bookmarks_prev_page;
-
 
88
seq_ui_page_t ui_mute_prev_page;
83
89
84
volatile u8 ui_cursor_flash;
90
volatile u8 ui_cursor_flash;
85
volatile u8 ui_cursor_flash_overrun_ctr;
91
volatile u8 ui_cursor_flash_overrun_ctr;
86
u16 ui_cursor_flash_ctr;
92
u16 ui_cursor_flash_ctr;
87
93
Line 106... Line 112...
106
112
107
// to display directories via SEQ_UI_SelectListItem() and SEQ_LCD_PrintList() -- see seq_ui_sysex.c as example
113
// to display directories via SEQ_UI_SelectListItem() and SEQ_LCD_PrintList() -- see seq_ui_sysex.c as example
108
char ui_global_dir_list[80];
114
char ui_global_dir_list[80];
109
115
110
seq_ui_bookmark_t seq_ui_bookmarks[SEQ_UI_BOOKMARKS_NUM];
116
seq_ui_bookmark_t seq_ui_bookmarks[SEQ_UI_BOOKMARKS_NUM];
-
 
117
-
 
118
seq_ui_sel_view_t seq_ui_sel_view;
111
119
112
mios32_sys_time_t seq_play_timer;
120
mios32_sys_time_t seq_play_timer;
113
121
114
122
115
/////////////////////////////////////////////////////////////////////////////
123
/////////////////////////////////////////////////////////////////////////////
Line 136... Line 144...
136
static s32 (*ui_midi_in_callback)(mios32_midi_port_t port, mios32_midi_package_t p);
144
static s32 (*ui_midi_in_callback)(mios32_midi_port_t port, mios32_midi_package_t p);
137
static s32 (*ui_delayed_action_callback)(u32 parameter);
145
static s32 (*ui_delayed_action_callback)(u32 parameter);
138
static u32 ui_delayed_action_parameter;
146
static u32 ui_delayed_action_parameter;
139
147
140
static u16 ui_gp_leds;
148
static u16 ui_gp_leds;
141
-
 
142
static u16 ui_select_leds_green;
-
 
143
static u16 ui_select_leds_red;
-
 
144
149
145
#define UI_MSG_MAX_CHAR 31
150
#define UI_MSG_MAX_CHAR 31
146
static char ui_msg[2][UI_MSG_MAX_CHAR];
151
static char ui_msg[2][UI_MSG_MAX_CHAR];
147
static u16 ui_msg_ctr;
152
static u16 ui_msg_ctr;
148
static seq_ui_msg_type_t ui_msg_type;
153
static seq_ui_msg_type_t ui_msg_type;
149
154
150
static u16 ui_delayed_action_ctr;
155
static u16 ui_delayed_action_ctr;
151
-
 
152
static seq_ui_page_t ui_page_before_bookmark;
-
 
153
156
154
static u8 seq_ui_track_setup_visible_track;
157
static u8 seq_ui_track_setup_visible_track;
155
static seq_ui_track_setup_t seq_ui_track_setup[SEQ_CORE_NUM_TRACKS];
158
static seq_ui_track_setup_t seq_ui_track_setup[SEQ_CORE_NUM_TRACKS];
156
159
157
160
Line 179... Line 182...
179
  ui_selected_trg_layer = 0;
182
  ui_selected_trg_layer = 0;
180
  ui_selected_instrument = 0;
183
  ui_selected_instrument = 0;
181
  ui_selected_step_view = 0;
184
  ui_selected_step_view = 0;
182
  ui_selected_step = 0;
185
  ui_selected_step = 0;
183
  ui_selected_item = 0;
186
  ui_selected_item = 0;
-
 
187
  ui_selected_bookmark = 0;
-
 
188
  ui_selected_phrase = 0;
184
  ui_selected_gp_buttons = 0;
189
  ui_selected_gp_buttons = 0;
185
190
186
  seq_ui_options.ALL = 0;
191
  seq_ui_options.ALL = 0;
187
192
188
  ui_hold_msg_ctr = 0;
193
  ui_hold_msg_ctr = 0;
Line 195... Line 200...
195
  seq_ui_button_state.ALL = 0;
200
  seq_ui_button_state.ALL = 0;
196
201
197
  ui_seq_pause = 0;
202
  ui_seq_pause = 0;
198
203
199
  ui_song_edit_pos = 0;
204
  ui_song_edit_pos = 0;
-
 
205
-
 
206
  seq_ui_sel_view = SEQ_UI_SEL_VIEW_NONE;
200
207
201
  // visible GP pattern
208
  // visible GP pattern
202
  ui_gp_leds = 0x0000;
209
  ui_gp_leds = 0x0000;
203
-
 
204
  // select LEDs
-
 
205
  ui_select_leds_green = 0x0000;
-
 
206
  ui_select_leds_red = 0x0000;
-
 
207
210
208
  // misc
211
  // misc
209
  seq_ui_backup_req = 0;
212
  seq_ui_backup_req = 0;
210
  seq_ui_format_req = 0;
213
  seq_ui_format_req = 0;
211
  seq_ui_saveall_req = 0;
214
  seq_ui_saveall_req = 0;
Line 215... Line 218...
215
  // change to edit page
218
  // change to edit page
216
  ui_page = SEQ_UI_PAGE_NONE;
219
  ui_page = SEQ_UI_PAGE_NONE;
217
  SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT);
220
  SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT);
218
221
219
  // finally init bookmarks
222
  // finally init bookmarks
220
  ui_page_before_bookmark = SEQ_UI_PAGE_EDIT;
223
  ui_bookmarks_prev_page = SEQ_UI_PAGE_EDIT;
221
  for(i=0; i<SEQ_UI_BOOKMARKS_NUM; ++i) {
224
  for(i=0; i<SEQ_UI_BOOKMARKS_NUM; ++i) {
222
    char buffer[10];
225
    char buffer[10];
223
    seq_ui_bookmark_t *bm = (seq_ui_bookmark_t *)&seq_ui_bookmarks[i];
226
    seq_ui_bookmark_t *bm = (seq_ui_bookmark_t *)&seq_ui_bookmarks[i];
224
227
225
    sprintf(buffer, "BM%2d ", i+1);
228
    sprintf(buffer, "BM%2d ", i+1);
Line 1180... Line 1183...
1180
}
1183
}
1181
1184
1182
1185
1183
static s32 SEQ_UI_Button_Bookmark(s32 depressed)
1186
static s32 SEQ_UI_Button_Bookmark(s32 depressed)
1184
{
1187
{
-
 
1188
  if( !depressed )
-
 
1189
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_BOOKMARKS;
-
 
1190
1185
  if( seq_hwcfg_button_beh.bookmark ) {
1191
  if( seq_hwcfg_button_beh.bookmark ) {
1186
    if( depressed ) return -1; // ignore when button depressed
1192
    if( depressed ) return -1; // ignore when button depressed
1187
    if( !seq_ui_button_state.BOOKMARK ) // due to page change: button going to be set, clear other toggle buttons
1193
    if( !seq_ui_button_state.BOOKMARK ) // due to page change: button going to be set, clear other toggle buttons
1188
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
1194
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
1189
#if 0
1195
#if 0
Line 1196... Line 1202...
1196
    seq_ui_button_state.BOOKMARK = depressed ? 0 : 1;
1202
    seq_ui_button_state.BOOKMARK = depressed ? 0 : 1;
1197
  }
1203
  }
1198
1204
1199
  if( seq_ui_button_state.BOOKMARK ) {
1205
  if( seq_ui_button_state.BOOKMARK ) {
1200
    if( ui_page != SEQ_UI_PAGE_BOOKMARKS )
1206
    if( ui_page != SEQ_UI_PAGE_BOOKMARKS )
1201
      ui_page_before_bookmark = ui_page;
1207
      ui_bookmarks_prev_page = ui_page;
1202
    SEQ_UI_PageSet(SEQ_UI_PAGE_BOOKMARKS);
1208
    SEQ_UI_PageSet(SEQ_UI_PAGE_BOOKMARKS);
1203
  } else {
1209
  } else {
1204
    if( ui_page == SEQ_UI_PAGE_BOOKMARKS )
1210
    if( ui_page == SEQ_UI_PAGE_BOOKMARKS )
1205
      SEQ_UI_PageSet(ui_page_before_bookmark);
1211
      SEQ_UI_PageSet(ui_bookmarks_prev_page);
1206
  }
1212
  }
1207
1213
1208
  return 0; // no error
1214
  return 0; // no error
1209
}
1215
}
1210
1216
1211
1217
1212
static s32 SEQ_UI_Button_DirectBookmark(s32 depressed, u32 bookmark_button)
1218
static s32 SEQ_UI_Button_DirectBookmark(s32 depressed, u32 bookmark_button)
1213
{
1219
{
1214
  if( !depressed )
1220
  if( !depressed )
1215
    ui_page_before_bookmark = ui_page;
1221
    ui_bookmarks_prev_page = ui_page;
1216
1222
1217
  return SEQ_UI_BOOKMARKS_Button_Handler(bookmark_button, depressed);
1223
  return SEQ_UI_BOOKMARKS_Button_Handler(bookmark_button, depressed);
1218
}
1224
}
1219
1225
1220
1226
Line 1287... Line 1293...
1287
  return 0; // no error
1293
  return 0; // no error
1288
}
1294
}
1289
1295
1290
static s32 SEQ_UI_Button_Mute(s32 depressed)
1296
static s32 SEQ_UI_Button_Mute(s32 depressed)
1291
{
1297
{
-
 
1298
  if( !depressed )
-
 
1299
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_MUTE;
-
 
1300
1292
  seq_ui_button_state.MUTE_PRESSED = depressed ? 0 : 1;
1301
  seq_ui_button_state.MUTE_PRESSED = depressed ? 0 : 1;
1293
1302
-
 
1303
#if 0
-
 
1304
  // doesn't really work since MUTE button also selects layer mutes when pressed
-
 
1305
  //
-
 
1306
  if( seq_hwcfg_button_beh.mute ) {
1294
  if( depressed ) return -1; // ignore when button depressed
1307
    if( depressed ) return -1; // ignore when button depressed
1295
1308
-
 
1309
    ui_mute_prev_page = ui_page;
1296
  SEQ_UI_PageSet(SEQ_UI_PAGE_MUTE);
1310
    SEQ_UI_PageSet(SEQ_UI_PAGE_MUTE);
-
 
1311
  } else {
-
 
1312
    if( seq_ui_button_state.MUTE_PRESSED ) {
-
 
1313
      ui_mute_prev_page = ui_page;
-
 
1314
      SEQ_UI_PageSet(SEQ_UI_PAGE_MUTE);
-
 
1315
    } else {
-
 
1316
      if( ui_page == SEQ_UI_PAGE_MUTE )
-
 
1317
    SEQ_UI_PageSet(ui_mute_prev_page);
-
 
1318
    }
-
 
1319
  }
-
 
1320
#else
-
 
1321
  if( depressed ) return -1; // ignore when button depressed
-
 
1322
-
 
1323
  SEQ_UI_PageSet(SEQ_UI_PAGE_MUTE);
-
 
1324
#endif
1297
1325
1298
  return 0; // no error
1326
  return 0; // no error
1299
}
1327
}
1300
1328
1301
static s32 SEQ_UI_Button_Pattern(s32 depressed)
1329
static s32 SEQ_UI_Button_Pattern(s32 depressed)
Line 1309... Line 1337...
1309
  return 0; // no error
1337
  return 0; // no error
1310
}
1338
}
1311
1339
1312
static s32 SEQ_UI_Button_Pattern_Remix(s32 depressed)
1340
static s32 SEQ_UI_Button_Pattern_Remix(s32 depressed)
1313
{
1341
{
1314
   
-
 
1315
    if ( ui_page == SEQ_UI_PAGE_PATTERN_RMX ) {
1342
  if ( ui_page == SEQ_UI_PAGE_PATTERN_RMX ) {
1316
#ifndef MIOS32_FAMILY_EMULATION
1343
#ifndef MIOS32_FAMILY_EMULATION
1317
        // to avoid race conditions using the same button(any other way of solving that?)
1344
    // to avoid race conditions using the same button(any other way of solving that?)
1318
        vTaskDelay(60);
1345
    vTaskDelay(60);
1319
#endif
1346
#endif
Line 1328... Line 1355...
1328
}
1355
}
1329
1356
1330
static s32 SEQ_UI_Button_Song(s32 depressed)
1357
static s32 SEQ_UI_Button_Song(s32 depressed)
1331
{
1358
{
1332
  seq_ui_button_state.SONG_PRESSED = depressed ? 0 : 1;
1359
  seq_ui_button_state.SONG_PRESSED = depressed ? 0 : 1;
-
 
1360
-
 
1361
  if( depressed ) return -1; // ignore when button depressed
-
 
1362
-
 
1363
  SEQ_UI_PageSet(SEQ_UI_PAGE_SONG);
-
 
1364
-
 
1365
  return 0; // no error
-
 
1366
}
-
 
1367
-
 
1368
static s32 SEQ_UI_Button_Phrase(s32 depressed)
-
 
1369
{
-
 
1370
  if( !depressed )
-
 
1371
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_PHRASE;
-
 
1372
-
 
1373
  seq_ui_button_state.PHRASE_PRESSED = depressed ? 0 : 1;
1333
1374
1334
  if( depressed ) return -1; // ignore when button depressed
1375
  if( depressed ) return -1; // ignore when button depressed
1335
1376
1336
  SEQ_UI_PageSet(SEQ_UI_PAGE_SONG);
1377
  SEQ_UI_PageSet(SEQ_UI_PAGE_SONG);
1337
1378
Line 1351... Line 1392...
1351
1392
1352
  // seq_core_trk_soloed currently only used for the BLM16x16+X
1393
  // seq_core_trk_soloed currently only used for the BLM16x16+X
1353
  // which overrules the legacy SOLO function
1394
  // which overrules the legacy SOLO function
1354
  if( !seq_ui_button_state.SOLO )
1395
  if( !seq_ui_button_state.SOLO )
1355
    seq_core_trk_soloed = 0;
1396
    seq_core_trk_soloed = 0;
-
 
1397
-
 
1398
  SEQ_UI_Msg(SEQ_UI_MSG_USER, 1000, "Solo", seq_ui_button_state.SOLO ? " on " : " off");
1356
1399
1357
  return 0; // no error
1400
  return 0; // no error
1358
}
1401
}
1359
1402
1360
static s32 SEQ_UI_Button_Fast(s32 depressed)
1403
static s32 SEQ_UI_Button_Fast(s32 depressed)
Line 1407... Line 1450...
1407
1450
1408
static s32 SEQ_UI_Button_StepView(s32 depressed)
1451
static s32 SEQ_UI_Button_StepView(s32 depressed)
1409
{
1452
{
1410
  //  static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1453
  //  static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1411
  // also used by seq_ui_stepsel
1454
  // also used by seq_ui_stepsel
-
 
1455
 
-
 
1456
  if( !depressed )
-
 
1457
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_STEPS;
1412
 
1458
1413
  if( seq_hwcfg_button_beh.step_view ) {
1459
  if( seq_hwcfg_button_beh.step_view ) {
1414
    if( depressed ) return -1; // ignore when button depressed
1460
    if( depressed ) return -1; // ignore when button depressed
1415
    if( !seq_ui_button_state.STEP_VIEW ) // due to page change: button going to be set, clear other toggle buttons
1461
    if( !seq_ui_button_state.STEP_VIEW ) // due to page change: button going to be set, clear other toggle buttons
1416
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
1462
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
Line 1478... Line 1524...
1478
  return 0; // no error
1524
  return 0; // no error
1479
}
1525
}
1480
1526
1481
static s32 SEQ_UI_Button_TrackSel(s32 depressed)
1527
static s32 SEQ_UI_Button_TrackSel(s32 depressed)
1482
{
1528
{
-
 
1529
  if( !depressed )
1483
  static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1530
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRACKS;
1484
1531
1485
  if( seq_hwcfg_button_beh.track_sel ) {
1532
  if( seq_hwcfg_button_beh.track_sel ) {
1486
    if( depressed ) return -1; // ignore when button depressed
1533
    if( depressed ) return -1; // ignore when button depressed
1487
    if( !seq_ui_button_state.TRACK_SEL ) // due to page change: button going to be set, clear other toggle buttons
1534
    if( !seq_ui_button_state.TRACK_SEL ) // due to page change: button going to be set, clear other toggle buttons
1488
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
1535
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
Line 1490... Line 1537...
1490
  } else {
1537
  } else {
1491
    seq_ui_button_state.TRACK_SEL = depressed ? 0 : 1;
1538
    seq_ui_button_state.TRACK_SEL = depressed ? 0 : 1;
1492
  }
1539
  }
1493
1540
1494
  if( seq_ui_button_state.TRACK_SEL ) {
1541
  if( seq_ui_button_state.TRACK_SEL ) {
1495
    prev_page = ui_page;
1542
    ui_tracksel_prev_page = ui_page;
1496
    SEQ_UI_PageSet(SEQ_UI_PAGE_TRACKSEL);
1543
    SEQ_UI_PageSet(SEQ_UI_PAGE_TRACKSEL);
1497
  } else {
1544
  } else {
1498
    if( ui_page == SEQ_UI_PAGE_TRACKSEL )
1545
    if( ui_page == SEQ_UI_PAGE_TRACKSEL )
1499
      SEQ_UI_PageSet(prev_page);
1546
      SEQ_UI_PageSet(ui_tracksel_prev_page);
1500
  }
1547
  }
1501
1548
1502
  return 0; // no error
1549
  return 0; // no error
1503
}
1550
}
1504
1551
Line 1562... Line 1609...
1562
  SEQ_UI_InitEncSpeed(1); // auto config
1609
  SEQ_UI_InitEncSpeed(1); // auto config
1563
1610
1564
  return 0; // no error
1611
  return 0; // no error
1565
}
1612
}
1566
1613
1567
static s32 SEQ_UI_Button_DirectTrack(s32 depressed, u32 track_button)
1614
static s32 SEQ_UI_Button_DirectTrack(s32 depressed, u32 sel_button)
1568
{
1615
{
1569
  static u16 button_state = 0xffff; // all 16 buttons depressed
1616
  static u16 button_state = 0xffff; // all 16 buttons depressed
1570
1617
1571
  if( track_button >= 16 ) return -2; // max. 16 direct track buttons
1618
  if( sel_button >= 16 ) return -2; // max. 16 direct track buttons
1572
1619
1573
  if( depressed ) {
1620
  if( depressed ) {
1574
    button_state |= (1 << track_button);
1621
    button_state |= (1 << sel_button);
1575
    return 0; // no error
1622
    return 0; // no error
1576
  }
1623
  }
1577
1624
1578
  button_state &= ~(1 << track_button);
1625
  button_state &= ~(1 << sel_button);
1579
1626
-
 
1627
  u8 visible_track = SEQ_UI_VisibleTrackGet();
-
 
1628
  u8 selbuttons_available = seq_hwcfg_blm8x8.dout_gp_mapping == 3;
-
 
1629
-
 
1630
  if( selbuttons_available ) {
-
 
1631
    // for selection buttons of Antilog PCB
-
 
1632
      switch( seq_ui_sel_view ) {
-
 
1633
      case SEQ_UI_SEL_VIEW_BOOKMARKS:
-
 
1634
    SEQ_UI_BOOKMARKS_Button_Handler((seq_ui_button_t)sel_button, depressed);
-
 
1635
    break;
-
 
1636
      case SEQ_UI_SEL_VIEW_STEPS:
-
 
1637
    SEQ_UI_STEPSEL_Button_Handler((seq_ui_button_t)sel_button, depressed);
-
 
1638
    break;
-
 
1639
      case SEQ_UI_SEL_VIEW_TRACKS: {
1580
  if( button_state == (~(1 << track_button) & 0xffff) ) {
1640
    if( button_state == (~(1 << sel_button) & 0xffff) ) {
1581
    // if only one select button pressed: radio-button function (1 of 16)
1641
      // if only one select button pressed: radio-button function (1 of 16)
1582
    ui_selected_tracks = 1 << track_button;
1642
      ui_selected_tracks = 1 << sel_button;
1583
    ui_selected_group = track_button / 4;
1643
      ui_selected_group = sel_button / 4;
1584
  } else {
1644
    } else {
1585
    // if more than one select button pressed: toggle function (16 of 16)
1645
      // if more than one select button pressed: toggle function (16 of 16)
-
 
1646
      ui_selected_tracks ^= 1 << sel_button;
-
 
1647
    }
-
 
1648
      } break;
-
 
1649
      case SEQ_UI_SEL_VIEW_PAR:
-
 
1650
    SEQ_UI_PARSEL_Button_Handler((seq_ui_button_t)sel_button, depressed);
-
 
1651
    break;
-
 
1652
      case SEQ_UI_SEL_VIEW_TRG:
-
 
1653
    SEQ_UI_TRGSEL_Button_Handler((seq_ui_button_t)sel_button, depressed);
-
 
1654
    break;
-
 
1655
      case SEQ_UI_SEL_VIEW_INS:
-
 
1656
    SEQ_UI_INSSEL_Button_Handler((seq_ui_button_t)sel_button, depressed);
-
 
1657
    break;
-
 
1658
      case SEQ_UI_SEL_VIEW_MUTE: {
-
 
1659
    u16 mask = 1 << sel_button;
-
 
1660
    u16 *mute_flags = seq_ui_button_state.MUTE_PRESSED ? &seq_core_trk[visible_track].layer_muted : &seq_core_trk_muted;
-
 
1661
    portENTER_CRITICAL();
-
 
1662
    if( *mute_flags & mask ) {
-
 
1663
      *mute_flags &= ~mask;
-
 
1664
    } else {
-
 
1665
      *mute_flags |= mask;
-
 
1666
    }
-
 
1667
    portEXIT_CRITICAL();
-
 
1668
      } break;
-
 
1669
      case SEQ_UI_SEL_VIEW_PHRASE: {
-
 
1670
    ui_selected_phrase = sel_button;
-
 
1671
    ui_song_edit_pos = ui_selected_phrase << 3;
-
 
1672
-
 
1673
    // set song position and fetch patterns
-
 
1674
    SEQ_SONG_PosSet(ui_song_edit_pos);
-
 
1675
    SEQ_SONG_FetchPos(0, 0);
-
 
1676
    ui_song_edit_pos = SEQ_SONG_PosGet();
-
 
1677
      } break;
-
 
1678
      }    
-
 
1679
  } else {
-
 
1680
    // common behaviour
-
 
1681
    if( button_state == (~(1 << sel_button) & 0xffff) ) {
-
 
1682
      // if only one select button pressed: radio-button function (1 of 16)
-
 
1683
      ui_selected_tracks = 1 << sel_button;
-
 
1684
      ui_selected_group = sel_button / 4;
-
 
1685
    } else {
-
 
1686
      // if more than one select button pressed: toggle function (16 of 16)
1586
    ui_selected_tracks ^= 1 << track_button;
1687
      ui_selected_tracks ^= 1 << sel_button;
-
 
1688
    }
1587
  }
1689
  }
1588
1690
1589
  // set/clear encoder fast function if required
1691
  // set/clear encoder fast function if required
1590
  SEQ_UI_InitEncSpeed(1); // auto config
1692
  SEQ_UI_InitEncSpeed(1); // auto config
1591
1693
Line 1594... Line 1696...
1594
1696
1595
static s32 SEQ_UI_Button_ParLayerSel(s32 depressed)
1697
static s32 SEQ_UI_Button_ParLayerSel(s32 depressed)
1596
{
1698
{
1597
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1699
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1598
  // also used by seq_ui_parsel.c
1700
  // also used by seq_ui_parsel.c
-
 
1701
-
 
1702
  if( !depressed )
-
 
1703
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_PAR;
1599
1704
1600
  if( seq_hwcfg_button_beh.par_layer ) {
1705
  if( seq_hwcfg_button_beh.par_layer ) {
1601
    if( depressed ) return -1; // ignore when button depressed
1706
    if( depressed ) return -1; // ignore when button depressed
1602
    if( !seq_ui_button_state.PAR_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
1707
    if( !seq_ui_button_state.PAR_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
1603
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
1708
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
Line 1707... Line 1812...
1707
1812
1708
static s32 SEQ_UI_Button_TrgLayerSel(s32 depressed)
1813
static s32 SEQ_UI_Button_TrgLayerSel(s32 depressed)
1709
{
1814
{
1710
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1815
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1711
  // also used by seq_ui_trgsel.c
1816
  // also used by seq_ui_trgsel.c
-
 
1817
-
 
1818
  if( !depressed )
-
 
1819
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRG;
1712
1820
1713
  if( seq_hwcfg_button_beh.trg_layer ) {
1821
  if( seq_hwcfg_button_beh.trg_layer ) {
1714
    if( depressed ) return -1; // ignore when button depressed
1822
    if( depressed ) return -1; // ignore when button depressed
1715
    if( !seq_ui_button_state.TRG_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
1823
    if( !seq_ui_button_state.TRG_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
1716
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
1824
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
Line 1804... Line 1912...
1804
  }
1912
  }
1805
1913
1806
  return 0; // no error
1914
  return 0; // no error
1807
}
1915
}
1808
1916
-
 
1917
-
 
1918
static s32 SEQ_UI_Button_InsSel(s32 depressed)
-
 
1919
{
-
 
1920
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
-
 
1921
  // also used by seq_ui_insel.c
-
 
1922
-
 
1923
  if( !depressed )
-
 
1924
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_INS;
-
 
1925
-
 
1926
  if( seq_hwcfg_button_beh.ins_sel ) {
-
 
1927
    if( depressed ) return -1; // ignore when button depressed
-
 
1928
    if( !seq_ui_button_state.INS_SEL ) // due to page change: button going to be set, clear other toggle buttons
-
 
1929
      seq_ui_button_state.PAGE_CHANGE_BUTTON_FLAGS = 0;
-
 
1930
    seq_ui_button_state.INS_SEL ^= 1; // toggle TRGSEL status (will also be released once GP button has been pressed)
-
 
1931
  } else {
-
 
1932
    seq_ui_button_state.INS_SEL = depressed ? 0 : 1;
-
 
1933
  }
-
 
1934
-
 
1935
  if( seq_ui_button_state.INS_SEL ) {
-
 
1936
    if( ui_page != SEQ_UI_PAGE_INSSEL ) {
-
 
1937
      ui_inssel_prev_page = ui_page;
-
 
1938
      SEQ_UI_PageSet(SEQ_UI_PAGE_INSSEL);
-
 
1939
    }
-
 
1940
  } else {
-
 
1941
    if( ui_page == SEQ_UI_PAGE_INSSEL )
-
 
1942
      SEQ_UI_PageSet(ui_inssel_prev_page);
-
 
1943
  }
-
 
1944
-
 
1945
  return 0; // no error
-
 
1946
}
1809
1947
1810
static s32 SEQ_UI_Button_Mixer(s32 depressed)
1948
static s32 SEQ_UI_Button_Mixer(s32 depressed)
1811
{
1949
{
1812
  if( depressed ) return -1; // ignore when button depressed
1950
  if( depressed ) return -1; // ignore when button depressed
1813
1951
Line 2089... Line 2227...
2089
  for(i=0; i<SEQ_HWCFG_NUM_TRG_LAYER; ++i)
2227
  for(i=0; i<SEQ_HWCFG_NUM_TRG_LAYER; ++i)
2090
    if( pin == seq_hwcfg_button.trg_layer[i] )
2228
    if( pin == seq_hwcfg_button.trg_layer[i] )
2091
      return SEQ_UI_Button_TrgLayer(pin_value, i);
2229
      return SEQ_UI_Button_TrgLayer(pin_value, i);
2092
  if( pin == seq_hwcfg_button.trg_layer_sel )
2230
  if( pin == seq_hwcfg_button.trg_layer_sel )
2093
    return SEQ_UI_Button_TrgLayerSel(pin_value);
2231
    return SEQ_UI_Button_TrgLayerSel(pin_value);
-
 
2232
  if( pin == seq_hwcfg_button.ins_sel )
-
 
2233
    return SEQ_UI_Button_InsSel(pin_value);
2094
2234
2095
  if( pin == seq_hwcfg_button.left )
2235
  if( pin == seq_hwcfg_button.left )
2096
    return SEQ_UI_Button_Left(pin_value);
2236
    return SEQ_UI_Button_Left(pin_value);
2097
  if( pin == seq_hwcfg_button.right )
2237
  if( pin == seq_hwcfg_button.right )
2098
    return SEQ_UI_Button_Right(pin_value);
2238
    return SEQ_UI_Button_Right(pin_value);
Line 2167... Line 2307...
2167
    return SEQ_UI_Button_Mute(pin_value);
2307
    return SEQ_UI_Button_Mute(pin_value);
2168
  if( pin == seq_hwcfg_button.pattern )
2308
  if( pin == seq_hwcfg_button.pattern )
2169
    return SEQ_UI_Button_Pattern(pin_value);
2309
    return SEQ_UI_Button_Pattern(pin_value);
2170
  if( pin == seq_hwcfg_button.song )
2310
  if( pin == seq_hwcfg_button.song )
2171
    return SEQ_UI_Button_Song(pin_value);
2311
    return SEQ_UI_Button_Song(pin_value);
-
 
2312
  if( pin == seq_hwcfg_button.phrase )
-
 
2313
    return SEQ_UI_Button_Phrase(pin_value);
2172
2314
2173
  if( pin == seq_hwcfg_button.solo )
2315
  if( pin == seq_hwcfg_button.solo )
2174
    return SEQ_UI_Button_Solo(pin_value);
2316
    return SEQ_UI_Button_Solo(pin_value);
2175
  if( pin == seq_hwcfg_button.fast )
2317
  if( pin == seq_hwcfg_button.fast )
2176
    return SEQ_UI_Button_Fast(pin_value);
2318
    return SEQ_UI_Button_Fast(pin_value);
Line 2832... Line 2974...
2832
    SEQ_LED_PinSet(seq_hwcfg_led.track[1], (selected_tracks & (1 << 1)));
2974
    SEQ_LED_PinSet(seq_hwcfg_led.track[1], (selected_tracks & (1 << 1)));
2833
    SEQ_LED_PinSet(seq_hwcfg_led.track[2], (selected_tracks & (1 << 2)));
2975
    SEQ_LED_PinSet(seq_hwcfg_led.track[2], (selected_tracks & (1 << 2)));
2834
    SEQ_LED_PinSet(seq_hwcfg_led.track[3], (selected_tracks & (1 << 3)));
2976
    SEQ_LED_PinSet(seq_hwcfg_led.track[3], (selected_tracks & (1 << 3)));
2835
  }
2977
  }
2836
2978
2837
  SEQ_LED_PinSet(seq_hwcfg_led.track_sel, ui_page == SEQ_UI_PAGE_TRACKSEL);
2979
  SEQ_LED_PinSet(seq_hwcfg_led.track_sel, ui_page == SEQ_UI_PAGE_TRACKSEL || seq_ui_sel_view == SEQ_UI_SEL_VIEW_TRACKS);
2838
 
2980
 
2839
  // parameter layer LEDs
2981
  // parameter layer LEDs
2840
  // in song page: layer buttons are used to select the cursor position
2982
  // in song page: layer buttons are used to select the cursor position
2841
  if( ui_page == SEQ_UI_PAGE_SONG ) {
2983
  if( ui_page == SEQ_UI_PAGE_SONG ) {
2842
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[0], ui_selected_item == 0);
2984
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[0], ui_selected_item == 0);
Line 2845... Line 2987...
2845
  } else {
2987
  } else {
2846
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[0], (ui_selected_par_layer == 0));
2988
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[0], (ui_selected_par_layer == 0));
2847
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[1], (ui_selected_par_layer == 1));
2989
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[1], (ui_selected_par_layer == 1));
2848
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[2], (ui_selected_par_layer >= 2) || seq_ui_button_state.PAR_LAYER_SEL);
2990
    SEQ_LED_PinSet(seq_hwcfg_led.par_layer[2], (ui_selected_par_layer >= 2) || seq_ui_button_state.PAR_LAYER_SEL);
2849
  }
2991
  }
2850
  SEQ_LED_PinSet(seq_hwcfg_led.par_layer_sel, ui_page == SEQ_UI_PAGE_PARSEL);
2992
  SEQ_LED_PinSet(seq_hwcfg_led.par_layer_sel, ui_page == SEQ_UI_PAGE_PARSEL || seq_ui_sel_view == SEQ_UI_SEL_VIEW_PAR);
2851
 
2993
 
2852
  // group LEDs
2994
  // group LEDs
2853
  // in song page: track and group buttons are used to select the cursor position
2995
  // in song page: track and group buttons are used to select the cursor position
2854
  if( ui_page == SEQ_UI_PAGE_SONG ) {
2996
  if( ui_page == SEQ_UI_PAGE_SONG ) {
2855
    SEQ_LED_PinSet(seq_hwcfg_led.group[0], (ui_selected_item == 3));
2997
    SEQ_LED_PinSet(seq_hwcfg_led.group[0], (ui_selected_item == 3));
Line 2865... Line 3007...
2865
 
3007
 
2866
  // trigger layer LEDs
3008
  // trigger layer LEDs
2867
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer[0], (ui_selected_trg_layer == 0));
3009
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer[0], (ui_selected_trg_layer == 0));
2868
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer[1], (ui_selected_trg_layer == 1));
3010
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer[1], (ui_selected_trg_layer == 1));
2869
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer[2], (ui_selected_trg_layer >= 2) || seq_ui_button_state.TRG_LAYER_SEL);
3011
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer[2], (ui_selected_trg_layer >= 2) || seq_ui_button_state.TRG_LAYER_SEL);
2870
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer_sel, ui_page == SEQ_UI_PAGE_TRGSEL);
3012
  SEQ_LED_PinSet(seq_hwcfg_led.trg_layer_sel, ui_page == SEQ_UI_PAGE_TRGSEL || seq_ui_sel_view == SEQ_UI_SEL_VIEW_TRG);
-
 
3013
-
 
3014
  // instrument layer LEDs
-
 
3015
  SEQ_LED_PinSet(seq_hwcfg_led.ins_sel, ui_page == SEQ_UI_PAGE_INSSEL || seq_ui_sel_view == SEQ_UI_SEL_VIEW_INS);
2871
 
3016
 
2872
  // remaining LEDs
3017
  // remaining LEDs
2873
  SEQ_LED_PinSet(seq_hwcfg_led.edit, ui_page == SEQ_UI_PAGE_EDIT);
3018
  SEQ_LED_PinSet(seq_hwcfg_led.edit, ui_page == SEQ_UI_PAGE_EDIT);
2874
  SEQ_LED_PinSet(seq_hwcfg_led.mute, ui_page == SEQ_UI_PAGE_MUTE);
3019
  SEQ_LED_PinSet(seq_hwcfg_led.mute, ui_page == SEQ_UI_PAGE_MUTE || seq_ui_sel_view == SEQ_UI_SEL_VIEW_MUTE);
2875
  SEQ_LED_PinSet(seq_hwcfg_led.pattern, ui_page == SEQ_UI_PAGE_PATTERN);
3020
  SEQ_LED_PinSet(seq_hwcfg_led.pattern, ui_page == SEQ_UI_PAGE_PATTERN);
2876
  if( SEQ_SONG_ActiveGet() )
3021
  if( SEQ_SONG_ActiveGet() )
2877
    SEQ_LED_PinSet(seq_hwcfg_led.song, 1);
3022
    SEQ_LED_PinSet(seq_hwcfg_led.song, 1);
2878
  else
3023
  else
2879
    SEQ_LED_PinSet(seq_hwcfg_led.song, ui_cursor_flash ? 0 : (ui_page == SEQ_UI_PAGE_SONG));
3024
    SEQ_LED_PinSet(seq_hwcfg_led.song, ui_cursor_flash ? 0 : (ui_page == SEQ_UI_PAGE_SONG));
-
 
3025
  SEQ_LED_PinSet(seq_hwcfg_led.phrase, seq_ui_button_state.PHRASE_PRESSED || seq_ui_sel_view == SEQ_UI_SEL_VIEW_PHRASE);
2880
  SEQ_LED_PinSet(seq_hwcfg_led.mixer, ui_page == SEQ_UI_PAGE_MIXER);
3026
  SEQ_LED_PinSet(seq_hwcfg_led.mixer, ui_page == SEQ_UI_PAGE_MIXER);
2881
3027
2882
  SEQ_LED_PinSet(seq_hwcfg_led.track_mode, ui_page == SEQ_UI_PAGE_TRKMODE);
3028
  SEQ_LED_PinSet(seq_hwcfg_led.track_mode, ui_page == SEQ_UI_PAGE_TRKMODE);
2883
  SEQ_LED_PinSet(seq_hwcfg_led.track_groove, ui_page == SEQ_UI_PAGE_TRKGRV);
3029
  SEQ_LED_PinSet(seq_hwcfg_led.track_groove, ui_page == SEQ_UI_PAGE_TRKGRV);
2884
  SEQ_LED_PinSet(seq_hwcfg_led.track_length, ui_page == SEQ_UI_PAGE_TRKLEN);
3030
  SEQ_LED_PinSet(seq_hwcfg_led.track_length, ui_page == SEQ_UI_PAGE_TRKLEN);
Line 2902... Line 3048...
2902
  SEQ_LED_PinSet(seq_hwcfg_led.fwd, seq_ui_button_state.FWD);
3048
  SEQ_LED_PinSet(seq_hwcfg_led.fwd, seq_ui_button_state.FWD);
2903
3049
2904
  SEQ_LED_PinSet(seq_hwcfg_led.loop, seq_core_state.LOOP);
3050
  SEQ_LED_PinSet(seq_hwcfg_led.loop, seq_core_state.LOOP);
2905
  SEQ_LED_PinSet(seq_hwcfg_led.follow, seq_core_state.FOLLOW);
3051
  SEQ_LED_PinSet(seq_hwcfg_led.follow, seq_core_state.FOLLOW);
2906
 
3052
 
2907
  SEQ_LED_PinSet(seq_hwcfg_led.step_view, ui_page == SEQ_UI_PAGE_STEPSEL);
3053
  SEQ_LED_PinSet(seq_hwcfg_led.step_view, ui_page == SEQ_UI_PAGE_STEPSEL || seq_ui_sel_view == SEQ_UI_SEL_VIEW_STEPS);
2908
3054
2909
  SEQ_LED_PinSet(seq_hwcfg_led.select, seq_ui_button_state.SELECT_PRESSED);
3055
  SEQ_LED_PinSet(seq_hwcfg_led.select, seq_ui_button_state.SELECT_PRESSED);
2910
  SEQ_LED_PinSet(seq_hwcfg_led.menu, seq_ui_button_state.MENU_PRESSED);
3056
  SEQ_LED_PinSet(seq_hwcfg_led.menu, seq_ui_button_state.MENU_PRESSED);
2911
  SEQ_LED_PinSet(seq_hwcfg_led.bookmark, ui_page == SEQ_UI_PAGE_BOOKMARKS);
3057
  SEQ_LED_PinSet(seq_hwcfg_led.bookmark, ui_page == SEQ_UI_PAGE_BOOKMARKS || seq_ui_sel_view == SEQ_UI_SEL_VIEW_BOOKMARKS);
2912
3058
2913
  // handle double functions
3059
  // handle double functions
2914
  if( seq_ui_button_state.MENU_PRESSED ) {
3060
  if( seq_ui_button_state.MENU_PRESSED ) {
2915
    SEQ_LED_PinSet(seq_hwcfg_led.scrub, seq_core_state.LOOP);
3061
    SEQ_LED_PinSet(seq_hwcfg_led.scrub, seq_core_state.LOOP);
2916
    SEQ_LED_PinSet(seq_hwcfg_led.exit, seq_core_state.FOLLOW);
3062
    SEQ_LED_PinSet(seq_hwcfg_led.exit, seq_core_state.FOLLOW);
Line 3153... Line 3299...
3153
      // Set Green LEDs
3299
      // Set Green LEDs
3154
      BLM_DOUT_SRSet(0, 2*track_ix+0, green_pattern);
3300
      BLM_DOUT_SRSet(0, 2*track_ix+0, green_pattern);
3155
      BLM_DOUT_SRSet(0, 2*track_ix+1, green_pattern >> 8);
3301
      BLM_DOUT_SRSet(0, 2*track_ix+1, green_pattern >> 8);
3156
    }
3302
    }
3157
  }
3303
  }
3158
-
 
3159
3304
3160
  if( seq_hwcfg_blm8x8.enabled ) {
3305
  if( seq_hwcfg_blm8x8.enabled ) {
3161
    if( seq_hwcfg_blm8x8.dout_gp_mapping == 1 ) {
3306
    if( seq_hwcfg_blm8x8.dout_gp_mapping == 1 ) {
3162
      // for wilba's frontpanel
3307
      // for wilba's frontpanel
3163
3308
Line 3199... Line 3344...
3199
    u8 mapped_sr = blm_x_sr_map[sr];
3344
    u8 mapped_sr = blm_x_sr_map[sr];
3200
    seq_blm8x8_led_row[0][mapped_sr] = (seq_blm8x8_led_row[0][mapped_sr] & 0x0f) | pattern;
3345
    seq_blm8x8_led_row[0][mapped_sr] = (seq_blm8x8_led_row[0][mapped_sr] & 0x0f) | pattern;
3201
      }
3346
      }
3202
    } else if( seq_hwcfg_blm8x8.dout_gp_mapping == 3 ) {
3347
    } else if( seq_hwcfg_blm8x8.dout_gp_mapping == 3 ) {
3203
      // for Antilog frontpanel
3348
      // for Antilog frontpanel
-
 
3349
-
 
3350
      // default view
-
 
3351
      if( seq_ui_sel_view == SEQ_UI_SEL_VIEW_NONE )
-
 
3352
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRACKS;
3204
3353
3205
      // BLM_X DOUT -> GP LED mapping
3354
      // BLM_X DOUT -> GP LED mapping
3206
      // left/right half offsets; green,red
3355
      // left/right half offsets; green,red
3207
      // 0 = 8,9        1 = 11,10       2 = 13,12       3 = 15,14
3356
      // 0 = 8,9        1 = 11,10       2 = 13,12       3 = 15,14
3208
      // 4 = 40,41      2 = 43,42       3 = 45,44       4 = 47,46
3357
      // 4 = 40,41      2 = 43,42       3 = 45,44       4 = 47,46
Line 3290... Line 3439...
3290
      }
3439
      }
3291
3440
3292
3441
3293
      // BLM_X DOUT -> Select LED mapping
3442
      // BLM_X DOUT -> Select LED mapping
3294
      // like above, just next SR
3443
      // like above, just next SR
-
 
3444
-
 
3445
      u16 select_leds_green = 0x0000;
-
 
3446
      u16 select_leds_red   = 0x0000;
-
 
3447
-
 
3448
      switch( seq_ui_sel_view ) {
-
 
3449
      case SEQ_UI_SEL_VIEW_BOOKMARKS:
-
 
3450
    select_leds_green = 1 << ui_selected_bookmark;
-
 
3451
    break;
-
 
3452
      case SEQ_UI_SEL_VIEW_STEPS: {
-
 
3453
    int num_steps = SEQ_TRG_NumStepsGet(visible_track);
-
 
3454
-
 
3455
    if( num_steps > 128 )
-
 
3456
      select_leds_green = 1 << ui_selected_step_view;
-
 
3457
    else if( num_steps > 64 )
-
 
3458
      select_leds_green = 3 << (2*ui_selected_step_view);
-
 
3459
    else
-
 
3460
      select_leds_green = 15 << (4*ui_selected_step_view);
-
 
3461
-
 
3462
    if( sequencer_running ) {
-
 
3463
      u8 played_step_view = (seq_core_trk[visible_track].step / 16);
-
 
3464
      if( num_steps > 128 )
-
 
3465
        select_leds_red = 1 << played_step_view;
-
 
3466
      else if( num_steps > 64 )
-
 
3467
        select_leds_red = 3 << (2*played_step_view);
-
 
3468
      else
-
 
3469
        select_leds_red = 15 << (4*played_step_view);
-
 
3470
    }
-
 
3471
      } break;
-
 
3472
      case SEQ_UI_SEL_VIEW_TRACKS:
-
 
3473
    select_leds_green = ui_selected_tracks;
-
 
3474
    break;
-
 
3475
      case SEQ_UI_SEL_VIEW_PAR:
-
 
3476
    select_leds_green = 1 << ui_selected_par_layer;
-
 
3477
    break;
-
 
3478
      case SEQ_UI_SEL_VIEW_TRG:
-
 
3479
    select_leds_green = 1 << ui_selected_trg_layer;
-
 
3480
    break;
-
 
3481
      case SEQ_UI_SEL_VIEW_INS:
-
 
3482
    select_leds_green = 1 << ui_selected_instrument;
-
 
3483
    break;
-
 
3484
      case SEQ_UI_SEL_VIEW_MUTE:
-
 
3485
    if( seq_ui_button_state.MUTE_PRESSED ) {
-
 
3486
      select_leds_green = seq_core_trk[visible_track].layer_muted | seq_core_trk[visible_track].layer_muted_from_midi;
-
 
3487
    } else {
-
 
3488
      select_leds_green = seq_core_trk_muted;
-
 
3489
    }
-
 
3490
    break;
-
 
3491
      case SEQ_UI_SEL_VIEW_PHRASE:
-
 
3492
    select_leds_green = 1 << ui_selected_phrase;
-
 
3493
    break;
-
 
3494
      }
-
 
3495
3295
3496
3296
      // Select row, first quarter
3497
      // Select row, first quarter
3297
      {
3498
      {
3298
    u8 value = 0;
3499
    u8 value = 0;
3299
3500
3300
    if( ui_select_leds_green & (1 << 0) ) value |= (1 << 0);
3501
    if( select_leds_green & (1 << 0) ) value |= (1 << 0);
3301
    if( ui_select_leds_red   & (1 << 0) ) value |= (1 << 1);
3502
    if( select_leds_red   & (1 << 0) ) value |= (1 << 1);
3302
3503
3303
    if( ui_select_leds_green & (1 << 1) ) value |= (1 << 3);
3504
    if( select_leds_green & (1 << 1) ) value |= (1 << 3);
3304
    if( ui_select_leds_red   & (1 << 1) ) value |= (1 << 2);
3505
    if( select_leds_red   & (1 << 1) ) value |= (1 << 2);
3305
3506
3306
    if( ui_select_leds_green & (1 << 2) ) value |= (1 << 5);
3507
    if( select_leds_green & (1 << 2) ) value |= (1 << 5);
3307
    if( ui_select_leds_red   & (1 << 2) ) value |= (1 << 4);
3508
    if( select_leds_red   & (1 << 2) ) value |= (1 << 4);
3308
3509
3309
    if( ui_select_leds_green & (1 << 3) ) value |= (1 << 7);
3510
    if( select_leds_green & (1 << 3) ) value |= (1 << 7);
3310
    if( ui_select_leds_red   & (1 << 3) ) value |= (1 << 6);
3511
    if( select_leds_red   & (1 << 3) ) value |= (1 << 6);
3311
3512
3312
    seq_blm8x8_led_row[0][2] = value;
3513
    seq_blm8x8_led_row[0][2] = value;
3313
      }
3514
      }
3314
3515
3315
      // Select row, second quarter
3516
      // Select row, second quarter
3316
      {
3517
      {
3317
    u8 value = 0;
3518
    u8 value = 0;
3318
3519
3319
    if( ui_select_leds_green & (1 << 4) ) value |= (1 << 0);
3520
    if( select_leds_green & (1 << 4) ) value |= (1 << 0);
3320
    if( ui_select_leds_red   & (1 << 4) ) value |= (1 << 1);
3521
    if( select_leds_red   & (1 << 4) ) value |= (1 << 1);
3321
3522
3322
    if( ui_select_leds_green & (1 << 5) ) value |= (1 << 3);
3523
    if( select_leds_green & (1 << 5) ) value |= (1 << 3);
3323
    if( ui_select_leds_red   & (1 << 5) ) value |= (1 << 2);
3524
    if( select_leds_red   & (1 << 5) ) value |= (1 << 2);
3324
3525
3325
    if( ui_select_leds_green & (1 << 6) ) value |= (1 << 5);
3526
    if( select_leds_green & (1 << 6) ) value |= (1 << 5);
3326
    if( ui_select_leds_red   & (1 << 6) ) value |= (1 << 4);
3527
    if( select_leds_red   & (1 << 6) ) value |= (1 << 4);
3327
3528
3328
    if( ui_select_leds_green & (1 << 7) ) value |= (1 << 7);
3529
    if( select_leds_green & (1 << 7) ) value |= (1 << 7);
3329
    if( ui_select_leds_red   & (1 << 7) ) value |= (1 << 6);
3530
    if( select_leds_red   & (1 << 7) ) value |= (1 << 6);
3330
3531
3331
    seq_blm8x8_led_row[0][6] = value;
3532
    seq_blm8x8_led_row[0][6] = value;
3332
      }
3533
      }
3333
3534
3334
      // Select row, third quarter
3535
      // Select row, third quarter
3335
      {
3536
      {
3336
    u8 value = 0;
3537
    u8 value = 0;
3337
3538
3338
    if( ui_select_leds_green & (1 << 8) ) value |= (1 << 0);
3539
    if( select_leds_green & (1 << 8) ) value |= (1 << 0);
3339
    if( ui_select_leds_red   & (1 << 8) ) value |= (1 << 1);
3540
    if( select_leds_red   & (1 << 8) ) value |= (1 << 1);
3340
3541
3341
    if( ui_select_leds_green & (1 << 9) ) value |= (1 << 3);
3542
    if( select_leds_green & (1 << 9) ) value |= (1 << 3);
3342
    if( ui_select_leds_red   & (1 << 9) ) value |= (1 << 2);
3543
    if( select_leds_red   & (1 << 9) ) value |= (1 << 2);
3343
3544
3344
    if( ui_select_leds_green & (1 << 10) ) value |= (1 << 5);
3545
    if( select_leds_green & (1 << 10) ) value |= (1 << 5);
3345
    if( ui_select_leds_red   & (1 << 10) ) value |= (1 << 4);
3546
    if( select_leds_red   & (1 << 10) ) value |= (1 << 4);
3346
3547
3347
    if( ui_select_leds_green & (1 << 11) ) value |= (1 << 7);
3548
    if( select_leds_green & (1 << 11) ) value |= (1 << 7);
3348
    if( ui_select_leds_red   & (1 << 11) ) value |= (1 << 6);
3549
    if( select_leds_red   & (1 << 11) ) value |= (1 << 6);
3349
3550
3350
    seq_blm8x8_led_row[1][2] = value;
3551
    seq_blm8x8_led_row[1][2] = value;
3351
      }
3552
      }
3352
3553
3353
      // Select row, fourth quarter
3554
      // Select row, fourth quarter
3354
      {
3555
      {
3355
    u8 value = 0;
3556
    u8 value = 0;
3356
3557
3357
    if( ui_select_leds_green & (1 << 12) ) value |= (1 << 0);
3558
    if( select_leds_green & (1 << 12) ) value |= (1 << 0);
3358
    if( ui_select_leds_red   & (1 << 12) ) value |= (1 << 1);
3559
    if( select_leds_red   & (1 << 12) ) value |= (1 << 1);
3359
3560
3360
    if( ui_select_leds_green & (1 << 13) ) value |= (1 << 3);
3561
    if( select_leds_green & (1 << 13) ) value |= (1 << 3);
3361
    if( ui_select_leds_red   & (1 << 13) ) value |= (1 << 2);
3562
    if( select_leds_red   & (1 << 13) ) value |= (1 << 2);
3362
3563
3363
    if( ui_select_leds_green & (1 << 14) ) value |= (1 << 5);
3564
    if( select_leds_green & (1 << 14) ) value |= (1 << 5);
3364
    if( ui_select_leds_red   & (1 << 14) ) value |= (1 << 4);
3565
    if( select_leds_red   & (1 << 14) ) value |= (1 << 4);
3365
3566
3366
    if( ui_select_leds_green & (1 << 15) ) value |= (1 << 7);
3567
    if( select_leds_green & (1 << 15) ) value |= (1 << 7);
3367
    if( ui_select_leds_red   & (1 << 15) ) value |= (1 << 6);
3568
    if( select_leds_red   & (1 << 15) ) value |= (1 << 6);
3368
3569
3369
    seq_blm8x8_led_row[1][6] = value;
3570
    seq_blm8x8_led_row[1][6] = value;
3370
      }
3571
      }
3371
    }
3572
    }
3372
  }
3573
  }
Line 4100... Line 4301...
4100
  bm->flags.CHANGE_ALL_STEPS = seq_ui_button_state.CHANGE_ALL_STEPS;
4301
  bm->flags.CHANGE_ALL_STEPS = seq_ui_button_state.CHANGE_ALL_STEPS;
4101
  bm->flags.FAST = seq_ui_button_state.FAST_ENCODERS;
4302
  bm->flags.FAST = seq_ui_button_state.FAST_ENCODERS;
4102
  bm->flags.METRONOME = seq_core_state.METRONOME;
4303
  bm->flags.METRONOME = seq_core_state.METRONOME;
4103
  bm->flags.LOOP = seq_core_state.LOOP;
4304
  bm->flags.LOOP = seq_core_state.LOOP;
4104
  bm->flags.FOLLOW = seq_core_state.FOLLOW;
4305
  bm->flags.FOLLOW = seq_core_state.FOLLOW;
4105
  bm->page = (u8)ui_page_before_bookmark;
4306
  bm->page = (u8)ui_bookmarks_prev_page;
4106
  bm->group = ui_selected_group;
4307
  bm->group = ui_selected_group;
4107
  bm->par_layer = ui_selected_par_layer;
4308
  bm->par_layer = ui_selected_par_layer;
4108
  bm->trg_layer = ui_selected_trg_layer;
4309
  bm->trg_layer = ui_selected_trg_layer;
4109
  bm->instrument = ui_selected_instrument;
4310
  bm->instrument = ui_selected_instrument;
4110
  bm->step_view = ui_selected_step_view;
4311
  bm->step_view = ui_selected_step_view;