-
Notifications
You must be signed in to change notification settings - Fork 82
/
ls_extstorage.ino
2134 lines (1961 loc) · 111 KB
/
ls_extstorage.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_extstorage: LinnStrument Settings *******************************
Copyright 2023 Roger Linn Design (https://www.rogerlinndesign.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
***************************************************************************************************
Functions to exchange settings with an external device over a serial handshake protocol.
This is essentially used by the upgrade tool to temporarily store the previous settings while doing
an upgrade and sending them back after the upgrade is finished.
The new firmware is then responsible of applying the received settings and possibly performing
some transformation logic is the settings structure changed for the new firmware.
**************************************************************************************************/
/**************************************** Configuration V1 ****************************************
This is used by firmware v1.0.9 and earlier
**************************************************************************************************/
struct CalibrationYV1 {
int minY;
int maxY;
int32_t fxdRatio;
};
struct GlobalSettingsV1 {
byte version; // to prepare for versioning
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
boolean mainNotes[12]; // determines which notes receive "main" lights
boolean accentNotes[12]; // determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
byte midiIO; // 0 = MIDI jacks, 1 = USB
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationYV1 calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean promoAnimationAtStartup; // store whether the promo animation should run at startup
};
struct SplitSettingsV1 {
byte midiMode; // 0 = one channel, 1 = note per channel, 2 = row per channel
byte midiChanMain; // main midi channel, 1 to 16
byte midiChanPerRow; // per-row midi channel, 1 to 16
boolean midiChanSet[16]; // Indicates whether each channel is used. If midiMode!=channelPerNote, only one channel can be set.
byte bendRange; // 1 - 96
boolean sendX; // true to send continuous X, false if not
boolean sendY; // true to send continuous Y, false if not
boolean sendZ; // true to send continuous Z, false if not
boolean pitchCorrectQuantize; // true to quantize pitch of initial touch, false if not
boolean pitchCorrectHold; // true to quantize pitch when note is held, false if not
boolean pitchResetOnRelease; // true to enable pitch bend being set back to 0 when releasing a touch
unsigned short ccForY; // 0-127
boolean relativeY; // true when Y should be sent relative to the initial touch, false when it's absolute
LoudnessExpression expressionForZ; // the expression that should be used for loudness
unsigned short ccForZ; // 0-127
byte colorMain; // color for non-accented cells
byte colorAccent; // color for accented cells
byte colorPlayed; // color for played notes
byte colorLowRow; // color for low row if on
byte lowRowMode; // see LowRowMode values
unsigned short preset; // preset number 0-127
signed char transposeOctave; // -60, -48, -36, -24, -12, 0, +12, +24, +36, +48, +60
signed char transposePitch; // transpose output midi notes. Range is -12 to +12
signed char transposeLights; // transpose lights on display. Range is -12 to +12
boolean ccFaders; // true to activated 8 CC faders for this split, false for regular music performance
boolean arpeggiator; // true when the arpeggiator is on, false if notes should be played directly
boolean strum; // true when this split strums the touches of the other split
};
struct ConfigurationV1 {
GlobalSettingsV1 global;
SplitSettingsV1 left;
SplitSettingsV1 right;
};
/**************************************** Configuration V2 ****************************************
This is used by firmware v1.1.0
**************************************************************************************************/
struct GlobalSettingsV2 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
boolean mainNotes[12]; // determines which notes receive "main" lights
boolean accentNotes[12]; // determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
};
struct SplitSettingsV2 {
byte midiMode; // 0 = one channel, 1 = note per channel, 2 = row per channel
byte midiChanMain; // main midi channel, 1 to 16
byte midiChanPerRow; // per-row midi channel, 1 to 16
boolean midiChanSet[16]; // Indicates whether each channel is used. If midiMode!=channelPerNote, only one channel can be set.
byte bendRange; // 1 - 96
boolean sendX; // true to send continuous X, false if not
boolean sendY; // true to send continuous Y, false if not
boolean sendZ; // true to send continuous Z, false if not
boolean pitchCorrectQuantize; // true to quantize pitch of initial touch, false if not
byte pitchCorrectHold; // See PitchCorrectHoldSpeed values
boolean pitchResetOnRelease; // true to enable pitch bend being set back to 0 when releasing a touch
TimbreExpression expressionForY; // the expression that should be used for timbre
unsigned short ccForY; // 0-129 (with 128 and 129 being placeholders for PolyPressure and ChannelPressure)
boolean relativeY; // true when Y should be sent relative to the initial touch, false when it's absolute
LoudnessExpression expressionForZ; // the expression that should be used for loudness
unsigned short ccForZ; // 0-127
byte colorMain; // color for non-accented cells
byte colorAccent; // color for accented cells
byte colorPlayed; // color for played notes
byte colorLowRow; // color for low row if on
byte lowRowMode; // see LowRowMode values
signed char transposeOctave; // -60, -48, -36, -24, -12, 0, +12, +24, +36, +48, +60
signed char transposePitch; // transpose output midi notes. Range is -12 to +12
signed char transposeLights; // transpose lights on display. Range is -12 to +12
boolean ccFaders; // true to activated 8 CC faders for this split, false for regular music performance
boolean arpeggiator; // true when the arpeggiator is on, false if notes should be played directly
boolean strum; // true when this split strums the touches of the other split
};
struct PresetSettingsV2 {
GlobalSettingsV2 global;
SplitSettingsV2 split[NUMSPLITS];
};
struct DeviceSettingsV2 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationYV1 calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean promoAnimationAtStartup; // store whether the promo animation should run at startup
byte currentPreset; // the currently active settings preset
};
struct ConfigurationV2 {
DeviceSettingsV2 device;
PresetSettingsV2 preset[4];
};
/**************************************** Configuration V3 ****************************************
This is used by firmware v1.1.1-beta1, v1.1.1-beta2 and v1.1.1-beta3
**************************************************************************************************/
struct GlobalSettingsV3 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
boolean mainNotes[12]; // determines which notes receive "main" lights
boolean accentNotes[12]; // determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
};
struct DeviceSettingsV3 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationYV1 calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean promoAnimationAtStartup; // store whether the promo animation should run at startup
byte currentPreset; // the currently active settings preset
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
};
struct PresetSettingsV3 {
GlobalSettingsV3 global;
SplitSettingsV2 split[NUMSPLITS];
};
struct ConfigurationV3 {
DeviceSettingsV3 device;
PresetSettingsV3 preset[4];
};
/**************************************** Configuration V4 ****************************************
This is used by firmware v1.1.1-beta4, v1.1.2-beta1, v1.1.2 and v1.2.0-alpha1
**************************************************************************************************/
struct DeviceSettingsV4 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationYV1 calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean promoAnimationAtStartup; // store whether the promo animation should run at startup
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
};
struct ConfigurationV4 {
DeviceSettingsV4 device;
PresetSettingsV3 settings;
PresetSettingsV3 preset[4];
};
/**************************************** Configuration V5 ****************************************
This is used by firmware v1.2.0-beta1, v1.2.0-beta2 and v1.2.0
**************************************************************************************************/
struct GlobalSettingsV4 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
boolean mainNotes[12]; // determines which notes receive "main" lights
boolean accentNotes[12]; // determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
unsigned short ccForSwitch; // 0-127
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
};
struct SplitSettingsV3 {
byte midiMode; // 0 = one channel, 1 = note per channel, 2 = row per channel
byte midiChanMain; // main midi channel, 1 to 16
byte midiChanPerRow; // per-row midi channel, 1 to 16
boolean midiChanSet[16]; // Indicates whether each channel is used. If midiMode!=channelPerNote, only one channel can be set.
BendRangeOption bendRangeOption; // see BendRangeOption
byte customBendRange; // 1 - 96
boolean sendX; // true to send continuous X, false if not
boolean sendY; // true to send continuous Y, false if not
boolean sendZ; // true to send continuous Z, false if not
boolean pitchCorrectQuantize; // true to quantize pitch of initial touch, false if not
byte pitchCorrectHold; // See PitchCorrectHoldSpeed values
boolean pitchResetOnRelease; // true to enable pitch bend being set back to 0 when releasing a touch
TimbreExpression expressionForY; // the expression that should be used for timbre
unsigned short customCCForY; // 0-129 (with 128 and 129 being placeholders for PolyPressure and ChannelPressure)
boolean relativeY; // true when Y should be sent relative to the initial touch, false when it's absolute
LoudnessExpression expressionForZ; // the expression that should be used for loudness
unsigned short customCCForZ; // 0-127
unsigned short ccForFader[8]; // each fader can control a CC number ranging from 0-127
byte colorMain; // color for non-accented cells
byte colorAccent; // color for accented cells
byte colorPlayed; // color for played notes
byte colorLowRow; // color for low row if on
byte lowRowMode; // see LowRowMode values
byte lowRowCCXBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRow; // 0-127
byte lowRowCCXYZBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRowX; // 0-127
unsigned short ccForLowRowY; // 0-127
unsigned short ccForLowRowZ; // 0-127
signed char transposeOctave; // -60, -48, -36, -24, -12, 0, +12, +24, +36, +48, +60
signed char transposePitch; // transpose output midi notes. Range is -12 to +12
signed char transposeLights; // transpose lights on display. Range is -12 to +12
boolean ccFaders; // true to activated 8 CC faders for this split, false for regular music performance
boolean arpeggiator; // true when the arpeggiator is on, false if notes should be played directly
boolean strum; // true when this split strums the touches of the other split
boolean mpe; // true when MPE is active for this split
};
struct PresetSettingsV4 {
GlobalSettingsV4 global;
SplitSettingsV3 split[NUMSPLITS];
};
struct ConfigurationV5 {
DeviceSettingsV4 device;
PresetSettingsV4 settings;
PresetSettingsV4 preset[4];
};
/**************************************** Configuration V6 ****************************************
This is used by firmware v1.2.1 and v1.2.2
**************************************************************************************************/
struct GlobalSettingsV5 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
byte activeNotes; // controls which collection of note lights presets is active
int mainNotes[12]; // bitmask array that determines which notes receive "main" lights
int accentNotes[12]; // bitmask array that determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
unsigned short minForVelocity; // 0-127
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
unsigned short ccForSwitch; // 0-127
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
SustainBehavior sustainBehavior; // the way the sustain pedal influences the notes
};
struct SplitSettingsV4 {
byte midiMode; // 0 = one channel, 1 = note per channel, 2 = row per channel
byte midiChanMain; // main midi channel, 1 to 16
byte midiChanPerRow; // per-row midi channel, 1 to 16
boolean midiChanSet[16]; // Indicates whether each channel is used. If midiMode!=channelPerNote, only one channel can be set.
BendRangeOption bendRangeOption; // see BendRangeOption
byte customBendRange; // 1 - 96
boolean sendX; // true to send continuous X, false if not
boolean sendY; // true to send continuous Y, false if not
boolean sendZ; // true to send continuous Z, false if not
boolean pitchCorrectQuantize; // true to quantize pitch of initial touch, false if not
byte pitchCorrectHold; // See PitchCorrectHoldSpeed values
boolean pitchResetOnRelease; // true to enable pitch bend being set back to 0 when releasing a touch
TimbreExpression expressionForY; // the expression that should be used for timbre
unsigned short customCCForY; // 0-129 (with 128 and 129 being placeholders for PolyPressure and ChannelPressure)
unsigned short minForY; // 0-127
unsigned short maxForY; // 0-127
boolean relativeY; // true when Y should be sent relative to the initial touch, false when it's absolute
LoudnessExpression expressionForZ; // the expression that should be used for loudness
unsigned short customCCForZ; // 0-127
unsigned short minForZ; // 0-127
unsigned short maxForZ; // 0-127
unsigned short ccForFader[8]; // each fader can control a CC number ranging from 0-127
byte colorMain; // color for non-accented cells
byte colorAccent; // color for accented cells
byte colorNoteon; // color for played notes
byte colorLowRow; // color for low row if on
byte lowRowMode; // see LowRowMode values
byte lowRowCCXBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRow; // 0-127
byte lowRowCCXYZBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRowX; // 0-127
unsigned short ccForLowRowY; // 0-127
unsigned short ccForLowRowZ; // 0-127
signed char transposeOctave; // -60, -48, -36, -24, -12, 0, +12, +24, +36, +48, +60
signed char transposePitch; // transpose output midi notes. Range is -12 to +12
signed char transposeLights; // transpose lights on display. Range is -12 to +12
boolean ccFaders; // true to activated 8 CC faders for this split, false for regular music performance
boolean arpeggiator; // true when the arpeggiator is on, false if notes should be played directly
boolean strum; // true when this split strums the touches of the other split
boolean mpe; // true when MPE is active for this split
};
struct PresetSettingsV5 {
GlobalSettingsV5 global;
SplitSettingsV4 split[NUMSPLITS];
};
struct ConfigurationV6 {
DeviceSettingsV4 device;
PresetSettingsV5 settings;
PresetSettingsV5 preset[4];
};
/**************************************** Configuration V7 ****************************************
This is used by firmware v1.2.3-beta1, v1.2.3-beta2, v1.2.3-beta3, v1.2.3 and v1.2.4-beta1
**************************************************************************************************/
struct DeviceSettingsV5 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationYV1 calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean promoAnimation; // store whether the promo animation should run after five minutes of not touching
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
};
struct GlobalSettingsV6 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
byte activeNotes; // controls which collection of note lights presets is active
int mainNotes[12]; // bitmask array that determines which notes receive "main" lights
int accentNotes[12]; // bitmask array that determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
unsigned short minForVelocity; // 1-127
unsigned short maxForVelocity; // 1-127
unsigned short valueForFixedVelocity; // 1-127
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
unsigned short ccForSwitch; // 0-127
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
SustainBehavior sustainBehavior; // the way the sustain pedal influences the notes
};
struct PresetSettingsV6 {
GlobalSettingsV6 global;
SplitSettingsV4 split[NUMSPLITS];
};
struct ConfigurationV7 {
DeviceSettingsV5 device;
PresetSettingsV6 settings;
PresetSettingsV6 preset[4];
};
/**************************************** Configuration V8 ****************************************
This is used by firmware v1.2.4-beta2 and v1.2.5
**************************************************************************************************/
struct DeviceSettingsV6 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationYV1 calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether the promo animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
boolean sleepAnimation; // store whether the promo animation should run during sleep mode
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
};
struct GlobalSettingsV7 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
byte activeNotes; // controls which collection of note lights presets is active
int mainNotes[12]; // bitmask array that determines which notes receive "main" lights
int accentNotes[12]; // bitmask array that determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
byte customRowOffset; // the custom row offset that can be configured at the location of the octave setting
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
unsigned short minForVelocity; // 1-127
unsigned short maxForVelocity; // 1-127
unsigned short valueForFixedVelocity; // 1-127
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
unsigned short ccForSwitch; // 0-127
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
SustainBehavior sustainBehavior; // the way the sustain pedal influences the notes
};
struct PresetSettingsV7 {
GlobalSettingsV7 global;
SplitSettingsV4 split[NUMSPLITS];
};
struct ConfigurationV8 {
DeviceSettingsV6 device;
PresetSettingsV7 settings;
PresetSettingsV7 preset[4];
};
/**************************************** Configuration V9 ****************************************
This is used by firmware v2.0.0-beta1 and v2.0.0-beta2
**************************************************************************************************/
struct DeviceSettingsV7 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationY calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether the promo animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
boolean sleepAnimation; // store whether the promo animation should run during sleep mode
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
boolean midiThrough; // false if incoming MIDI should be isolated, true if it should be passed through to the outgoing MIDI port
};
struct SplitSettingsV5 {
byte midiMode; // 0 = one channel, 1 = note per channel, 2 = row per channel
byte midiChanMain; // main midi channel, 1 to 16
byte midiChanPerRow; // per-row midi channel, 1 to 16
boolean midiChanSet[16]; // Indicates whether each channel is used. If midiMode!=channelPerNote, only one channel can be set.
BendRangeOption bendRangeOption; // see BendRangeOption
byte customBendRange; // 1 - 96
boolean sendX; // true to send continuous X, false if not
boolean sendY; // true to send continuous Y, false if not
boolean sendZ; // true to send continuous Z, false if not
boolean pitchCorrectQuantize; // true to quantize pitch of initial touch, false if not
byte pitchCorrectHold; // See PitchCorrectHoldSpeed values
boolean pitchResetOnRelease; // true to enable pitch bend being set back to 0 when releasing a touch
TimbreExpression expressionForY; // the expression that should be used for timbre
unsigned short customCCForY; // 0-129 (with 128 and 129 being placeholders for PolyPressure and ChannelPressure)
unsigned short minForY; // 0-127
unsigned short maxForY; // 0-127
boolean relativeY; // true when Y should be sent relative to the initial touch, false when it's absolute
LoudnessExpression expressionForZ; // the expression that should be used for loudness
unsigned short customCCForZ; // 0-127
unsigned short minForZ; // 0-127
unsigned short maxForZ; // 0-127
boolean ccForZ14Bit; // true when 14-bit messages should be sent when Z CC is between 0-31, false when only 7-bit messages should be sent
unsigned short ccForFader[8]; // each fader can control a CC number ranging from 0-127
byte colorMain; // color for non-accented cells
byte colorAccent; // color for accented cells
byte colorPlayed; // color for played notes
byte colorLowRow; // color for low row if on
byte colorSequencerEmpty; // color for sequencer low row step with no events
byte colorSequencerEvent; // color for sequencer low row step with events
byte colorSequencerDisabled; // color for sequencer low row step that's not being played
byte lowRowMode; // see LowRowMode values
byte lowRowCCXBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRow; // 0-127
byte lowRowCCXYZBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRowX; // 0-127
unsigned short ccForLowRowY; // 0-127
unsigned short ccForLowRowZ; // 0-127
signed char transposeOctave; // -60, -48, -36, -24, -12, 0, +12, +24, +36, +48, +60
signed char transposePitch; // transpose output midi notes. Range is -12 to +12
signed char transposeLights; // transpose lights on display. Range is -12 to +12
boolean ccFaders; // true to activated 8 CC faders for this split, false for regular music performance
boolean arpeggiator; // true when the arpeggiator is on, false if notes should be played directly
boolean strum; // true when this split strums the touches of the other split
boolean mpe; // true when MPE is active for this split
boolean sequencer; // true when the sequencer of this split is displayed
SequencerView sequencerView; // see SequencerView
};
struct PresetSettingsV8 {
GlobalSettingsV7 global;
SplitSettingsV5 split[NUMSPLITS];
};
struct ConfigurationV9 {
DeviceSettingsV7 device;
PresetSettingsV8 settings;
PresetSettingsV8 preset[4];
SequencerProject project;
};
/**************************************** Configuration V10 ****************************************
This is used by firmware v2.0.0 and v2.0.1
**************************************************************************************************/
struct DeviceSettingsV8 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationY calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether the promo animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
boolean sleepAnimation; // store whether the promo animation should run during sleep mode
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
boolean midiThrough; // false if incoming MIDI should be isolated, true if it should be passed through to the outgoing MIDI port
short lastLoadedPreset; // the last settings preset that was loaded
short lastLoadedProject; // the last sequencer project that was loaded
};
struct ConfigurationV10 {
DeviceSettingsV8 device;
PresetSettingsV8 settings;
PresetSettingsV8 preset[4];
SequencerProject project;
};
/**************************************** Configuration V11 ****************************************
This is used by firmware v2.0.2
**************************************************************************************************/
struct DeviceSettingsV9 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationY calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
byte sensorSensitivityZ; // the scaling factor of the raw value of Z in percentage
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether an animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
byte sleepAnimationType; // the animation type to use during sleep, see SleepAnimationType
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
boolean midiThrough; // false if incoming MIDI should be isolated, true if it should be passed through to the outgoing MIDI port
short lastLoadedPreset; // the last settings preset that was loaded
short lastLoadedProject; // the last sequencer project that was loaded
boolean splitActive; // false = split off, true = split on
};
struct ConfigurationV11 {
DeviceSettingsV9 device;
PresetSettingsV8 settings;
PresetSettingsV8 preset[4];
SequencerProject project;
};
/**************************************** Configuration V12 ****************************************
This is used by firmware v2.0.3-beta1
**************************************************************************************************/
struct DeviceSettingsV10 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationY calCols[9][MAXROWS]; // store nine columns of calibration data
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
byte sensorSensitivityZ; // the scaling factor of the raw value of Z in percentage
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether an animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
byte sleepAnimationType; // the animation type to use during sleep, see SleepAnimationType
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean leftHanded; // whether to orient the X axis from right to left instead of from left to right
boolean midiThrough; // false if incoming MIDI should be isolated, true if it should be passed through to the outgoing MIDI port
short lastLoadedPreset; // the last settings preset that was loaded
short lastLoadedProject; // the last sequencer project that was loaded
};
struct GlobalSettingsV8 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
byte activeNotes; // controls which collection of note lights presets is active
int mainNotes[12]; // bitmask array that determines which notes receive "main" lights
int accentNotes[12]; // bitmask array that determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
byte customRowOffset; // the custom row offset that can be configured at the location of the octave setting
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
unsigned short minForVelocity; // 1-127
unsigned short maxForVelocity; // 1-127
unsigned short valueForFixedVelocity; // 1-127
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
unsigned short ccForSwitch; // 0-127
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
SustainBehavior sustainBehavior; // the way the sustain pedal influences the notes
boolean splitActive; // false = split off, true = split on
};
struct PresetSettingsV9 {
GlobalSettingsV8 global;
SplitSettingsV5 split[NUMSPLITS];
};
struct ConfigurationV12 {
DeviceSettingsV10 device;
PresetSettingsV9 settings;
PresetSettingsV9 preset[4];
SequencerProject project;
};
/**************************************** Configuration V13 ****************************************
This is used by firmware v2.1.0-beta2 and firmware v2.1.0-beta3
**************************************************************************************************/
struct DeviceSettingsV11 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationY calCols[9][MAXROWS]; // store nine columns of calibration data
uint32_t calCrc; // the CRC check value of the calibration data to see if it's still valid
boolean calCrcCalculated; // indicates whether the CRC of the calibration was calculated, previous firmware versions didn't
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
byte sensorSensitivityZ; // the scaling factor of the raw value of Z in percentage
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether an animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
byte sleepAnimationType; // the animation type to use during sleep, see SleepAnimationType
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean otherHanded; // whether change the handedness of the splits
byte splitHandedness; // see SplitHandednessType
boolean midiThrough; // false if incoming MIDI should be isolated, true if it should be passed through to the outgoing MIDI port
short lastLoadedPreset; // the last settings preset that was loaded
short lastLoadedProject; // the last sequencer project that was loaded
};
struct GlobalSettingsV9 {
void setSwitchAssignment(byte, byte);
byte splitPoint; // leftmost column number of right split (0 = leftmost column of playable area)
byte currentPerSplit; // controls which split's settings are being displayed
byte activeNotes; // controls which collection of note lights presets is active
int mainNotes[12]; // bitmask array that determines which notes receive "main" lights
int accentNotes[12]; // bitmask array that determines which notes receive accent lights (octaves, white keys, black keys, etc.)
byte rowOffset; // interval between rows. 0 = no overlap, 1-12 = interval, 13 = guitar
signed char customRowOffset; // the custom row offset that can be configured at the location of the octave setting
VelocitySensitivity velocitySensitivity; // See VelocitySensitivity values
unsigned short minForVelocity; // 1-127
unsigned short maxForVelocity; // 1-127
unsigned short valueForFixedVelocity; // 1-127
PressureSensitivity pressureSensitivity; // See PressureSensitivity values
boolean pressureAftertouch; // Indicates whether pressure should behave like traditional piano keyboard aftertouch or be continuous from the start
byte switchAssignment[4]; // The element values are ASSIGNED_*. The index values are SWITCH_*.
boolean switchBothSplits[4]; // Indicate whether the switches should operate on both splits or only on the focused one
unsigned short ccForSwitchCC65[4]; // 0-127
unsigned short ccForSwitchSustain[4]; // 0-127
unsigned short customSwitchAssignment[4]; // ASSIGNED_TAP_TEMPO, ASSIGNED_LEGATO, ASSIGNED_LATCH, ASSIGNED_PRESET_UP, ASSIGNED_PRESET_DOWN, ASSIGNED_REVERSE_PITCH_X, ASSIGNED_SEQUENCER_PLAY, ASSIGNED_SEQUENCER_PREV or ASSIGNED_SEQUENCER_NEXT
byte midiIO; // 0 = MIDI jacks, 1 = USB
ArpeggiatorDirection arpDirection; // the arpeggiator direction that has to be used for the note sequence
ArpeggiatorStepTempo arpTempo; // the multiplier that needs to be applied to the current tempo to achieve the arpeggiator's step duration
signed char arpOctave; // the number of octaves that the arpeggiator has to operate over: 0, +1, or +2
SustainBehavior sustainBehavior; // the way the sustain pedal influences the notes
boolean splitActive; // false = split off, true = split on
};
struct SplitSettingsV6 {
byte midiMode; // 0 = one channel, 1 = note per channel, 2 = row per channel
byte midiChanMain; // main midi channel, 1 to 16
byte midiChanPerRow; // per-row midi channel, 1 to 16
boolean midiChanPerRowReversed; // indicates whether channel per row channels count upwards or downwards across the rows
boolean midiChanSet[16]; // Indicates whether each channel is used. If midiMode!=channelPerNote, only one channel can be set.
BendRangeOption bendRangeOption; // see BendRangeOption
byte customBendRange; // 1 - 96
boolean sendX; // true to send continuous X, false if not
boolean sendY; // true to send continuous Y, false if not
boolean sendZ; // true to send continuous Z, false if not
boolean pitchCorrectQuantize; // true to quantize pitch of initial touch, false if not
byte pitchCorrectHold; // See PitchCorrectHoldSpeed values
boolean pitchResetOnRelease; // true to enable pitch bend being set back to 0 when releasing a touch
TimbreExpression expressionForY; // the expression that should be used for timbre
unsigned short customCCForY; // 0-129 (with 128 and 129 being placeholders for PolyPressure and ChannelPressure)
unsigned short minForY; // 0-127
unsigned short maxForY; // 0-127
boolean relativeY; // true when Y should be sent relative to the initial touch, false when it's absolute
unsigned short initialRelativeY; // 0-127
LoudnessExpression expressionForZ; // the expression that should be used for loudness
unsigned short customCCForZ; // 0-127
unsigned short minForZ; // 0-127
unsigned short maxForZ; // 0-127
boolean ccForZ14Bit; // true when 14-bit messages should be sent when Z CC is between 0-31, false when only 7-bit messages should be sent
unsigned short ccForFader[8]; // each fader can control a CC number ranging from 0-128 (with 128 being placeholder for ChannelPressure)
byte colorMain; // color for non-accented cells
byte colorAccent; // color for accented cells
byte colorPlayed; // color for played notes
byte colorLowRow; // color for low row if on
byte colorSequencerEmpty; // color for sequencer low row step with no events
byte colorSequencerEvent; // color for sequencer low row step with events
byte colorSequencerDisabled; // color for sequencer low row step that's not being played
byte playedTouchMode; // see PlayedTouchMode values
byte lowRowMode; // see LowRowMode values
byte lowRowCCXBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRow; // 0-128 (with 128 being placeholder for ChannelPressure)
byte lowRowCCXYZBehavior; // see LowRowCCBehavior values
unsigned short ccForLowRowX; // 0-128 (with 128 being placeholder for ChannelPressure)
unsigned short ccForLowRowY; // 0-128 (with 128 being placeholder for ChannelPressure)
unsigned short ccForLowRowZ; // 0-128 (with 128 being placeholder for ChannelPressure)
signed char transposeOctave; // -60, -48, -36, -24, -12, 0, +12, +24, +36, +48, +60
signed char transposePitch; // transpose output midi notes. Range is -12 to +12
signed char transposeLights; // transpose lights on display. Range is -12 to +12
boolean ccFaders; // true to activated 8 CC faders for this split, false for regular music performance
boolean arpeggiator; // true when the arpeggiator is on, false if notes should be played directly
boolean strum; // true when this split strums the touches of the other split
boolean mpe; // true when MPE is active for this split
boolean sequencer; // true when the sequencer of this split is displayed
SequencerView sequencerView; // see SequencerView
};
struct PresetSettingsV10 {
GlobalSettingsV9 global;
SplitSettingsV6 split[NUMSPLITS];
};
struct ConfigurationV13 {
DeviceSettingsV11 device;
PresetSettingsV10 settings;
PresetSettingsV10 preset[4];
SequencerProject project;
};
/**************************************** Configuration V14 ****************************************
This is used by firmware v2.1.0
**************************************************************************************************/
struct DeviceSettingsV12 {
byte version; // the version of the configuration format
boolean serialMode; // 0 = normal MIDI I/O, 1 = Arduino serial mode for OS update and serial monitor
CalibrationX calRows[MAXCOLS+1][4]; // store four rows of calibration data
CalibrationY calCols[9][MAXROWS]; // store nine columns of calibration data
uint32_t calCrc; // the CRC check value of the calibration data to see if it's still valid
boolean calCrcCalculated; // indicates whether the CRC of the calibration was calculated, previous firmware versions didn't
boolean calibrated; // indicates whether the calibration data actually resulted from a calibration operation
boolean calibrationHealed; // indicates whether the calibration data was healed
unsigned short minUSBMIDIInterval; // the minimum delay between MIDI bytes when sent over USB
byte sensorSensitivityZ; // the scaling factor of the raw value of Z in percentage
unsigned short sensorLoZ; // the lowest acceptable raw Z value to start a touch
unsigned short sensorFeatherZ; // the lowest acceptable raw Z value to continue a touch
unsigned short sensorRangeZ; // the maximum raw value of Z
boolean sleepAnimationActive; // store whether an animation was active last
boolean sleepActive; // store whether LinnStrument should go to sleep automatically
byte sleepDelay; // the number of minutes it takes for sleep to kick in
byte sleepAnimationType; // the animation type to use during sleep, see SleepAnimationType
char audienceMessages[16][31]; // the 16 audience messages that will scroll across the surface
boolean operatingLowPower; // whether low power mode is active or not
boolean otherHanded; // whether change the handedness of the splits
byte splitHandedness; // see SplitHandednessType
boolean midiThrough; // false if incoming MIDI should be isolated, true if it should be passed through to the outgoing MIDI port
short lastLoadedPreset; // the last settings preset that was loaded
short lastLoadedProject; // the last sequencer project that was loaded
};
struct ConfigurationV14 {
DeviceSettingsV12 device;
PresetSettingsV10 settings;
PresetSettingsV10 preset[4];
SequencerProject project;
};
/**************************************** Configuration V15 ****************************************
This is used by firmware v2.2.0, v2.2.1, v2.2.2
**************************************************************************************************/
struct ConfigurationV15 {
DeviceSettingsV12 device;
PresetSettings settings;
PresetSettings preset[6];
SequencerProject project;
};
/*************************************************************************************************/
boolean upgradeConfigurationSettings(int32_t confSize, byte* buff2) {
boolean result = false;
byte settingsVersion = buff2[0];
// if the stored version is newer than what this firmware supports, resort to default settings
if (settingsVersion > Device.version) {
result = false;
}
else {
void* sourceConfig = buff2;
void (*copyConfigurationFunction)(void* target, void* source) = NULL;
switch (settingsVersion) {
// if this is v1 of the configuration format, load it in the old structure and then convert it if the size is right
case 1:
if (confSize == sizeof(ConfigurationV1)) {
copyConfigurationFunction = ©ConfigurationV1;
}
break;
// this is the v2 of the configuration configuration, apply it if the size is right
case 2:
if (confSize == sizeof(ConfigurationV2)) {
copyConfigurationFunction = ©ConfigurationV2;
}
break;
// this is the v3 of the configuration configuration, apply it if the size is right
case 3:
if (confSize == sizeof(ConfigurationV3)) {
copyConfigurationFunction = ©ConfigurationV3;
}
break;
// this is the v4 of the configuration configuration, apply it if the size is right
case 4:
if (confSize == sizeof(ConfigurationV4)) {
copyConfigurationFunction = ©ConfigurationV4;
}
break;
// this is the v5 of the configuration configuration, apply it if the size is right
case 5:
if (confSize == sizeof(ConfigurationV5)) {
copyConfigurationFunction = ©ConfigurationV5;
}
break;
// this is the v6 of the configuration configuration, apply it if the size is right
case 6:
if (confSize == sizeof(ConfigurationV6)) {
copyConfigurationFunction = ©ConfigurationV6;
}
break;
// this is the v7 of the configuration configuration, apply it if the size is right
case 7:
if (confSize == sizeof(ConfigurationV7)) {
copyConfigurationFunction = ©ConfigurationV7;
}
break;
// this is the v8 of the configuration configuration, apply it if the size is right
case 8:
if (confSize == sizeof(ConfigurationV8)) {
copyConfigurationFunction = ©ConfigurationV8;
}
break;
// this is the v9 of the configuration configuration, apply it if the size is right
case 9:
if (confSize == sizeof(ConfigurationV9)) {
copyConfigurationFunction = ©ConfigurationV9;
}
break;
// this is the v10 of the configuration configuration, apply it if the size is right
case 10:
if (confSize == sizeof(ConfigurationV10)) {
copyConfigurationFunction = ©ConfigurationV10;
}
break;
// this is the v11 of the configuration configuration, apply it if the size is right
case 11:
if (confSize == sizeof(ConfigurationV11)) {
copyConfigurationFunction = ©ConfigurationV11;
}
break;
// this is the v12 of the configuration configuration, apply it if the size is right
case 12:
if (confSize == sizeof(ConfigurationV12)) {
copyConfigurationFunction = ©ConfigurationV12;
}
break;
// this is the v13 of the configuration configuration, apply it if the size is right
case 13:
if (confSize == sizeof(ConfigurationV13)) {
copyConfigurationFunction = ©ConfigurationV13;
}
break;
// this is the v14 of the configuration configuration, apply it if the size is right
case 14:
if (confSize == sizeof(ConfigurationV14)) {
copyConfigurationFunction = ©ConfigurationV14;
}
break;
// this is the v15 of the configuration configuration, apply it if the size is right
case 15:
if (confSize == sizeof(ConfigurationV15)) {
copyConfigurationFunction = ©ConfigurationV15;
}
break;
// this is the v16 of the configuration configuration, apply it if the size is right
case 16:
if (confSize == sizeof(Configuration)) {
memcpy(&config, buff2, confSize);
result = true;
}
break;
default:
result = false;
break;
}
// if a target config and a copy settings fuction were set, use them to transform the old settings into the new
if (sourceConfig && copyConfigurationFunction) {
byte currentVersion = Device.version;
copyConfigurationFunction(&config, sourceConfig);
Device.version = currentVersion;
result = true;
}
}
return result;
}
void copyCalibrationV1(CalibrationX (*calRowsTarget)[MAXCOLS+1][4], CalibrationX (*calRowsSource)[MAXCOLS+1][4], CalibrationY (*calColsTarget)[9][MAXROWS], CalibrationYV1 (*calColsSource)[9][MAXROWS]) {
for (int i = 0; i < MAXCOLS+1; ++i) {
for (int j = 0; j < 4; ++j) {
(*calRowsTarget)[i][j].fxdMeasuredX = (*calRowsSource)[i][j].fxdMeasuredX;
(*calRowsTarget)[i][j].fxdReferenceX = (*calRowsSource)[i][j].fxdReferenceX;
(*calRowsTarget)[i][j].fxdRatio = (*calRowsSource)[i][j].fxdRatio;
}
}
for (int i = 0; i < 9; ++i) {
for (int j = 0; j < MAXROWS; ++j) {
(*calColsTarget)[i][j].minY = min(max((*calColsSource)[i][j].minY, 0), 4095);
(*calColsTarget)[i][j].maxY = min(max((*calColsSource)[i][j].maxY, 0), 4095);
(*calColsTarget)[i][j].fxdRatio = (*calColsSource)[i][j].fxdRatio;
}
}
}
void copyCalibrationV2(CalibrationX (*calRowsTarget)[MAXCOLS+1][4], CalibrationX (*calRowsSource)[MAXCOLS+1][4], CalibrationY (*calColsTarget)[9][MAXROWS], CalibrationY (*calColsSource)[9][MAXROWS]) {
for (int i = 0; i < MAXCOLS+1; ++i) {
for (int j = 0; j < 4; ++j) {
(*calRowsTarget)[i][j].fxdMeasuredX = (*calRowsSource)[i][j].fxdMeasuredX;
(*calRowsTarget)[i][j].fxdReferenceX = (*calRowsSource)[i][j].fxdReferenceX;
(*calRowsTarget)[i][j].fxdRatio = (*calRowsSource)[i][j].fxdRatio;
}
}
for (int i = 0; i < 9; ++i) {
for (int j = 0; j < MAXROWS; ++j) {
(*calColsTarget)[i][j].minY = min(max((*calColsSource)[i][j].minY, 0), 4095);
(*calColsTarget)[i][j].maxY = min(max((*calColsSource)[i][j].maxY, 0), 4095);
(*calColsTarget)[i][j].fxdRatio = (*calColsSource)[i][j].fxdRatio;
}
}