forked from GrandOrgue/grandorgue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGOSetter.cpp
1237 lines (1089 loc) · 41.9 KB
/
GOSetter.cpp
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
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
#include "GOSetter.h"
#include <wx/app.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/intl.h>
#include <wx/window.h>
#include <yaml-cpp/yaml.h>
#include "config/GOConfig.h"
#include "config/GOConfigReader.h"
#include "config/GOConfigWriter.h"
#include "control/GOCallbackButtonControl.h"
#include "control/GODivisionalButtonControl.h"
#include "control/GOGeneralButtonControl.h"
#include "model/GODivisionalCoupler.h"
#include "model/GOManual.h"
#include "yaml/go-wx-yaml.h"
#include "GOEvent.h"
#include "GOOrganController.h"
#include "go_ids.h"
#define FRAME_GENERALS 1000
#define GENERAL_BANKS 20
#define GENERALS 50
#define CRESCENDO_STEPS 32
enum {
ID_SETTER_PREV = 0,
ID_SETTER_NEXT,
ID_SETTER_SET,
ID_SETTER_M1,
ID_SETTER_M10,
ID_SETTER_M100,
ID_SETTER_P1,
ID_SETTER_P10,
ID_SETTER_P100,
ID_SETTER_CURRENT,
ID_SETTER_HOME,
ID_SETTER_GC,
ID_SETTER_L0,
ID_SETTER_L1,
ID_SETTER_L2,
ID_SETTER_L3,
ID_SETTER_L4,
ID_SETTER_L5,
ID_SETTER_L6,
ID_SETTER_L7,
ID_SETTER_L8,
ID_SETTER_L9,
ID_SETTER_REGULAR,
ID_SETTER_SCOPE,
ID_SETTER_SCOPED,
ID_SETTER_FULL,
ID_SETTER_DELETE,
ID_SETTER_INSERT,
ID_SETTER_REFRESH_FILES,
ID_SETTER_PREV_FILE,
ID_SETTER_NEXT_FILE,
ID_SETTER_LOAD_FILE,
ID_SETTER_SAVE_FILE,
ID_SETTER_SAVE_SETTINGS,
ID_SETTER_GENERAL00,
ID_SETTER_GENERAL01,
ID_SETTER_GENERAL02,
ID_SETTER_GENERAL03,
ID_SETTER_GENERAL04,
ID_SETTER_GENERAL05,
ID_SETTER_GENERAL06,
ID_SETTER_GENERAL07,
ID_SETTER_GENERAL08,
ID_SETTER_GENERAL09,
ID_SETTER_GENERAL10,
ID_SETTER_GENERAL11,
ID_SETTER_GENERAL12,
ID_SETTER_GENERAL13,
ID_SETTER_GENERAL14,
ID_SETTER_GENERAL15,
ID_SETTER_GENERAL16,
ID_SETTER_GENERAL17,
ID_SETTER_GENERAL18,
ID_SETTER_GENERAL19,
ID_SETTER_GENERAL20,
ID_SETTER_GENERAL21,
ID_SETTER_GENERAL22,
ID_SETTER_GENERAL23,
ID_SETTER_GENERAL24,
ID_SETTER_GENERAL25,
ID_SETTER_GENERAL26,
ID_SETTER_GENERAL27,
ID_SETTER_GENERAL28,
ID_SETTER_GENERAL29,
ID_SETTER_GENERAL30,
ID_SETTER_GENERAL31,
ID_SETTER_GENERAL32,
ID_SETTER_GENERAL33,
ID_SETTER_GENERAL34,
ID_SETTER_GENERAL35,
ID_SETTER_GENERAL36,
ID_SETTER_GENERAL37,
ID_SETTER_GENERAL38,
ID_SETTER_GENERAL39,
ID_SETTER_GENERAL40,
ID_SETTER_GENERAL41,
ID_SETTER_GENERAL42,
ID_SETTER_GENERAL43,
ID_SETTER_GENERAL44,
ID_SETTER_GENERAL45,
ID_SETTER_GENERAL46,
ID_SETTER_GENERAL47,
ID_SETTER_GENERAL48,
ID_SETTER_GENERAL49,
ID_SETTER_GENERAL_PREV,
ID_SETTER_GENERAL_NEXT,
ID_SETTER_CRESCENDO_PREV,
ID_SETTER_CRESCENDO_CURRENT,
ID_SETTER_CRESCENDO_NEXT,
ID_SETTER_CRESCENDO_A,
ID_SETTER_CRESCENDO_B,
ID_SETTER_CRESCENDO_C,
ID_SETTER_CRESCENDO_D,
ID_SETTER_CRESCENDO_OVERRIDE,
ID_SETTER_TEMPERAMENT_PREV,
ID_SETTER_TEMPERAMENT_NEXT,
ID_SETTER_PITCH_M1,
ID_SETTER_PITCH_M10,
ID_SETTER_PITCH_M100,
ID_SETTER_PITCH_P1,
ID_SETTER_PITCH_P10,
ID_SETTER_PITCH_P100,
ID_SETTER_TRANSPOSE_DOWN,
ID_SETTER_TRANSPOSE_UP,
ID_SETTER_ON,
ID_SETTER_AUDIO_PANIC,
ID_SETTER_FILE_EXIT
};
const wxString GOSetter::KEY_REFRESH_FILES = wxT("RefreshFiles");
const wxString GOSetter::KEY_PREV_FILE = wxT("PrevFile");
const wxString GOSetter::KEY_CURR_FILE_NAME = wxT("CurrFileName");
const wxString GOSetter::KEY_NEXT_FILE = wxT("NextFile");
const wxString GOSetter::KEY_LOAD_FILE = wxT("LoadFile");
const wxString GOSetter::KEY_SAVE_FILE = wxT("SaveFile");
const wxString GOSetter::KEY_SAVE_SETTINGS = wxT("Save");
const wxString GOSetter::KEY_ON_STATE = wxT("OnState");
const wxString GOSetter::GROUP_REFRESH_FILES = wxT("SetterRefreshFiles");
const wxString GOSetter::GROUP_PREV_FILE = wxT("SetterPrevFile");
const wxString GOSetter::GROUP_CURR_FILE_NAME = wxT("SetterCurrFileName");
const wxString GOSetter::GROUP_NEXT_FILE = wxT("SetterNextFile");
const wxString GOSetter::GROUP_LOAD_FILE = wxT("SetterLoadFile");
const wxString GOSetter::GROUP_SAVE_FILE = wxT("SetterSaveFile");
const wxString GOSetter::GROUP_SAVE_SETTINGS = wxT("SetterSave");
const struct GOElementCreator::ButtonDefinitionEntry GOSetter::m_element_types[]
= {
{wxT("Prev"), ID_SETTER_PREV, true, true, false},
{wxT("Next"), ID_SETTER_NEXT, true, true, false},
{wxT("Set"), ID_SETTER_SET, true, false, false},
{wxT("M1"), ID_SETTER_M1, true, true, false},
{wxT("M10"), ID_SETTER_M10, true, true, false},
{wxT("M100"), ID_SETTER_M100, true, true, false},
{wxT("P1"), ID_SETTER_P1, true, true, false},
{wxT("P10"), ID_SETTER_P10, true, true, false},
{wxT("P100"), ID_SETTER_P100, true, true, false},
{wxT("Current"), ID_SETTER_CURRENT, true, true, false},
{wxT("Home"), ID_SETTER_HOME, true, true, false},
{wxT("GC"), ID_SETTER_GC, true, true, false},
{wxT("L1"), ID_SETTER_L1, true, true, false},
{wxT("L2"), ID_SETTER_L2, true, true, false},
{wxT("L3"), ID_SETTER_L3, true, true, false},
{wxT("L4"), ID_SETTER_L4, true, true, false},
{wxT("L5"), ID_SETTER_L5, true, true, false},
{wxT("L6"), ID_SETTER_L6, true, true, false},
{wxT("L7"), ID_SETTER_L7, true, true, false},
{wxT("L8"), ID_SETTER_L8, true, true, false},
{wxT("L9"), ID_SETTER_L9, true, true, false},
{wxT("L0"), ID_SETTER_L0, true, true, false},
{wxT("Regular"), ID_SETTER_REGULAR, true, true, false},
{wxT("Scope"), ID_SETTER_SCOPE, true, true, false},
{wxT("Scoped"), ID_SETTER_SCOPED, true, true, false},
{wxT("Full"), ID_SETTER_FULL, true, false, false},
{wxT("Insert"), ID_SETTER_INSERT, true, true, false},
{wxT("Delete"), ID_SETTER_DELETE, true, true, false},
{KEY_REFRESH_FILES, ID_SETTER_REFRESH_FILES, true, true, false},
{KEY_PREV_FILE, ID_SETTER_PREV_FILE, true, true, false},
{KEY_NEXT_FILE, ID_SETTER_NEXT_FILE, true, true, false},
{KEY_LOAD_FILE, ID_SETTER_LOAD_FILE, true, true, false},
{KEY_SAVE_FILE, ID_SETTER_SAVE_FILE, true, true, false},
{wxT("General01"), ID_SETTER_GENERAL00, true, true, true},
{wxT("General02"), ID_SETTER_GENERAL01, true, true, true},
{wxT("General03"), ID_SETTER_GENERAL02, true, true, true},
{wxT("General04"), ID_SETTER_GENERAL03, true, true, true},
{wxT("General05"), ID_SETTER_GENERAL04, true, true, true},
{wxT("General06"), ID_SETTER_GENERAL05, true, true, true},
{wxT("General07"), ID_SETTER_GENERAL06, true, true, true},
{wxT("General08"), ID_SETTER_GENERAL07, true, true, true},
{wxT("General09"), ID_SETTER_GENERAL08, true, true, true},
{wxT("General10"), ID_SETTER_GENERAL09, true, true, true},
{wxT("General11"), ID_SETTER_GENERAL10, true, true, true},
{wxT("General12"), ID_SETTER_GENERAL11, true, true, true},
{wxT("General13"), ID_SETTER_GENERAL12, true, true, true},
{wxT("General14"), ID_SETTER_GENERAL13, true, true, true},
{wxT("General15"), ID_SETTER_GENERAL14, true, true, true},
{wxT("General16"), ID_SETTER_GENERAL15, true, true, true},
{wxT("General17"), ID_SETTER_GENERAL16, true, true, true},
{wxT("General18"), ID_SETTER_GENERAL17, true, true, true},
{wxT("General19"), ID_SETTER_GENERAL18, true, true, true},
{wxT("General20"), ID_SETTER_GENERAL19, true, true, true},
{wxT("General21"), ID_SETTER_GENERAL20, true, true, true},
{wxT("General22"), ID_SETTER_GENERAL21, true, true, true},
{wxT("General23"), ID_SETTER_GENERAL22, true, true, true},
{wxT("General24"), ID_SETTER_GENERAL23, true, true, true},
{wxT("General25"), ID_SETTER_GENERAL24, true, true, true},
{wxT("General26"), ID_SETTER_GENERAL25, true, true, true},
{wxT("General27"), ID_SETTER_GENERAL26, true, true, true},
{wxT("General28"), ID_SETTER_GENERAL27, true, true, true},
{wxT("General29"), ID_SETTER_GENERAL28, true, true, true},
{wxT("General30"), ID_SETTER_GENERAL29, true, true, true},
{wxT("General31"), ID_SETTER_GENERAL30, true, true, true},
{wxT("General32"), ID_SETTER_GENERAL31, true, true, true},
{wxT("General33"), ID_SETTER_GENERAL32, true, true, true},
{wxT("General34"), ID_SETTER_GENERAL33, true, true, true},
{wxT("General35"), ID_SETTER_GENERAL34, true, true, true},
{wxT("General36"), ID_SETTER_GENERAL35, true, true, true},
{wxT("General37"), ID_SETTER_GENERAL36, true, true, true},
{wxT("General38"), ID_SETTER_GENERAL37, true, true, true},
{wxT("General39"), ID_SETTER_GENERAL38, true, true, true},
{wxT("General40"), ID_SETTER_GENERAL39, true, true, true},
{wxT("General41"), ID_SETTER_GENERAL40, true, true, true},
{wxT("General42"), ID_SETTER_GENERAL41, true, true, true},
{wxT("General43"), ID_SETTER_GENERAL42, true, true, true},
{wxT("General44"), ID_SETTER_GENERAL43, true, true, true},
{wxT("General45"), ID_SETTER_GENERAL44, true, true, true},
{wxT("General46"), ID_SETTER_GENERAL45, true, true, true},
{wxT("General47"), ID_SETTER_GENERAL46, true, true, true},
{wxT("General48"), ID_SETTER_GENERAL47, true, true, true},
{wxT("General49"), ID_SETTER_GENERAL48, true, true, true},
{wxT("General50"), ID_SETTER_GENERAL49, true, true, true},
{wxT("GeneralPrev"), ID_SETTER_GENERAL_PREV, true, true, false},
{wxT("GeneralNext"), ID_SETTER_GENERAL_NEXT, true, true, false},
{wxT("PitchP1"), ID_SETTER_PITCH_P1, true, true, false},
{wxT("PitchP10"), ID_SETTER_PITCH_P10, true, true, false},
{wxT("PitchP100"), ID_SETTER_PITCH_P100, true, true, false},
{wxT("PitchM1"), ID_SETTER_PITCH_M1, true, true, false},
{wxT("PitchM10"), ID_SETTER_PITCH_M10, true, true, false},
{wxT("PitchM100"), ID_SETTER_PITCH_M100, true, true, false},
{wxT("TemperamentPrev"), ID_SETTER_TEMPERAMENT_PREV, true, true, false},
{wxT("TemperamentNext"), ID_SETTER_TEMPERAMENT_NEXT, true, true, false},
{wxT("TransposeDown"), ID_SETTER_TRANSPOSE_DOWN, true, true, false},
{wxT("TransposeUp"), ID_SETTER_TRANSPOSE_UP, true, true, false},
{KEY_SAVE_SETTINGS, ID_SETTER_SAVE_SETTINGS, true, true, false},
{KEY_ON_STATE, ID_SETTER_ON, false, true, false},
{wxT("CrescendoA"), ID_SETTER_CRESCENDO_A, true, true, false},
{wxT("CrescendoB"), ID_SETTER_CRESCENDO_B, true, true, false},
{wxT("CrescendoC"), ID_SETTER_CRESCENDO_C, true, true, false},
{wxT("CrescendoD"), ID_SETTER_CRESCENDO_D, true, true, false},
{wxT("CrescendoPrev"), ID_SETTER_CRESCENDO_PREV, true, true, false},
{wxT("CrescendoCurrent"), ID_SETTER_CRESCENDO_CURRENT, true, true, false},
{wxT("CrescendoNext"), ID_SETTER_CRESCENDO_NEXT, true, true, false},
{wxT("CrescendoOverride"),
ID_SETTER_CRESCENDO_OVERRIDE,
true,
false,
false},
{wxT("PanicButton"), ID_SETTER_AUDIO_PANIC, true, true, true},
{wxT("ExitGO"), ID_SETTER_FILE_EXIT, true, true, true},
{wxT(""), -1, false, false, false}};
const struct GOElementCreator::ButtonDefinitionEntry *GOSetter::
GetButtonDefinitionList() {
return m_element_types;
}
GOSetter::GOSetter(GOOrganController *organController)
: m_OrganController(organController),
m_pos(0),
m_bank(0),
m_crescendopos(0),
m_crescendobank(0),
m_framegeneral(0),
m_general(0),
m_crescendo(0),
m_CurrFileDisplay(*organController),
m_PosDisplay(*organController),
m_BankDisplay(*organController),
m_CrescendoDisplay(*organController),
m_TransposeDisplay(*organController),
m_NameDisplay(*organController),
m_CrescendoCtrl(*organController) {
CreateButtons(*m_OrganController);
m_buttons[ID_SETTER_PREV]->SetPreconfigIndex(0);
m_buttons[ID_SETTER_NEXT]->SetPreconfigIndex(1);
m_buttons[ID_SETTER_SET]->SetPreconfigIndex(2);
m_buttons[ID_SETTER_CURRENT]->SetPreconfigIndex(3);
m_buttons[ID_SETTER_GC]->SetPreconfigIndex(4);
m_buttons[ID_SETTER_M10]->SetPreconfigIndex(5);
m_buttons[ID_SETTER_P10]->SetPreconfigIndex(6);
m_buttons[ID_SETTER_L0]->SetPreconfigIndex(7);
m_buttons[ID_SETTER_L1]->SetPreconfigIndex(8);
m_buttons[ID_SETTER_L2]->SetPreconfigIndex(9);
m_buttons[ID_SETTER_L3]->SetPreconfigIndex(10);
m_buttons[ID_SETTER_L4]->SetPreconfigIndex(11);
m_buttons[ID_SETTER_L5]->SetPreconfigIndex(12);
m_buttons[ID_SETTER_L6]->SetPreconfigIndex(13);
m_buttons[ID_SETTER_L7]->SetPreconfigIndex(14);
m_buttons[ID_SETTER_L8]->SetPreconfigIndex(15);
m_buttons[ID_SETTER_L9]->SetPreconfigIndex(16);
m_buttons[ID_SETTER_PITCH_M1]->SetPreconfigIndex(17);
m_buttons[ID_SETTER_PITCH_P1]->SetPreconfigIndex(18);
m_buttons[ID_SETTER_PITCH_M100]->SetPreconfigIndex(19);
m_buttons[ID_SETTER_PITCH_P100]->SetPreconfigIndex(20);
m_buttons[ID_SETTER_TEMPERAMENT_PREV]->SetPreconfigIndex(21);
m_buttons[ID_SETTER_TEMPERAMENT_NEXT]->SetPreconfigIndex(22);
m_buttons[ID_SETTER_TRANSPOSE_DOWN]->SetPreconfigIndex(23);
m_buttons[ID_SETTER_TRANSPOSE_UP]->SetPreconfigIndex(24);
m_buttons[ID_SETTER_AUDIO_PANIC]->SetPreconfigIndex(25);
m_buttons[ID_SETTER_FILE_EXIT]->SetPreconfigIndex(26);
m_buttons[ID_SETTER_PREV]->SetShortcutKey(37);
m_buttons[ID_SETTER_NEXT]->SetShortcutKey(39);
m_buttons[ID_SETTER_CURRENT]->SetShortcutKey(40);
SetSetterType(GOSetterState::SETTER_REGULAR);
SetCrescendoType(m_crescendobank);
m_OrganController->RegisterSoundStateHandler(this);
m_OrganController->RegisterCombinationButtonSet(this);
m_OrganController->RegisterControlChangedHandler(this);
}
GOSetter::~GOSetter() {}
static const wxString WX_OVERRIDE_MODE = wxT("OverrideMode");
static const wxString WX_EMPTY_STRING = wxEmptyString;
static wxString crescendo_cmb_state_name(
bool isOverride, uint8_t crescendoIdx) {
return isOverride ? WX_EMPTY_STRING
: wxString::Format("crescendo-%c", 'A' + crescendoIdx);
}
wxString GOSetter::GetCrescendoCmbStateName(uint8_t crescendoIdx) const {
return crescendo_cmb_state_name(
m_CrescendoOverrideMode[crescendoIdx], crescendoIdx);
}
void GOSetter::Load(GOConfigReader &cfg) {
m_OrganController->RegisterSaveableObject(this);
wxString buffer;
m_framegeneral.resize(0);
for (unsigned i = 0; i < FRAME_GENERALS; i++) {
m_framegeneral.push_back(
new GOGeneralCombination(*m_OrganController, true));
buffer.Printf(wxT("FrameGeneral%03d"), i + 1);
m_framegeneral[i]->Load(cfg, buffer);
}
m_general.resize(0);
for (unsigned i = 0; i < GENERALS * GENERAL_BANKS; i++) {
m_general.push_back(new GOGeneralCombination(*m_OrganController, true));
buffer.Printf(wxT("SetterGeneral%03d"), i + 1);
m_general[i]->Load(cfg, buffer);
}
m_crescendo.resize(0);
for (unsigned i = 0; i < N_CRESCENDOS; i++) {
buffer.Printf(wxT("SetterCrescendo%d"), i);
bool defaultAddMode
= cfg.ReadBoolean(ODFSetting, buffer, WX_OVERRIDE_MODE, false, true);
m_CrescendoOverrideMode[i] = cfg.ReadBoolean(
CMBSetting, buffer, WX_OVERRIDE_MODE, false, defaultAddMode);
}
for (uint8_t crescendoIdx = 0; crescendoIdx < N_CRESCENDOS; crescendoIdx++) {
wxString cmbStateName = GetCrescendoCmbStateName(crescendoIdx);
for (unsigned i = 0; i < CRESCENDO_STEPS; i++) {
GOGeneralCombination *pCmb
= new GOGeneralCombination(*m_OrganController, true);
m_crescendo.push_back(pCmb);
pCmb->Load(
cfg,
wxString::Format(
wxT("SetterCrescendo%d_%03d"), crescendoIdx + 1, i + 1));
pCmb->SetCombinationStateName(cmbStateName);
}
}
m_buttons[ID_SETTER_PREV]->Init(cfg, wxT("SetterPrev"), _("Previous"));
m_buttons[ID_SETTER_NEXT]->Init(cfg, wxT("SetterNext"), _("Next"));
m_buttons[ID_SETTER_SET]->Init(cfg, wxT("SetterSet"), _("Set"));
m_buttons[ID_SETTER_M1]->Init(cfg, wxT("SetterM1"), _("-1"));
m_buttons[ID_SETTER_M10]->Init(cfg, wxT("SetterM10"), _("-10"));
m_buttons[ID_SETTER_M100]->Init(cfg, wxT("SetterM100"), _("-100"));
m_buttons[ID_SETTER_P1]->Init(cfg, wxT("SetterP1"), _("+1"));
m_buttons[ID_SETTER_P10]->Init(cfg, wxT("SetterP10"), _("+10"));
m_buttons[ID_SETTER_P100]->Init(cfg, wxT("SetterP100"), _("+100"));
m_buttons[ID_SETTER_CURRENT]->Init(cfg, wxT("SetterCurrent"), _("Current"));
m_buttons[ID_SETTER_HOME]->Init(cfg, wxT("SetterHome"), _("000"));
m_buttons[ID_SETTER_GC]->Init(cfg, wxT("SetterGC"), _("G.C."));
m_buttons[ID_SETTER_REGULAR]->Init(cfg, wxT("SetterRegular"), _("Regular"));
m_buttons[ID_SETTER_SCOPE]->Init(cfg, wxT("SetterScope"), _("Scope"));
m_buttons[ID_SETTER_SCOPED]->Init(cfg, wxT("SetterScoped"), _("Scoped"));
m_buttons[ID_SETTER_FULL]->Init(cfg, wxT("SetterFull"), _("Full"));
m_buttons[ID_SETTER_INSERT]->Init(cfg, wxT("SetterInsert"), _("Insert"));
m_buttons[ID_SETTER_DELETE]->Init(cfg, wxT("SetterDelete"), _("Delete"));
m_buttons[ID_SETTER_REFRESH_FILES]->Init(
cfg, GROUP_REFRESH_FILES, _("Refresh files"));
m_buttons[ID_SETTER_PREV_FILE]->Init(cfg, GROUP_PREV_FILE, _("Prev file"));
m_buttons[ID_SETTER_NEXT_FILE]->Init(cfg, GROUP_NEXT_FILE, _("Next file"));
m_buttons[ID_SETTER_LOAD_FILE]->Init(cfg, GROUP_LOAD_FILE, _("Load file"));
m_buttons[ID_SETTER_SAVE_FILE]->Init(cfg, GROUP_SAVE_FILE, _("Save file"));
m_buttons[ID_SETTER_SAVE_SETTINGS]->Init(
cfg, GROUP_SAVE_SETTINGS, _("Save settings"));
m_buttons[ID_SETTER_CRESCENDO_PREV]->Init(
cfg, wxT("SetterCrescendoPrev"), _("<"));
m_buttons[ID_SETTER_CRESCENDO_NEXT]->Init(
cfg, wxT("SetterCrescendoNext"), _(">"));
m_buttons[ID_SETTER_CRESCENDO_CURRENT]->Init(
cfg, wxT("SetterCrescendoCurrent"), _("Current"));
m_buttons[ID_SETTER_CRESCENDO_A]->Init(cfg, wxT("SetterCrescendoA"), _("A"));
m_buttons[ID_SETTER_CRESCENDO_B]->Init(cfg, wxT("SetterCrescendoB"), _("B"));
m_buttons[ID_SETTER_CRESCENDO_C]->Init(cfg, wxT("SetterCrescendoC"), _("C"));
m_buttons[ID_SETTER_CRESCENDO_D]->Init(cfg, wxT("SetterCrescendoD"), _("D"));
m_buttons[ID_SETTER_CRESCENDO_OVERRIDE]->Init(
cfg, wxT("SetterCrescendoOverride"), _("Override"));
m_buttons[ID_SETTER_CRESCENDO_OVERRIDE]->Display(
m_CrescendoOverrideMode[m_crescendobank]);
m_buttons[ID_SETTER_PITCH_M1]->Init(cfg, wxT("SetterPitchM1"), _("-1"));
m_buttons[ID_SETTER_PITCH_M10]->Init(cfg, wxT("SetterPitchM10"), _("-10"));
m_buttons[ID_SETTER_PITCH_M100]->Init(cfg, wxT("SetterPitchM100"), _("-100"));
m_buttons[ID_SETTER_PITCH_P1]->Init(cfg, wxT("SetterPitchP1"), _("+1"));
m_buttons[ID_SETTER_PITCH_P10]->Init(cfg, wxT("SetterPitchP10"), _("+10"));
m_buttons[ID_SETTER_PITCH_P100]->Init(cfg, wxT("SetterPitchP100"), _("+100"));
m_buttons[ID_SETTER_TEMPERAMENT_PREV]->Init(
cfg, wxT("SetterTemperamentPrev"), _("<"));
m_buttons[ID_SETTER_TEMPERAMENT_NEXT]->Init(
cfg, wxT("SetterTemperamentNext"), _(">"));
m_buttons[ID_SETTER_TRANSPOSE_DOWN]->Init(
cfg, wxT("SetterTransposeDown"), _("-"));
m_buttons[ID_SETTER_TRANSPOSE_UP]->Init(
cfg, wxT("SetterTransposeUp"), _("+"));
m_buttons[ID_SETTER_ON]->Init(cfg, wxT("SetterOn"), _("ON"));
m_buttons[ID_SETTER_ON]->Display(true);
m_buttons[ID_SETTER_AUDIO_PANIC]->Init(cfg, wxT("AudioPanic"), _("Panic"));
m_buttons[ID_SETTER_FILE_EXIT]->Init(
cfg, wxT("ExitGO"), _("Exit GrandOrgue"));
m_CrescendoCtrl.Init(cfg, wxT("SetterSwell"), _("Crescendo"), 0);
m_PosDisplay.Init(cfg, wxT("SetterCurrentPosition"), _("sequencer position"));
m_BankDisplay.Init(cfg, wxT("SetterGeneralBank"), _("general bank"));
m_CrescendoDisplay.Init(
cfg, wxT("SetterCrescendoPosition"), _("crescendo position"));
m_TransposeDisplay.Init(cfg, wxT("SetterTranspose"), _("transpose"));
m_NameDisplay.Init(cfg, wxT("SetterName"), _("organ name"));
m_CurrFileDisplay.Init(cfg, KEY_CURR_FILE_NAME, _("current file name"));
for (unsigned i = 0; i < 10; i++) {
wxString group;
wxString buffer;
buffer.Printf(_("__%d"), i);
group.Printf(wxT("SetterL%d"), i);
m_buttons[ID_SETTER_L0 + i]->Init(cfg, group, buffer);
}
for (unsigned i = 0; i < GENERALS; i++) {
wxString group;
wxString buffer;
buffer.Printf(_("%d"), i + 1);
group.Printf(wxT("SetterGeneral%d"), i);
m_buttons[ID_SETTER_GENERAL00 + i]->Init(cfg, group, buffer);
}
m_buttons[ID_SETTER_GENERAL_PREV]->Init(
cfg, wxT("SetterGeneralPrev"), _("Prev"));
m_buttons[ID_SETTER_GENERAL_NEXT]->Init(
cfg, wxT("SetterGeneralNext"), _("Next"));
}
void GOSetter::DisplayCmbFile(const wxString &fileName) {
const bool isValid = !fileName.IsEmpty();
const bool isTheSameAsLoaded = fileName == m_CmbFileLastLoaded;
m_CmbFileDisplayed = fileName;
m_CurrFileDisplay.SetContent(
isValid ? wxFileName(fileName).GetName() : wxString());
m_buttons[ID_SETTER_LOAD_FILE]->Display(isValid && !isTheSameAsLoaded);
m_buttons[ID_SETTER_SAVE_FILE]->Display(
isValid && isTheSameAsLoaded && m_state.m_IsModified);
}
int GOSetter::FindCmbFilePosFor(const wxString &yamlFile) {
return yamlFile.IsEmpty() ? -1 : m_CmbFileList.Index(yamlFile);
}
void GOSetter::MoveToCmbFile(int offset) {
if (!m_IsCmbFileListPopulated) {
// read the list of combination files
wxDir cmbDir(m_CmbFilesDir);
m_CmbFileList.Clear();
wxDir::GetAllFiles(m_CmbFilesDir, &m_CmbFileList, wxT("*.yaml"));
m_CmbFileList.Sort();
m_CmbFilePos = FindCmbFilePosFor(m_CmbFileDisplayed);
m_IsCmbFileListPopulated = true;
}
unsigned l = m_CmbFileList.GetCount();
if (l) {
assert(abs(offset) <= l);
// move along the list
if (m_CmbFilePos < 0 && offset < 0)
m_CmbFilePos = 0; // move from the end
m_CmbFilePos = (m_CmbFilePos + offset + l) % l; // wrap around the margins
DisplayCmbFile(m_CmbFileList[m_CmbFilePos]);
}
}
void GOSetter::NotifyCmbChanged() {
// Temporary we mark the organ modified when a combination is changed for
// the user would save the preset.
// But we intend to split combinations and organ settings, so in the future
// we will only mark the combinations as modified, not the organ settings
m_OrganController->SetOrganModified();
}
void GOSetter::NotifyCmbPushed(bool isChanged, bool isForceSet) {
if (
isChanged && (m_state.m_IsActive || isForceSet) && !m_state.m_IsModified) {
m_state.m_IsModified = true;
// light the save button if the last loaded combination file is displayed
if (
!m_CmbFileDisplayed.IsEmpty()
&& m_CmbFileDisplayed == m_CmbFileLastLoaded)
m_buttons[ID_SETTER_SAVE_FILE]->Display(true);
NotifyCmbChanged();
}
}
void GOSetter::Save(GOConfigWriter &cfg) {
for (unsigned i = 0; i < N_CRESCENDOS; i++) {
cfg.WriteBoolean(
wxString::Format(wxT("SetterCrescendo%d"), i),
WX_OVERRIDE_MODE,
m_CrescendoOverrideMode[i]);
}
// another objects are saveble themself so they are saved separatelly
}
const char *const SIMPLE_GENERALS = "generals";
const char *const BANKED_GENERALS = "banked-generals";
const char *const CRESCENDOS = "crescendos";
const char *const OVERRIDE_MODE = "override-mode";
const char *const STEPS = "steps";
const char *const SEQUENCER = "sequencer";
const wxString WX_C = wxT("%c");
const wxString WX_C02U = wxT("%c%02u");
const wxString WX_U = wxT("%u");
const wxString WX_03U = wxT("%03u");
wxString general_yaml_key(unsigned i) { return wxString::Format(WX_U, i); }
wxString banked_general_yaml_key(unsigned i) {
return wxString::Format(WX_C02U, i / GENERALS + 'A', i % GENERALS + 1);
}
wxString crescendo_yaml_key(unsigned i) {
return wxString::Format(WX_C, i + 'A');
}
wxString crescendo_step_yaml_key(unsigned i) {
return wxString::Format(WX_U, i + 1);
}
wxString sequencer_cmb_yaml_key(unsigned i) {
return wxString::Format(WX_03U, i);
}
void GOSetter::ToYaml(YAML::Node &yamlNode) const {
// save generals
YAML::Node generalsNode;
for (unsigned l = m_OrganController->GetGeneralCount(), i = 0; i < l; i++)
m_OrganController->GetGeneral(i)->GetCombination().PutToYamlMap(
generalsNode, general_yaml_key(i));
put_to_map_if_not_null(yamlNode, SIMPLE_GENERALS, generalsNode);
// save banked generals
YAML::Node bankedGeneralsNode;
for (unsigned l = m_general.size(), i = 0; i < l; i++)
GOCombination::putToYamlMap(
bankedGeneralsNode, banked_general_yaml_key(i), m_general[i]);
put_to_map_if_not_null(yamlNode, BANKED_GENERALS, bankedGeneralsNode);
// save crescendos
YAML::Node crescendosNode;
for (unsigned i = 0; i < N_CRESCENDOS; i++) {
YAML::Node crescendoSteps;
unsigned baseIndex = CRESCENDO_STEPS * i;
for (unsigned j = 0; j < CRESCENDO_STEPS; j++)
GOCombination::putToYamlMap(
crescendoSteps, crescendo_step_yaml_key(j), m_crescendo[baseIndex + j]);
if (!crescendoSteps.IsNull()) {
YAML::Node crescendoNode = crescendosNode[crescendo_yaml_key(i)];
crescendoNode[OVERRIDE_MODE] = m_CrescendoOverrideMode[i];
crescendoNode[STEPS] = crescendoSteps;
}
}
put_to_map_if_not_null(yamlNode, CRESCENDOS, crescendosNode);
// save sequencer
YAML::Node sequencerNode;
for (unsigned i = 0; i < FRAME_GENERALS; i++)
GOCombination::putToYamlMap(
sequencerNode, wxString::Format(WX_03U, i), m_framegeneral[i]);
put_to_map_if_not_null(yamlNode, SEQUENCER, sequencerNode);
}
void GOSetter::FromYaml(const YAML::Node &yamlNode) {
// restore generals
const YAML::Node generalsNode = yamlNode[SIMPLE_GENERALS];
for (unsigned l = m_OrganController->GetGeneralCount(), i = 0; i < l; i++)
get_from_map_or_null(generalsNode, general_yaml_key(i))
>> m_OrganController->GetGeneral(i)->GetCombination();
// restore banked generals
const YAML::Node bankedGeneralsNode = yamlNode[BANKED_GENERALS];
for (unsigned l = m_general.size(), i = 0; i < l; i++)
get_from_map_or_null(bankedGeneralsNode, banked_general_yaml_key(i))
>> *m_general[i];
// restore crescendos
const YAML::Node crescendosNode = yamlNode[CRESCENDOS];
for (unsigned i = 0; i < N_CRESCENDOS; i++) {
const YAML::Node crescendoNode
= get_from_map_or_null(crescendosNode, crescendo_yaml_key(i));
const YAML::Node crescendoOverridNode
= get_from_map_or_null(crescendoNode, OVERRIDE_MODE);
const YAML::Node crescendoSteps
= get_from_map_or_null(crescendoNode, STEPS);
unsigned baseIndex = CRESCENDO_STEPS * i;
m_CrescendoOverrideMode[i] = crescendoOverridNode.as<bool, bool>(true);
for (unsigned j = 0; j < CRESCENDO_STEPS; j++)
get_from_map_or_null(crescendoSteps, crescendo_step_yaml_key(j))
>> *m_crescendo[baseIndex + j];
}
// restore sequencer
const YAML::Node sequencerNode = yamlNode[SEQUENCER];
for (unsigned i = 0; i < FRAME_GENERALS; i++)
get_from_map_or_null(sequencerNode, sequencer_cmb_yaml_key(i))
>> *m_framegeneral[i];
}
bool GOSetter::CopyFrameGenerals(
unsigned fromIdx, unsigned toIdx, bool changedBefore) {
const GOGeneralCombination *pNewCmb = m_framegeneral[fromIdx];
GOGeneralCombination *pOldCmb = m_framegeneral[toIdx];
bool changed = (changedBefore || !pOldCmb->IsEmpty() || !pNewCmb->IsEmpty());
pOldCmb->Copy(pNewCmb);
return changed;
}
void GOSetter::ButtonStateChanged(int id, bool newState) {
switch (id) {
case ID_SETTER_REFRESH_FILES:
m_IsCmbFileListPopulated = false;
break;
case ID_SETTER_PREV_FILE:
MoveToCmbFile(-1);
break;
case ID_SETTER_NEXT_FILE:
MoveToCmbFile(1);
break;
case ID_SETTER_LOAD_FILE:
if (!m_CmbFileDisplayed.IsEmpty()) {
// Flash the button until OnCombinationsLoaded()
m_buttons[ID_SETTER_LOAD_FILE]->Display(true);
m_OrganController->LoadCombination(m_CmbFileDisplayed);
// for minimising buttons to press we just make GrandOrgue ready to play
// from the home position
SetterActive(false);
SetPosition(0, true);
}
break;
case ID_SETTER_SAVE_FILE:
if (
!m_CmbFileLastLoaded.IsEmpty()
&& m_CmbFileDisplayed == m_CmbFileLastLoaded)
m_OrganController->ExportCombination(m_CmbFileLastLoaded);
break;
case ID_SETTER_PREV:
Prev();
break;
case ID_SETTER_NEXT:
Next();
break;
case ID_SETTER_FULL:
m_state.m_IsStoreInvisible = newState;
break;
case ID_SETTER_SET:
m_state.m_IsActive = newState;
wxTheApp->GetTopWindow()->UpdateWindowUI();
break;
case ID_SETTER_M1:
SetPosition(m_pos - 1, false);
break;
case ID_SETTER_M10:
SetPosition(m_pos - 10, false);
break;
case ID_SETTER_M100:
SetPosition(m_pos - 100, false);
break;
case ID_SETTER_P1:
SetPosition(m_pos + 1, false);
break;
case ID_SETTER_P10:
SetPosition(m_pos + 10, false);
break;
case ID_SETTER_P100:
SetPosition(m_pos + 100, false);
break;
case ID_SETTER_HOME:
SetPosition(0, false);
break;
case ID_SETTER_GC: {
GOButtonControl *pGc = m_buttons[ID_SETTER_GC];
pGc->Display(true);
m_OrganController->Reset();
pGc->Display(false);
break;
}
case ID_SETTER_CURRENT:
SetPosition(m_pos);
break;
case ID_SETTER_DELETE: {
bool changed = false;
for (unsigned j = m_pos; j < m_framegeneral.size() - 1; j++)
changed = CopyFrameGenerals(j + 1, j, changed);
UpdateAllButtonsLight(nullptr, -1);
NotifyCmbPushed(changed, true);
break;
}
case ID_SETTER_INSERT: {
bool changed = false;
for (unsigned j = m_framegeneral.size() - 1; j > m_pos; j--)
changed = CopyFrameGenerals(j - 1, j, changed);
UpdateAllButtonsLight(nullptr, -1);
SetPosition(m_pos);
NotifyCmbPushed(changed, true);
break;
}
case ID_SETTER_L0:
case ID_SETTER_L1:
case ID_SETTER_L2:
case ID_SETTER_L3:
case ID_SETTER_L4:
case ID_SETTER_L5:
case ID_SETTER_L6:
case ID_SETTER_L7:
case ID_SETTER_L8:
case ID_SETTER_L9:
SetPosition(m_pos - (m_pos % 10) + id - ID_SETTER_L0);
break;
case ID_SETTER_GENERAL00:
case ID_SETTER_GENERAL01:
case ID_SETTER_GENERAL02:
case ID_SETTER_GENERAL03:
case ID_SETTER_GENERAL04:
case ID_SETTER_GENERAL05:
case ID_SETTER_GENERAL06:
case ID_SETTER_GENERAL07:
case ID_SETTER_GENERAL08:
case ID_SETTER_GENERAL09:
case ID_SETTER_GENERAL10:
case ID_SETTER_GENERAL11:
case ID_SETTER_GENERAL12:
case ID_SETTER_GENERAL13:
case ID_SETTER_GENERAL14:
case ID_SETTER_GENERAL15:
case ID_SETTER_GENERAL16:
case ID_SETTER_GENERAL17:
case ID_SETTER_GENERAL18:
case ID_SETTER_GENERAL19:
case ID_SETTER_GENERAL20:
case ID_SETTER_GENERAL21:
case ID_SETTER_GENERAL22:
case ID_SETTER_GENERAL23:
case ID_SETTER_GENERAL24:
case ID_SETTER_GENERAL25:
case ID_SETTER_GENERAL26:
case ID_SETTER_GENERAL27:
case ID_SETTER_GENERAL28:
case ID_SETTER_GENERAL29:
case ID_SETTER_GENERAL30:
case ID_SETTER_GENERAL31:
case ID_SETTER_GENERAL32:
case ID_SETTER_GENERAL33:
case ID_SETTER_GENERAL34:
case ID_SETTER_GENERAL35:
case ID_SETTER_GENERAL36:
case ID_SETTER_GENERAL37:
case ID_SETTER_GENERAL38:
case ID_SETTER_GENERAL39:
case ID_SETTER_GENERAL40:
case ID_SETTER_GENERAL41:
case ID_SETTER_GENERAL42:
case ID_SETTER_GENERAL43:
case ID_SETTER_GENERAL44:
case ID_SETTER_GENERAL45:
case ID_SETTER_GENERAL46:
case ID_SETTER_GENERAL47:
case ID_SETTER_GENERAL48:
case ID_SETTER_GENERAL49:
PushGeneral(
*m_general[id - ID_SETTER_GENERAL00 + m_bank * GENERALS], m_buttons[id]);
break;
case ID_SETTER_GENERAL_PREV:
case ID_SETTER_GENERAL_NEXT:
if (id == ID_SETTER_GENERAL_PREV && m_bank > 0)
m_bank--;
if (id == ID_SETTER_GENERAL_NEXT && m_bank < GENERAL_BANKS - 1)
m_bank++;
m_BankDisplay.SetContent(wxString::Format(wxT("%c"), m_bank + wxT('A')));
break;
case ID_SETTER_REGULAR:
SetSetterType(GOSetterState::SETTER_REGULAR);
break;
case ID_SETTER_SCOPE:
SetSetterType(GOSetterState::SETTER_SCOPE);
break;
case ID_SETTER_SCOPED:
SetSetterType(GOSetterState::SETTER_SCOPED);
break;
case ID_SETTER_CRESCENDO_A:
case ID_SETTER_CRESCENDO_B:
case ID_SETTER_CRESCENDO_C:
case ID_SETTER_CRESCENDO_D:
SetCrescendoType(id - ID_SETTER_CRESCENDO_A);
break;
case ID_SETTER_CRESCENDO_PREV:
Crescendo(m_crescendopos - 1, true);
break;
case ID_SETTER_CRESCENDO_NEXT:
Crescendo(m_crescendopos + 1, true);
break;
case ID_SETTER_CRESCENDO_CURRENT:
PushGeneral(
*m_crescendo[m_crescendopos + m_crescendobank * CRESCENDO_STEPS],
nullptr);
break;
case ID_SETTER_CRESCENDO_OVERRIDE: {
wxString cmbStateName = crescendo_cmb_state_name(newState, m_crescendobank);
m_CrescendoOverrideMode[m_crescendobank] = newState;
for (unsigned i = 0; i < CRESCENDO_STEPS; i++)
m_crescendo[N_CRESCENDOS * m_crescendobank + i]->SetCombinationStateName(
cmbStateName);
m_buttons[ID_SETTER_CRESCENDO_OVERRIDE]->Display(newState);
break;
}
case ID_SETTER_PITCH_M1:
m_OrganController->GetRootPipeConfigNode().ModifyManualTuning(-1);
m_OrganController->GetRootPipeConfigNode().ModifyAutoTuningCorrection(-1);
break;
case ID_SETTER_PITCH_M10:
m_OrganController->GetRootPipeConfigNode().ModifyManualTuning(-10);
m_OrganController->GetRootPipeConfigNode().ModifyAutoTuningCorrection(-10);
break;
case ID_SETTER_PITCH_M100:
m_OrganController->GetRootPipeConfigNode().ModifyManualTuning(-100);
m_OrganController->GetRootPipeConfigNode().ModifyAutoTuningCorrection(-100);
break;
case ID_SETTER_PITCH_P1:
m_OrganController->GetRootPipeConfigNode().ModifyManualTuning(1);
m_OrganController->GetRootPipeConfigNode().ModifyAutoTuningCorrection(1);
break;
case ID_SETTER_PITCH_P10:
m_OrganController->GetRootPipeConfigNode().ModifyManualTuning(10);
m_OrganController->GetRootPipeConfigNode().ModifyAutoTuningCorrection(10);
break;
case ID_SETTER_PITCH_P100:
m_OrganController->GetRootPipeConfigNode().ModifyManualTuning(100);
m_OrganController->GetRootPipeConfigNode().ModifyAutoTuningCorrection(100);
break;
case ID_SETTER_SAVE_SETTINGS:
m_OrganController->Save();
break;
case ID_SETTER_TEMPERAMENT_NEXT:
case ID_SETTER_TEMPERAMENT_PREV: {
unsigned index
= m_OrganController->GetSettings().GetTemperaments().GetTemperamentIndex(
m_OrganController->GetTemperament());
index += m_OrganController->GetSettings()
.GetTemperaments()
.GetTemperamentCount();
if (id == ID_SETTER_TEMPERAMENT_NEXT)
index++;
else
index--;
index = index
% m_OrganController->GetSettings()
.GetTemperaments()
.GetTemperamentCount();
m_OrganController->SetTemperament(
m_OrganController->GetSettings().GetTemperaments().GetTemperamentName(
index));
} break;
case ID_SETTER_TRANSPOSE_DOWN:
case ID_SETTER_TRANSPOSE_UP: {
int value = m_OrganController->GetSettings().Transpose();
if (id == ID_SETTER_TRANSPOSE_UP)
value++;
else
value--;
SetTranspose(value);
} break;
case ID_SETTER_AUDIO_PANIC: {
wxCommandEvent event(wxEVT_MENU, ID_AUDIO_PANIC);
wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(event);
} break;
case ID_SETTER_FILE_EXIT: {
wxCommandEvent event(wxEVT_MENU, ID_FILE_EXIT);
wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(event);
} break;
}
}
void GOSetter::PreparePlayback() {
wxString buffer;
buffer.Printf(wxT("%03d"), m_pos);
m_PosDisplay.SetContent(buffer);
m_NameDisplay.SetContent(m_OrganController->GetChurchName());
wxCommandEvent event(wxEVT_SETVALUE, ID_METER_FRAME_SPIN);
event.SetInt(m_pos);
wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(event);
buffer.Printf(wxT("%d"), m_crescendopos + 1);
m_CrescendoDisplay.SetContent(buffer);
buffer.Printf(wxT("%c"), m_bank + wxT('A'));
m_BankDisplay.SetContent(buffer);
UpdateTranspose();