forked from rogerlinndesign/linnstrument-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ls_displayModes.ino
1905 lines (1713 loc) · 55.8 KB
/
ls_displayModes.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/************************** ls_displayModes: LinnStrument display modes drawing *******************
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
***************************************************************************************************
There are 13 different display modes.
These are the possible values of the global variable displayMode:
displayNormal : normal performance display
displayPerSplit : per-split settings (left or right split)
displayPreset : preset number
displayVolume : volume
displayOctaveTranspose : octave and transpose settings
displaySplitPoint : split point
displayGlobal : global settings
displayGlobalWithTempo : global settings with tempo
displayOsVersion : version number of the OS
displayCalibration : calibration process
displayReset : global reset confirmation and wait for touch release
displayBendRange ; custom bend range selection for X expression
displayLimitsForY : min and max value selection for Y expression
displayCCForY : custom CC number selection for Y expression
displayInitialForRelativeY : initial value for relative Y
displayLimitsForZ : min and max value selection for Z expression
displayCCForZ : custom CC number selection for Z expression
displayPlayedTouchModeConfig : custom display mode for played notes upon touch
displayCCForFader : custom CC number selection for a CC fader
displayLowRowCCXConfig : custom CC number selection and behavior for LowRow in CCX mode
displayLowRowCCXYZConfig : custom CC number selection and behavior for LowRow in CCXYZ mode
displayCCForSwitchCC65 : custom CC number selection and behavior for Switches in CC65 mode
displayCCForSwitchSustain : custom CC number selection and behavior for Switches in Sustain mode
displayCustomSwitchAssignment : custom switch behavior for Switches
displayLimitsForVelocity : min and max value selection for velocity
displayValueForFixedVelocity : value selection for fixed velocity
displayMinUSBMIDIInterval : minimum delay between MIDI bytes when sent over USB
displaySensorSensitivityZ : sensor sensitivity setting for Z
displaySensorLoZ : sensor low Z sensitivity selection
displaySensorFeatherZ : sensor feather Z sensitivity selection
displaySensorRangeZ : max Z sensor range selection
displayAnimation : display animation
displayEditAudienceMessage : edit an audience message
displaySleep : sleeping
displaySleepConfig : sleep mode configuration
displayRowOffset : custom row offset selection
displayGuitarTuning : guitar tuning configuration
displayMIDIThrough : MIDI through configuration
displaySequencerProjects : sequencer projects
displaySequencerDrum0107 : sequencer first 7 drum notes
displaySequencerDrum0814 : sequencer second 7 drum notes
displaySequencerColors : sequencer low row colors
These routines handle the painting of these display modes on LinnStument's 208 LEDs.
**************************************************************************************************/
unsigned long displayModeStart = 0; // indicates when the current display mode was activated
boolean blinkMiddleRootNote = false; // indicates whether the middle root note should be blinking
// changes the active display mode
void setDisplayMode(DisplayMode mode) {
DEBUGPRINT((0,"setDisplayMode"));
DEBUGPRINT((0," mode="));DEBUGPRINT((0,(int)mode));
DEBUGPRINT((0,"\n"));
boolean refresh = (displayMode != mode);
if (refresh || displayModeStart == 0) {
displayModeStart = millis();
exitDisplayMode(displayMode);
}
displayMode = mode;
if (refresh) {
enterDisplayMode(mode);
completelyRefreshLeds();
}
}
// updates columns 1=25 of the LED display based on the current displayMode setting:
// 0:normal, 1:perSplit, 2:preset, 3:volume, 4:transpose, 5:split, 6:global
void updateDisplay() {
if (animationActive) {
return;
}
startBufferedLeds();
switch (displayMode) {
case displayNormal:
case displaySplitPoint:
if (!controlModeActive) {
paintNormalDisplay();
}
break;
case displayPerSplit:
paintPerSplitDisplay(Global.currentPerSplit);
break;
case displayPreset:
paintPresetDisplay(Global.currentPerSplit);
break;
case displayOsVersion:
paintOSVersionDisplay();
break;
case displayOsVersionBuild:
paintOSVersionBuildDisplay();
break;
case displayVolume:
paintVolumeDisplay(Global.currentPerSplit);
break;
case displayOctaveTranspose:
paintOctaveTransposeDisplay(Global.currentPerSplit);
break;
case displayGlobal:
case displayGlobalWithTempo:
paintGlobalSettingsDisplay();
break;
case displayCalibration:
paintCalibrationDisplay();
break;
case displayReset:
paintResetDisplay();
break;
case displayBendRange:
paintBendRangeDisplay(Global.currentPerSplit);
break;
case displayLimitsForY:
paintLimitsForYDisplay(Global.currentPerSplit);
break;
case displayCCForY:
paintCCForYDisplay(Global.currentPerSplit);
break;
case displayInitialForRelativeY:
paintInitialForRelativeYDisplay(Global.currentPerSplit);
break;
case displayLimitsForZ:
paintLimitsForZDisplay(Global.currentPerSplit);
break;
case displayCCForZ:
paintCCForZDisplay(Global.currentPerSplit);
break;
case displayPlayedTouchModeConfig:
paintPlayedTouchModeDisplay(Global.currentPerSplit);
break;
case displayCCForFader:
paintCCForFaderDisplay(Global.currentPerSplit);
break;
case displayLowRowCCXConfig:
paintLowRowCCXConfigDisplay(Global.currentPerSplit);
break;
case displayLowRowCCXYZConfig:
paintLowRowCCXYZConfigDisplay(Global.currentPerSplit);
break;
case displayCCForSwitchCC65:
paintCCForSwitchCC65ConfigDisplay();
break;
case displayCCForSwitchSustain:
paintCCForSwitchSustainConfigDisplay();
break;
case displayCustomSwitchAssignment:
paintCustomSwitchAssignmentConfigDisplay();
break;
case displayLimitsForVelocity:
paintLimitsForVelocityDisplay();
break;
case displayValueForFixedVelocity:
paintValueForFixedVelocityDisplay();
break;
case displayMinUSBMIDIInterval:
paintMinUSBMIDIIntervalDisplay();
break;
case displaySensorSensitivityZ:
paintSensorSensitivityZDisplay();
break;
case displaySensorLoZ:
paintSensorLoZDisplay();
break;
case displaySensorFeatherZ:
paintSensorFeatherZDisplay();
break;
case displaySensorRangeZ:
paintSensorRangeZDisplay();
break;
case displayAnimation:
// animation display is handled independently
break;
case displayEditAudienceMessage:
paintEditAudienceMessage();
break;
case displaySleep:
// sleep display is handled independently
break;
case displaySleepConfig:
paintSleepConfig();
break;
case displaySplitHandedness:
paintSplitHandedness();
break;
case displayRowOffset:
paintRowOffset();
break;
case displayGuitarTuning:
paintGuitarTuning();
break;
case displayMIDIThrough:
paintMIDIThrough();
break;
case displaySequencerProjects:
paintSequencerProjects();
break;
case displaySequencerDrum0107:
paintSequencerDrum0107();
break;
case displaySequencerDrum0814:
paintSequencerDrum0814();
break;
case displaySequencerColors:
paintSequencerColors();
break;
}
updateSwitchLeds();
finishBufferedLeds();
}
// handle logic tied to entering specific display mode, like clearing
void enterDisplayMode(DisplayMode mode) {
switch (mode) {
// ensure that in non settings displays, the control buttons are cleared out
case displayNormal:
case displaySleep:
case displayAnimation:
clearLed(0, GLOBAL_SETTINGS_ROW);
clearLed(0, OCTAVE_ROW);
clearLed(0, VOLUME_ROW);
clearLed(0, PRESET_ROW);
clearLed(0, PER_SPLIT_ROW);
controlButton = -1;
break;
case displaySensorSensitivityZ:
clearDisplay();
break;
#ifdef DEBUG_ENABLED
case displayCalibration:
debugCalibration();
break;
#endif
default:
// no logic tied to entering the display mode
break;
}
}
// handle logic tied to exiting specific display mode, like post-processing or saving
void exitDisplayMode(DisplayMode mode) {
switch (mode) {
case displayNormal:
initializeTouchAnimation();
break;
case displayEditAudienceMessage:
trimEditedAudienceMessage();
storeSettings();
break;
default:
// no logic tied to exiting the display mode
break;
}
}
void updateSwitchLeds() {
if (operatingMode != modePerformance) {
return;
}
// highlight global settings yellow when user firmware mode is active
if (userFirmwareActive) {
setLed(0, GLOBAL_SETTINGS_ROW, COLOR_YELLOW, cellOn);
return;
}
CellDisplay displaySwitch1 = switchState[SWITCH_SWITCH_1][Global.currentPerSplit] ? cellOn : cellOff;
if (Global.switchAssignment[SWITCH_SWITCH_1] == ASSIGNED_ARPEGGIATOR) {
displaySwitch1 = isArpeggiatorEnabled(Global.currentPerSplit) ? cellOn : cellOff;
}
else if (isLowRowSustainPressed(Global.currentPerSplit) &&
((Global.switchAssignment[SWITCH_SWITCH_1] == ASSIGNED_SUSTAIN && Global.ccForSwitchSustain[SWITCH_SWITCH_1] == 64) ||
(Global.switchAssignment[SWITCH_SWITCH_1] == ASSIGNED_CC_65 && Global.ccForSwitchCC65[SWITCH_SWITCH_1] == 64))) {
displaySwitch1 = cellOn;
}
else if ((Global.switchAssignment[SWITCH_SWITCH_1] == ASSIGNED_SUSTAIN && isSwitchSustainCCEnabled(SWITCH_SWITCH_1, Global.currentPerSplit)) ||
(Global.switchAssignment[SWITCH_SWITCH_1] == ASSIGNED_CC_65 && isSwitchCC65CCEnabled(SWITCH_SWITCH_1, Global.currentPerSplit))) {
displaySwitch1 = cellOn;
}
else if (Global.switchAssignment[SWITCH_SWITCH_1] == ASSIGNED_AUTO_OCTAVE && isSwitchAutoOctavePressed(Global.currentPerSplit)) {
displaySwitch1 = cellOn;
}
setLed(0, SWITCH_1_ROW, globalColor, displaySwitch1);
CellDisplay displaySwitch2 = switchState[SWITCH_SWITCH_2][Global.currentPerSplit] ? cellOn : cellOff;
if (Global.switchAssignment[SWITCH_SWITCH_2] == ASSIGNED_ARPEGGIATOR) {
displaySwitch2 = isArpeggiatorEnabled(Global.currentPerSplit) ? cellOn : cellOff;
}
else if (isLowRowSustainPressed(Global.currentPerSplit) &&
((Global.switchAssignment[SWITCH_SWITCH_2] == ASSIGNED_SUSTAIN && Global.ccForSwitchSustain[SWITCH_SWITCH_2] == 64) ||
(Global.switchAssignment[SWITCH_SWITCH_2] == ASSIGNED_CC_65 && Global.ccForSwitchCC65[SWITCH_SWITCH_2] == 64))) {
displaySwitch2 = cellOn;
}
else if ((Global.switchAssignment[SWITCH_SWITCH_2] == ASSIGNED_SUSTAIN && isSwitchSustainCCEnabled(SWITCH_SWITCH_2, Global.currentPerSplit)) ||
(Global.switchAssignment[SWITCH_SWITCH_2] == ASSIGNED_CC_65 && isSwitchCC65CCEnabled(SWITCH_SWITCH_2, Global.currentPerSplit))) {
displaySwitch2 = cellOn;
}
else if (Global.switchAssignment[SWITCH_SWITCH_2] == ASSIGNED_AUTO_OCTAVE && isSwitchAutoOctavePressed(Global.currentPerSplit)) {
displaySwitch2 = cellOn;
}
setLed(0, SWITCH_2_ROW, globalColor, displaySwitch2);
if (Split[Global.currentPerSplit].sequencer) {
setLed(0, SPLIT_ROW, Split[Global.currentPerSplit].colorMain, cellOn);
}
else if (Global.splitActive) {
setLed(0, SPLIT_ROW, Split[Global.currentPerSplit].colorMain, cellOn);
}
else {
clearLed(0, SPLIT_ROW);
}
switch (displayMode) {
case displayGlobal:
lightLed(0, GLOBAL_SETTINGS_ROW);
break;
case displayOctaveTranspose:
lightLed(0, OCTAVE_ROW);
break;
case displayVolume:
lightLed(0, VOLUME_ROW);
break;
case displayPreset:
lightLed(0, PRESET_ROW);
break;
case displayPerSplit:
lightLed(0, PER_SPLIT_ROW);
break;
default:
break;
}
updateSequencerSwitchLeds();
}
// paintNormalDisplay:
// Paints all non-switch columns of the display with the normal performance colors
void paintNormalDisplay() {
if (userFirmwareActive) return;
if (Split[Global.currentPerSplit].sequencer) {
paintSequencerDisplay(Global.currentPerSplit);
return;
}
// determine the splits and divider
byte split = Global.currentPerSplit;
byte divider = NUMCOLS;
if (Global.splitActive || displayMode == displaySplitPoint) {
split = LEFT;
divider = Global.splitPoint;
}
paintNormalDisplaySplit(split, 1, divider);
if (divider != NUMCOLS) {
paintNormalDisplaySplit(RIGHT, divider, NUMCOLS);
}
// light the octave/transpose switch if the pitch is transposed
if ((Split[LEFT].transposePitch < 0 && Split[RIGHT].transposePitch < 0) ||
(Split[LEFT].transposePitch < 0 && Split[RIGHT].transposePitch == 0) ||
(Split[LEFT].transposePitch == 0 && Split[RIGHT].transposePitch < 0)) {
setLed(0, OCTAVE_ROW, COLOR_RED, cellOn);
}
else if ((Split[LEFT].transposePitch > 0 && Split[RIGHT].transposePitch > 0) ||
(Split[LEFT].transposePitch > 0 && Split[RIGHT].transposePitch == 0) ||
(Split[LEFT].transposePitch == 0 && Split[RIGHT].transposePitch > 0)) {
setLed(0, OCTAVE_ROW, COLOR_GREEN, cellOn);
}
else if (Split[LEFT].transposePitch != 0 && Split[RIGHT].transposePitch != 0) {
setLed(0, OCTAVE_ROW, COLOR_YELLOW, cellOn);
}
else {
clearLed(0, OCTAVE_ROW);
}
}
void paintNormalDisplaySplit(byte split, byte leftEdge, byte rightEdge) {
if (userFirmwareActive) return;
byte faderLeft, faderLength;
determineFaderBoundaries(split, faderLeft, faderLength);
for (byte row = 0; row < NUMROWS; ++row) {
if (Split[split].ccFaders) {
paintCCFaderDisplayRow(split, row, faderLeft, faderLength);
}
else if (isStrummingSplit(split)) {
for (byte col = leftEdge; col < rightEdge; ++col) {
paintStrumDisplayCell(split, col, row);
}
}
else {
for (byte col = leftEdge; col < rightEdge; ++col) {
paintNormalDisplayCell(split, col, row);
}
if (!userFirmwareActive && row == 0 && Split[split].lowRowMode != lowRowNormal) {
if (Split[split].lowRowMode == lowRowCCX && Split[split].lowRowCCXBehavior == lowRowCCFader) {
paintCCFaderDisplayRow(split, 0, Split[split].colorLowRow, Split[split].ccForLowRow, faderLeft, faderLength);
}
if (Split[split].lowRowMode == lowRowCCXYZ && Split[split].lowRowCCXYZBehavior == lowRowCCFader) {
paintCCFaderDisplayRow(split, 0, Split[split].colorLowRow, Split[split].ccForLowRowX, faderLeft, faderLength);
}
}
}
performContinuousTasks();
}
}
void paintCCFaderDisplayRow(byte split, byte row, byte faderLeft, byte faderLength) {
paintCCFaderDisplayRow(split, row, Split[split].colorMain, Split[split].ccForFader[row], faderLeft, faderLength);
}
void paintCCFaderDisplayRow(byte split, byte row, byte color, unsigned short ccForFader, byte faderLeft, byte faderLength) {
if (userFirmwareActive || ccForFader > 128) return;
// when the fader only spans one cell, it acts as a toggle
if (faderLength == 0) {
if (ccFaderValues[split][ccForFader] > 0) {
setLed(faderLeft, row, color, cellOn);
}
else {
clearLed(faderLeft, row);
}
}
// otherwise calculate the fader position based on its value and light the appropriate leds
else {
int32_t fxdFaderPosition = fxdCalculateFaderPosition(ccFaderValues[split][ccForFader], faderLeft, faderLength);
for (byte col = faderLength + faderLeft; col >= faderLeft; --col ) {
if (Device.calRows[col][0].fxdReferenceX - FXD_CALX_HALF_UNIT > fxdFaderPosition) {
clearLed(col, row);
}
else {
setLed(col, row, color, cellOn);
}
}
}
}
void paintStrumDisplayCell(byte split, byte col, byte row) {
if (userFirmwareActive) return;
// by default clear the cell color
byte colour = COLOR_OFF;
CellDisplay cellDisplay = cellOff;
if (row % 2 == 0) {
colour = Split[split].colorAccent;
cellDisplay = cellOn;
}
else {
colour = Split[split].colorMain;
cellDisplay = cellOn;
}
// actually set the cell's color
setLed(col, row, colour, cellDisplay);
}
void paintNormalDisplayCell(byte split, byte col, byte row) {
if (userFirmwareActive) return;
// by default clear the cell color
byte colour = COLOR_OFF;
CellDisplay cellDisplay = cellOff;
short displayedNote = getNoteNumber(split, col, row) + Split[split].transposeOctave;
short actualnote = transposedNote(split, col, row);
// the note is out of MIDI note range, disable it
if (actualnote < 0 || actualnote > 127) {
colour = COLOR_OFF;
cellDisplay = cellOff;
}
else {
byte octaveNote = abs(displayedNote % 12);
// first paint all cells in split to its background color
if (Global.mainNotes[Global.activeNotes] & (1 << octaveNote)) {
colour = Split[split].colorMain;
cellDisplay = cellOn;
}
// then paint only notes marked as Accent notes with Accent color
if (Global.accentNotes[Global.activeNotes] & (1 << octaveNote)) {
colour = Split[split].colorAccent;
cellDisplay = cellOn;
}
}
// show pulsating middle root note
if (blinkMiddleRootNote && displayedNote == 60) {
colour = Split[split].colorAccent;
cellDisplay = cellFastPulse;
}
// if the low row is anything but normal, set it to the appropriate color
if (row == 0 && Split[split].lowRowMode != lowRowNormal) {
if ((Split[split].lowRowMode == lowRowCCX && Split[sensorSplit].lowRowCCXBehavior == lowRowCCFader) ||
(Split[split].lowRowMode == lowRowCCXYZ && Split[sensorSplit].lowRowCCXYZBehavior == lowRowCCFader)) {
colour = COLOR_BLACK;
cellDisplay = cellOff;
}
else {
colour = Split[split].colorLowRow;
cellDisplay = cellOn;
}
}
// actually set the cell's color
setLed(col, row, colour, cellDisplay);
}
// paintPerSplitDisplay:
// paints all cells with per-split settings for a given split
void paintPerSplitDisplay(byte side) {
clearDisplay();
doublePerSplit = false;
// set Midi Mode and channel lights
switch (Split[side].midiMode) {
case oneChannel:
{
setLed(1, 7, Split[side].colorMain, cellOn);
break;
}
case channelPerNote:
{
setLed(1, 6, getMpeColor(side), cellOn);
break;
}
case channelPerRow:
{
setLed(1, 5, getChannelPerRowColor(side), cellOn);
break;
}
}
switch (midiChannelSelect) {
case MIDICHANNEL_MAIN:
setLed(2, 7, Split[side].colorMain, cellOn);
showMainMidiChannel(side);
break;
case MIDICHANNEL_PERNOTE:
setLed(2, 6, Split[side].colorMain, cellOn);
showPerNoteMidiChannels(side);
break;
case MIDICHANNEL_PERROW:
setLed(2, 5, Split[side].colorMain, cellOn);
showPerRowMidiChannel(side);
break;
}
switch (Split[side].bendRangeOption) {
case bendRange2:
setLed(7, 7, Split[side].colorMain, cellOn);
break;
case bendRange3:
setLed(7, 6, Split[side].colorMain, cellOn);
break;
case bendRange12:
setLed(7, 5, Split[side].colorMain, cellOn);
break;
case bendRange24:
setLed(7, 4, getBendRangeColor(side), cellOn);
break;
}
// set Pitch/X settings
if (Split[side].sendX == true) {
setLed(8, 7, Split[side].colorMain, cellOn);
}
if (Split[side].pitchCorrectQuantize == true) {
setLed(8, 6, Split[side].colorMain, cellOn);
}
if (Split[side].pitchCorrectHold == pitchCorrectHoldMedium ||
Split[side].pitchCorrectHold == pitchCorrectHoldSlow) {
setLed(8, 5, Split[side].colorMain, cellOn);
}
if (Split[side].pitchCorrectHold == pitchCorrectHoldFast ||
Split[side].pitchCorrectHold == pitchCorrectHoldSlow) {
setLed(8, 4, Split[side].colorMain, cellOn);
}
if (Split[side].pitchResetOnRelease == true) {
setLed(8, 3, Split[side].colorMain, cellOn);
}
// set Timbre/Y settings
if (Split[side].sendY == true) {
setLed(9, 7, getLimitsForYColor(side), cellOn);
}
switch (Split[side].expressionForY) {
case timbrePolyPressure:
case timbreChannelPressure:
case timbreCC74:
setLed(9, 5, getCCForYColor(side), cellOn);
break;
case timbreCC1:
setLed(9, 6, Split[side].colorMain, cellOn);
break;
}
if (Split[side].relativeY == true)
{
setLed(9, 4, getRelativeYColor(side), cellOn);
}
// set Loudness/Z settings
if (Split[side].sendZ == true) {
setLed(10, 7, getLimitsForZColor(side), cellOn);
}
switch (Split[side].expressionForZ) {
case loudnessPolyPressure:
setLed(10, 6, Split[side].colorMain, cellOn);
break;
case loudnessChannelPressure:
setLed(10, 5, Split[side].colorMain, cellOn);
break;
case loudnessCC11:
setLed(10, 4, getCCForZColor(side), cellOn);
break;
}
// Set "Color" lights
setLed(11, 7, Split[side].colorMain, cellOn);
setLed(11, 6, Split[side].colorAccent, cellOn);
setLed(11, 5, Split[side].colorPlayed, cellOn);
setLed(11, 4, Split[side].colorLowRow, cellOn);
// Set "Low row" lights
switch (Split[side].lowRowMode) {
case lowRowNormal:
setLed(12, 7, Split[side].colorMain, cellOn);
break;
case lowRowRestrike:
setLed(12, 6, Split[side].colorMain, cellOn);
break;
case lowRowStrum:
setLed(12, 5, Split[side].colorMain, cellOn);
break;
case lowRowArpeggiator:
setLed(12, 4, Split[side].colorMain, cellOn);
break;
case lowRowSustain:
setLed(13, 7, Split[side].colorMain, cellOn);
break;
case lowRowBend:
setLed(13, 6, Split[side].colorMain, cellOn);
break;
case lowRowCCX:
setLed(13, 5, getLowRowCCXColor(side), cellOn);
break;
case lowRowCCXYZ:
setLed(13, 4, getLowRowCCXYZColor(side), cellOn);
break;
}
// set Arpeggiator
if (Split[side].arpeggiator) {
setLed(14, 7, Split[side].colorMain, cellOn);
}
// set CC faders
if (Split[side].ccFaders) {
setLed(14, 6, getCCFadersColor(side), cellOn);
}
// set strum
if (Split[side].strum) {
setLed(14, 5, Split[side].colorMain, cellOn);
}
// set sequencer
if (Split[side].sequencer) {
setLed(14, 4, Split[side].colorMain, cellOn);
}
// set "show split" led
paintShowSplitSelection(side);
}
byte getMpeColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].mpe) {
color = Split[side].colorAccent;
}
return color;
}
byte getChannelPerRowColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].midiChanPerRowReversed) {
color = Split[side].colorAccent;
}
return color;
}
byte getBendRangeColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].customBendRange != 24) {
color = Split[side].colorAccent;
}
return color;
}
byte getLimitsForYColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].minForY != 0 || Split[side].maxForY != 127) {
color = Split[side].colorAccent;
}
return color;
}
byte getCCForYColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].customCCForY != 74) {
color = Split[side].colorAccent;
}
return color;
}
byte getRelativeYColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].initialRelativeY != 64) {
color = Split[side].colorAccent;
}
return color;
}
byte getLimitsForZColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].minForZ != 0 || Split[side].maxForZ != 127 || Split[side].ccForZ14Bit) {
color = Split[side].colorAccent;
}
return color;
}
byte getCCForZColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].customCCForZ != 11) {
color = Split[side].colorAccent;
}
return color;
}
byte getLowRowCCXColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].ccForLowRow != 1) {
color = Split[side].colorAccent;
}
return color;
}
byte getLowRowCCXYZColor(byte side) {
byte color = Split[side].colorMain;
if (Split[side].ccForLowRowX != 16) {
color = Split[side].colorAccent;
}
if (Split[side].ccForLowRowY != 17) {
color = Split[side].colorAccent;
}
if (Split[side].ccForLowRowZ != 18) {
color = Split[side].colorAccent;
}
return color;
}
byte getCCFadersColor(byte side) {
byte color = Split[side].colorMain;
for (byte f = 0; f < 8; ++f) {
if (Split[side].ccForFader[f] != f+1) {
color = Split[side].colorAccent;
break;
}
}
return color;
}
byte getCalibrationColor() {
if (Device.calibrated) {
return COLOR_GREEN;
}
return COLOR_RED;
}
byte getSplitHandednessColor() {
if (Device.splitHandedness == reversedBoth) {
return globalColor;
}
return globalAltColor;
}
byte getGuitarTuningColor() {
byte color = globalColor;
if (Global.guitarTuning[0] != 30 ||
Global.guitarTuning[1] != 35 ||
Global.guitarTuning[2] != 40 ||
Global.guitarTuning[3] != 45 ||
Global.guitarTuning[4] != 50 ||
Global.guitarTuning[5] != 55 ||
Global.guitarTuning[6] != 59 ||
Global.guitarTuning[7] != 64) {
color = globalAltColor;
}
return color;
}
// paint one of the two leds that indicate which split is being controlled
// (e.g. when you're changing per-split settings, or changing the preset or volume)
void paintShowSplitSelection(byte side) {
if (side == LEFT || doublePerSplit) {
setLed(15, 7, Split[LEFT].colorMain, cellOn);
}
if (side == RIGHT || doublePerSplit) {
setLed(16, 7, Split[RIGHT].colorMain, cellOn);
}
}
void paintOSVersionDisplay() {
clearDisplay();
byte color = Split[LEFT].colorMain;
smallfont_draw_string(0, 0, OSVersion, color);
}
void paintOSVersionBuildDisplay() {
clearDisplay();
byte color = Split[LEFT].colorAccent;
smallfont_draw_string(0, 0, OSVersionBuild, color);
}
// paint the current preset number for a particular side, in large block characters
byte getPresetDisplayColumn() {
return LINNMODEL == 200 ? NUMCOLS-2 : NUMCOLS-1;
}
void paintPresetDisplay(byte side) {
clearDisplay();
setLed(1, 7, COLOR_GREEN, cellOn);
setLed(1, 6, COLOR_RED, cellOn);
for (byte p = 0; p < NUMPRESETS; ++p) {
int color = globalColor;
if (p == Device.lastLoadedPreset) {
color = COLOR_CYAN;
}
int row = p+2;
if (row >= 6) row -= 6;
setLed(getPresetDisplayColumn(), row, color, cellOn);
}
paintSplitNumericDataDisplay(side, midiPreset[side]+1, 0, false);
}
void paintBendRangeDisplay(byte side) {
clearDisplay();
paintSplitNumericDataDisplay(side, Split[side].customBendRange, 0, false);
}
void paintLimitsForYDisplay(byte side) {
clearDisplay();
switch (limitsForYConfigState) {
case 1:
condfont_draw_string(0, 0, "L", Split[side].colorMain, true);
paintSplitNumericDataDisplay(side, Split[side].minForY, 4, true);
break;
case 0:
condfont_draw_string(0, 0, "H", Split[side].colorMain, true);
paintSplitNumericDataDisplay(side, Split[side].maxForY, 4, true);
break;
}
}
void paintCCForYDisplay(byte side) {
clearDisplay();
if (Split[side].customCCForY == 128) {
condfont_draw_string(0, 0, "POPRS", Split[side].colorMain, false);
paintShowSplitSelection(side);
}
else if (Split[side].customCCForY == 129) {
condfont_draw_string(0, 0, "CHPRS", Split[side].colorMain, false);
paintShowSplitSelection(side);
}
else {
paintSplitNumericDataDisplay(side, Split[side].customCCForY, 0, false);
}
}
void paintInitialForRelativeYDisplay(byte side) {
clearDisplay();
paintSplitNumericDataDisplay(side, Split[side].initialRelativeY, 0, false);
}
void paintLimitsForZDisplay(byte side) {
clearDisplay();
switch (limitsForZConfigState) {
case 2:
condfont_draw_string(0, 0, "L", Split[side].colorMain, true);
paintSplitNumericDataDisplay(side, Split[side].minForZ, 4, true);
break;
case 1:
condfont_draw_string(0, 0, "H", Split[side].colorMain, true);
paintSplitNumericDataDisplay(side, Split[side].maxForZ, 4, true);
break;
case 0:
if (Split[side].ccForZ14Bit) {
condfont_draw_string(0, 0, "14BT", Split[side].colorMain, true);
}
else {
condfont_draw_string(3, 0, "7BT", Split[side].colorMain, true);
}
paintShowSplitSelection(side);
break;
}
}
void paintCCForZDisplay(byte side) {
clearDisplay();
if (Split[side].expressionForZ != loudnessCC11) {
setDisplayMode(displayPerSplit);
updateDisplay();
}
else {
paintSplitNumericDataDisplay(side, Split[side].customCCForZ, 0, false);
}
}
void paintCCForFaderDisplay(byte side) {
clearDisplay();
for (byte r = 0; r < NUMROWS; ++r) {
setLed(NUMCOLS-1, r, globalColor, cellOn);
}
setLed(NUMCOLS-1, currentEditedCCFader[side], COLOR_GREEN, cellOn);
unsigned short cc = Split[side].ccForFader[currentEditedCCFader[side]];
if (cc == 128) {
condfont_draw_string(0, 0, "CHPRS", Split[side].colorMain, false);
paintShowSplitSelection(side);
}
else {
paintSplitNumericDataDisplay(side, cc, 0, false);
}
}
void paintPlayedTouchModeDisplay(byte side) {
clearDisplay();
switch(Split[side].playedTouchMode) {
case playedCell:
adaptfont_draw_string(0, 0, "CELL", Split[side].colorMain, true);
break;
case playedSame:
adaptfont_draw_string(0, 0, LINNMODEL == 200 ? "SAME" : "SAM", Split[side].colorMain, true);
break;
case playedCrosses:
adaptfont_draw_string(0, 0, "CROS", Split[side].colorMain, true);
break;
case playedCircles:
adaptfont_draw_string(0, 0, "CIRC", Split[side].colorMain, true);
break;
case playedSquares:
adaptfont_draw_string(0, 0, "SQUA", Split[side].colorMain, true);
break;
case playedDiamonds:
adaptfont_draw_string(0, 0, LINNMODEL == 200 ? "DIAM" : "DIA", Split[side].colorMain, true);
break;
case playedStars:
adaptfont_draw_string(0, 0, "STAR", Split[side].colorMain, true);
break;
case playedSparkles:
adaptfont_draw_string(0, 0, "SPAR", Split[side].colorMain, true);
break;
case playedCurtains:
adaptfont_draw_string(0, 0, "CURT", Split[side].colorMain, true);
break;
case playedBlinds:
adaptfont_draw_string(0, 0, "BLIN", Split[side].colorMain, true);