[go: up one dir, main page]

Menu

[21ef45]: / src / Setup.c  Maximize  Restore  History

Download this file

2532 lines (1979 with data), 71.0 kB

   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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
// Backup Band for Linux
// Copyright 2013 Jeff Glatt
// Backup Band is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Backup Band is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Backup Band. If not, see <http://www.gnu.org/licenses/>.
static const char MusicianNameStrs[] = "Drums\0Bass\0Guitar\0Pad\0Human";
const char * getMusicianName(register unsigned char robotNum)
{
register const char * strs;
strs = MusicianNameStrs;
while (robotNum--)
{
while (*strs++);
}
return strs;
}
#ifndef BB_NO_GUI
#include "Main.h"
#include "Robots.h"
#include "MVerb.h"
#include "Prefs.h"
#include "MidiIn.h"
#include "MidiOut.h"
#include "AccompSeq.h"
#include "AudioPlay.h"
#include "FileLoad.h"
#include "Editor.h"
#include "Setup.h"
#include "SongSheet.h"
#include "StyleData.h"
#include "Version.h"
//======================================================
// SETUP SCREEN
//======================================================
VOIDRETFUNC ReturnFunc;
static unsigned char MusicianAssignChange;
static unsigned char PanelSelect = 0;
//static unsigned char MusicianMuteChange;
static const char GeneralHelpStr[] = "\x13 Flash error\x11 automatically dismisses any error message after 5 seconds. Be sure to enable this \
if you're running BackupBand without a computer keyboard or mouse.\n\n\x13 Clock\x11 offers 3 settings for timing. The faster settings invoke \
less overhead, but may result in the robots playing at an erratic tempo, depending upon your system. Choose the fastest clock that doesn't \
adversely affect the robots' rhythm.\x13 MIDI\x11 clock is used only if you wish to slave BackupBand to some other hardware/software's tempo, \
using MIDI clock messages. You must set the tempo, and start/stop play, from the other device.\n\nIncreasing\x13 Click delay\x11 causes \
BackupBand to be less sensitive to mouse button double-clicks. Adjust this setting if you're using a touchscreen that tends to generate \
false double-clicks, or when using a USB pedal configured as a mouse it does likewise.\n\n\x13 Transpose\x11 transposes the drum, guitar, \
pad, and human solo instruments up/down by half steps. Unlike the Transpose setting in the main screen, the Setup screen's \
transpose is maintained each time you run BackupBand.";
static const char RobotsHelpStr[] = "\x16Instruments Change\x11 determines when the robots' instruments change automatically.\x13 Always\x11 is the default behavior. The \
robots automatically change instruments whenever the style is selected, during play or stopped.\x13 When stopped\x11 changes the instruments only when you change styles with \
playback stopped. Instruments do not change automatically during play. With\x13 Manually\x11, the instruments never change automatically. They change only when you manually change \
them.\x13 Articulations\x11 is like\x13 Manually\x11 except that articulations can change automatically during play. (ie, The guitarist can mute strings on one Variation, and unmute \
on another. But he can't change the instrument itself, for example, change from a Les Paul to a Nylon string. He must play the instrument you manually choose.)\n\n\
When\x13 Autostart\x11 is\x13 On\x11, as soon as you play a chord, the robots all start to play along (assuming you haven't muted/disabled them) \
in the current style. When Autostart is\x13 Off\x11, the drummer does nothing and the bass/guitar strum rubato chords (in time with your chords), \
until you manually start play. Only when you start play do the robots all begin playing in the current style.\x13 Toggle\x11 automatically \
turns on Autostart whenever you select a style (while play is stopped), and then automatically turns it off when play starts. This allows you \
to play rubato chords at the ending of a style without causing play to automatically restart.";
static const char HumanHelpStr[] = "The\x16 Chords Model\x11 determines how you wish to play chords upon your \
controller.\x13 Split Piano\x11 means that you intend to divide your controller's note range into two halves. The bottom half is \
where you will play chords for BackupBand to follow, and the top half is where you can play anything you'd like, such as a \
solo.\x13 One finger\x11 model allows you to play minor or major chords with 1 or 2 fingers (on your controller's bottom half). \
For a major chord, just play the root note. (Play a C note for a C major chord). For a minor chord, add the note a half or whole \
step up. (Play a C note, along with either a Db or D note, for a C minor chord).\x13 Full piano\x11 means you intend to play a \
two-handed freeform part, across the entire note range, and BackupBand should deduce chords from that.\x13 Sensitivity\x11 sets how \
many notes you must simultaneously play before BackupBand will recognize a chord. For example, if Sensitivity is 4, then you must hold \
at least 4 notes simultaneously in order to change the chord.\n\n\x13 Foot (or Bass) pedals\x11 indicates you will play minor or major chords \
on at least a full octave (C to high C) of pedals. For a major chord, just play the root pedal. For a minor chord, play the root pedal, \
simultaneously with the high C pedal. You must set the high C pedal as the\x13 Minor Pedal\x11 note.\n\n\x13 Wind model\x11 uses 2 \
devices. One device is a monophonic controller where you play the root note. The other device is a switch or pedal that you press for \
a minor chord, or release for major. If you use a USB pedal that emulates a mouse, then set\x13 Minor by\x11 to \"Mouse\", and click \
the adjacent button to configure the pedal. If you instead use a pedal that sends MIDI controller, then set\x13 Minor by\x11 to \
\"Controller\", and click the adjacent button to enter the controller number.\n\n\x13 Guitar\x11 model is for a MIDI guitar. \
BackupBand's robot musicians change chord only when you strum a chord on at least 4 strings.\n\n\x13 Drum Pads\x11 model assigns \
a different chord to each midi note number. Alternately you can set\x13 Trigger by\x11 to instead use Aftertouch or Program Change \
numbers. Or you can use one MIDI Controller. See the manual for a chart.\n\n\x13 Change on\x11 determines whether the robots can \
change the chord on the downbeat of every measure, or only the first and third beats.\n\nWhen\x13 Chord Hold\x11 is on, then the \
robots continue playing the chord even after you release the notes on your controller. When off, the bass, guitar, and pad robots play only \
while you're sustaining (holding) the notes of the chord. The drummer continues regardless.\n\nThe\x16 MIDI Controller\x11 section \
is where you set what MIDI device you wish BackupBand's robot musicians to \"follow\" for changing chords, and receiving remote \
commands. Click on the\x13 Device\x11 button to choose one device from a list of external MIDI hardware, or other software programs, \
which BackupBand can follow. Click the Split button, and play the note on your controller where you want to split it into 2 note \
ranges. Note that\x13 Full Piano\x11 and\x13 Guitar\x11 chord models do not need the split note set.\n\nThe\x13 Test\x11 button \
opens a screen that displays information about each MIDI message received from your controller. Also indicated is what BackupBand \
does with that message.\n\nThe\x13 Master Chan\x11 indicates what MIDI channel you will set your controller to play chords upon. This \
channel is also used to control Master settings that affect all robots, such as transpose, tempo, etc. If set it to \"Auto\", then all \
notes from your controller (on any channel) will play chords below the split point. Also, all non-note events will control Master \
settings.\n\nThe\x16 Solo Instrument\x11 section are settings for the upper half of your controller (above the split note). You can \
play any of BackupBand's sampled instruments on its Internal Synth. Or you can set the playback to one of the 4 MIDI choices of software \
synths or external MIDI hardware synths.\x13 Channel\x11 determines which MIDI channel you will set your controller to play the \
\"Solo\" instrument. If the \x13 Master channel\x11 is set to \"Auto\", then the solo channel is ignored, and all notes above the split point \
play the Solo patch.\n\nWhen Master channel is set to to \"Basic\", then this automatically disables the guitar, bass, and \
pad robots (but not the drummer). This is useful if you don't need BackupBand's accompaniment features and instead wish only to use \
BackupBand as a sound module that you yourself play. Note that the Solo Instrument settings still allow you to do splits and layers.";
static const char CommandsHelpStr[] = "Set\x13 Switch Note\x11 only if you want to use a range of notes for issuing commands to BackupBand \
(instead of playing sampled instruments), such as start/stop play, transpose, increase/decrease tempo, etc.";
static const char * HelpStrs[5] = {&GeneralHelpStr[0], &RobotsHelpStr[0], &HumanHelpStr[0], &CommandsHelpStr[0], 0};
static int32_t getPlayDevStr(void *, GUIAPPHANDLE);
static uint32_t set_playdev_assign(register GUICTL_ARROWS *, register uint32_t);
static void updateBussBtns(void);
static void setup_msg_handler(void);
/******************* updateDevice() *******************
* Called by GUI thread when user selects an audio/midi
* device.
*/
static void updateDevice(register SOUNDDEV * sounddev)
{
#if !defined(NO_ALSA_AUDIO_SUPPORT) || !defined(NO_JACK_SUPPORT)
if (!sounddev)
{
#ifndef NO_SAMPLERATE_SUPPORT
setSampleRateCtl(waveSampleRateFactor(0xff));
#endif
sounddev = getNextAudioOutDev(0);
}
#endif
GuiApp->WinInfo.Banner.Text = sounddev->DevName;
if (doPickSoundDevDlg(sounddev))
{
register const char * errmsg;
// Open new dev
if (sounddev->DevFlags & DEVFLAG_INPUTDEV)
{
switch (sounddev->DevType)
{
#ifndef NO_ALSA_AUDIO_SUPPORT
// case DEVTYPE_AUDIO:
// {
// break;
// }
#endif
#if !defined(NO_MIDI_IN_SUPPORT) || !defined(NO_SEQ_IN_SUPPORT)
case DEVTYPE_RAWMIDI:
openMidiIn(sounddev);
break;
#endif
err: show_msgbox(errmsg);
err2: return;
}
}
else switch (sounddev->DevType)
{
#if !defined(NO_ALSA_AUDIO_SUPPORT) || !defined(NO_JACK_SUPPORT)
case DEVTYPE_AUDIO:
{
#ifndef NO_JACK_SUPPORT
if (!sounddev->DevHash)
{
if ((errmsg = open_libjack())) goto err;
}
else
#endif
{
// Get dialog's sample rate in case user changed it
if (setFrameSize(1)) SaveConfigFlag |= SAVECONFIG_OTHER;
}
if (!loadDataSets(LOADFLAG_INSTRUMENTS)) goto err2;
MusicianAssignChange = 0;
allocAudio();
break;
}
#endif
#ifndef NO_MIDI_OUT_SUPPORT
case DEVTYPE_RAWMIDI:
if ((errmsg = openMidiOut(sounddev))) goto err;
break;
#endif
#ifndef NO_SEQ_OUT_SUPPORT
case DEVTYPE_SEQ:
if ((errmsg = openSeqOut(sounddev))) goto err;
#endif
}
SaveConfigFlag |= SAVECONFIG_DEVICES;
}
}
#ifndef NO_ALSA_AUDIO_SUPPORT
/************ doPickAudioOutDev() ************
* Called by GUI thread when user clicks on the
* XRun indication GUICTL (to adjust the audio
* driver settings).
*/
void doPickAudioOutDev(void)
{
updateDevice(0);
showMainScreen();
}
#endif
#if !defined(NO_MIDI_IN_SUPPORT) || !defined(NO_SEQ_IN_SUPPORT)
static uint32_t ctl_set_midi_in(register GUICTL * ctl)
{
updateDevice(getNextMidiInDev(0));
updateBussBtns();
doSetupScreen();
return 0;
}
#endif
#if !defined(NO_ALSA_AUDIO_SUPPORT) || !defined(NO_JACK_SUPPORT)
static uint32_t ctl_set_intsynth_dev(register GUICTL * ctl)
{
updateDevice(0);
updateBussBtns();
doSetupScreen();
return 0;
}
#endif
#if !defined(NO_MIDI_OUT_SUPPORT) || !defined(NO_SEQ_OUT_SUPPORT)
static uint32_t ctl_set_midiout_dev(register GUICTL * ctl)
{
register uint32_t i;
register SOUNDDEV * sounddev;
i = ((((GUICTL_PUSH *)ctl)->Ctl.IdNumber & 0x2f));
sounddev = 0;
while ((sounddev = getNextMidiOutDev(sounddev)))
{
if (!i)
{
updateDevice(sounddev);
break;
}
--i;
}
updateBussBtns();
doSetupScreen();
return 0;
}
#endif
static const char CtlNames[] = {0,'B','a','n','k','S','w',' ','H',0,
1,'M','o','d',' ','H',0,
2,'B','r','e','a','t','h',' ','H',0,
4,'F','o','o','t','P','d',' ','H',0,
5,'P',' ','T','i','m','e',' ','H',0,
6,'D','a','t','a',' ','H',0,
7,'V','o','l','u','m','e',' ','H',0,
8,'B','a','l','a','n','c',' ','H',0,
10,'P','a','n',' ','H',0,
11,'E','x','p','r','e','s',' ','H',0,
12,'E','f','f','c',' ','1',' ','H',0,
13,'E','f','f','c',' ','2',' ','H',0,
16,'G','e','n','e','r','l',' ','1',0,
17,'G','e','n','e','r','l',' ','2',0,
18,'G','e','n','e','r','l',' ','3',0,
19,'G','e','n','e','r','l',' ','4',0,
32,'B','a','n','k','S','w',' ','L',0,
33,'M','o','d',' ','L',0,
34,'B','r','e','a','t','h',' ','L',0,
36,'F','o','o','t','P','d',' ','L',0,
37,'P',' ','T','i','m','e',' ','L',0,
38,'D','a','t','a',' ','L',0,
39,'V','o','l','u','m','e',' ','L',0,
40,'B','a','l','a','n','c',' ','L',0,
42,'P','a','n',' ','L',0,
43,'E','x','p','r','e','s',' ','L',0,
44,'E','f','f','c',' ','1',' ','L',0,
45,'E','f','f','c',' ','2',' ','L',0,
64,'H','o','l','d',' ','P','e','d',0,
65,'P','o','r','t','a',' ','O','n',0,
66,'S','u','s','t','e','n','u','t',0,
67,'S','o','f','t',' ','P','e','d',0,
68,'L','e','g','a','t','o','P','d',0,
69,'H','o','l','d','2','P','e','d',0,
70,'S','n','d',' ','V','a','r','i',0,
71,'T','i','m','b','r','e',0,
72,'R','e','l',' ','T','i','m','e',0,
73,'A','t','k',' ','T','i','m','e',0,
74,'B','r','i','g','h','t','n','s',0,
75,'S','n','d','C','t','l',' ','6',0,
76,'S','n','d','C','t','l',' ','7',0,
77,'S','n','d','C','t','l',' ','8',0,
78,'S','n','d','C','t','l',' ','9',0,
79,'S','n','d','C','t','l','1','0',
80,'G','e','n','e','r','l',' ','5',0,
81,'G','e','n','e','r','l',' ','6',0,
82,'G','e','n','e','r','l',' ','7',0,
83,'G','e','n','e','r','l',' ','8',0,
91,'E','f','f','e','c','t','s',0,
92,'T','r','e','m','u','l','o',0,
93,'C','h','o','r','u','s',0,
94,'C','e','l','e','s','t','e',0,
95,'P','h','a','s','e','r',0,
96,'D','a','t','a',' ','+',0,
97,'D','a','t','a',' ','-',0,
98,'N','R','P','N',' ','L',0,
99,'N','R','P','N',' ','H',0,
100,'R','P','N',' ','L',0,
101,'R','P','N',' ','H',0,
120,'S','o','u','n','d','O','f','f',0,
121,'C','o','n','t','l','O','f','f',0,
122,'L','o','c','a','l','K','e','y',0,
123,'N','o','t','e','s','O','f','f',0,
124,'O','m','n','i',' ','O','f','f',0,
125,'O','m','n','i',' ','O','n',0,
126,'M','o','n','o',' ','O','n',0,
127,'P','o','l','y',' ','O','n',0,
-1};
/********************* getGmCtl() *********************
* Retrieves the General MIDI Controller Name for a
* controller number.
*/
const char * getGmCtl(unsigned char ctlNum)
{
register const char * ptr;
ptr = &CtlNames[0];
while (ctlNum > (unsigned char)ptr[0]) ptr += (strlen(ptr + 1) + 2);
return (ctlNum == (unsigned char)ptr[0] ? ptr + 1 : 0);
}
#ifndef NO_MIDI_IN_SUPPORT
// =========================================================
// Set split, command note, bass octave
// =========================================================
static const char PlayNoteStr[] = "Play the desired key for the split point on your MIDI controller. (Typically the center key.) I'm listening for it...";
static const char PlayPedalStr[] = "Play the desired pedal to change the chord to minor (instead of major). I'm listening for it...";
static void * setNotePoint(register void * signalHandle, register unsigned char * msg)
{
if (msg[0] >= 0x90 && msg[0] <= 0x9F && msg[2])
{
register unsigned char note;
note = msg[1];
if (isNoteAssign())
{
if (note <= (CmdSwitchNote & 0x7f) || note >= (CmdSwitchNote & 0x7f) + 88)
{
#ifdef DEBUG_GUIWINSIGNAL
GuiWinSignal(GuiApp, signalHandle, SIGNALMAIN_CMDSWITCHERR, "setNotePoint");
#else
GuiWinSignal(GuiApp, signalHandle, SIGNALMAIN_CMDSWITCHERR);
#endif
goto ignore;
}
note -= (CmdSwitchNote & 0x7f);
}
// Settings must be saved to disk if done via Setup screen
if (ReturnFunc == &doSetupScreen) SaveConfigFlag |= SAVECONFIG_OTHER;
// Set the note
*BytePtr = note;
// Wake up main thread
#ifdef DEBUG_GUIWINSIGNAL
GuiWinSignal(GuiApp, signalHandle, SIGNALMAIN_MIDIIN, "setNotePoint");
#else
GuiWinSignal(GuiApp, signalHandle, SIGNALMAIN_MIDIIN);
#endif
// Don't siphon any more
return 0;
}
ignore:
// Continue siphoning midi input
return (void *)-1;
}
void endNotePoint(void)
{
setMidiInSiphon(&setNotePoint, 0);
ReturnFunc();
}
static void midinote_msg_handler(void)
{
if (GuiApp->Command == (GUIMSG_TYPE_SERVICE|GUIMSG_ACTION_SIGNAL))
{
if (GuiApp->Signal & SIGNALMAIN_MIDIIN) goto end;
if (GuiApp->Signal & SIGNALMAIN_CMDSWITCHERR)
show_msgbox("You can't assign an action to the note that switches command mode on/off.");
}
else if (GuiMsgIsPresetClick(GuiApp->Command))
{
if (GuiApp->SelectedSubCtl == GUIBTN_DEL) *BytePtr = 128;
end: endNotePoint();
}
}
void doNoteScreen(register const char * title, register unsigned char delFlag)
{
register GUIAPPHANDLE app;
app = GuiApp;
{
register GUIBANNER * hdr;
hdr = (GUIBANNER *)&app->WinInfo.Banner;
hdr->Text = title;
hdr->Color = GUICOLOR_PURPLE;
hdr->Options = GUIDRAW_Y_CENTER;
}
// No other ctls
app->WinInfo.ControlsList = 0;
app->WinInfo.Options = GUIWIN_OPT_SPACE_AS_ENTER|GUIWIN_OPT_TAB_NEXT_CTL|GUIWIN_OPT_ENTER_AS_CLICK|GUIWIN_OPT_ESC_KEY_CANCEL|GUIWIN_OPT_CUSTOM_DRAWING;
// "Cancel" and "Delete" lower preset btns
app->WinInfo.Presets.LowerMask = (delFlag) ? GUIBTN_DEL_SHOW|GUIBTN_CANCEL_SHOW : GUIBTN_CANCEL_SHOW;
GuiMsgFunc = midinote_msg_handler;
init_setup_panel(GUI_WIN_SET_CONTROLS|GUI_WIN_SET_PRESET_LOWER|GUI_WIN_SET_OPTIONS|GUI_WIN_SET_BANNER_TEXT|GUI_WIN_SET_BANNER_COLOR|GUI_WIN_SET_BANNER_OPTIONS);
// Tell Midi In thread to pass each midi msg to setNotePoint()
setMidiInSiphon(&setNotePoint, 1);
}
#endif // NO_MIDI_IN_SUPPORT
// =========================================================
// Human Settings
// =========================================================
/******************** numToPitch() *********************
* Converts a MIDI note number to a note name (ie,
* nul-terminated string). For example, MIDI note number 60
* returns "C 3". Note number 61 returns "C#3", etc. (Note
* "A -2", so the first octave is -2). The
* resulting string is stored in the passed buffer (which should
* be large enough to hold at least 5 characters including nul).
*/
static unsigned char NtnNams[] = {'C',' ','C','#','D',' ','D','#','E',' ','F',' ','F','#','G',' ','G','#','A',' ','A','#','B',' ','C'};
char * numToNoteName(register char * buffer, register unsigned char noteNum)
{
register unsigned char * name;
name = &NtnNams[(noteNum % 12) << 1];
*buffer++ = *name++;
*buffer++ = *name;
if (*name != ' ') *buffer++ = ' ';
return buffer;
}
void numToPitch(void * buffer, unsigned char noteNum)
{
register unsigned char * ptr;
register unsigned char * name;
register unsigned char oct;
// save ptr
ptr = (unsigned char *)buffer;
// Get note name
name = &NtnNams[(noteNum % 12) << 1];
// Get sharp or space char after name
oct = *(name+1);
// Store note name (and incidental)
*(ptr)++ = *name;
if (oct == '#') *(ptr)++ = oct;
// Get octave
if (!(oct = noteNum/12))
{
*(ptr)++ = '-';
*(ptr)++ = '2';
}
else if (oct < 2)
{
*(ptr)++ = '-';
*(ptr)++ = '1';
}
else
*(ptr)++ = 46 + oct;
// Nul-terminate
*ptr = 0;
}
#ifndef NO_MIDI_IN_SUPPORT
static uint32_t ctl_set_split(register GUICTL * ctl)
{
BytePtr = &SplitPoint;
ReturnFunc = &doSetupScreen;
doNoteScreen((AppFlags & APPFLAG_2KEY) ? &PlayPedalStr[0] : &PlayNoteStr[0], 0);
// Not yet done setting this parameter. user must enter data..
return 0;
}
static int32_t getSplitStr(void * appdata, GUIAPPHANDLE app)
{
register unsigned char num;
if (app->Command & GUICMD_GET_STR)
{
num = SplitPoint;
wide: numToPitch((char *)app->Buffer, num);
return 0;
}
if (app->Command & GUICMD_GET_STR_WIDTH)
{
num = 61;
goto wide;
}
return 0;
}
static uint32_t ctl_set_midi_test(register GUICTL * ctl)
{
startMidiTest();
return 0;
}
#endif
// ===================================================
// Human
// ===================================================
#if !defined(NO_MIDI_OUT_SUPPORT) || !defined(NO_SEQ_OUT_SUPPORT)
static const char PlaybackStr[] = "Playback on";
#else
static const char PlaybackStr[] = "Playback";
#endif
#ifndef NO_MIDI_IN_SUPPORT
static const char CModelsStr[] = {'S','p','l','i','t',' ','P','i','a','n','o',0,'F','u','l','l',' ','P','i','a','n','o',0,
'1',' ','F','i','n','g','e','r',0, 'F','o','o','t',' ','P','e','d','a','l','s',0,
'B','r','e','a','t','h','/','W','i','n','d',0,'G','u','i','t','a','r',0,'D','r','u','m','/','P','a','d','s',0};
static const char DrumChordStrs[] = "Note\0Aftertouch\0Controller\0Program";
static const char TriggerByStr[] = "Trigger by";
static const char WindChordStrs[] = "Mouse\0Controller";
static const char MinorByStr[] = "Minor by";
static const char SensitivityStr[] = "Sensitivity";
static unsigned char TempChordTrigger;
static uint32_t ctl_set_chordtrigger(register GUICTL *);
static uint32_t ctl_set_model_triggerby(register GUICTL *);
static int32_t get_chord_vlabel(void *, GUIAPPHANDLE);
static uint32_t ctl_set_chordsens(register GUICTL *);
static uint32_t ctl_update_chordsens(register GUICTL *);
static uint32_t ctl_set_chordmodel(register GUICTL *);
static uint32_t ctl_update_chordmodel(register GUICTL *);
static uint32_t ctl_set_curve(register GUICTL *);
static uint32_t ctl_update_curve(register GUICTL *);
static uint32_t ctl_set_lower_split(register GUICTL *);
static uint32_t ctl_update_lower_split(register GUICTL *);
static uint32_t ctl_set_upper_split(register GUICTL *);
static uint32_t ctl_update_upper_split(register GUICTL *);
static int32_t getBassOctLabel(void *, GUIAPPHANDLE);
static uint32_t ctl_set_low_oct(register GUICTL *);
static uint32_t ctl_set_solo_midichan(register GUICTL *);
static uint32_t ctl_update_solo_midichan(register GUICTL *);
static uint32_t ctl_set_solo_playdev(register GUICTL *);
#endif // NO_MIDI_IN_SUPPORT
static uint32_t ctl_set_bound(register GUICTL *);
static uint32_t ctl_update_bound(register GUICTL *);
static uint32_t ctl_set_chordhold(register GUICTL *);
static uint32_t ctl_update_chordhold(register GUICTL *);;
#define HUMANCTLS &ChordsGroupCtl.Ctl
// =================== Controller
#ifndef NO_MIDI_IN_SUPPORT
static GUI_DEF_PUSH_CMD(SplitNoteCtl, getSplitStr) GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR|DRAW_ON_UPDATE, .NumOfLabels=1, .Ctl.Ptr=&ctl_set_split,
GUI_NO_NEXT_CTL()
static GUI_DEF_LABEL(SplitTextCtl, "Split\nNote:") 0, .NumOfLabels=1, .Ctl.LineNum=-1, GUI_NEXT_CTL(SplitNoteCtl)
#endif
#ifndef NO_QWERTY_PIANO
static uint32_t ctl_set_qwerty(register GUICTL *);
static uint32_t ctl_update_qwerty(register GUICTL *);
static GUICTLFUNCS QwertyFunc = {ctl_update_qwerty, ctl_set_qwerty};
static GUI_DEF_RADIO(QwertyCtl,"Off\0On\0Qwerty Piano") GUICFLAG_LABELBOX, .Ctl.Ptr=&QwertyFunc, .NumOfLabels=2,
#ifndef NO_MIDI_IN_SUPPORT
GUI_NEXT_CTL(SplitTextCtl)
#else
GUI_NO_NEXT_CTL()
#endif
static uint32_t ctl_set_qwerty(register GUICTL * ctl)
{
if (QwertyCtl.Select) AppFlags2 |= APPFLAG2_QWERTYKEYS;
else AppFlags2 &= ~APPFLAG2_QWERTYKEYS;
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_qwerty(register GUICTL * ctl)
{
return ((AppFlags2 & APPFLAG2_QWERTYKEYS) ? 1 : 0);
}
#endif // NO_QWERTY_PIANO
#ifndef NO_MIDI_IN_SUPPORT
static GUI_DEF_PUSH(MidiInTestCtl, "Test") SETFUNC_ONLY_PTR, .NumOfLabels=1, .Ctl.Ptr=&ctl_set_midi_test,
#ifndef NO_QWERTY_PIANO
GUI_NEXT_CTL(QwertyCtl)
#else
GUI_NEXT_CTL(SplitTextCtl)
#endif
static int32_t getMasterChanLabel(void * appdata, GUIAPPHANDLE);
static uint32_t ctl_update_masterchan(register GUICTL *);
static uint32_t ctl_set_masterchan(register GUICTL *);
static uint32_t ctl_update_solo_playdev(register GUICTL *);
static GUICTLFUNCS MasterChanFunc = {ctl_update_masterchan, ctl_set_masterchan};
static GUI_DEF_ARROWS_CMD(MidiInChanCtl, getMasterChanLabel, "Master Chan") 0, .Range.Low=1, .Range.High=18, .Ctl.Ptr=&MasterChanFunc,
GUI_NEXT_CTL(MidiInTestCtl)
static int32_t getMasterChanLabel(void * appdata, GUIAPPHANDLE app)
{
register unsigned char labelNum;
if (app->Command & GUICMD_GET_STR)
{
labelNum = app->StrCount;
if (labelNum > 15)
app->Buffer = (labelNum > 16 ? "Basic" : "Auto");
else
sprintf((char *)app->Buffer, "%u", labelNum + 1);
}
else if (app->Command & GUICMD_GET_STR_WIDTH)
app->Buffer = MidiInChanCtl.Heading;
return 0;
}
static uint32_t ctl_update_masterchan(register GUICTL * ctl)
{
return MasterMidiChan;
}
static uint32_t ctl_set_masterchan(register GUICTL * ctl)
{
MasterMidiChan = GuiApp->ArrowsValue;
return CTLMASK_SETCONFIGSAVE;
}
static GUI_DEF_PUSH(MidiInDevCtl, "Device") SETFUNC_ONLY_PTR, .NumOfLabels=1, .Ctl.Color=GUICOLOR_GRAY | (GUICOLOR_BLACK << 4),
.Ctl.Ptr=&ctl_set_midi_in,
GUI_NEXT_CTL(MidiInChanCtl)
static GUI_DEF_GROUPBOX(MidiInGroupCtl, "Controller", MidiInDevCtl) 0, .Ctl.LineNum=-1, GUI_NO_NEXT_CTL()
//=================== Upper Layer
static uint32_t ctl_set_curve(register GUICTL *);
static uint32_t ctl_update_curve(register GUICTL *);
static GUICTLFUNCS CurveFunc = {ctl_update_curve, ctl_set_curve};
static GUI_DEF_ARROWS(VelCurveCtl, "Normal\0Compress", "Vel Curve") 0, .Ctl.Ptr=&CurveFunc, .Range.High=1, GUI_NO_NEXT_CTL()
static uint32_t ctl_set_curve(register GUICTL * ctl)
{
VelCurve = GuiApp->ArrowsValue;
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_curve(register GUICTL * ctl)
{
return VelCurve;
}
static GUICTLFUNCS UpperFunc = {ctl_update_upper_split, ctl_set_upper_split};
static GUI_DEF_RADIO(UpperLayerCtl, "Off\0Pad\0Upper Layer") GUICFLAG_LABELBOX, .Ctl.Ptr=&UpperFunc, .NumOfLabels=2, .Ctl.LineNum=-1,
GUI_NEXT_CTL(VelCurveCtl)
//=================== Lower Split
static GUI_DEF_PUSH_CMD(OctaveCtl, getBassOctLabel) GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR, .Ctl.Ptr=&ctl_set_low_oct, .NumOfLabels=1
GUI_NO_NEXT_CTL()
static GUI_DEF_LABEL(OctaveTextCtl, "Octave:") 0, .NumOfLabels=1, GUI_NEXT_CTL(OctaveCtl)
static GUICTLFUNCS LowerFunc = {ctl_update_lower_split, ctl_set_lower_split};
static GUI_DEF_RADIO(LowSplitCtl, "Off\0Bass\0Legato Bass\0Drums") 0, .Ctl.Ptr=&LowerFunc, .NumOfLabels=4, GUI_NEXT_CTL(OctaveTextCtl)
static GUI_DEF_GROUPBOX(LowerGroupCtl, "Lower split", LowSplitCtl) 0, .Ctl.LineNum=-1, GUI_NEXT_CTL(UpperLayerCtl)
// ==================== Solo instrument
static GUICTLFUNCS SoloPlayDevFunc = {ctl_update_solo_playdev, ctl_set_solo_playdev};
static GUI_DEF_ARROWS_CMD(SoloDevCtl, getPlayDevStr, PlaybackStr) 0, .Ctl.Ptr=&SoloPlayDevFunc, .Range.High=1, GUI_NEXT_CTL(LowerGroupCtl)
static GUI_DEF_ARROWS(SoloVolCtl, 0, VolStr) GUICFLAG_NOSTRINGS|GUICFLAG_RESERVED, .Ctl.Ptr=(void *)CTLSTR_PATCHVOL, .Range.High=100,
GUI_NEXT_CTL(SoloDevCtl)
static GUICTLFUNCS SoloMidiChanFunc = {ctl_update_solo_midichan, ctl_set_solo_midichan};
static GUI_DEF_ARROWS(SoloMidiChanCtl, 0, "Channel") GUICFLAG_NOSTRINGS, .Ctl.Ptr=&SoloMidiChanFunc, .Range.Low=1, .Range.High=16,
GUI_NEXT_CTL(SoloVolCtl)
static GUI_DEF_GROUPBOX(SoloInsGroupCtl, "Solo instrument", SoloMidiChanCtl) 0, .Ctl.LineNum=-1, GUI_NEXT_CTL(MidiInGroupCtl)
#endif // NO_MIDI_IN_SUPPORT
// ==================== Chords
static GUICTLFUNCS ChordHoldFunc = {ctl_update_chordhold, ctl_set_chordhold};
static GUI_DEF_CHECK(ChordHoldCtl, "Chord Hold") 0, .Ctl.Ptr=&ChordHoldFunc, .NumOfLabels=1,
#if defined(NO_MIDI_IN_SUPPORT) && !defined(NO_QWERTY_PIANO)
GUI_NEXT_CTL(QwertyCtl)
#else
GUI_NO_NEXT_CTL()
#endif
static GUICTLFUNCS ChordBoundFunc = {ctl_update_bound, ctl_set_bound};
static GUI_DEF_ARROWS(ChordBoundCtl, "Every Beat\0Beats 1+3", "Change on") 0, .Ctl.Ptr=&ChordBoundFunc, .Range.High=1,
#ifndef NO_MIDI_IN_SUPPORT
.Ctl.LineNum=-1,
#endif
GUI_NEXT_CTL(ChordHoldCtl)
#ifndef NO_MIDI_IN_SUPPORT
static GUI_DEF_PUSH_CMD(TriggerAssignCtl, get_chord_vlabel) GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR|DRAW_ON_UPDATE,
.Ctl.Ptr=&ctl_set_model_triggerby, .NumOfLabels=1,
GUI_NEXT_CTL(ChordBoundCtl)
static GUI_DEF_LABEL(MinorPedalCtl, "Minor\nPedal:") 0, .NumOfLabels=1, GUI_NO_NEXT_CTL()
// ChordTriggerByCtl and ChordSensCtl are never simultaneously visible,
// so they can be located at the same spot
static GUICTLFUNCS ChordSensFunc = {ctl_update_chordsens, ctl_set_chordsens};
static GUI_DEF_ARROWS(ChordSensCtl, 0, SensitivityStr) GUICFLAG_NOSTRINGS, .Ctl.Ptr=&ChordSensFunc, .Range.High=6, .Range.Low=2, .Value=2,
GUI_NO_NEXT_CTL()
static GUI_DEF_ARROWS(ChordTriggerByCtl, DrumChordStrs, TriggerByStr) SETFUNC_ONLY_PTR, .Ctl.Ptr=&ctl_set_chordtrigger, .Range.High=3,
GUI_NEXT_CTL(TriggerAssignCtl)
static GUICTLFUNCS ChordModelFunc = {ctl_update_chordmodel, ctl_set_chordmodel};
static GUI_DEF_ARROWS(ChordModelCtl, CModelsStr, "Model:") 0, .Ctl.Ptr=&ChordModelFunc, .Range.High=6, GUI_NEXT_CTL(ChordTriggerByCtl)
#endif // NO_MIDI_IN_SUPPORT
#ifndef NO_MIDI_IN_SUPPORT
static GUI_DEF_GROUPBOX(ChordsGroupCtl, "Chords", ChordModelCtl) 0, GUI_NEXT_CTL(SoloInsGroupCtl)
#else
static GUI_DEF_GROUPBOX(ChordsGroupCtl, "Chords", ChordBoundCtl) 0, GUI_NO_NEXT_CTL()
#endif
#ifndef NO_MIDI_IN_SUPPORT
/**************** ctl_set_wndmodel_mousebtn() *********************
* Called when user clicks on the value button for "Wind" or
* "Drum pads" chord models to set Controller #.
*/
// Sets the mouse btn # used by Wind controller chord model's "Minor by"
static uint32_t ctl_set_wndmodel_mousebtn(register GUICTL * ctl)
{
doMouseChordBtn();
SaveConfigFlag |= SAVECONFIG_OTHER;
return 0;
}
static void showChordParams(void)
{
register uint32_t hideFlag;
hideFlag = 0;
// Only Drums and Wind models use ChordTriggerByCtl/MinorBy. Other models will
// either use the Sensitivity ctl, or no other ctl
if (AppFlags & (APPFLAG_DRUMPAD|APPFLAG_WINDCTL))
{
ChordModelCtl.Ctl.Next = &ChordTriggerByCtl.Ctl;
ChordTriggerByCtl.Ctl.Next = &TriggerAssignCtl.Ctl;
TriggerAssignCtl.Ctl.Ptr = ctl_set_model_triggerby;
if (AppFlags & APPFLAG_DRUMPAD)
{
ChordTriggerByCtl.Heading = &TriggerByStr[0];
ChordTriggerByCtl.Ctl.Label = &DrumChordStrs[0];
ChordTriggerByCtl.Range.High=3;
// If "Trigger by" != "Controller" (2), then DON'T show the VALUE button
if (ChordTriggerByCtl.Value != 2) ChordTriggerByCtl.Ctl.Next = &ChordBoundCtl.Ctl;
}
else
{
ChordTriggerByCtl.Heading = &MinorByStr[0];
ChordTriggerByCtl.Ctl.Label = &WindChordStrs[0];
ChordTriggerByCtl.Range.High=2;
if (ChordTriggerByCtl.Value >= 2) ChordTriggerByCtl.Value = 1;
if (!ChordTriggerByCtl.Value) TriggerAssignCtl.Ctl.Ptr = ctl_set_wndmodel_mousebtn;
}
}
// Foot Pedals and 1 Finger don't use Sensitivity
else if (AppFlags & APPFLAG_1FINGER)
ChordModelCtl.Ctl.Next = &ChordBoundCtl.Ctl;
// Foot pedals has a "Minor Pedal" setting
else if (AppFlags & APPFLAG_2KEY)
{
ChordModelCtl.Ctl.Next = &MinorPedalCtl.Ctl;
TriggerAssignCtl.Ctl.Ptr = ctl_set_split;
// Remove "Split Note" ctl
hideFlag = GUICFLAG_HIDE|GUICFLAG_VALUE_CHANGE;
}
// All other models use Sensitivity
else
ChordModelCtl.Ctl.Next = &ChordSensCtl.Ctl;
if ((SplitTextCtl.Ctl.Flags & GUICFLAG_HIDE) != hideFlag)
{
GuiCtlUpdate(GuiApp, MainWin, &SplitTextCtl.Ctl, hideFlag);
GuiCtlUpdate(GuiApp, MainWin, &SplitNoteCtl.Ctl, hideFlag);
}
// Updating the groupbox updates all its ctls
ctl_update_full_ctl(&ChordsGroupCtl.Ctl);
}
static uint32_t ctl_set_chordtrigger(register GUICTL * ctl)
{
showChordParams();
return CTLMASK_SETCONFIGSAVE;
}
/**************** ctl_set_model_triggerby() *********************
* Called when user clicks on the value button for "Wind" or
* "Drum pads" chord models to set a Controller #.
*/
static uint32_t ctl_set_model_triggerby(register GUICTL * ctl)
{
if (!doNumeric("Enter value 0 to 127", 0, 127) && GuiApp->NumpadValue < 128)
{
TempChordTrigger = (unsigned char)GuiApp->NumpadValue;
SaveConfigFlag |= SAVECONFIG_OTHER;
}
// doSetupScreen();
return 0;
}
static int32_t get_chord_vlabel(void * appdata, GUIAPPHANDLE app)
{
if (app->Command & GUICMD_GET_STR)
{
register const char * str;
register char ctlNum;
// Bass pedals has a "Minor Pedal" setting (which sets SplitNote)
if (AppFlags & APPFLAG_2KEY)
{
numToPitch((char *)app->Buffer, SplitPoint);
goto ret0;
}
if ((AppFlags & APPFLAG_WINDCTL) && !ChordTriggerByCtl.Value)
{
app->SelectedSubCtl = 1;
goto ret;
}
ctlNum = TempChordTrigger < 127 ? TempChordTrigger : 64;
sprintf((char *)app->Buffer, "%u", ctlNum);
if ((str = getGmCtl(ctlNum)))
sprintf((char *)app->Buffer + strlen(app->Buffer), " (%s)", str);
}
else if (app->Command & GUICMD_GET_STR_WIDTH)
{
app->SelectedSubCtl = 0;
ret: formatMouseBtnLabel((char *)app->Buffer, 1);
}
ret0:
return 0;
}
static uint32_t ctl_set_chordsens(register GUICTL * ctl)
{
setChordSensitivity(ChordSensCtl.Value + 1);
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_chordsens(register GUICTL * ctl)
{
return setChordSensitivity(0xff) - 1;
}
static uint32_t ctl_set_chordmodel(register GUICTL * ctl)
{
register unsigned char val;
AppFlags &= ~(APPFLAG_2KEY|APPFLAG_1FINGER|APPFLAG_WINDCTL|APPFLAG_GTRCHORD|APPFLAG_FULLKEY|APPFLAG_DRUMPAD);
clearChord(0|GUITHREADID);
if ((val = ChordModelCtl.Value))
AppFlags |= (APPFLAG_FULLKEY << (val - 1));
val = (AppFlags & APPFLAG_GTRCHORD) ? 3 : 1;
if (AppFlags & APPFLAG_FULLKEY) val = 2;
setChordSensitivity(val);
ctl_update_chordsens(&ChordSensCtl.Ctl);
showChordParams();
// Done setting this parameter. Let caller redraw the ctl
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_chordmodel(register GUICTL * ctl)
{
register unsigned char val, flags;
val = 0;
if ((flags = (AppFlags & (APPFLAG_2KEY|APPFLAG_1FINGER|APPFLAG_WINDCTL|APPFLAG_GTRCHORD|APPFLAG_FULLKEY|APPFLAG_DRUMPAD))))
{
flags >>= 1;
do
{
val++;
flags >>= 1;
} while (!(flags & 0x01));
}
ChordModelCtl.Value = val;
showChordParams();
return val;
}
static uint32_t ctl_set_lower_split(register GUICTL * ctl)
{
AppFlags &= ~(APPFLAG_BASS_LEGATO|APPFLAG_BASS_ON);
AppFlags |= LowSplitCtl.Select;
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_lower_split(register GUICTL * ctl)
{
return (AppFlags & (APPFLAG_BASS_LEGATO|APPFLAG_BASS_ON));
}
static uint32_t ctl_set_upper_split(register GUICTL * ctl)
{
AppFlags4 &= ~APPFLAG4_UPPER_PAD;
if (UpperLayerCtl.Select) AppFlags4 |= APPFLAG4_UPPER_PAD;
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_upper_split(register GUICTL * ctl)
{
return (AppFlags4 & APPFLAG4_UPPER_PAD) ? 1 : 0;
}
static int32_t getBassOctLabel(void * appdata, GUIAPPHANDLE app)
{
register char labelNum;
if (app->Command & GUICMD_GET_STR_WIDTH)
{
labelNum = -5;
goto wide;
}
if (app->Command & GUICMD_GET_STR)
{
labelNum = (BassOct - 28) / 12;
wide: sprintf((char *)app->Buffer, "%d", labelNum);
}
return 0;
}
static uint32_t ctl_set_low_oct(register GUICTL * ctl)
{
BytePtr = (unsigned char *)&BassOct;
ReturnFunc = &doSetupScreen;
doNoteScreen("Play the note on your controller where you want the bass low E to sound.", 0);
return 0;
}
static uint32_t ctl_set_solo_midichan(register GUICTL * ctl)
{
RobotInfo[MUSICIAN_SOLO].MidiChan = SoloMidiChanCtl.Value;
updChansInUse();
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_solo_midichan(register GUICTL * ctl)
{
return RobotInfo[MUSICIAN_SOLO].MidiChan;
}
#endif
static uint32_t ctl_set_bound(register GUICTL * ctl)
{
ChordBoundary = (ChordBoundCtl.Value ? 24*2 : 24);
// Done setting this parameter. Let caller redraw the ctl
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_bound(register GUICTL * ctl)
{
return ChordBoundary != 24;
}
static uint32_t ctl_set_chordhold(register GUICTL * ctl)
{
AppFlags4 &= ~APPFLAG4_NOCHORDHOLD;
if (!ChordHoldCtl.SelectMask) AppFlags |= APPFLAG4_NOCHORDHOLD;
return clearChord(2|GUITHREADID) | CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_chordhold(register GUICTL * ctl)
{
return (AppFlags4 & APPFLAG4_NOCHORDHOLD) ? 0 : 1;
}
// =============================================================
// General settings
// =============================================================
static GUI_DEF_LABEL(VersionCtl, VERSIONSTRING) GUICFLAG_SMALLTEXT,
.NumOfLabels=1
GUI_NO_NEXT_CTL()
static uint32_t ctl_update_flash(register GUICTL *);
static uint32_t ctl_set_flash(register GUICTL *);
static GUICTLFUNCS FlashFunc = {ctl_update_flash, ctl_set_flash};
static GUI_DEF_CHECK(FlashErrCtl, "Flash error") 0, .Ctl.Ptr=&FlashFunc, .NumOfLabels=1, GUI_NEXT_CTL(VersionCtl)
static uint32_t ctl_update_flash(register GUICTL * ctl)
{
return (AppFlags2 & APPFLAG2_TIMED_ERR) ? 1 : 0;
}
static uint32_t ctl_set_flash(register GUICTL * ctl)
{
AppFlags2 &= ~APPFLAG2_TIMED_ERR;
if (FlashErrCtl.SelectMask) AppFlags2 |= APPFLAG2_TIMED_ERR;
// Done setting this parameter. Let caller redraw the ctl
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_click(register GUICTL *);
static uint32_t ctl_set_click(register GUICTL *);
static GUICTLFUNCS ClickFunc = {ctl_update_click, ctl_set_click};
static GUI_DEF_ARROWS(ClickDelayCtl, 0, "Click delay") GUICFLAG_NOSTRINGS,
.Ctl.LineNum=-1,
.Ctl.Ptr=&ClickFunc,
.Range.High=255, .Range.Low=1, .Value=GUI_CLICKDELAY,
GUI_NEXT_CTL(FlashErrCtl)
static uint32_t ctl_update_click(register GUICTL * ctl)
{
return GuiApp->ClickDelay;
}
static uint32_t ctl_set_click(register GUICTL * ctl)
{
GuiApp->ClickDelay = (unsigned char)ClickDelayCtl.Value;
// Done setting this parameter. Let caller redraw the ctl
return CTLMASK_SETCONFIGSAVE;
}
unsigned char get_click_delay(void)
{
return (unsigned char)ClickDelayCtl.Value;
}
void set_click_delay(register unsigned char val)
{
ClickDelayCtl.Value = val;
ctl_set_click(0);
}
// ================= Reverb
#ifndef NO_REVERB_SUPPORT
static uint32_t ctl_set_revparam(register GUICTL * ctl)
{
setReverbParam(((GUICTL_ARROWS *)ctl)->Value, 0x00000001 << ctl->IdNumber);
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_get_revparam(register GUICTL * ctl)
{
return getReverbParam(0x00000001 << ctl->IdNumber);
}
static GUICTLFUNCS ReverbParamFuncs = {&ctl_get_revparam, &ctl_set_revparam};
static GUI_DEF_ARROWS(RevDampingCtl, 0, "Damping Freq") GUICFLAG_NOSTRINGS,
.Range.High=100,
.Ctl.IdNumber = REVPARAM_DAMPINGFREQ,
.Ctl.Ptr=&ReverbParamFuncs,
GUI_NO_NEXT_CTL()
static GUI_DEF_ARROWS(RevPreDelayCtl,0,"Pre-Delay") GUICFLAG_NOSTRINGS, .Range.High=100,
.Ctl.Ptr=&ReverbParamFuncs,
.Ctl.IdNumber = REVPARAM_PREDELAY,
GUI_NEXT_CTL(RevDampingCtl)
static GUI_DEF_ARROWS(RevDecayCtl, 0, "Decay") GUICFLAG_NOSTRINGS, .Range.High=100,
.Ctl.LineNum=-1,
.Ctl.Ptr=&ReverbParamFuncs,
.Ctl.IdNumber = REVPARAM_DECAY,
GUI_NEXT_CTL(RevPreDelayCtl)
static GUI_DEF_ARROWS(RevEarlyCtl, 0, "Early reflect") GUICFLAG_NOSTRINGS, .Range.High=100,
.Ctl.Ptr=&ReverbParamFuncs,
.Ctl.IdNumber = REVPARAM_EARLYLATE,
GUI_NEXT_CTL(RevDecayCtl)
static GUI_DEF_ARROWS(RevSizeCtl, 0, "Room Size") GUICFLAG_NOSTRINGS, .Range.High=100,
.Ctl.Ptr=&ReverbParamFuncs,
.Ctl.IdNumber = REVPARAM_SIZE,
GUI_NEXT_CTL(RevEarlyCtl)
static GUI_DEF_ARROWS(RevVolCtl, 0, VolStr) GUICFLAG_RESERVED|GUICFLAG_NOSTRINGS, .Range.High=100,
.Ctl.Ptr=(void *)CTLSTR_REVERBVOL,
.Ctl.IdNumber = REVPARAM_REVLEVEL,
GUI_NEXT_CTL(RevSizeCtl)
static GUI_DEF_CHECK(RevOnCtl, "Enable") GUICFLAG_RESERVED,
.Ctl.Ptr=(void *)CTLSTR_REVERBMUTE,
.NumOfLabels=1,
.SelectMask=1,
GUI_NEXT_CTL(RevVolCtl)
static GUI_DEF_GROUPBOX(RevGroupCtl, ReverbStr, RevOnCtl) 0, .Ctl.LineNum=-1, GUI_NEXT_CTL(ClickDelayCtl)
#endif
// ================= Flash Err, Clock
static uint32_t ctl_update_clock(register GUICTL *);
static uint32_t ctl_set_clock(register GUICTL *);
static GUICTLFUNCS ClockFunc = {ctl_update_clock, ctl_set_clock};
#ifndef NO_MIDICLOCK_IN
static GUI_DEF_ARROWS(ClockSrcCtl, "Normal\0Fast\0Fastest\0MIDI", "Clock") 0,
#else
static GUI_DEF_ARROWS(ClockSrcCtl, "Normal\0Fast\0Fastest", "Clock") 0,
#endif
#ifndef NO_MIDICLOCK_IN
.Range.High=3,
#else
.Range.High=2,
#endif
.Ctl.Ptr=&ClockFunc,
#ifndef NO_REVERB_SUPPORT
GUI_NEXT_CTL(RevGroupCtl)
#else
GUI_NEXT_CTL(ClickDelayCtl)
#endif
static uint32_t ctl_update_clock(register GUICTL * ctl)
{
return (AppFlags2 & APPFLAG2_CLOCKMASK);
}
static uint32_t ctl_set_clock(register GUICTL * ctl)
{
AppFlags2 = (AppFlags2 & ~APPFLAG2_CLOCKMASK) | ClockSrcCtl.Value;
set_clock_type();
// Done setting this parameter. Let caller redraw the ctl
return CTLMASK_SETCONFIGSAVE;
}
// ================= Master
static GUI_DEF_ARROWS(MasterTransposeCtl, &TransStr[10], TransStr) GUICFLAG_RESERVED,
.Ctl.Ptr=(void *)CTLSTR_TRANSPOSE,
.Range.High=9,
GUI_NO_NEXT_CTL()
static GUI_DEF_ARROWS(MasterVolCtl, 0, VolStr) GUICFLAG_RESERVED|GUICFLAG_NOSTRINGS,
.Ctl.IdNumber=15,
.Ctl.Ptr=(void *)CTLSTR_MASTERVOL,
.Range.High=100,
GUI_NEXT_CTL(MasterTransposeCtl)
static GUI_DEF_GROUPBOX(MasterGroupCtl, "Master", MasterVolCtl) 0, .Ctl.LineNum=-1, GUI_NEXT_CTL(ClockSrcCtl)
// ================= Playback Devs
#if !defined(NO_MIDI_OUT_SUPPORT) || !defined(NO_SEQ_OUT_SUPPORT)
static GUI_DEF_PUSH(MidiOutDev4Ctl, "External\nSynth 4") GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR,
.Ctl.IdNumber=3,
.Ctl.Ptr=&ctl_set_midiout_dev,
.NumOfLabels=1
GUI_NO_NEXT_CTL()
static GUI_DEF_PUSH(MidiOutDev3Ctl, "External\nSynth 3") GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR,
.Ctl.IdNumber=2,
.Ctl.Ptr=&ctl_set_midiout_dev,
.NumOfLabels=1,
GUI_NEXT_CTL(MidiOutDev4Ctl)
static GUI_DEF_PUSH(MidiOutDev2Ctl, "External\nSynth 2") GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR,
.Ctl.IdNumber=1,
.Ctl.Ptr=&ctl_set_midiout_dev,
.NumOfLabels=1,
GUI_NEXT_CTL(MidiOutDev3Ctl)
static GUI_DEF_PUSH(MidiOutDev1Ctl, "External\nSynth 1") SETFUNC_ONLY_PTR,
.Ctl.Ptr=&ctl_set_midiout_dev,
.NumOfLabels=1,
GUI_NEXT_CTL(MidiOutDev2Ctl)
#endif
#if !defined(NO_ALSA_AUDIO_SUPPORT) || !defined(NO_JACK_SUPPORT)
#if defined(NO_MIDI_OUT_SUPPORT) && defined(NO_SEQ_OUT_SUPPORT)
#define GLOBALCTLS &IntSynthTextCtl.Ctl
static GUI_DEF_PUSH(IntSynthCtl, "Playback\nDevice") GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR,
.Ctl.Ptr=&ctl_set_intsynth_dev,
.NumOfLabels=1,
GUI_NEXT_CTL(MasterGroupCtl)
static GUI_DEF_LABEL(IntSynthTextCtl, "Internal Synth:") 0,
.NumOfLabels=1,
GUI_NEXT_CTL(IntSynthCtl)
#else
static GUI_DEF_PUSH(IntSynthCtl, "Internal\nSynth") GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR,
.Ctl.Ptr=&ctl_set_intsynth_dev,
.NumOfLabels=1,
GUI_NEXT_CTL(MidiOutDev1Ctl)
#define GLOBALCTLS &PlayDevGroupCtl.Ctl
#if defined(NO_ALSA_AUDIO_SUPPORT) && defined(NO_JACK_SUPPORT)
#define PLAYDEV1CTL MidiOutDev1Ctl
#else
#define PLAYDEV1CTL IntSynthCtl
#endif
static GUI_DEF_GROUPBOX(PlayDevGroupCtl, "Playback Devices", PLAYDEV1CTL) 0, GUI_NEXT_CTL(MasterGroupCtl)
#endif
#endif
static void updateBussBtns(void)
{
register GUICTL * ctl;
register SOUNDDEV * sounddev;
register unsigned char color, flag;
flag = 0;
#if !defined(NO_ALSA_AUDIO_SUPPORT) || !defined(NO_JACK_SUPPORT)
sounddev = getNextAudioOutDev(0);
color = (sounddev->Handle && sounddev->DevType) ? GUICOLOR_LIGHTBLUE | (GUICOLOR_BLACK << 4) : GUICOLOR_GRAY | (GUICOLOR_BLACK << 4);
if (IntSynthCtl.Ctl.Color != color)
{
flag = 1;
IntSynthCtl.Ctl.Color = color;
}
#endif
#if !defined(NO_SEQ_IN_SUPPORT) && !defined(NO_MIDI_IN_SUPPORT)
sounddev = getNextMidiInDev(0);
color = (sounddev->Handle && sounddev->DevType) ? GUICOLOR_LIGHTBLUE | (GUICOLOR_BLACK << 4) : GUICOLOR_GRAY | (GUICOLOR_BLACK << 4);
if (MidiInDevCtl.Ctl.Color != color)
{
flag = 1;
MidiInDevCtl.Ctl.Color = color;
}
#endif
#if !defined(NO_SEQ_OUT_SUPPORT) && !defined(NO_MIDI_OUT_SUPPORT)
sounddev = 0;
ctl = &MidiOutDev1Ctl.Ctl;
while (ctl && /* ctl->Ptr == &MidiOutFunc && */ (sounddev = getNextMidiOutDev(sounddev)))
{
color = (sounddev->Handle && sounddev->DevType) ? GUICOLOR_LIGHTBLUE | (GUICOLOR_BLACK << 4) : GUICOLOR_GRAY | (GUICOLOR_BLACK << 4);
if (ctl->Color != color)
{
flag <<= 1;
flag |= 1;
ctl->Color = color;
}
ctl = ctl->Next;
}
#endif
if (flag) clearMainWindow();
}
#ifndef NO_REVERB_SUPPORT
void updateReverbCtls(void)
{
if (APPFLAG3_NOREVERB & AppFlags3)
{
// if (!RevOnCtl.Ctl.Next) goto out;
RevOnCtl.SelectMask = 0;
RevOnCtl.Ctl.Next = 0;
}
else
{
register GUICTL * ctl;
RevOnCtl.SelectMask = 1;
// if (RevOnCtl.Ctl.Next) goto out;
RevOnCtl.Ctl.Next = ctl = &RevVolCtl.Ctl;
do
{
ctl_get_revparam(ctl);
} while ((ctl = ctl->Next));
}
ctl_update_full_ctl(&RevGroupCtl.Ctl);
}
#endif
// ===================================================
// Commands
// ===================================================
static uint32_t actionsListFunc(register GUICTL *);
#ifndef NO_MIDI_IN_SUPPORT
static void update_cmd_ctls(void);
#endif
#ifndef NO_MIDI_IN_SUPPORT
static const char CmdNoteStr1[] = "Play the key that will switch into command mode. (Typically, the lowest note.) Or click delete to disable command mode.";
static const char CmdNoteStr2[] = "Play the key that will split your controller between chords and commands. (Typically, the center note.) Or click delete to disable command mode.";
uint32_t ctl_set_cmd_switch(register GUICTL * ctl)
{
BytePtr = &CmdSwitchNote;
ReturnFunc = &enterSetupScreen;
doNoteScreen((MasterMidiChan > 15 ? &CmdNoteStr1[0] : &CmdNoteStr2[0]), 1);
return 0;
}
static int32_t getCmdSwitchStr(void * appdata, GUIAPPHANDLE app)
{
register unsigned char labelNum;
if (app->Command & GUICMD_GET_STR_WIDTH)
{
labelNum = 61;
goto wide;
}
if (app->Command & GUICMD_GET_STR)
{
labelNum = CmdSwitchNote;
if (labelNum > 127)
app->Buffer = "Off";
else
wide: numToPitch((char *)app->Buffer, labelNum);
}
return 0;
}
#endif
static GUI_DEF_LIST(ActionsCtl, drawActionsList) GUICFLAG_SMALLTEXT|SETFUNC_ONLY_PTR,
.Ctl.LineNum=-1,
.Ctl.Ptr=&actionsListFunc,
GUI_NO_NEXT_CTL()
static uint32_t ctl_set_erase1(register GUICTL * ctl)
{
eraseSelAction();
return 0;
}
#ifndef NO_MIDI_IN_SUPPORT
// ===========================
// -----------------------------
// Command menu bar on/off
static uint32_t ctl_update_cmd_always(register GUICTL *);
static uint32_t ctl_set_cmd_always(register GUICTL *);
static GUICTLFUNCS CmdOnFunc = {ctl_update_cmd_always, ctl_set_cmd_always};
static GUI_DEF_CHECK(AlwaysOnCtl, "Always on") GUICFLAG_SMALLTEXT,
.Ctl.Ptr=&CmdOnFunc,
.NumOfLabels=1
GUI_NO_NEXT_CTL()
static uint32_t ctl_update_cmd_always(register GUICTL * ctl)
{
return (AppFlags4 & APPFLAG4_CMD_ALWAYS_ON) ? 1 : 0;
}
static uint32_t ctl_set_cmd_always(register GUICTL * ctl)
{
AppFlags4 &= ~APPFLAG4_CMD_ALWAYS_ON;
if (AlwaysOnCtl.SelectMask) AppFlags4 |= APPFLAG4_CMD_ALWAYS_ON;
endCmdMode();
return CTLMASK_SETCONFIGSAVE;
}
// --------------------------
// Tool tips
static uint32_t ctl_update_tooltips(register GUICTL *);
static uint32_t ctl_set_tooltips(register GUICTL *);
static GUICTLFUNCS TooltipsFunc = {ctl_update_tooltips, ctl_set_tooltips};
static GUI_DEF_CHECK(TooltipsCtl, "Statusbar") GUICFLAG_SMALLTEXT|GUICFLAG_OFF_AS_ON,
.Ctl.Ptr=&TooltipsFunc,
.NumOfLabels=1,
.Ctl.Next = &AlwaysOnCtl.Ctl
};
static uint32_t ctl_update_tooltips(register GUICTL * ctl)
{
return (AppFlags4 & APPFLAG4_CMD_NOSTATUSBAR) ? 1 : 0;
}
static uint32_t ctl_set_tooltips(register GUICTL * ctl)
{
AppFlags4 &= ~APPFLAG4_CMD_NOSTATUSBAR;
if (TooltipsCtl.SelectMask) AppFlags4 |= APPFLAG4_CMD_NOSTATUSBAR;
return CTLMASK_SETCONFIGSAVE;
}
// --------------------------
// Set Command note
static GUI_DEF_PUSH_CMD(CmdSwitchCtl, getCmdSwitchStr) GUICFLAG_NOPADDING|GUICFLAG_SMALLTEXT|SETFUNC_ONLY_PTR|DRAW_ON_UPDATE,
.Ctl.Ptr=&ctl_set_cmd_switch,
.NumOfLabels=1,
GUI_NEXT_CTL(TooltipsCtl)
static GUI_DEF_LABEL(SwitchNoteTextCtl, "Switch\nNote:") 0,
.NumOfLabels=1,
GUI_NEXT_CTL(CmdSwitchCtl)
static GUI_DEF_GROUPBOX(CmdGroupCtl, "Command notes", SwitchNoteTextCtl) 0,
.Ctl.LineNum=-1,
GUI_NEXT_CTL(ActionsCtl)
#endif
static GUI_DEF_PUSH(RemAssignCtl, "Remove\nAssignment") GUICFLAG_NOPADDING|SETFUNC_ONLY_PTR,
.Ctl.LineNum=-1,
.Ctl.Ptr=&ctl_set_erase1,
.NumOfLabels=1,
#ifndef NO_MIDI_IN_SUPPORT
GUI_NEXT_CTL(CmdGroupCtl)
#else
GUI_NEXT_CTL(ActionsCtl)
#endif
static GUI_DEF_LABEL(AssignedToCtl, "Assigned:") GUICFLAG_SMALLTEXT,
.NumOfLabels=1,
GUI_NEXT_CTL(RemAssignCtl)
static uint32_t ctl_update_list_asn(register GUICTL *);
static uint32_t ctl_set_list_asn(register GUICTL *);
static GUICTLFUNCS AsnListFunc = {ctl_update_list_asn, ctl_set_list_asn};
#ifndef NO_MIDI_IN_SUPPORT
static GUI_DEF_RADIO(CmdCategoryCtl, "Mouse Button\0PC Key\0Midi Knob\0Midi Note\0Assign action to") GUICFLAG_LABELBOX|GUICFLAG_SMALLTEXT,
.NumOfLabels=4,
#else
static GUI_DEF_RADIO(CmdCategoryCtl, "Mouse Button\0PC Key\0Assign action to") GUICFLAG_LABELBOX|GUICFLAG_SMALLTEXT,
.NumOfLabels=2,
#endif
.Ctl.Ptr=&AsnListFunc,
GUI_NEXT_CTL(AssignedToCtl)
static uint32_t ctl_update_list_asn(register GUICTL * ctl)
{
return CmdCategoryCtl.Select;
}
static uint32_t ctl_set_list_asn(register GUICTL * ctl)
{
chooseActionsList(CmdCategoryCtl.Select);
resetActionsList(&ActionsCtl);
#ifndef NO_MIDI_IN_SUPPORT
update_cmd_ctls();
#endif
// GuiApp->Command = GUIMSG_ACTION_CLICK;
actionsListFunc(&ActionsCtl.Ctl);
ctl_update_full_ctl(&ActionsCtl.Ctl);
return 1;
}
#define CMDCTLS &CmdCategoryCtl.Ctl
static unsigned char AsnFlags;
static void draw_helpbox(void)
{
if (GuiApp->DrawFlags & GUIWFLAG_DRAW_CUSTOM)
{
GUIBOX box;
register unsigned char flags;
flags = AsnFlags;
// Clear the area where we display the assignment. We
// don't need to do this if the entire win is already erased
box.Left = AssignedToCtl.Ctl.X + AssignedToCtl.Ctl.Width + GuiGetMetric(GuiApp, GUIMETRIC_XSPACE);
box.Right = GuiApp->DrawParams.FreeArea.Width;
box.Top = AssignedToCtl.Ctl.Y + GuiApp->DrawParams.FreeArea.Top;
box.Bottom = box.Top + AssignedToCtl.Ctl.Height;
if ((flags & 0x01) && !(GuiApp->DrawFlags & GUIWFLAG_DRAW_BACKGROUND))
GuiWinRect(GuiApp, &box, GUIRECT_USE_RIGHT_BOTTOM);
GuiTextSetColor(GuiApp, GUICOLOR_BLACK);
GuiTextSetSmall(GuiApp, MainWin);
AsnFlags = (drawActionAssign(box.X, box.Y) ? 0x01 : 0x00);
// Do the same for help description
box.Top = box.Bottom;
box.Left = AssignedToCtl.Ctl.X;
box.Bottom = ActionsCtl.Ctl.Y - GuiGetMetric(GuiApp, GUIMETRIC_LINEHEIGHT) + AssignedToCtl.Ctl.Height;
if ((flags & 0x02) && !(GuiApp->DrawFlags & GUIWFLAG_DRAW_BACKGROUND))
GuiWinRect(GuiApp, &box, GUIRECT_USE_RIGHT_BOTTOM);
if (makeAsnHelpStr())
{
AsnFlags |= 0x02;
GuiTextDrawMsg(GuiApp, (char *)TempBuffer, &box, GUICOLOR_VIOLET|GUIDRAW_SMALLTEXT);
}
}
}
/**************** actionsListFunc() *******************
* Called by cmdasn_msg_handler() to handle a mouse
* event upon the Actions List control.
*/
static uint32_t actionsListFunc(register GUICTL * ctl)
{
register uint32_t cmd;
cmd = GuiApp->Command;
if (GuiMsgIsValueChange(cmd))
{
// Make sure user didn't click on a category
checkForCatSelection();
// Cause draw_helpbox() to be called upon next window draw
GuiWinUpdate(GuiApp, MainWin, GUIWFLAG_DRAW_CUSTOM);
}
if (GuiMsgActionIs(cmd, GUIMSG_ACTION_LIST_DONE))
{
switch (CmdCategoryCtl.Select)
{
#ifndef NO_MIDI_IN_SUPPORT
case 3:
doMidiNoteAsn();
break;
case 2:
doMidiMsgAsn();
break;
#endif
case 1:
doPcKeyAsn();
break;
case 0:
doMouseBtnAsn();
}
}
return CTLMASK_NONE;
}
#ifndef NO_MIDI_IN_SUPPORT
static void update_cmd_ctls(void)
{
// Hide the "Command Note" related controls if user not displaying Command note listing
if (CmdCategoryCtl.Select == 3)
{
if (RemAssignCtl.Ctl.Next != &CmdGroupCtl.Ctl)
{
RemAssignCtl.Ctl.Next = &CmdGroupCtl.Ctl;
upd: clearMainWindowNoSize();
}
}
else if (RemAssignCtl.Ctl.Next == &CmdGroupCtl.Ctl)
{
RemAssignCtl.Ctl.Next = &ActionsCtl.Ctl;
goto upd;
}
}
#endif
static void cmdasn_msg_handler(void)
{
if (GuiApp->Command == (GUIMSG_TYPE_WINDOW|GUIMSG_ACTION_WINDOW_DRAW))
draw_helpbox();
// One of the preset btns
else
setup_msg_handler();
}
// ============================================================
// Robots settings
// ============================================================
static uint32_t ctl_set_polarity(register GUICTL *);
static uint32_t ctl_update_patch_chg(register GUICTL *);
static uint32_t ctl_set_patch_chg(register GUICTL *);
static uint32_t set_playdev_assign(register GUICTL_ARROWS *, register uint32_t);
static uint32_t ctl_set_robot_playdev(register GUICTL *);
static uint32_t ctl_update_robot_playdev(register GUICTL *);
static uint32_t ctl_set_robot_midichan(register GUICTL *);
static uint32_t ctl_update_robot_midichan(register GUICTL *);
static uint32_t ctl_set_CurrentRobot(register GUICTL *);
static uint32_t ctl_set_robot_mute(register GUICTL *);
static uint32_t ctl_update_robot_mute(register GUICTL *);
static uint32_t ctl_update_autostart(register GUICTL *);
static uint32_t ctl_set_autostart(register GUICTL *);
static uint32_t ctl_update_polarity(register GUICTL *);
static GUICTLFUNCS PatchChgFunc = {ctl_update_patch_chg, ctl_set_patch_chg};
static GUICTLFUNCS AutostartFunc = {ctl_update_autostart, ctl_set_autostart};
static GUICTLFUNCS HHPolFunc = {ctl_update_polarity, ctl_set_polarity};
static GUICTLFUNCS RobotMuteFunc = {ctl_update_robot_mute, ctl_set_robot_mute};
static GUICTLFUNCS RobotPlayDevFunc = {ctl_update_robot_playdev, ctl_set_robot_playdev};
static GUICTLFUNCS RobotMidiChanFunc = {ctl_update_robot_midichan, ctl_set_robot_midichan};
// ==================Individual robot settings
static GUI_DEF_RADIO(PolarityCtl, "Pos\0Neg\0HiHat Polarity") GUICFLAG_LABELBOX,
.Ctl.Ptr=&HHPolFunc,
.NumOfLabels=2
GUI_NO_NEXT_CTL()
static GUI_DEF_ARROWS_CMD(RobotDevCtl, getPlayDevStr, PlaybackStr) 0,
.Ctl.LineNum=-1,
.Ctl.Ptr=&RobotPlayDevFunc,
.Range.High=1,
GUI_NEXT_CTL(PolarityCtl)
static GUI_DEF_ARROWS(RobotVolCtl,0, VolStr) GUICFLAG_NOSTRINGS|GUICFLAG_RESERVED,
.Ctl.Ptr=(void *)CTLSTR_DRUMVOL,
.Range.High=100,
GUI_NEXT_CTL(RobotDevCtl)
static GUI_DEF_CHECK(RobotMuteCtl, "Mute robot") 0,
.Ctl.Ptr=&RobotMuteFunc,
.NumOfLabels=1,
GUI_NEXT_CTL(RobotVolCtl)
static GUI_DEF_ARROWS(RobotChanCtl, 0, "Channel") GUICFLAG_NOSTRINGS,
.Ctl.LineNum=-1,
.Ctl.Ptr=&RobotMidiChanFunc,
.Range.Low=1, .Range.High=16,
GUI_NEXT_CTL(RobotMuteCtl)
static GUI_DEF_RADIO(RobotNameCtl, MusicianNameStrs) SETFUNC_ONLY_PTR,
.Ctl.Ptr=&ctl_set_CurrentRobot,
.NumOfLabels=NUM_OF_ROBOTS,
// .Select=0,
GUI_NEXT_CTL(RobotChanCtl)
static GUI_DEF_GROUPBOX(RobotGroupCtl, "Robot", RobotNameCtl) 0, .Ctl.LineNum=-1, GUI_NO_NEXT_CTL()
static GUI_DEF_CHECK(VarCycleCtl, "Variation Cycle") GUICFLAG_RESERVED|GUICFLAG_OFF_AS_ON,
.Ctl.Ptr=(void *)CTLSTR_CYCLEVARIATION,
.NumOfLabels=1,
GUI_NEXT_CTL(RobotGroupCtl)
static GUI_DEF_ARROWS(PgmChangeCtl, "Always\0When stopped\0Manually\0Articulations\0Instruments", "Change") GUICFLAG_LABELBOX,
.Ctl.Ptr=&PatchChgFunc,
.Range.High=3,
GUI_NEXT_CTL(VarCycleCtl)
static GUI_DEF_ARROWS(AutoStartCtl, "Off\0On\0Toggle", "Autostart") 0,
.Ctl.Ptr=&AutostartFunc,
.Range.High=2,
GUI_NEXT_CTL(PgmChangeCtl)
#define ROBOTCTLS &AutoStartCtl.Ctl
/**************** show_robotctls() ****************
* Shows/hides all robot individual ctls based upon
* whether the robot's Playback destination ("Playback on")
* is set to "Off".
*/
static void show_robotctls(void)
{
// Only drums use polarity
if (RobotNameCtl.Select)
PolarityCtl.Ctl.Flags |= GUICFLAG_HIDE;
else
PolarityCtl.Ctl.Flags &= ~GUICFLAG_HIDE;
// If PlayDev isn't off, show all the other ctls
RobotNameCtl.Ctl.Next = (RobotInfo[RobotNameCtl.Select].PlayDev) ? &RobotChanCtl.Ctl : &RobotDevCtl.Ctl;
ctl_update_full_ctl(&RobotGroupCtl.Ctl);
}
static uint32_t ctl_update_polarity(register GUICTL * ctl)
{
return ((AppFlags2 & APPFLAG2_POLARITY) ? 0 : 1);
}
static uint32_t ctl_set_polarity(register GUICTL * ctl)
{
AppFlags2 &= ~APPFLAG2_POLARITY;
if (PolarityCtl.Select) AppFlags2 |= APPFLAG2_POLARITY;
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_set_solo_playdev(register GUICTL * ctl)
{
return set_playdev_assign(&SoloDevCtl, MUSICIAN_SOLO);
}
static uint32_t ctl_update_solo_playdev(register GUICTL * ctl)
{
return getDeviceIndex(RobotInfo[MUSICIAN_SOLO].PlayDev);
}
static int32_t getPlayDevStr(void * appdata, GUIAPPHANDLE app)
{
register uint32_t labelNum;
if (app->Command & GUICMD_GET_STR)
{
if ((labelNum = app->StrCount))
{
//app->Buffer = "On";
//if (RobotDevCtl.Range.High > 1)
{
register SOUNDDEV * sounddev;
sounddev = 0;
while ((sounddev = getNextOutDevice(sounddev)))
{
if (sounddev->Handle && !(--labelNum))
{
app->Buffer = sounddev->DevName;
goto out;
}
}
}
}
app->Buffer = "Off";
}
else if (app->Command & GUICMD_GET_STR_WIDTH)
app->Buffer = getNextOutDevice(0)->DevName;
out:
return 0;
}
static uint32_t ctl_update_patch_chg(register GUICTL * ctl)
{
return (AppFlags2 & (APPFLAG2_PATCHCHG_MANUAL|APPFLAG2_PATCHCHG_STOPPED)) >> 6;
}
static uint32_t ctl_set_patch_chg(register GUICTL * ctl)
{
AppFlags2 = (AppFlags2 & ~(APPFLAG2_PATCHCHG_MANUAL|APPFLAG2_PATCHCHG_STOPPED)) | (PgmChangeCtl.Value << 6);
// Done setting this parameter. Let caller redraw the ctl
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t set_playdev_assign(register GUICTL_ARROWS * ctl, register uint32_t robotNum)
{
register SOUNDDEV * sounddev;
register uint32_t devNum;
sounddev = 0;
// "Off" ?
if (!(devNum = GuiApp->ArrowsValue))
{
set: RobotInfo[robotNum].PlayDev = sounddev;
MusicianAssignChange |= (0x01 << robotNum);
show_robotctls();
return CTLMASK_SETCONFIGSAVE;
}
while ((sounddev = getNextOutDevice(sounddev)))
{
if (sounddev->Handle && !(--devNum)) goto set;
}
return 0;
}
static uint32_t ctl_update_robot_playdev(register GUICTL * ctl)
{
return getDeviceIndex(RobotInfo[RobotNameCtl.Select].PlayDev);
}
static uint32_t ctl_set_robot_playdev(register GUICTL * ctl)
{
return set_playdev_assign(&RobotDevCtl, RobotNameCtl.Select);
}
static uint32_t ctl_update_robot_midichan(register GUICTL * ctl)
{
return RobotInfo[RobotNameCtl.Select].MidiChan;
}
static uint32_t ctl_set_robot_midichan(register GUICTL * ctl)
{
RobotInfo[RobotNameCtl.Select].MidiChan = RobotChanCtl.Value;
updChansInUse();
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_set_CurrentRobot(register GUICTL * ctl)
{
RobotVolCtl.Ctl.Ptr = getVolCtlDataPtr(RobotNameCtl.Select);
show_robotctls();
ctl = &RobotChanCtl.Ctl;
do
{
update_ctl_value(ctl);
} while ((ctl = ctl->Next));
// Redraw the group ctl to also redraw all children
ctl_update_full_ctl(&RobotGroupCtl.Ctl);
return 0;
}
static uint32_t ctl_update_robot_mute(register GUICTL * ctl)
{
return ((AppFlags3 & (APPFLAG3_NODRUMS << (RobotNameCtl.Select))) ? 1 : 0);
}
static uint32_t ctl_set_robot_mute(register GUICTL * ctl)
{
register unsigned char musicianNum;
musicianNum = RobotNameCtl.Select;
setAppFlags(APPFLAG3_NODRUMS << musicianNum, RobotMuteCtl.SelectMask);
// MusicianMuteChange |= (0x01 << musicianNum);
return CTLMASK_SETCONFIGSAVE;
}
static uint32_t ctl_update_autostart(register GUICTL * ctl)
{
register unsigned char val;
if (AppFlags3 & APPFLAG3_AUTOSTARTARM)
val = 2;
else
val = ((AppFlags3 & APPFLAG3_NOAUTOSTART) >> AUTOSTART_SHIFT) ^ 0x01;
return val;
}
static uint32_t ctl_set_autostart(register GUICTL * ctl)
{
AppFlags3 &= ~(APPFLAG3_AUTOSTARTARM|APPFLAG3_NOAUTOSTART);
TempFlags &= ~(TEMPFLAG_AUTOSTART);
switch (AutoStartCtl.Value)
{
case 2:
AppFlags3 |= APPFLAG3_AUTOSTARTARM;
case 1:
TempFlags |= TEMPFLAG_AUTOSTART;
break;
case 0:
AppFlags3 |= APPFLAG3_NOAUTOSTART;
break;
}
return CTLMASK_SETCONFIGSAVE;
}
#ifndef NO_SONGSHEET_SUPPORT
static uint32_t ctl_set_edsong(register GUICTL * ctl)
{
songEdit();
return 0;
}
static uint32_t ctl_set_crsong(register GUICTL * ctl)
{
songCreate(1);
return 0;
}
static uint32_t ctl_set_crsongb(register GUICTL * ctl)
{
songCreate(0);
return 0;
}
static GUICTLFUNCPTR * SongEdFunc[] = {&ctl_set_edsong, &ctl_set_crsong, &ctl_set_crsongb};
static GUI_DEF_PUSH(EditSongCtl, "Edit\0New\0New\nEmpty\0Songs") GUICFLAG_LABELBOX|SETFUNC_ONLY_PTR,
.Ctl.Ptr=&SongEdFunc[0],
.Ctl.LineNum=-1,
.NumOfLabels=3
GUI_NO_NEXT_CTL()
#endif
//=======================
static uint32_t ctl_set_edit_style(register GUICTL * ctl)
{
doStyleEdit();
return 0;
}
static uint32_t ctl_set_reloads(register GUICTL * ctl)
{
freeAccompStyles();
loadDataSets(LOADFLAG_STYLES);
doSetupScreen();
return 0;
}
static GUICTLFUNCPTR * StyleEditFunc[] = {&ctl_set_edit_style, &ctl_set_reloads};
static GUI_DEF_PUSH(EditStylesCtl, "Edit\0Reload all\0Styles") GUICFLAG_LABELBOX|SETFUNC_ONLY_PTR,
.Ctl.Ptr=&StyleEditFunc[0],
.NumOfLabels=2,
.Ctl.LineNum=-1,
#ifndef NO_SONGSHEET_SUPPORT
GUI_NEXT_CTL(EditSongCtl)
#else
GUI_NO_NEXT_CTL()
#endif
//=======================
static uint32_t ctl_edit_drum(register GUICTL * ctl)
{
return 0;
}
static uint32_t ctl_new_drum(register GUICTL * ctl)
{
return 0;
}
static uint32_t ctl_import_drum(register GUICTL * ctl)
{
return 0;
}
static uint32_t ctl_export_drum(register GUICTL * ctl)
{
return 0;
}
static GUICTLFUNCPTR * DrumPtnEditFunc[] = {&ctl_edit_drum, &ctl_new_drum, &ctl_import_drum, &ctl_export_drum};
static GUI_DEF_PUSH(DrumsGroupCtl, "Edit\0Create\0Import\nMIDI\0Export\nMIDI\0Drum Pattern\0") GUICFLAG_LABELBOX|SETFUNC_ONLY_PTR,
.Ctl.Ptr=&DrumPtnEditFunc[0],
.NumOfLabels=4,
GUI_NEXT_CTL(EditStylesCtl)
#define EDITORCTLS &DrumsGroupCtl.Ctl
/********************** setup_msg_handler() ************************
* Called by GUI thread when user operates a ctl in the Setup
* main screens.
*/
static void setup_msg_handler(void)
{
register uint32_t cmd;
cmd = GuiApp->Command;
// One of the preset btns
if (GuiMsgIsPreset(cmd))
{
if (GuiApp->SelectedSubCtl == GUIBTN_HELP) goto help;
// Exit setup btn?
if (GuiApp->SelectedSubCtl == GUIBTN_EXITSETUP || GuiApp->SelectedSubCtl == GUIBTN_CANCEL) // ESC key
{
#ifndef NO_MIDI_IN_SUPPORT
midiviewDone();
#endif
// if ((MusicianMuteChange | MusicianAssignChange))
// hideMainCtls();
if (MusicianAssignChange)
{
loadDataSets(LOADFLAG_INSTRUMENTS|LOADFLAG_SONGS);
#ifndef NO_MIDI_IN_SUPPORT
updChansInUse();
#endif
}
#ifndef NO_MIDI_IN_SUPPORT
if (AppFlags & APPFLAG_WINDCTL)
{
if (ChordTriggerByCtl.Value) goto midi;
ChordTrigger = limitMouseBtn(0xff) + 0xf1;
}
else if (ChordTriggerByCtl.Value != 2)
ChordTrigger = (ChordTriggerByCtl.Value + 9) << 4;
else
midi: ChordTrigger = TempChordTrigger;
#endif
showMainScreen();
}
goto out;
}
if (GuiMsgIsValueChange(cmd) || GuiMsgActionIs(cmd, GUIMSG_ACTION_LIST_DONE))
handle_ctl_click();
else switch (GuiMsgAction(cmd))
{
// ================ Panel bar ================
case GUIMSG_ACTION_FOCUS_PANEL:
case GUIMSG_ACTION_PANEL_SELECT:
{
PanelSelect = GuiApp->PanelNum;
doSetupScreen();
break;
}
case GUIMSG_ACTION_SHOW_HELP:
{
help: showHelpScreen(HelpStrs[PanelSelect]);
// doSetupScreen();
}
}
out:
return;
}
//====================================
// Panel bar
//====================================
void play_off_state(void)
{
#ifndef NO_MIDI_IN_SUPPORT
endCmdMode();
#endif
abrupt_stop_play(GUITHREADID);
#ifndef NO_SONGSHEET_SUPPORT
selectSongSheet(0, GUITHREADID);
#endif
}
static void updateSetupCtls(register GUICTL * ctl)
{
while (ctl)
{
if (GuiCtlIsGroup(ctl))
updateSetupCtls(((GUICTL_GROUPBOX *)ctl)->Child);
else
update_ctl_value(ctl);
ctl = ctl->Next;
}
}
static void doGeneralDlg(GUIAPPHANDLE app)
{
GuiMsgFunc = 0;
GuiApp->WinInfo.ControlsList = GLOBALCTLS;
init_setup_panel(GUI_WIN_SET_CONTROLS);
// Update the Bus buttons
updateBussBtns();
// Update rev ctls
updateReverbCtls();
updateSetupCtls(GLOBALCTLS);
}
static void doRobotsDlg(GUIAPPHANDLE app)
{
GuiMsgFunc = 0;
GuiApp->WinInfo.ControlsList = ROBOTCTLS;
init_setup_panel(GUI_WIN_SET_CONTROLS);
updateSetupCtls(ROBOTCTLS);
}
static void doCommandsDlg(GUIAPPHANDLE app)
{
play_off_state();
GuiMsgFunc = 0;
#ifndef NO_MIDI_IN_SUPPORT
update_cmd_ctls();
#endif
resetActionsList(&ActionsCtl);
GuiApp->WinInfo.Options = GUIWIN_OPT_LIST_KEY_FOCUS|GUIWIN_OPT_TAB_NEXT_PANEL|GUIWIN_OPT_TAB_NEXT_CTL|
GUIWIN_OPT_ENTER_AS_CLICK|GUIWIN_OPT_SHOW_HELP|GUIWIN_OPT_SPACE_AS_ENTER|GUIWIN_OPT_ESC_KEY_CANCEL|GUIWIN_OPT_CUSTOM_DRAWING;
GuiApp->WinInfo.ControlsList = CMDCTLS;
init_setup_panel(GUI_WIN_SET_OPTIONS|GUI_WIN_SET_CONTROLS);
GuiMsgFunc = &cmdasn_msg_handler;
updateSetupCtls(CMDCTLS);
}
GUICTL_LIST * getActionsList(void)
{
return &ActionsCtl;
}
static void doHumanDlg(GUIAPPHANDLE app)
{
GuiMsgFunc = 0;
GuiApp->WinInfo.ControlsList = HUMANCTLS;
init_setup_panel(GUI_WIN_SET_CONTROLS);
updateSetupCtls(HUMANCTLS);
}
static void doEditorDlg(GUIAPPHANDLE app)
{
GuiMsgFunc = 0;
GuiApp->WinInfo.ControlsList = EDITORCTLS;
init_setup_panel(GUI_WIN_SET_CONTROLS);
updateSetupCtls(EDITORCTLS);
}
static GUI_PANEL_ITEM SetupEditor = {.Label="Editor",
.UserData=doEditorDlg,
.IdNumber=4,
.Color = (GUICOLOR_GREEN << 4) | GUICOLOR_DARKGREEN
};
static GUI_PANEL_ITEM SetupCommands = {.Label="Commands",
.Next=&SetupEditor,
.UserData=doCommandsDlg,
.IdNumber=3,
.Color = (GUICOLOR_GREEN << 4) | GUICOLOR_DARKGREEN
};
static GUI_PANEL_ITEM SetupHuman = {.Label="Human",
.Next=&SetupCommands,
.UserData=doHumanDlg,
.IdNumber=2,
.Color = (GUICOLOR_GREEN << 4) | GUICOLOR_DARKGREEN
};
static GUI_PANEL_ITEM SetupRobots = {.Label="Robots",
.Next=&SetupHuman,
.UserData=doRobotsDlg,
.IdNumber=1,
.Color = (GUICOLOR_GREEN << 4) | GUICOLOR_DARKGREEN
};
static GUI_PANEL_ITEM SetupGeneral = {.Label="General",
.Next=&SetupRobots,
.UserData=doGeneralDlg,
.IdNumber=0,
.Color = (GUICOLOR_GREEN << 4) | GUICOLOR_DARKGREEN
};
void init_setup_panel(register uint32_t flags)
{
register uint32_t setflags;
setflags = 0;
// Attach Setup panel bar, and specify msg handler = setup_msg_handler if GuiMsgFunc=0
if (!GuiMsgFunc)
{
register GUIPANEL * panel;
GuiMsgFunc = &setup_msg_handler;
panel = &GuiApp->WinInfo.Panel;
panel->List = &SetupGeneral;
panel->PanelNum = PanelSelect;
panel->Reserve.Width = 0;
GuiApp->SelectedSubCtl = GUIBTN_EXITSETUP;
GuiApp->WinInfo.Presets.LowerMask = GUIBTN_HELP_SHOW|GUIBTN_EXITSETUP_SHOW;
flags |= GUI_WIN_SET_PANEL_RESERVE|GUI_WIN_SET_PANEL_NUM|GUI_WIN_SET_PANEL_ITEMS|GUI_WIN_SET_PRESET_LOWER|GUI_WIN_SET_FOCUS;
}
else if (!(flags & GUI_WIN_SET_PANEL_ITEMS))
{
setflags = GUI_WIN_SET_PANEL_ITEMS;
GuiApp->WinInfo.Panel.List = 0;
}
if (flags)
{
// If caller didn't specify preset btns, then none
if (!(flags & GUI_WIN_SET_PRESET_LOWER))
GuiApp->WinInfo.Presets.LowerMask = 0;
else
{
// If caller didn't specify a default btn, then set to lower "Cancel"
if (!(flags & GUI_WIN_SET_FOCUS))
{
GuiApp->SelectedSubCtl = GUIBTN_CANCEL;
setflags |= GUI_WIN_SET_FOCUS;
}
GuiApp->SelectedCtl = GUISELECT_LOWERBTN;
}
// If caller didn't specify flags, then use this default
if (!(flags & GUI_WIN_SET_OPTIONS)) GuiApp->WinInfo.Options = GUIWIN_OPT_TAB_NEXT_PANEL|GUIWIN_OPT_TAB_NEXT_CTL|GUIWIN_OPT_ENTER_AS_CLICK|GUIWIN_OPT_SHOW_HELP|GUIWIN_OPT_ESC_KEY_CANCEL;
setflags |= GUI_WIN_SET_OPTIONS | GUI_WIN_SET_PRESET_LOWER;
}
// No Banner string if not specified
if (!(flags & GUI_WIN_SET_BANNER_TEXT))
{
GuiApp->WinInfo.Banner.Text = 0;
setflags |= GUI_WIN_SET_BANNER_TEXT;
}
GuiApp->Window = MainWin;
GuiWinSetValue(GuiApp, setflags|flags);
// clearMainWindow();
}
void showHelpScreen(register const char * ptr)
{
GuiApp->HelpText = ptr;
GuiApp->HelpFlags = GUIHELP_REUSE_WIN;
GuiApp->HelpColor = 0;
if (!GuiHelpShow(GuiApp, MainWin))
{
while (GuiAppGetMsg(GuiApp) >= 0);
}
return;
}
// ====================================================
/********************* doSetupScreen() ***********************
* Shows/operates the "Setup" screen's current panel.
*/
void doSetupScreen(void)
{
#ifndef NO_MIDI_IN_SUPPORT
midiviewDone();
endCmdMode();
#endif
setShownCtls(0);
ReturnFunc = doSetupScreen;
RobotDevCtl.Range.High = SoloDevCtl.Range.High = get_out_dev_count();
((VOIDRETFUNC)(get_panel_item(&SetupGeneral, PanelSelect)->UserData))();
clearMainWindow();
}
void enterSetupScreen(void)
{
// Indicate setup screen is being operated
setupScreenIsOn();
#ifndef NO_MIDI_IN_SUPPORT
TempChordTrigger = ChordTrigger;
if (AppFlags & APPFLAG_WINDCTL)
{
if (TempChordTrigger < 128)
{
ChordTriggerByCtl.Value = 1;
limitMouseBtn(1);
}
else
{
limitMouseBtn(TempChordTrigger - 0xf1);
ChordTriggerByCtl.Value = 0;
}
}
else
{
ChordTriggerByCtl.Value = 2;
if (TempChordTrigger > 127)
ChordTriggerByCtl.Value = (TempChordTrigger >> 4) - 9;
}
#endif
// MusicianMuteChange =
MusicianAssignChange = 0;
doSetupScreen();
}
unsigned char isHumanScreen(void)
{
return (!isMainScreen() && PanelSelect == 2) ? 1 : 0;
}
/*************** positionSetupGui() ****************
* Sets initial position/scaling of GUI ctls based
* upon font size.
*/
void positionSetupGui(void)
{
fixup_setup_ctls(GLOBALCTLS);
fixup_setup_ctls(HUMANCTLS);
fixup_setup_ctls(ROBOTCTLS);
// fixup_setup_ctls(CMDCTLS);
GuiApp->CreateFlags = 0;
GuiApp->SelectedCtl = GLOBALCTLS;
GuiCtlScale(GuiApp);
GuiApp->SelectedCtl = HUMANCTLS;
GuiCtlScale(GuiApp);
GuiApp->SelectedCtl = ROBOTCTLS;
GuiCtlScale(GuiApp);
GuiApp->SelectedCtl = CMDCTLS;
GuiCtlScale(GuiApp);
GuiApp->SelectedCtl = EDITORCTLS;
GuiCtlScale(GuiApp);
GuiApp->SelectedCtl = &ChordSensCtl.Ctl;
GuiCtlScale(GuiApp);
#ifndef NO_MIDI_IN_SUPPORT
ChordSensCtl.Ctl.X = ChordTriggerByCtl.Ctl.X;
ChordSensCtl.Ctl.Y = ChordTriggerByCtl.Ctl.Y;
ChordSensCtl.Ctl.Next = &ChordBoundCtl.Ctl;
GuiApp->SelectedCtl = &MinorPedalCtl.Ctl;
GuiCtlScale(GuiApp);
MinorPedalCtl.Ctl.X = TriggerAssignCtl.Ctl.X - (MinorPedalCtl.Ctl.Width + GuiGetMetric(GuiApp, GUIMETRIC_XSPACE));
MinorPedalCtl.Ctl.Y = TriggerAssignCtl.Ctl.Y;
MinorPedalCtl.Ctl.Next = &TriggerAssignCtl.Ctl;
#endif
}
void set_default_lower_preset(register unsigned char guiBtn)
{
GuiApp->SelectedCtl = GUISELECT_LOWERBTN;
GuiApp->SelectedSubCtl = guiBtn;
GuiApp->WinInfo.Presets.UpperMask = 0;
GuiApp->WinInfo.Panel.List = 0;
}
#endif // BB_NO_GUI