aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/ui_recorder.fl
blob: f650f5f0a88b3b3b54da1f6b0145ff7edc3675ff (plain)
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
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
# data file for the Fltk User Interface Designer (fluid)
version 1.0109 
header_name {.h} 
code_name {.cxx}
decl {\#define RECORDERDEBUG 0} {public
} 

decl {\#define MAXSAMRATE 48000} {public
} 

decl {\#define AUDIOLIB_PORTAUDIO 1} {public
} 

decl {\#define AUDIOLIB_JACK 2} {public
} 

decl {\#define AUDIOLIB_SNDFILE 3} {public
} 

decl {\#define Pi2 (2*3.1415926535897)} {public
} 

decl {\#include <config.h>} {public
} 

decl {\#include <string>} {public
} 

decl {\#include <vector>} {public
} 

decl {\#include <soundlibs.h>} {public
} 

decl {\#include <iostream>} {public
} 

decl {\#include <fstream>} {public
} 

decl {\#include <FL/FLTKstuff.H>} {public
} 

decl {\#include <FL/filename.H>} {public
} 

decl {\#include <convertlib.h>} {public
} 

decl {\#include <time.h>} {public
} 

decl {\#include <math.h>} {public
} 

decl {\#include <hd24fs.h>} {public
} 

decl {\#include <ui_hd24connect.h>} {public
} 

decl {\#include <ui_mixer.h>} {public
} 

decl {class MixerControl;} {public
} 

decl {\#include <sharedlibs.h>} {public
} 

decl {class RecorderChannelData;} {public
} 

decl {class RecorderChannelControl;} {public
} 

decl {class RecorderChannelUI;} {public
} 

decl {class RecorderData;} {public
} 

decl {class RecorderControl;} {public
} 

decl {class RecorderUI;} {public
} 

class ScrubWheel {: {public Fl_Roller}
} {
  decl {int myval;} {}
  decl {RecorderUI* ui;} {}
  decl {int lastx;} {}
  Function {handle(int e)} {open return_type int
  } {
    code {/*char *fltk_eventnames[] =
{
  "FL_NO_EVENT",
  "FL_PUSH",
  "FL_RELEASE",
  "FL_ENTER",
  "FL_LEAVE",
  "FL_DRAG",
  "FL_FOCUS",
  "FL_UNFOCUS",
  "FL_KEYDOWN",
  "FL_KEYUP",
  "FL_CLOSE",
  "FL_MOVE",
  "FL_SHORTCUT",
  "FL_DEACTIVATE",
  "FL_ACTIVATE",
  "FL_HIDE",
  "FL_SHOW",
  "FL_PASTE",
  "FL_SELECTIONCLEAR",
  "FL_MOUSEWHEEL",
  "FL_DND_ENTER",
  "FL_DND_DRAG",
  "FL_DND_LEAVE",
  "FL_DND_RELEASE",
};

*/
if (e==FL_DRAG) {
	myval=Fl::event_x()-lastx;
	RecorderControl::button_scrub_call(myval,this->ui->control);
}
lastx=Fl::event_x();
return 1;} {}
  }
  Function {ScrubWheel(int a,int b,int c,int d,const char* e):Fl_Roller(a,b,c,d,e)} {open
  } {
    code {myval=0;} {}
  }
  Function {draw()} {open
  } {
    code {//draw goes here
return Fl_Roller::draw();} {}
  }
  Function {value()} {open return_type int
  } {
    code {return this->myval;} {}
  }
  Function {value(int newval)} {open return_type int
  } {
    code {int oldval=this->myval;
this->myval=newval; // not very useful but whatever
return oldval;} {}
  }
  Function {setui(RecorderUI* p_ui)} {open
  } {
    code {this->ui=p_ui;} {}
  }
} 

class AudioSystem {open
} {
  decl {AudioStorage* tape;} {}
  decl {__uint32 samrate;} {public
  }
  decl {bool closingdown;} {public
  }
  decl {MixerControl* mixercontrol;} {}
  decl {RecorderControl* recorder;} {}
  decl {PortAudioWrapper* portaudio;} {public
  }
  decl {SoundFileWrapper* soundfile;} {public
  }
  decl {JackWrapper* libjack;} {}
  decl {PaStreamParameters* inputParameters;} {}
  decl {PaStreamParameters* outputParameters;} {}
  decl {PaStream* portaudiostream;} {}
  decl {jack_client_t *jackclient;} {}
  decl {__uint32 jackrate;} {}
  decl {__uint32 portaudiooffset;} {public
  }
  decl {int as_initialized;} {}
  decl {int portaudio_initialized;} {}
  decl {int jack_initialized;} {}
  decl {int as_looppos;} {}
  decl {bool as_mustloop;} {}
  decl {jack_port_t *output_port[24];} {}
  decl {jack_port_t *output_master[2];} {}
  decl {jack_port_t *input_port[24];} {}
  decl {long* mtsample;} {}
  decl {bool havestreamtime;} {}
  decl {__sint64 streamtime;} {public
  }
  Function {AudioSystem(RecorderControl* rec)} {open
  } {
    code {\#if (RECORDERDEBUG==1)
cout << "AudioSystem::AudioSystem()" << endl;
\#endif
initvars(rec);} {}
  }
  Function {initvars(RecorderControl* rec)} {open return_type void
  } {
    code {this->tape=NULL;
this->samrate=0;
this->closingdown=false;
this->mixercontrol=NULL;
this->recorder=rec;
this->portaudio=NULL;
this->soundfile=NULL;
this->libjack=NULL;
this->jackclient=NULL;
this->portaudiostream=NULL;
this->portaudio_initialized=0;
this->as_initialized=false;
this->jack_initialized=false;
this->as_looppos=0;
this->as_mustloop=false;
this->inputParameters=NULL;
this->outputParameters=NULL;
this->inputParameters=new PaStreamParameters;
this->outputParameters=new PaStreamParameters;
this->mtsample=NULL;
for (int i=0;i<24;i++) {
   this->output_port[i]=NULL;
   this->input_port[i]=NULL;
}
this->output_master[0]=NULL;
this->output_master[1]=NULL;
this->havestreamtime=false;} {}
  }
  Function {currentlocation(__uint32 newpos)} {open return_type void
  } {
    code {if (tape==NULL) return;
tape->currentlocation(newpos);} {}
  }
  Function {currentlocation()} {return_type __uint32
  } {
    code {if (tape==NULL) return 0;
return tape->currentlocation();} {}
  }
  Function {jack_process(jack_nframes_t nframes, void *arg)} {open private return_type {static int}
  } {
    code {\#ifndef LIBJACK
\#if (RECORDERDEBUG==1)
cout << "no libjack" << endl;
\#endif
\#endif

\#ifdef LIBJACK

RecorderControl* recordercontrol=(RecorderControl*)arg;

if (recordercontrol==NULL) {
	cout << "no control" << endl;
	return 0;
}
AudioSystem* audio=recordercontrol->audio;
if (audio==NULL)
{
	cout << "no audiosys" << endl;
	return 0;
}
if ((audio->libjack)==NULL)
{
\#if (RECORDERDEBUG==1)
cout << "no libjack" << endl;
\#endif
	return 0;
}

if (!(audio->libjack->libloaded)) 
{
	cout << "no jacklib" << endl;
	return 0;
}

RecorderControl* mythis=recordercontrol;
//RecorderUI* mythis=recordercontrol; //(RecorderUI*)arg;
//AudioSystem* audio=mythis->control->audio;


jack_client_t* currjackclient=audio->jackclient;
if (currjackclient==NULL) return 0;
MixerControl* mixer=audio->mixer();
if (mixer==NULL) return 0;
jack_position_t current;
jack_transport_state_t transport_state=audio->libjack->jack_transport_query(currjackclient,&current);

hd24song* mysong=(hd24song*)audio->tape;
if (mysong==NULL) return 0; /* nothing to do! */

hd24fs* myfs=mysong->fs();

__sint64 frame_time = (__sint64)(audio->libjack->jack_get_current_transport_frame(currjackclient));

MixerChannelControl* mixerchannel[24];

	
for (unsigned int tracknum=0;tracknum<MAXCHANNELS;tracknum++) 
{
	mixerchannel[tracknum]=mixer->parentui()->mixerchannel[tracknum]->control;
}
	
unsigned int i;
__sint64 intsamval=0;
mysong->golocatepos(frame_time);
int jumpedloop=0;
if (transport_state!=JackTransportStopped) 
{
	__sint64 frpos=frame_time;
	__sint64 posoffset=0;
	for (i=0;i<nframes;i++) 
	{
		if ( mythis->loopmode()==1 ) 
		{
			posoffset++;
			if ((frpos+i)==(__sint64)(mysong->getlocatepos(hd24song::LOCATEPOS_LOOPEND))) 
			{
				frpos=mysong->getlocatepos(hd24song::LOCATEPOS_LOOPSTART);
				mysong->golocatepos(frpos);
				posoffset=0;
				jumpedloop=1;
			}
		}

		mysong->getmultitracksample(
			(long*)((&audio->mtsample[i*25])),
			hd24song::READMODE_REALTIME
		);
	}
	if (jumpedloop==1) 
	{
		audio->hd24_transport_locate((__sint64)(frpos+posoffset));
	}
}

for (unsigned int tracknum=0;tracknum<MAXCHANNELS;tracknum++) 
{
	jack_default_audio_sample_t *out = 
	(jack_default_audio_sample_t *)(audio->libjack->jack_port_get_buffer (audio->output_port[tracknum], nframes));
	jack_default_audio_sample_t *in = 
	(jack_default_audio_sample_t *)(audio->libjack->jack_port_get_buffer (audio->input_port[tracknum], nframes));
	for (i=0;i<nframes;i++) 
	{
		if (transport_state!=JackTransportStopped) {
 			long* xb=(long*)(&(audio->mtsample[i*25+tracknum]));
			intsamval=xb[0];
			intsamval=((intsamval>>16)+((intsamval%256)<<16)+(intsamval & 0xff00));			
			if (intsamval>=(1<<23)) {
				intsamval-=(1<<24);
			}
			double samval=(intsamval/(double)0x800000);
			out[i]=samval; // send pre-fader, pre-mixer channel output to JACK
		} else {			
			out[i]=0;
		}
		
		mixerchannel[tracknum]->sample(i,out[i]);
				
		// ... except if we are monitoring input, in which case regular reading etc is
		// still going on, but we will just copy the incoming signal to the output:
		// (with the possible exception of tracks being recorded but that's for later)
		if (myfs->isallinput()) {
			out[i]=in[i];
		}

                if (fabs(out[i]) > mythis->data->trackpeak[i]) {
			mythis->data->trackpeak[tracknum]=fabs(out[i]);
		}
	}
}
mixer->mix(nframes);
jack_default_audio_sample_t *masterL = 
(jack_default_audio_sample_t *)(audio->libjack->jack_port_get_buffer (audio->output_master[0], nframes));
jack_default_audio_sample_t *masterR = 
(jack_default_audio_sample_t *)(audio->libjack->jack_port_get_buffer (audio->output_master[1], nframes));
if ((masterL!=NULL)&&(masterR!=NULL)) {	
	for (i=0;i<nframes;i++) 
	{
		masterL[i] = mixer->masterout(0,i); // left 
		masterR[i] = mixer->masterout(1,i); // right	
	}
}
\#endif

return 0;} {}
  }
  Function {jack_shutdown(void *arg)} {private return_type {static void}
  } {
    code {\#ifdef LIBJACK
AudioSystem* audio=(AudioSystem*)arg;
if (audio->jackclient==NULL) {
    return;
}
if (audio->mtsample!=NULL) {
	memutils::myfree("jack_shutdown",audio->mtsample);
	audio->mtsample=NULL;
}
audio->jackclient=NULL;
return;
\#endif} {}
  }
  Function {jackinit()} {open private return_type void
  } {
    code {if (portaudio_initialized==1) 
{
\#if (RECORDERDEBUG==1)
	cout << "not initializing jack because portaudio is active" << endl;
\#endif
	return;
}
if (!(libjack->libloaded)) 
{
\#if (RECORDERDEBUG==1)
	cout << "not initializing jack because its lib is not loaded" << endl;
\#endif
	return;
}
if (this->closingdown) {
    if (jackclient!=NULL)
    {
        jack_shutdown(this);
    }
    jackclient=NULL;
    return;
}
\#ifdef LIBJACK
//button_setlocate->value(0);
//highlight_setbuttons(0); // value of setlocate button
//mustdisplaytimer=true;
if (jackclient==NULL) {
	jackclient = libjack->jack_client_new("HD24connect");

	if (jackclient == NULL) {
		// error: jack open failed.
\#if (RECORDERDEBUG==1)
		cout << "error: jack open failed." << endl;
\#endif		
		return;
	}
	mtsample=(long *)memutils::mymalloc("jackinit",512000,1);
	
	libjack->jack_set_process_callback (
		jackclient,
		(int (*)(jack_nframes_t, void*))jack_process, 
		recorder); // was: this (=audiosystem)
	libjack->jack_on_shutdown (jackclient, jack_shutdown, this);
	jackrate=libjack->jack_get_sample_rate (jackclient);
	int i;
	for (i=1;i<=MAXCHANNELS;i++) {
		string portnameout="output";
		string portnamein="input";
		
		string* tracknum=Convert::int2str(i);
		portnameout+=*tracknum;
		portnamein+=*tracknum;
		delete(tracknum);

		output_port[i-1]=libjack->jack_port_register (jackclient, portnameout.c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
		input_port[i-1]=libjack->jack_port_register (jackclient, portnamein.c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
	}
	string portnameout="master_out_L";
	output_master[0]=libjack->jack_port_register (jackclient, portnameout.c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
	portnameout="master_out_R";
	output_master[1]=libjack->jack_port_register (jackclient, portnameout.c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);	
	if (libjack->jack_activate(jackclient)) {
\#if (RECORDERDEBUG==1)
		cout << "cannot activate jack client" << endl;
\#endif
	};
}
\#endif} {}
  }
  Function {isjackinitialized()} {open private return_type bool
  } {
    code {if (this->jackclient!=NULL)
{
	return true;
}
return false;} {}
  }
  Function {portaudioinit()} {open private return_type void
  } {
    code {\#ifndef LIBPORTAUDIO
return;
\#endif
\#ifdef LIBPORTAUDIO
//if (currsong==NULL) return;
//\#if (RECORDERDEBUG==1) 
//cout << "Init portaudio" << endl; 
//\#endif
//mustdisplaytimer=true;
PaError err;
err=(*(portaudio->Pa_Initialize))();
if (err!=paNoError) { 
        this->portaudiostream=NULL;
	(*(portaudio->Pa_Terminate))(); return; 
\#if (RECORDERDEBUG==1) 
cout << "Error during init portaudio" << endl; 
\#endif
}
this->mustloop(false);
this->as_looppos=0;
this->portaudio_initialized=1;
this->as_initialized=1;
\#endif} {}
  }
  Function {isportaudioinitialized()} {open private return_type bool
  } {
    code {if (!(portaudio->libloaded)) {
return false;
}
if (portaudiostream!=NULL) {
	return true;
}
if (portaudio_initialized!=0) {
	return true;
}
return false;} {}
  }
  Function {portaudio_process(const void *inputBuffer, void *outputBuffer, __uint32 nframes, const PaStreamCallbackTimeInfo* timeinfo,PaStreamCallbackFlags, void *userData)} {open private return_type {static int}
  } {
    code {RecorderControl* recordercontrol=(RecorderControl*)userData;

if (recordercontrol==NULL) {
	cout << "no control" << endl;
	return 0;
}
AudioSystem* audio=recordercontrol->audio;
if (audio==NULL)
{
	cout << "no audiosys" << endl;
	return 0;
}
if (audio->portaudio==NULL)
{
	cout << "no portaudio" << endl;
	return 0;
}
if (!(audio->portaudio->libloaded)) 
{
	cout << "no palib" << endl;
	return 0;
}
if (!audio->havestreamtime)
{
	audio->streamtime=0;
        audio->havestreamtime=true;
}

float samleft=0;
float samright=0;

//hd24fs* myfs=mythis->currenthd24;

PaStream* curr_pa_stream=audio->portaudiostream;

if (curr_pa_stream==NULL)
{
	cout << "no stream" << endl;
	return paContinue;
}
if ((audio->mtsample)==NULL) 
{
	cout << "no sample" << endl;
	return paContinue;
}

// TODO: connect audio system to mixer
MixerControl* mixer=audio->mixer();
if (mixer==NULL) 
{
	cout << "no mixer" << endl;
	return paContinue;
}

if (audio->mustloop()) 
{
	cout << "must loop" << endl;
	return paContinue;
}

hd24song* mysong=recordercontrol->song();
if (mysong == NULL) 
{
	cout << "no song" << endl;
	return 0;//nothing to do!
}

unsigned int tottracks=(unsigned int)mysong->logical_channels();

/* frame time indicates how long the stream has been playing
   and is reset to 0 after pressing stop/play.
   To compensate for this, we must add our portaudio-offset,
   the offset of the songcursor when we pressed 'play'.
   We then record the absolute stream time in pa_streamtime. */
__sint64 frame_time = audio->streamtime; 
frame_time+=audio->portaudiooffset; 
//audio->streamtime=frame_time;
audio->streamtime+=nframes;
MixerChannelControl* mixerchannel[24];

unsigned int i;
__sint64 intsamval=0;

mysong->golocatepos(frame_time);
int loopmode=recordercontrol->loopmode();
int jumpedloop=0;

	__sint64 frpos=frame_time;
	__sint64 posoffset=0;
	for (i=0;i<nframes;i++) 
	{
		if ( loopmode==1 ) 
		{
			posoffset++;
			if ((frpos+i)==(__sint64)(mysong->getlocatepos(hd24song::LOCATEPOS_LOOPEND))) 
			{
				frpos=mysong->getlocatepos(hd24song::LOCATEPOS_LOOPSTART);
				mysong->golocatepos(frpos);
				posoffset=0;
				jumpedloop=1;
			}
		}

		mysong->getmultitracksample(
			(long*)((&audio->mtsample[i*25])),
			hd24song::READMODE_REALTIME
		);
		// if sample rate is high speed, skip next sample.
		if ((mysong->physical_channels()/mysong->logical_channels())==2) 
		{
			mysong->getmultitracksample(
				(long*)((&audio->mtsample[i*25])),
				hd24song::READMODE_REALTIME
			);		
		}
	}
	if (jumpedloop==1) 
	{
		audio->as_looppos=frpos+posoffset;
		audio->mustloop(true);
	}
	

	
	for (unsigned int tracknum=0;tracknum<MAXCHANNELS;tracknum++) 
	{
		mixerchannel[tracknum]=mixer->parentui()->mixerchannel[tracknum]->control;	
	}
	
	for (unsigned int tracknum=0;tracknum<tottracks;tracknum++) 
	{
		recordercontrol->data->trackpeak[tracknum]=0;
	}
	

	for (i=0;i<nframes;i++) 
	{
		double samvaltot=0;
		if (inputBuffer!=NULL) {
			samleft=((float*)inputBuffer)[i*2];
			samright=((float*)inputBuffer)[i*2+1];
		} else {
			samleft=0;
			samright=0;
		}
		// depending on input mode, mix these to mono, set right to be equal to 
		// left, swap them or set left to be equal to right.
		float subsamval;
		for (unsigned int tracknum=0;tracknum<tottracks;tracknum++) 
		{
 			long* xb=(long*)(&(audio->mtsample[i*25+tracknum]));
			intsamval=xb[0];
			intsamval=((intsamval>>16)+((intsamval%256)<<16)+(intsamval & 0xff00));			
			if (intsamval>=(1<<23)) {
				intsamval-=(1<<24);
			}
			

			if (mysong->istrackmonitoringinput(tracknum+1)) 
			{				
				subsamval=((tracknum%2)==0)?(samleft):(samright);
			} 
			else 
			{
				subsamval=(intsamval/(double)0x800000);
			}
			samvaltot+=subsamval;
			if (fabs(subsamval) > recordercontrol->data->trackpeak[tracknum]) {
				recordercontrol->data->trackpeak[tracknum]=fabs(subsamval);
			}
			
			mixerchannel[tracknum]->sample(i,subsamval);

		}
		if (tottracks<24) {
			for (unsigned int tracknum=tottracks;tracknum<MAXCHANNELS;tracknum++) {
				mixerchannel[tracknum]->sample(i,0);
			}
		}
		/*
		if (outputBuffer!=NULL) {
			((float*)outputBuffer)[i*2] = samval; // left 
			((float*)outputBuffer)[i*2+1] = samval; // right
		}*/

	}
	mixer->mix(nframes);
	
	if (outputBuffer!=NULL) {
		
		for (i=0;i<nframes;i++) 
		{
			((float*)outputBuffer)[i*2] = mixer->masterout(0,i); // left 
			((float*)outputBuffer)[i*2+1] = mixer->masterout(1,i); // right	
		}
	}

//	cout << mythis->trackpeak[0] << endl;

return 0;} {}
  }
  Function {portaudio_transport_start()} {open private return_type void
  } {
    code {if (!(portaudio->libloaded)) {
return;
}

\#if (RECORDERDEBUG==1) 
cout << "portaudio transport start" << endl; 
\#endif
if (!isportaudioinitialized())
{
	PaError err=(*(portaudio->Pa_Initialize))();
	if (err != paNoError) 
	{
\#if (RECORDERDEBUG==1) 
		cout << "Cannot initialize portaudio- exiting." << endl;
\#endif
		
	}
}
if (isportaudioinitialized() && (portaudiostream!=NULL)) {
\#if (RECORDERDEBUG==1) 
cout << "already have stream- done starting" << endl; 
\#endif
	return;
}
this->mustloop(false);

this->as_looppos=0;
PaDeviceIndex indev=(*(portaudio->Pa_GetDefaultInputDevice))();
PaDeviceIndex outdev=(*(portaudio->Pa_GetDefaultOutputDevice))();
cout << "default input device="<<indev<< endl;
cout << "default output device="<<outdev<<endl;

if (inputParameters!=NULL)
{
	memset(inputParameters,'\\0',sizeof(*inputParameters));
}

inputParameters->channelCount=2;
inputParameters->sampleFormat=paFloat32;
inputParameters->device=indev;
inputParameters->suggestedLatency = (*(portaudio->Pa_GetDeviceInfo))( inputParameters->device )->defaultLowInputLatency;
inputParameters->hostApiSpecificStreamInfo = NULL;
\#if (RECORDERDEBUG==1) 
cout << "Input params set" << endl; 
cout << "Device=" << indev << endl;
cout << "Channelcount=" << inputParameters->channelCount << endl;
cout << "sampleFormat=" << inputParameters->sampleFormat << endl;
cout << "suggestedlatency=" << inputParameters->suggestedLatency << endl;

\#endif
if (outputParameters!=NULL)
{
	memset(outputParameters,'\\0',sizeof(*outputParameters));
}

outputParameters->channelCount=2;
outputParameters->sampleFormat=paFloat32;
outputParameters->device=outdev;
outputParameters->suggestedLatency = (*(portaudio->Pa_GetDeviceInfo))( outputParameters->device )->defaultLowOutputLatency;
outputParameters->hostApiSpecificStreamInfo = NULL;
\#if (RECORDERDEBUG==1) 
cout << "Output params set" << endl; 
\#endif
cout << "Device=" << outdev << endl;
cout << "Channelcount=" << outputParameters->channelCount << endl;
cout << "sampleFormat=" << outputParameters->sampleFormat << endl;
cout << "suggestedlatency=" << outputParameters->suggestedLatency << endl;

if (mtsample==NULL)
{
	mtsample=(long *)memutils::mymalloc("portaudio_transport_start",512000,sizeof(long));
}

double playbackrate=this->samplerate();
cout << "trying samrate="<<samrate<<endl;
cout << "framesperbuf=" << PA_FRAMESPERBUF << endl;

PaError err=(*(portaudio->Pa_OpenStream))(
	&portaudiostream,
	NULL,/*this->inputParameters,*/
	this->outputParameters,
	playbackrate,
	PA_FRAMESPERBUF, /* frames per buffer */
	paClipOff | paDitherOff,
	portaudio_process,
	(void*)recorder);
this->havestreamtime=false;
this->streamtime=0;

if (err!=paNoError) { 
\#if (RECORDERDEBUG==1) 
cout << "Error opening stream" << endl; 
cout << portaudio->Pa_GetErrorText(err) << endl;
cout << "playbackrate=" << playbackrate << endl;
\#endif
	(*(portaudio->Pa_Terminate))(); 
	return; 
}
\#if (RECORDERDEBUG==1) 
cout << "Stream opened, going to start it now..." << endl; 
\#endif
err=(*(portaudio->Pa_StartStream))(portaudiostream);
if (err!=paNoError) { 
\#if (RECORDERDEBUG==1) 
cout << "Error starting stream" << endl; 
cout << portaudio->Pa_GetErrorText(err) << endl;
\#endif
	(*(portaudio->Pa_Terminate))(); 
	return; 
}
\#if (RECORDERDEBUG==1) 
cout << "Stream started" << endl; 
\#endif


return;} {}
  }
  Function {stopPAstream()} {open private return_type void
  } {
    code {// only to be called by portaudio_transport_stop
if (portaudiostream==NULL) return;
PaStream* pstream=portaudiostream;
portaudiostream=NULL;

PaError err = (*(portaudio->Pa_StopStream))( pstream );

if (err!=paNoError) { 
       cout << portaudio->Pa_GetErrorText(err) << endl;
}

err = (*(portaudio->Pa_CloseStream))( pstream );

if (err!=paNoError) { 
   cout << portaudio->Pa_GetErrorText(err) << endl;
}

(*(portaudio->Pa_Terminate))();} {}
  }
  Function {portaudio_transport_stop()} {open private return_type void
  } {
    code {if (portaudio==NULL) return;
if (!(portaudio->libloaded)) return;

\#if (RECORDERDEBUG==1) 
cout << "portaudio transport stop" << endl;   
\#endif
// TODO: only stop stream if not monitoring input.
stopPAstream();
portaudio_initialized=0;
portaudiostream=NULL;
portaudiooffset+=streamtime;
cout << "portaudiooffset at stop=" << portaudiooffset << endl;
if (mtsample!=NULL) 
{
    memutils::myfree("portaudio_transport_stop",mtsample);
    mtsample=NULL;
}} {}
  }
  Function {hd24_transport_goloc(__uint32 frames)} {open return_type void
  } {
    code {if (libjack!=NULL)
{
	if (libjack->libloaded) {
		if (portaudio_initialized!=1) {

			jackinit();
			if (jackclient!=NULL) {
				hd24_transport_locate((__sint64)frames);
				return;
			}
		}	
	}
}

if (portaudio!=NULL)
{
	if (portaudio->libloaded) 
	{
		hd24_transport_locate((__sint64)frames);
		return;
	}
}} {}
  }
  Function {hd24_transport_locate(__sint64 i)} {open return_type void
  } {
    code {cout << "Request to transport locate to " << i << endl;
if (i<0) i=0;
if (libjack!=NULL)
{
	if (libjack->libloaded) {
		cout << "try jackinit" << endl;
		jackinit();
		if (jackclient!=NULL) {
			libjack->jack_transport_locate(jackclient,i);
			return;
		}
	}
	cout << "Jack locate attempt inconclusive, will try portaudio if available" << endl;
}

if (portaudio!=NULL)
{
	if (portaudio->libloaded) {
		cout << "will have to do portaudio locate." << endl;
		bool streamwasinitialized=true;
		if (!(isportaudioinitialized())) 
		{	
			cout << "No previous stream, init a new one "<< endl;
			streamwasinitialized=false;
			if (tape==NULL)
			{
				return;
			}

		    	tape->currentlocation((i < 0) ? 0 : i);
			cout << "set location to " << i << endl;
			portaudiooffset=i; // still ok even without active stream
			streamtime=i;
  			cout << "set portaudiooffset, streamtime to " << i << endl;
  			return; // <-- see if this does the trick- no previous 
  				// stream, no new one.
		}
	
		PaError err;
		if (portaudiostream!=NULL) 
		{
			cout << "Still have a stream that needs stopping first." << endl;
			err = (*(portaudio->Pa_StopStream))( portaudiostream );
			if (err!=paNoError) 
			{
				// maybe another program owns the stream.
            			cout << portaudio->Pa_GetErrorText(err) << endl;
        		}
        				
			PaStream* oldportaudiostream=portaudiostream;
			portaudiostream=NULL;
			err = (*(portaudio->Pa_CloseStream))( oldportaudiostream );        
		}
		
		portaudiooffset=i; // still ok even without active stream
		streamtime=i; // old portaudio V18 legacy

		bool streamnolongerinitialized=false;
		if (!(isportaudioinitialized())) 
		{
			if (streamwasinitialized)
			{ 
				streamnolongerinitialized=true;
			}
		}
		
		if (streamnolongerinitialized)
		{
			/* if closing stream means no longer initialized,
			   do not open another because we are not playing back
			   anything at the moment. */
			return;
		}
		cout << "open a fresh stream" << endl;
		
		PaDeviceIndex indev=(*(portaudio->Pa_GetDefaultInputDevice))();
		PaDeviceIndex outdev=(*(portaudio->Pa_GetDefaultOutputDevice))();
		if (inputParameters!=NULL)
		{
			memset(inputParameters,'\\0',sizeof(*inputParameters));		

			this->inputParameters->device=indev;
			this->inputParameters->channelCount=2;
			this->inputParameters->sampleFormat=paFloat32;
			void* devinfo=(void*)(*(portaudio->Pa_GetDeviceInfo))( inputParameters->device );
			if (devinfo!=NULL)
			{
				this->inputParameters->suggestedLatency = (*(portaudio->Pa_GetDeviceInfo))( inputParameters->device )->defaultLowInputLatency;
			}
			this->inputParameters->hostApiSpecificStreamInfo = NULL;
		}
		if (outputParameters!=NULL)
		{
			memset(outputParameters,'\\0',sizeof(*outputParameters));
			this->outputParameters->device=outdev;
			this->outputParameters->channelCount=2;
			this->outputParameters->sampleFormat=paFloat32;
			void* devinfo=(void*)(*(portaudio->Pa_GetDeviceInfo))( outputParameters->device );
			if (devinfo!=NULL)
			{
				this->outputParameters->suggestedLatency = (*(portaudio->Pa_GetDeviceInfo))( outputParameters->device )->defaultLowOutputLatency;
			}
			this->outputParameters->hostApiSpecificStreamInfo = NULL;
		}

		double samrate=this->samplerate();
		cout << " sample rate for new stream is " << samrate << endl;
		if (samrate==0)
		{
			return;
		}
		
		err=(*(portaudio->Pa_OpenStream))(
			&portaudiostream,
			NULL,/*this->inputParameters,*/
			this->outputParameters,
			samrate,
			PA_FRAMESPERBUF, /* frames per buffer */
			paClipOff | paDitherOff,
			portaudio_process,
			this->recorder);
		this->havestreamtime=false;
		this->streamtime=0;
	
		if (err!=paNoError) { 
            		cout << portaudio->Pa_GetErrorText(err) << endl;
        	}
		if (err!=paNoError) { (*( portaudio->Pa_Terminate))(); return; }


		err=(*(portaudio->Pa_StartStream))(portaudiostream);
		if (err!=paNoError) { 
            		cout << portaudio->Pa_GetErrorText(err) << endl;
        	}
        	cout << "stream appears to have started successfully" << endl;
		        	
		return;
	}
}} {}
  }
  Function {hd24_transport_locate(__uint32 i)} {open return_type void
  } {
    code {this->hd24_transport_locate((__sint64)i);} {}
  }
  Function {hd24_transport_start()} {open return_type void
  } {
    code {if (libjack!=NULL)
{
	if (libjack->libloaded) {
		jackinit();
		if (jackclient!=NULL) {
			libjack->jack_transport_start(jackclient);
			return;
		}
	}
}

if (portaudio!=NULL)
{
	if (portaudio->libloaded) 
	{
		if (!(isportaudioinitialized())) 
		{
			portaudioinit();
		}
		if (isportaudioinitialized()) 
		{
			portaudio_transport_start();
			return;
		}
	}
}} {}
  }
  Function {hd24_transport_stop()} {open return_type void
  } {
    code {if (recorder!=NULL)
{
	recorder->resetpeaks();
}

if (libjack!=NULL)
{
	if (libjack->libloaded) 
	{
		jackinit();
		if (jackclient!=NULL) 
		{
			libjack->jack_transport_stop(jackclient);
			return;			
		}
	}
}

if (portaudio!=NULL)
{
	if (portaudio->libloaded) 
	{
		if (!(isportaudioinitialized())) 
		{
			portaudioinit();
		}
		if (isportaudioinitialized()) 
		{
			portaudio_transport_stop();
			return;
		}
	}
}} {}
  }
  Function {hd24_transport_ffwd(long int frames)} {open return_type void
  } {
    code {if (portaudio_initialized!=1) 
{
	if (libjack!=NULL)
	{
		if (libjack->libloaded) 
		{
			jackinit();
			if (jackclient!=NULL) 
			{
			__sint64 frame_time = /* currentlocation() */
				(__sint64)(libjack->jack_get_current_transport_frame(jackclient));
			hd24_transport_locate((__sint64)(frame_time+frames));
			return;
			}
		}
	}
}

if (portaudio!=NULL)
{
	if (portaudio->libloaded) 
	{
		__sint64 frame_time=currentlocation();
		hd24_transport_locate((__sint64)(frame_time+frames));

//string* dur=currsong->display_cursor();
//setstatus(*dur);
//delete (dur);

		return;
	}
}} {}
  }
  Function {hd24_transport_rew(long int frames)} {open return_type void
  } {
    code {if (libjack!=NULL)
{
	if (libjack->libloaded) 
	{
		if (portaudio_initialized!=1) 
		{	
			jackinit();	
			if (jackclient!=NULL) 
			{
				__sint64 frame_time = 
					(__sint64)(libjack->jack_get_current_transport_frame(jackclient));
				if (frames>frame_time) {
			   	    hd24_transport_locate((__sint64)0);
				} else {
				    hd24_transport_locate((__sint64)(frame_time-frames));
				}
				return;	
			}
		}	
	}
}

if (portaudio!=NULL)
{
	if (portaudio->libloaded) {

		__sint64 frame_time=currentlocation();
		if (frames>frame_time) {
		    hd24_transport_locate((__sint64)0);
		} else {
		    hd24_transport_locate((__sint64)(frame_time-frames));
		}

		hd24_transport_locate((__sint64)(frame_time-frames));

		return;
	}	
}} {}
  }
  Function {isinitialized()} {return_type bool
  } {
    code {if (this->isportaudioinitialized())
{
	return true;
}
if (this->isjackinitialized())
{
	return true;
}
return false;} {}
  }
  Function {mustloop()} {return_type bool
  } {
    code {return this->as_mustloop;} {}
  }
  Function {mustloop(bool yesno)} {return_type void
  } {
    code {this->as_mustloop=yesno;} {}
  }
  Function {samplerate()} {return_type __uint32
  } {
    code {return this->samrate; 
/*(double)(currsong->samplerate()/(currsong->physical_channels()/currsong->logical_channels())); */} {}
  }
  Function {samplerate(__uint32 newrate)} {return_type void
  } {
    code {this->samrate=newrate;} {}
  }
  Function {looppos()} {return_type __uint32
  } {
    code {return this->as_looppos;} {}
  }
  Function {looppos(__uint32 newpos)} {return_type void
  } {
    code {this->as_looppos=newpos;} {}
  }
  Function {locatepoint(int locpointnum,__uint32 locatepos)} {return_type void
  } {
    code {if (tape==NULL) return;
tape->setlocatepos(locpointnum,locatepos);} {}
  }
  Function {locatepoint(int locpointnum)} {return_type __uint32
  } {
    code {if (tape==NULL) return 0;
return tape->getlocatepos(locpointnum);} {}
  }
  Function {audiolib(int whichlib,void* libptr)} {open return_type void
  } {
    code {if (whichlib==AUDIOLIB_PORTAUDIO)
{
	this->portaudio=(PortAudioWrapper*)libptr;
\#if (RECORDERDEBUG==1)
cout << "set portaudio lib to " << libptr << endl;
\#endif
	return;
}
if (whichlib==AUDIOLIB_JACK)
{
	this->libjack=(JackWrapper*)libptr;
\#if (RECORDERDEBUG==1)
cout << "set jack lib to " << libptr << endl;
\#endif	
	return;
}
if (whichlib==AUDIOLIB_SNDFILE)
{
	this->soundfile=(SoundFileWrapper*)libptr;
\#if (RECORDERDEBUG==1)
cout << "set soundfile lib to " << libptr << endl;
\#endif		
}} {}
  }
  Function {audiolib(int whichlib)} {open return_type {void*}
  } {
    code {if (whichlib==AUDIOLIB_PORTAUDIO)
{
	return (void*)portaudio;
}
if (whichlib==AUDIOLIB_JACK)
{
	return (void*)libjack;
}
if (whichlib==AUDIOLIB_SNDFILE)
{
	return (void*)soundfile;
}
return NULL;} {}
  }
  Function {~AudioSystem()} {open
  } {
    code {if (inputParameters!=NULL)
{
	delete inputParameters;
	inputParameters=NULL;
}
if (outputParameters!=NULL)
{
	delete outputParameters;
	outputParameters=NULL;
}
\#if (RECORDERDEBUG==1)
cout << "AudioSystem::~AudioSystem()" << endl;
\#endif} {}
  }
  Function {audiostore(AudioStorage* store)} {open return_type void
  } {
    code {this->tape=store;
if (store!=NULL)
{
	this->samrate=store->samplerate();
}} {}
  }
  Function {audiostore()} {open return_type {AudioStorage*}
  } {
    code {return tape;} {}
  }
  Function {mixer(MixerControl* p_mixer)} {open return_type void
  } {
    code {this->mixercontrol=p_mixer;} {}
  }
  Function {mixer()} {open return_type {MixerControl*}
  } {
    code {return this->mixercontrol;} {}
  }
} 

class RecorderData {open
} {
  decl {int loopmode;} {public
  }
  decl {float trackpeak[24];} {public
  }
} 

class RecorderControl {open
} {
  decl {RecorderData* data;} {public
  }
  decl {RecorderUI* ui;} {public
  }
  decl {AudioSystem* audio;} {public
  }
  Function {RecorderControl()} {open
  } {
    code {this->data=new RecorderData();
init();} {}
  }
  Function {~RecorderControl()} {open
  } {
    code {if (this->data!=NULL)
{
	delete this->data;
}} {}
  }
  Function {init()} {open return_type void
  } {
    code {this->ui=NULL;
this->audio=new AudioSystem(this);
data->loopmode=0;} {}
  }
  Function {ready()} {open return_type int
  } {
    code {return 1;} {}
  }
  Function {parentui()} {open return_type {RecorderUI*}
  } {
    code {return this->ui;} {}
  }
  Function {parentui(RecorderUI* p_ui)} {open return_type void
  } {
    code {this->ui=p_ui;} {}
  }
  Function {loopmode()} {open return_type int
  } {
    code {return data->loopmode;} {}
  }
  Function {loopmode(int p_loopmode)} {return_type void
  } {
    code {data->loopmode=p_loopmode;
if (ui!=NULL)
{
	ui->button_loopmode->value(p_loopmode);
	ui->button_loopmode->redraw();
}} {}
  }
  Function {button_scrub_call(int amount,RecorderControl* mycontrol)} {open return_type {static void}
  } {
    code {if (mycontrol->audio==NULL) return;
// we could get the current transport pos here; ....
if (amount>0) {
mycontrol->audio->hd24_transport_ffwd((__uint32)(300*amount));
} else {
mycontrol->audio->hd24_transport_rew((__uint32)(-300*amount));
}
// ... then the new transport pos here; read the snippet 
// of audio that is spanned by the difference, stretch 
// it to the audio buffer size, then play it.
// Alternatively, a visual-only representation could be fine.} {}
  }
  Function {button_rew_call()} {open return_type void
  } {
    code {if (this->audio==NULL) return;
this->audio->hd24_transport_rew(5*this->audio->samplerate());} {}
  }
  Function {button_ffwd_call()} {open return_type void
  } {
    code {if (this->audio==NULL) return;
this->audio->hd24_transport_ffwd(5*this->audio->samplerate());} {}
  }
  Function {button_stop_call()} {open return_type void
  } {
    code {if (this->audio==NULL) return;
//this->currenthd24->settransportstatus(hd24fs::TRANSPORTSTATUS_STOP);
//TODO: The above is for monitoring purposes
this->audio->hd24_transport_stop();
if (ui==NULL) return;

ui->button_light((void*)(ui->button_stop),1);
//button_stop->up_image(button_stop_uplit->image());
ui->button_up((void*)(ui->button_play));
ui->button_up((void*)(ui->button_rec));} {}
  }
  Function {button_play_call()} {open return_type void
  } {
    code {if (this->audio==NULL) return;
//if (button_rec->value()==1) {
//	this->currenthd24->settransportstatus(hd24fs::TRANSPORTSTATUS_REC);
// TODO: The above is for monitoring purposes
//} else {
//	this->currenthd24->settransportstatus(hd24fs::TRANSPORTSTATUS_PLAY);
// TODO: The above is for monitoring purposes
//}
this->audio->hd24_transport_start();

ui->button_light(ui->button_stop,0);

if (ui->button_play->value()==1)
{
	ui->button_up(ui->button_rec);
}
ui->button_down(ui->button_play);} {}
  }
  Function {button_rec_call()} {open return_type void
  } {
    code {/* ui->button_rec->redraw();
if (currsong==NULL) return;
if (currenthd24==NULL) return;

if (this->currenthd24->gettransportstatus()==hd24fs::TRANSPORTSTATUS_STOP) {
	return;
}

if (ui->button_rec->value()==1) {
	this->currenthd24->settransportstatus(hd24fs::TRANSPORTSTATUS_REC);
} else {
	this->currenthd24->settransportstatus(hd24fs::TRANSPORTSTATUS_PLAY);
}

this->audio->hd24_transport_stop();
//button_play->value(0); */} {}
  }
  Function {solo(int channel,int val)} {} {
    code {// set solo status of channel to value
//mixer->mixerchannel[channel]->control->solo(val);} {}
  }
  Function {mute(int channel,int val)} {} {
    code {// set mute status of channel to value
//mixer->mixerchannel[channel]->control->mute(val);} {}
  }
  Function {resetpeaks()} {open return_type void
  } {
    code {for (int i=0;i<24;i++)
{
	data->trackpeak[i]=0;
}} {}
  }
  Function {highlight_setbuttons(int value)} {open return_type void
  } {
    code {ui->highlight_setbuttons(value);} {}
  }
  Function {hd24_transport_goloc(__uint32 frames)} {open return_type void
  } {
    code {if (audio==NULL)
{
	return;
}
audio->hd24_transport_goloc(frames);} {}
  }
  Function {button_rehearse_call()} {return_type void
  } {
    code {return;} {}
  }
  Function {handlelocatebutton(__uint32 locpoint)} {return_type void
  } {
    code {// either set or jumpto locate point

if (ui->button_setlocate->value()==1) 
{
   // set locate point
   ui->button_setlocate->value(0);
   highlight_setbuttons(ui->button_setlocate->value());
   // set loop start to current song cursor
   if (audio==NULL) return;
   audio->locatepoint(locpoint,audio->currentlocation());   
//   ui->populate_locatepoints(currsong,ui->locatepoints);
} else {
   // jump to locate point
   if (audio==NULL) return;
   audio->hd24_transport_locate((__sint64)(audio->locatepoint(locpoint)));
}} {}
  }
  Function {disable()} {} {
    code {/* Disable the recorder */
//fl_message("TODO: recordercontrol::disable()");
if ((this->ui)==NULL) return;
this->ui->deactivate();} {}
  }
  Function {enable()} {} {
    code {/* Disable the recorder */
//fl_message("TODO: recordercontrol::enable()");
if ((this->ui)==NULL) return;
this->ui->activate();} {}
  }
  decl {int dispwritecountdown;} {public
  }
  Function {dispwrite(unsigned int line,const char* message)} {return_type void
  } {
    code {ui->dispwrite(line,message);} {}
  }
  Function {dispwrite(unsigned int line,const char* message,__uint32 timeout_msec)} {return_type void
  } {
    code {ui->dispwrite(line,message,timeout_msec);} {}
  }
  Function {audiolib(int whichlib,void* libptr)} {open return_type void
  } {
    code {if (audio==NULL) return;
audio->audiolib(whichlib,libptr);} {}
  }
  Function {song(hd24song* store)} {open return_type void
  } {
    code {audio->audiostore((AudioStorage*)store);
if (store!=NULL)
{
	this->enable();
} else {
	this->disable();
}
if (store==NULL)
{
        string* disp=new string("    No Song     "
                                "    Selected    ");
        dispwrite(0,disp->c_str());
        delete disp;
}
else
{

	string disp="S";
	string* idstr=Convert::int2str(store->songid(),2,"0");
	disp+=*idstr;
	delete idstr;
	disp+=":\\"";
	string* dummy=store->songname();
	//transfersource->value(dummy->c_str());
	string* dummy2=Convert::readstring((unsigned char*)dummy->c_str(),0,10);
	string* dummy3=Convert::readstring((unsigned char*)dummy->c_str(),0,11);

	disp+=*dummy2;
	delete dummy;
	delete dummy2;
	if (dummy3->length()>10)
	{
	disp+="\\4"; // arrow right
	} else {
	disp+="\\"";
	}
	delete dummy3;
	string* disp2=Convert::padright(disp,16," ");
	
	string* dur=store->display_duration();

	*disp2+=dur->substr(0,8);
	*disp2+=":";
	*disp2+=dur->substr(9,2);
	*disp2+=" ";
	delete dur;

	if (store->iswriteprotected())
	{
	*disp2+="\\1";
	} else {
	*disp2+="\\2";
	}
	string* strtracksb=Convert::int2str(store->logical_channels(),2,"0");
	*disp2+=*strtracksb;
	delete strtracksb;
	*disp2+="t";

	dispwrite(0,disp2->c_str());
	delete disp2;

}} {selected
    }
  }
  Function {song()} {open return_type {hd24song*}
  } {
    code {return (hd24song*)audio->audiostore();} {}
  }
  Function {toggletrackarmed(__uint32 base1tracknum)} {open return_type void
  } {
    code {AudioStorage* astore=(hd24song*)(this->audio->audiostore());
astore->trackarmed(base1tracknum,!astore->trackarmed(base1tracknum));} {}
  }
} 

class RecorderUI {: {public Fl_Group}
} {
  decl {RecorderControl* control;} {public
  }
  Function {RecorderUI(int a,int b,int c,int d):Fl_Group(a,b,c,d,NULL)} {open
  } {
    code {this->control=new RecorderControl();
control->parentui(this);
this->window=(Fl_Window*)(this->make_window());
this->init_gui();} {}
  }
  Function {~RecorderUI()} {open
  } {
    code {delete control;} {}
  }
  Function {init_gui()} {open
  } {
    code {// position vu meters on recorder tab
int startx=trackchan[0]->x();
int starty=trackchan[0]->y();
for (unsigned int i=1; i<=MAXCHANNELS; i++) {
   int coloff=((i-((i-1)%8))-1)/8;
   trackchan[i-1]->setui(this);
   trackchan[i-1]->position(7+(18*coloff)+(startx)+((i-1)*23),starty+10);
   trackchan[i-1]->setchnum(i);

   solobutton[i-1]->position(8+(15*coloff)+(startx)+((i-1)*23),solobutton[i-1]->y());
   solobutton[i-1]->size(solobutton[0]->w(),solobutton[0]->h());
   solobutton[i-1]->up_image(solobutton[0]->up_image());
   solobutton[i-1]->down_image(solobutton[0]->down_image());
   mutebutton[i-1]->up_image(mutebutton[0]->up_image());
   mutebutton[i-1]->down_image(mutebutton[0]->down_image());
   mutebutton[i-1]->position(solobutton[i-1]->x(),mutebutton[i-1]->y());
   mutebutton[i-1]->size(mutebutton[0]->w(),mutebutton[0]->h());

   armbutton[i-1]->position(solobutton[i-1]->x(),armbutton[i-1]->y());
   if (i!=1) {
   	armbutton[i-1]->size(armbutton[0]->w(),armbutton[0]->h());
	armbutton[i-1]->up_image(armbutton[0]->up_image());
	armbutton[i-1]->down_image(armbutton[0]->down_image());
   }

}
   

trackinfo[0]->position(8*23+15,starty+10);
trackinfo[1]->position(16*23+33,starty+10);} {}
  }
  Function {set_ui(HD24UserInterface* p_ui)} {open return_type void
  } {
    code {this->ui=p_ui;} {}
  }
  decl {bool mustdisplaytimer;} {public
  }
  decl {int loopmode;} {public
  }
  decl {RecorderChannelUI* recorderchannel[24];} {public
  }
  decl {/* ==== RECORDER UI STUFF ====================*/} {}
  decl {HD24UserInterface* ui;} {}
  decl {//hd24fs* currenthd24;} {public
  }
  decl {//hd24song* currsong;} {public
  }
  decl {Fl_Window* window} {}
  decl {int currpeakmode;} {public
  }
  decl {Fl_Box* dispcell[16][2];} {public
  }
  decl {Fl_Box* i7seg[10];} {public
  }
  decl {Fl_Box* dispfont[256];} {public
  }
  decl {int slidermoved;} {public
  }
  decl {Fl_Image_Button* armbutton[24];} {public
  }
  decl {Fl_Image_Toggle_Button* mutebutton[24];} {public
  }
  decl {Fl_Image_Toggle_Button* solobutton[24];} {public
  }
  decl {int blinkcounter; /* For blinking record enable leds of level meters etc */} {public
  }
  decl {HD24TrackChannel* trackchan[24];} {public
  }
  decl {TrackInfo* trackinfo[24];} {public
  }
  decl {char olddisp[32];} {}
  Function {dispwrite_raw(unsigned int line,const char* message,bool savedisp)} {private return_type void
  } {
    code {unsigned int max=strlen(message);
// allowed lines on display: 0 and 1
if (line>1) { return; }

if (max>(16*(2-line))) {
   // maximum 16 chars if we start on line 1 (second line)
   // 32 chars if we start on line 0 (first line).
   max=(16*(2-line));
}

for (unsigned int i=0;i<max;i++) {
    if (i==16) { line++; }    
    unsigned int currchar=(unsigned int)((unsigned char)(message[i]));
    if (savedisp) 
    {
    	olddisp[(i%16)+(16*line)]=currchar;
    }
    this->dispcell[i%16][line]->image(dispfont[currchar]->image());
    this->dispcell[i%16][line]->redraw();
    
}
fl_check();} {}
  }
  decl {int dispwritecountdown;} {public
  }
  Function {dispwrite(unsigned int line,const char* message)} {return_type void
  } {
    code {dispwrite_raw(line,message,true);
dispwritecountdown=0;} {}
  }
  Function {disprestore()} {return_type void
  } {
    code {dispwrite_raw(0,&olddisp[0],false);
dispwritecountdown=0;} {}
  }
  Function {dispwrite(unsigned int line,const char* message,__uint32 timeout_msec)} {return_type void
  } {
    code {dispwrite_raw(line,message,false);
    dispwritecountdown=(int)(1000*TIMEOUT);} {}
  }
  Function {readmixer()} {open return_type void
  } {
    code {// set solo status of channel to value
/*
for (unsigned int i=0;i<MAXCHANNELS;i++) {
	solobutton[i]->value(mixer->mixerchannel[i]->control->solo());
	solobutton[i]->redraw();
	mutebutton[i]->value(mixer->mixerchannel[i]->control->mute());
	mutebutton[i]->redraw();
}
*/} {}
  }
  Function {make_window() /*<-----------------------------------*/} {open
  } {
    Fl_Window recordergroup {open
      xywh {378 259 615 440} type Double
      code0 {o->position(this->x(),this->y());}
      class Fl_Group visible
    } {
      Fl_Group resources {open
        xywh {25 62 560 423} hide deactivate
      } {
        Fl_Button button_play_up {
          tooltip Play image {images/button_play.gif} xywh {25 75 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_play_dn {
          tooltip Play image {images/button_play_dn.gif} xywh {75 75 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_stop_dn {
          tooltip Play image {images/button_stop_dn.gif} xywh {295 445 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_stop_up {
          tooltip Play image {images/button_stop.gif} xywh {345 445 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_stop_uplit {
          tooltip Play image {images/button_stop_uplit.gif} xywh {355 455 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_small_up {
          tooltip arm image {images/button_small.gif} xywh {565 195 20 15} deactivate
        }
        Fl_Button button_small_dn {
          tooltip arm image {images/button_small_dn.gif} xywh {60 215 20 15} deactivate
        }
        Fl_Button button_rew_up {
          tooltip Play image {images/button_rew.gif} xywh {35 85 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_rew_dn {
          tooltip Play image {images/button_rew_dn.gif} xywh {85 85 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_ffwd_up {
          tooltip Play image {images/button_ffwd.gif} xywh {45 95 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_ffwd_dn {
          tooltip Play image {images/button_ffwd_dn.gif} xywh {95 95 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_rec_up {
          tooltip Play image {images/button_rec.gif} xywh {55 105 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_rec_dn {
          tooltip Play image {images/button_rec_dn.gif} xywh {105 105 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_mute_up {
          tooltip Play image {images/button_mute.gif} xywh {65 115 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_mute_dn {
          tooltip Play image {images/button_mute_dn.gif} xywh {115 115 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_solo_up {
          tooltip Play image {images/button_solo.gif} xywh {75 125 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_solo_dn {
          tooltip Play image {images/button_solo_dn.gif} xywh {125 125 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_lrc_led_up {
          tooltip Play image {images/button_lrc_led.gif} xywh {85 135 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_lrc_led_dn {
          tooltip Play image {images/button_lrc_led_dn.gif} xywh {135 135 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_lrc_led_on_up {
          tooltip Play image {images/button_lrc_led_on.gif} xywh {85 135 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_lrc_led_on_dn {
          tooltip Play image {images/button_lrc_led_on_dn.gif} xywh {135 135 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_lrc_up {
          tooltip Play image {images/button_lrc.gif} xywh {85 135 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Button button_lrc_dn {
          tooltip Play image {images/button_lrc_dn.gif} xywh {135 135 50 30} labelsize 11 align 16 deactivate
        }
        Fl_Box i7seg0 {
          image {images/7seg_0.gif} xywh {325 276 20 34} hide
          code0 {i7seg[0]=o;}
        }
        Fl_Box i7seg1 {
          image {images/7seg_1.gif} xywh {325 276 20 34} hide
          code0 {i7seg[1]=o;}
        }
        Fl_Box i7seg2 {
          image {images/7seg_2.gif} xywh {325 276 20 34} hide
          code0 {i7seg[2]=o;}
        }
        Fl_Box i7seg3 {
          image {images/7seg_3.gif} xywh {325 276 20 34} hide
          code0 {i7seg[3]=o;}
        }
        Fl_Box i7seg4 {
          image {images/7seg_4.gif} xywh {325 276 20 34} hide
          code0 {i7seg[4]=o;}
        }
        Fl_Box i7seg5 {
          image {images/7seg_5.gif} xywh {325 276 20 34} hide
          code0 {i7seg[5]=o;}
        }
        Fl_Box i7seg6 {
          image {images/7seg_6.gif} xywh {325 276 20 34} hide
          code0 {i7seg[6]=o;}
        }
        Fl_Box i7seg7 {
          image {images/7seg_7.gif} xywh {325 276 20 34} hide
          code0 {i7seg[7]=o;}
        }
        Fl_Box i7seg8 {
          image {images/7seg_8.gif} xywh {325 276 20 34} hide
          code0 {i7seg[8]=o;}
        }
        Fl_Box i7seg9 {
          image {images/7seg_9.gif} xywh {325 276 20 34} hide
          code0 {i7seg[9]=o;}
        }
        Fl_Group dispfontgroup {
          label font open
          xywh {565 28 70 52} hide deactivate
        } {
          Fl_Box {} {
            label label
            image {images/HD24_matrix_32.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[32]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_33.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[33]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_34.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[34]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_35.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[35]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_36.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[36]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_37.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[37]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_38.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[38]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_39.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[39]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_40.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[40]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_41.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[41]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_42.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[42]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_43.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[43]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_44.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[44]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_45.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[45]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_46.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[46]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_47.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[47]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_48.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[48]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_49.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[49]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_50.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[50]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_51.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[51]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_52.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[52]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_53.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[53]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_54.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[54]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_55.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[55]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_56.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[56]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_57.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[57]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_58.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[58]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_59.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[59]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_60.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[60]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_61.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[61]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_62.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[62]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_63.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[63]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_64.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[64]=o;}
          }
          Fl_Box {} {
            label A
            image {images/HD24_matrix_65.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[65]=o;}
          }
          Fl_Box {} {
            label B
            image {images/HD24_matrix_66.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[66]=o;}
          }
          Fl_Box {} {
            label C
            image {images/HD24_matrix_67.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[67]=o;}
          }
          Fl_Box {} {
            label D
            image {images/HD24_matrix_68.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[68]=o;}
          }
          Fl_Box {} {
            label E
            image {images/HD24_matrix_69.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[69]=o;}
          }
          Fl_Box {} {
            label F
            image {images/HD24_matrix_70.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[70]=o;}
          }
          Fl_Box {} {
            label G
            image {images/HD24_matrix_71.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[71]=o;}
          }
          Fl_Box {} {
            label H
            image {images/HD24_matrix_72.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[72]=o;}
          }
          Fl_Box {} {
            label I
            image {images/HD24_matrix_73.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[73]=o;}
          }
          Fl_Box {} {
            label J
            image {images/HD24_matrix_74.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[74]=o;}
          }
          Fl_Box {} {
            label K
            image {images/HD24_matrix_75.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[75]=o;}
          }
          Fl_Box {} {
            label L
            image {images/HD24_matrix_76.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[76]=o;}
          }
          Fl_Box {} {
            label M
            image {images/HD24_matrix_77.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[77]=o;}
          }
          Fl_Box {} {
            label N
            image {images/HD24_matrix_78.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[78]=o;}
          }
          Fl_Box {} {
            label O
            image {images/HD24_matrix_79.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[79]=o;}
          }
          Fl_Box {} {
            label P
            image {images/HD24_matrix_80.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[80]=o;}
          }
          Fl_Box {} {
            label Q
            image {images/HD24_matrix_81.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[81]=o;}
          }
          Fl_Box {} {
            label R
            image {images/HD24_matrix_82.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[82]=o;}
          }
          Fl_Box {} {
            label S
            image {images/HD24_matrix_83.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[83]=o;}
          }
          Fl_Box {} {
            label T
            image {images/HD24_matrix_84.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[84]=o;}
          }
          Fl_Box {} {
            label U
            image {images/HD24_matrix_85.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[85]=o;}
          }
          Fl_Box {} {
            label V
            image {images/HD24_matrix_86.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[86]=o;}
          }
          Fl_Box {} {
            label W
            image {images/HD24_matrix_87.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[87]=o;}
          }
          Fl_Box {} {
            label X
            image {images/HD24_matrix_88.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[88]=o;}
          }
          Fl_Box {} {
            label Y
            image {images/HD24_matrix_89.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[89]=o;}
          }
          Fl_Box {} {
            label Z
            image {images/HD24_matrix_90.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[90]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_91.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[91]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_92.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[92]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_93.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[93]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_94.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[94]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_95.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[95]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_96.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[96]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_97.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[97]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_98.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[98]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_99.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[99]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_100.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[100]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_101.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[101]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_102.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[102]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_103.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[103]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_104.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[104]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_105.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[105]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_106.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[106]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_107.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[107]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_108.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[108]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_109.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[109]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_110.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[110]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_111.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[111]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_112.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[112]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_113.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[113]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_114.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[114]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_115.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[115]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_116.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[116]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_117.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[117]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_118.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[118]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_119.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[119]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_120.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[120]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_121.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[121]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_122.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[122]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_123.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[123]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_124.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[124]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_125.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[125]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_126.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[126]=o;}
          }
          Fl_Box {} {
            label label
            image {images/HD24_matrix_127.gif} xywh {580 43 35 17} hide
            code0 {this->dispfont[127]=o;}
          }
          Fl_Box {} {
            label writeprotect
            image {images/HD24_matrix_writeprotected.gif} xywh {590 53 35 17} hide
            code0 {this->dispfont[1]=o;}
          }
          Fl_Box {} {
            label writeenable
            image {images/HD24_matrix_writeenabled.gif} xywh {600 63 35 17} hide
            code0 {this->dispfont[2]=o;}
          }
          Fl_Box {} {
            label {arrow left}
            image {images/HD24_matrix_arrowleft.gif} xywh {600 63 35 17} hide
            code0 {this->dispfont[3]=o;}
          }
          Fl_Box {} {
            label {arrow right}
            image {images/HD24_matrix_arrowright.gif} xywh {610 73 35 17} hide
            code0 {this->dispfont[4]=o;}
          }
        }
      }
      Fl_Slider locationslider {
        callback {hd24song* currsong=(hd24song*)(this->control->song());
if (currsong==NULL) return;
this->slidermoved=3;
long long newpos=(long long)currsong->songlength_in_samples();
newpos*=(int)(o->value());
newpos=(__uint32)(newpos/1000);
control->hd24_transport_goloc(newpos);}
        xywh {10 208 595 17} type Horizontal selection_color 41 labelsize 12 align 4 maximum 1000 step 1
        code0 {this->slidermoved=0;}
      }
      Fl_Box {} {
        xywh {305 226 300 149} box DOWN_BOX color 8
      }
      Fl_Button button_setlocate {
        label {SET LOC}
        callback {control->highlight_setbuttons(o->value());}
        tooltip {Set Locate} xywh {420 290 50 20} type Toggle box FLAT_BOX down_box FLAT_BOX color 16 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 5
        code0 {o->up_image(button_lrc_up->image()); o->down_image(button_lrc_dn->image());}
        class Fl_Image_Toggle_Button
      }
      Fl_Button button_loopmode {
        label {AUTO LOOP}
        callback {control->loopmode(button_loopmode->value());}
        tooltip {Auto Loop} xywh {310 250 50 20} type Toggle box FLAT_BOX down_box FLAT_BOX color 16 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 5
        code0 {o->up_image(button_lrc_up->image()); o->down_image(button_lrc_dn->image());}
        class Fl_Image_Toggle_Button
      }
      Fl_Repeat_Button button_rew {
        callback {control->button_rew_call();}
        tooltip Rewind image {images/button_rew.gif} xywh {310 330 50 30} box FLAT_BOX labelsize 11 align 16
        code0 {o->up_image(o->image()); o->down_image(button_rew_dn->image()); o->image(NULL);}
        class Fl_Image_Repeat_Button
      }
      Fl_Repeat_Button button_ffwd {
        callback {control->button_ffwd_call();}
        tooltip {F Fwd} image {images/button_ffwd.gif} xywh {370 330 50 30} box FLAT_BOX labelsize 11 align 16
        code0 {o->up_image(o->image()); o->down_image(button_ffwd_dn->image()); o->image(NULL);}
        class Fl_Image_Repeat_Button
      }
      Fl_Button button_stop {
        callback {if (control!=NULL) control->button_stop_call();}
        tooltip Stop image {images/button_stop_uplit.gif} xywh {430 330 50 30} box FLAT_BOX labelsize 11 align 16
        code0 {//o->up_image(button_stop_uplit->image()); o->down_image(button_stop_dn->image());}
        code1 {o->up_image(o->image()); o->down_image(button_stop_dn->image()); o->image(NULL);}
        class Fl_Image_Button
      }
      Fl_Button button_play {
        callback {control->button_play_call();}
        tooltip Play image {images/button_play.gif} xywh {490 330 50 30} box FLAT_BOX labelsize 11 align 16
        code0 {o->up_image(o->image()); o->down_image(button_play_dn->image()); o->image(NULL);}
        class Fl_Image_Button
      }
      Fl_Box {} {
        xywh {475 231 127 84} box BORDER_BOX color 0
      }
      Fl_Button button_loopstart {
        label {LOOP START}
        callback {control->handlelocatebutton(hd24song::LOCATEPOS_LOOPSTART);}
        tooltip {Loop Start} xywh {485 250 50 20} box FLAT_BOX down_box FLAT_BOX color 16 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 1
        code0 {hlbuttons_defaultcolor=o->color(); o->up_image(button_lrc_led_up->image()); o->down_image(button_lrc_led_dn->image());}
        class Fl_Image_Button
      }
      Fl_Button button_loopend {
        label {LOOP END}
        callback {control->handlelocatebutton(hd24song::LOCATEPOS_LOOPEND);}
        tooltip {Loop End} xywh {550 250 50 20} box FLAT_BOX down_box FLAT_BOX color 16 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 9
        code0 {o->up_image(button_lrc_led_up->image()); o->down_image(button_lrc_led_dn->image());}
        class Fl_Image_Button
      }
      Fl_Button button_locate0 {
        label {LOC 0}
        callback {control->audio->hd24_transport_locate((__sint64)0);}
        tooltip {Locate 0} xywh {420 250 50 20} box FLAT_BOX color 16 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 5
        code0 {o->up_image(button_lrc_up->image()); o->down_image(button_lrc_dn->image());}
        class Fl_Image_Button
      }
      Fl_Button button_rec {
        callback {control->button_rec_call();}
        tooltip Record image {images/button_rec.gif} xywh {550 330 50 30} type Toggle box FLAT_BOX labelsize 11
        code0 {o->up_image(o->image()); o->down_image(button_rec_dn->image()); o->image(NULL);}
        class Fl_Image_Toggle_Button
      }
      Fl_Group channelcanvas {open
        xywh {10 15 595 140} box DOWN_BOX color 0
      } {
        Fl_Group tc1 {open
          xywh {15 15 15 135}
          code0 {trackchan[0]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc2 {open
          xywh {15 15 15 135}
          code0 {trackchan[1]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc3 {open
          xywh {15 15 15 135}
          code0 {trackchan[2]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc4 {open
          xywh {15 15 15 135}
          code0 {trackchan[3]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc5 {open
          xywh {15 15 15 135}
          code0 {trackchan[4]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc6 {open
          xywh {15 15 15 135}
          code0 {trackchan[5]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc7 {open
          xywh {15 15 15 135}
          code0 {trackchan[6]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc8 {open
          xywh {15 15 15 135}
          code0 {trackchan[7]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group trackinfo1 {open
          xywh {15 15 15 135}
          code0 {trackinfo[0]=trackinfo1;}
          class TrackInfo
        } {}
        Fl_Group tc9 {open
          xywh {15 15 15 135}
          code0 {trackchan[8]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc10 {open
          xywh {15 15 15 135}
          code0 {trackchan[9]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc11 {open
          xywh {15 15 15 135}
          code0 {trackchan[10]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc12 {open
          xywh {15 15 15 135}
          code0 {trackchan[11]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc13 {open
          xywh {15 15 15 135}
          code0 {trackchan[12]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc14 {open
          xywh {15 15 15 135}
          code0 {trackchan[13]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc15 {open
          xywh {15 15 15 135}
          code0 {trackchan[14]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc16 {open
          xywh {15 15 15 135}
          code0 {trackchan[15]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group trackinfo2 {open
          xywh {15 15 15 135}
          code0 {trackinfo[1]=trackinfo2;}
          class TrackInfo
        } {}
        Fl_Group tc17 {open
          xywh {15 15 15 135}
          code0 {trackchan[16]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc18 {open
          xywh {15 15 15 135}
          code0 {trackchan[17]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc19 {open
          xywh {15 15 15 135}
          code0 {trackchan[18]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc20 {open
          xywh {15 15 15 135}
          code0 {trackchan[19]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc21 {open
          xywh {15 15 15 135}
          code0 {trackchan[20]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc22 {open
          xywh {15 15 15 135}
          code0 {trackchan[21]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc23 {open
          xywh {15 15 15 135}
          code0 {trackchan[22]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group tc24 {open
          xywh {15 15 15 135}
          code0 {trackchan[23]=o;}
          class HD24TrackChannel
        } {}
        Fl_Group {} {open
          xywh {35 40 15 15}
        } {}
      }
      Fl_Button arm1 {
        callback {this->control->toggletrackarmed(1);}
        tooltip arm xywh {40 155 20 15} labelsize 8 labelcolor 7
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[0]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm2 {
        callback {this->control->toggletrackarmed(2);}
        tooltip arm xywh {60 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[1]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm3 {
        callback {this->control->toggletrackarmed(3);}
        tooltip arm xywh {75 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[2]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm4 {
        callback {this->control->toggletrackarmed(4);}
        tooltip arm xywh {90 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[3]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm5 {
        callback {this->control->toggletrackarmed(5);}
        tooltip arm xywh {105 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[4]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm6 {
        callback {this->control->toggletrackarmed(6);}
        tooltip arm xywh {120 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[5]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm7 {
        callback {this->control->toggletrackarmed(7);}
        tooltip arm xywh {135 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[6]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm8 {
        callback {this->control->toggletrackarmed(8);}
        tooltip arm xywh {150 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[7]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm9 {
        callback {this->control->toggletrackarmed(9);}
        tooltip arm xywh {235 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[8]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm10 {
        callback {this->control->toggletrackarmed(10);}
        tooltip arm xywh {250 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[9]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm11 {
        callback {this->control->toggletrackarmed(11);}
        tooltip arm xywh {265 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[10]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm12 {
        callback {this->control->toggletrackarmed(12);}
        tooltip arm xywh {280 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[11]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm13 {
        callback {this->control->toggletrackarmed(13);}
        tooltip arm xywh {295 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[12]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm14 {
        callback {this->control->toggletrackarmed(14);}
        tooltip arm xywh {310 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[13]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm15 {
        callback {this->control->toggletrackarmed(15);}
        tooltip arm xywh {325 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[14]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm16 {
        callback {this->control->toggletrackarmed(16);}
        tooltip arm xywh {340 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[15]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm17 {
        callback {this->control->toggletrackarmed(17);}
        tooltip arm xywh {430 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[16]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm18 {
        callback {this->control->toggletrackarmed(18);}
        tooltip arm xywh {445 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[17]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm19 {
        callback {this->control->toggletrackarmed(19);}
        tooltip arm xywh {460 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[18]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm20 {
        callback {this->control->toggletrackarmed(20);}
        tooltip arm xywh {475 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[19]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm21 {
        callback {this->control->toggletrackarmed(21);}
        tooltip arm xywh {490 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[20]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm22 {
        callback {this->control->toggletrackarmed(22);}
        tooltip arm xywh {505 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[21]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm23 {
        callback {this->control->toggletrackarmed(23);}
        tooltip arm xywh {520 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[22]=o;}
        class Fl_Image_Button
      }
      Fl_Button arm24 {
        callback {this->control->toggletrackarmed(24);}
        tooltip arm xywh {535 155 15 15}
        code0 {o->up_image(button_small_up->image()); o->down_image(button_small_dn->image()); armbutton[23]=o;}
        class Fl_Image_Button
      }
      Fl_Button solo1 {
        callback {control->solo(0,o->value());}
        xywh {40 175 20 15} selection_color 2
        code0 {o->up_image(button_solo_up->image()); o->down_image(button_solo_dn->image()); solobutton[0]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo2 {
        callback {control->solo(1,o->value());}
        xywh {60 175 15 15} selection_color 2
        code0 {solobutton[1]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo3 {
        callback {control->solo(2,o->value());}
        xywh {75 175 15 15} selection_color 2
        code0 {solobutton[2]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo4 {
        callback {control->solo(3,o->value());}
        xywh {90 175 15 15} selection_color 2
        code0 {solobutton[3]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo5 {
        callback {control->solo(4,o->value());}
        xywh {105 175 15 15} selection_color 2
        code0 {solobutton[4]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo6 {
        callback {control->solo(5,o->value());}
        xywh {120 175 15 15} selection_color 2
        code0 {solobutton[5]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo7 {
        callback {control->solo(6,o->value());}
        xywh {135 175 15 15} selection_color 2
        code0 {solobutton[6]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo8 {
        callback {control->solo(7,o->value());}
        xywh {150 175 15 15} selection_color 2
        code0 {solobutton[7]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo9 {
        callback {control->solo(8,o->value());}
        xywh {235 175 15 15} selection_color 2
        code0 {solobutton[8]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo10 {
        callback {control->solo(9,o->value());}
        xywh {250 175 15 15} selection_color 2
        code0 {solobutton[9]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo11 {
        callback {control->solo(10,o->value());}
        xywh {265 175 15 15} selection_color 2
        code0 {solobutton[10]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo12 {
        callback {control->solo(11,o->value());}
        xywh {280 175 15 15} selection_color 2
        code0 {solobutton[11]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo13 {
        callback {control->solo(12,o->value());}
        xywh {295 175 15 15} selection_color 2
        code0 {solobutton[12]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo14 {
        callback {control->solo(13,o->value());}
        xywh {310 175 15 15} selection_color 2
        code0 {solobutton[13]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo15 {
        callback {control->solo(14,o->value());}
        xywh {325 175 15 15} selection_color 2
        code0 {solobutton[14]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo16 {
        callback {control->solo(15,o->value());}
        xywh {340 175 15 15} selection_color 2
        code0 {solobutton[15]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo17 {
        callback {control->solo(16,o->value());}
        xywh {430 175 15 15} selection_color 2
        code0 {solobutton[16]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo18 {
        callback {control->solo(17,o->value());}
        xywh {445 175 15 15} selection_color 2
        code0 {solobutton[17]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo19 {
        callback {control->solo(18,o->value());}
        xywh {460 175 15 15} selection_color 2
        code0 {solobutton[18]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo20 {
        callback {control->solo(19,o->value());}
        xywh {475 175 15 15} selection_color 2
        code0 {solobutton[19]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo21 {
        callback {control->solo(20,o->value());}
        xywh {490 175 15 15} selection_color 2
        code0 {solobutton[20]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo22 {
        callback {control->solo(21,o->value());}
        xywh {505 175 15 15} selection_color 2
        code0 {solobutton[21]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo23 {
        callback {control->solo(22,o->value());}
        xywh {520 175 15 15} selection_color 2
        code0 {solobutton[22]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button solo24 {
        callback {control->solo(23,o->value());}
        xywh {535 175 15 15} selection_color 2
        code0 {solobutton[23]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute1 {
        callback {control->mute(0,o->value());}
        xywh {40 192 20 15} selection_color 1
        code0 {o->up_image(button_mute_up->image()); o->down_image(button_mute_dn->image()); mutebutton[0]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute2 {
        callback {control->mute(1,o->value());}
        xywh {60 192 15 15} selection_color 1
        code0 {mutebutton[1]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute3 {
        callback {control->mute(2,o->value());}
        xywh {75 192 15 15} selection_color 1
        code0 {mutebutton[2]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute4 {
        callback {control->mute(3,o->value());}
        xywh {90 192 15 15} selection_color 1
        code0 {mutebutton[3]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute5 {
        callback {control->mute(4,o->value());}
        xywh {105 192 15 15} selection_color 1
        code0 {mutebutton[4]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute6 {
        callback {control->mute(5,o->value());}
        xywh {120 192 15 15} selection_color 1
        code0 {mutebutton[5]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute7 {
        callback {control->mute(6,o->value());}
        xywh {135 192 15 15} selection_color 1
        code0 {mutebutton[6]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute8 {
        callback {control->mute(7,o->value());}
        xywh {150 192 15 15} selection_color 1
        code0 {mutebutton[7]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute9 {
        callback {control->mute(8,o->value());}
        xywh {235 192 15 15} selection_color 1
        code0 {mutebutton[8]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute10 {
        callback {control->mute(9,o->value());}
        xywh {250 192 15 15} selection_color 1
        code0 {mutebutton[9]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute11 {
        callback {control->mute(10,o->value());}
        xywh {265 192 15 15} selection_color 1
        code0 {mutebutton[10]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute12 {
        callback {control->mute(11,o->value());}
        xywh {280 192 15 15} selection_color 1
        code0 {mutebutton[11]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute13 {
        callback {control->mute(12,o->value());}
        xywh {295 192 15 15} selection_color 1
        code0 {mutebutton[12]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute14 {
        callback {control->mute(13,o->value());}
        xywh {310 192 15 15} selection_color 1
        code0 {mutebutton[13]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute15 {
        callback {control->mute(14,o->value());}
        xywh {325 192 15 15} selection_color 1
        code0 {mutebutton[14]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute16 {
        callback {control->mute(15,o->value());}
        xywh {340 192 15 15} selection_color 1
        code0 {mutebutton[15]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute17 {
        callback {control->mute(16,o->value());}
        xywh {430 192 15 15} selection_color 1
        code0 {mutebutton[16]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute18 {
        callback {control->mute(17,o->value());}
        xywh {445 192 15 15} selection_color 1
        code0 {mutebutton[17]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute19 {
        callback {control->mute(18,o->value());}
        xywh {460 192 15 15} selection_color 1
        code0 {mutebutton[18]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute20 {
        callback {control->mute(19,o->value());}
        xywh {475 192 15 15} selection_color 1
        code0 {mutebutton[19]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute21 {
        callback {control->mute(20,o->value());}
        xywh {490 192 15 15} selection_color 1
        code0 {mutebutton[20]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute22 {
        callback {control->mute(21,o->value());}
        xywh {505 192 15 15} selection_color 1
        code0 {mutebutton[21]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute23 {
        callback {control->mute(22,o->value());}
        xywh {520 192 15 15} selection_color 1
        code0 {mutebutton[22]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Button mute24 {
        callback {control->mute(23,o->value());}
        xywh {535 192 15 15} selection_color 1
        code0 {mutebutton[23]=o;}
        class Fl_Image_Toggle_Button
      }
      Fl_Box arm_unarm_all {
        callback {hd24song* currsong=this->control->song();
if (currsong==NULL) return;

bool alltracksarmed=true;
for (unsigned int i=1;i<=currsong->logical_channels();i++) {
   if (!currsong->trackarmed(i)) {
      alltracksarmed=false;
      break;
   }
}
bool mustarm=false;
if (!alltracksarmed) {
   mustarm=true;
}
for (unsigned int i=1;i<=currsong->logical_channels();i++) {
   currsong->trackarmed(i,mustarm);
}}
        tooltip {Arm tracks} xywh {10 156 10 10} box OVAL_BOX color 1 selection_color 1
        class Fl_Button
      }
      Fl_Box {} {
        label S
        tooltip Solo xywh {10 176 15 14} color 1 selection_color 1 labelfont 1 labelsize 12
      }
      Fl_Box {} {
        label M
        tooltip Mute xywh {10 191 15 14} color 1 selection_color 1 labelfont 1 labelsize 12
      }
      Fl_Group infodisplay {open
        xywh {10 225 295 150} box DOWN_BOX color 0
      } {
        Fl_Box ho1 {
          image {images/7seg_8.gif} xywh {12 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box ho2 {
          image {images/7seg_8.gif} xywh {27 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box mi1 {
          image {images/7seg_8.gif} xywh {55 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box mi2 {
          image {images/7seg_8.gif} xywh {70 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box se1 {
          image {images/7seg_8.gif} xywh {98 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box se2 {
          image {images/7seg_8.gif} xywh {113 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box fr1 {
          image {images/7seg_8.gif} xywh {141 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box fr2 {
          image {images/7seg_8.gif} xywh {156 234 16 26}
          code0 {o->image(i7seg0->image()); o->redraw();}
        }
        Fl_Box {} {
          label H
          xywh {42 247 12 14} labelfont 3 labelsize 11 labelcolor 6
        }
        Fl_Box {} {
          label M
          xywh {85 247 12 14} labelfont 3 labelsize 11 labelcolor 6
        }
        Fl_Box {} {
          label S
          xywh {128 247 12 14} labelfont 3 labelsize 11 labelcolor 6
        }
        Fl_Box {} {
          label F
          xywh {171 247 12 14} labelfont 3 labelsize 11 labelcolor 6
        }
        Fl_Box l1c0 {
          image {images/HD24_matrix_realsize.gif} xywh {13 274 20 26}
          code0 {this->dispcell[0][0]=o;}
        }
        Fl_Box l1c1 {
          image {images/HD24_matrix_realsize.gif} xywh {31 274 20 26}
          code0 {this->dispcell[1][0]=o;}
        }
        Fl_Box l1c2 {
          image {images/HD24_matrix_realsize.gif} xywh {49 274 20 26}
          code0 {this->dispcell[2][0]=o;}
        }
        Fl_Box l1c3 {
          image {images/HD24_matrix_realsize.gif} xywh {67 274 20 26}
          code0 {this->dispcell[3][0]=o;}
        }
        Fl_Box l1c4 {
          image {images/HD24_matrix_realsize.gif} xywh {85 274 20 26}
          code0 {this->dispcell[4][0]=o;}
        }
        Fl_Box l1c5 {
          image {images/HD24_matrix_realsize.gif} xywh {103 274 20 26}
          code0 {this->dispcell[5][0]=o;}
        }
        Fl_Box l1c6 {
          image {images/HD24_matrix_realsize.gif} xywh {121 274 20 26}
          code0 {this->dispcell[6][0]=o;}
        }
        Fl_Box l1c7 {
          image {images/HD24_matrix_realsize.gif} xywh {139 274 20 26}
          code0 {this->dispcell[7][0]=o;}
        }
        Fl_Box l1c8 {
          image {images/HD24_matrix_realsize.gif} xywh {157 274 20 26}
          code0 {this->dispcell[8][0]=o;}
        }
        Fl_Box l1c9 {
          image {images/HD24_matrix_realsize.gif} xywh {175 274 20 26}
          code0 {this->dispcell[9][0]=o;}
        }
        Fl_Box l1ca {
          image {images/HD24_matrix_realsize.gif} xywh {193 274 20 26}
          code0 {this->dispcell[10][0]=o;}
        }
        Fl_Box l1cb {
          image {images/HD24_matrix_realsize.gif} xywh {211 274 20 26}
          code0 {this->dispcell[11][0]=o;}
        }
        Fl_Box l1cc {
          image {images/HD24_matrix_realsize.gif} xywh {229 274 20 26}
          code0 {this->dispcell[12][0]=o;}
        }
        Fl_Box l1cd {
          image {images/HD24_matrix_realsize.gif} xywh {247 274 20 26}
          code0 {this->dispcell[13][0]=o;}
        }
        Fl_Box l1ce {
          image {images/HD24_matrix_realsize.gif} xywh {265 274 20 26}
          code0 {this->dispcell[14][0]=o;}
        }
        Fl_Box l1cf {
          image {images/HD24_matrix_realsize.gif} xywh {283 274 20 26}
          code0 {this->dispcell[15][0]=o;}
        }
        Fl_Box l2c0 {
          image {images/HD24_matrix_realsize.gif} xywh {12 304 20 26}
          code0 {this->dispcell[0][1]=o;}
        }
        Fl_Box l2c1 {
          image {images/HD24_matrix_realsize.gif} xywh {30 304 20 26}
          code0 {this->dispcell[1][1]=o;}
        }
        Fl_Box l2c2 {
          image {images/HD24_matrix_realsize.gif} xywh {48 304 20 26}
          code0 {this->dispcell[2][1]=o;}
        }
        Fl_Box l2c3 {
          image {images/HD24_matrix_realsize.gif} xywh {66 304 20 26}
          code0 {this->dispcell[3][1]=o;}
        }
        Fl_Box l2c4 {
          image {images/HD24_matrix_realsize.gif} xywh {84 304 20 26}
          code0 {this->dispcell[4][1]=o;}
        }
        Fl_Box l2c5 {
          image {images/HD24_matrix_realsize.gif} xywh {102 304 20 26}
          code0 {this->dispcell[5][1]=o;}
        }
        Fl_Box l2c6 {
          image {images/HD24_matrix_realsize.gif} xywh {120 304 20 26}
          code0 {this->dispcell[6][1]=o;}
        }
        Fl_Box l2c7 {
          image {images/HD24_matrix_realsize.gif} xywh {138 304 20 26}
          code0 {this->dispcell[7][1]=o;}
        }
        Fl_Box l2c8 {
          image {images/HD24_matrix_realsize.gif} xywh {156 304 20 26}
          code0 {this->dispcell[8][1]=o;}
        }
        Fl_Box l2c9 {
          image {images/HD24_matrix_realsize.gif} xywh {174 304 20 26}
          code0 {this->dispcell[9][1]=o;}
        }
        Fl_Box l2ca {
          image {images/HD24_matrix_realsize.gif} xywh {192 304 20 26}
          code0 {this->dispcell[10][1]=o;}
        }
        Fl_Box l2cb {
          image {images/HD24_matrix_realsize.gif} xywh {210 304 20 26}
          code0 {this->dispcell[11][1]=o;}
        }
        Fl_Box l2cc {
          image {images/HD24_matrix_realsize.gif} xywh {228 304 20 26}
          code0 {this->dispcell[12][1]=o;}
        }
        Fl_Box l2cd {
          image {images/HD24_matrix_realsize.gif} xywh {246 304 20 26}
          code0 {this->dispcell[13][1]=o;}
        }
        Fl_Box l2ce {
          image {images/HD24_matrix_realsize.gif} xywh {264 304 20 26}
          code0 {this->dispcell[14][1]=o;}
        }
        Fl_Box l2cf {
          image {images/HD24_matrix_realsize.gif} xywh {282 304 20 26}
          code0 {this->dispcell[15][1]=o;}
        }
        Fl_Box autoanythingled {
          label AUTO
          xywh {193 233 65 8} box FLAT_BOX color 93 labelfont 1 labelsize 8 hide
        }
        Fl_Box autoplayled {
          label PLAY
          xywh {215 242 24 8} box FLAT_BOX color 93 labelfont 1 labelsize 8 hide
        }
        Fl_Box autortnled {
          label RTN
          xywh {240 242 18 8} box FLAT_BOX color 93 labelfont 1 labelsize 8 hide
        }
        Fl_Box autorecled {
          label REC
          xywh {193 242 21 8} box FLAT_BOX color 1 labelfont 1 labelsize 8 align 16 hide
        }
        Fl_Box rehearseled {
          label REHEARSE
          xywh {193 251 65 8} box FLAT_BOX color 1 labelfont 1 labelsize 8
        }
        Fl_Box pitchled {
          label PITCH
          xywh {260 242 40 8} box FLAT_BOX color 6 labelfont 1 labelsize 8 hide
        }
      }
      Fl_Button button_rehearse {
        label REHEARSE
        callback {control->button_rehearse_call();}
        tooltip {Set Locate} xywh {310 290 50 20} type Toggle box FLAT_BOX down_box FLAT_BOX color 47 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 5 deactivate
        code0 {o->up_image(button_lrc_up->image()); o->down_image(button_lrc_dn->image());}
        class Fl_Image_Toggle_Button
      }
      Fl_Button button_punchin {
        label {PUNCH IN}
        callback {control->handlelocatebutton(hd24song::LOCATEPOS_PUNCHIN);}
        tooltip {Set Locate} xywh {485 290 50 20} box FLAT_BOX down_box FLAT_BOX color 47 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 1
        code0 {o->up_image(button_lrc_led_up->image()); o->down_image(button_lrc_led_dn->image());}
        class Fl_Image_Button
      }
      Fl_Button button_punchout {
        label {PUNCH OUT}
        callback {control->handlelocatebutton(hd24song::LOCATEPOS_PUNCHOUT);}
        tooltip {Set Locate} xywh {550 290 50 20} box FLAT_BOX down_box FLAT_BOX color 47 selection_color 18 labelfont 1 labelsize 9 labelcolor 7 align 9
        code0 {o->up_image(button_lrc_led_up->image()); o->down_image(button_lrc_led_dn->image());}
        class Fl_Image_Button
      }
      Fl_Button button_peakmode {
        label {Peak
mode}
        callback {this->currpeakmode=((this->currpeakmode)+1)%3;

for (unsigned int i=0;i<MAXCHANNELS;i++) {
	this->trackchan[i]->peakmode(this->currpeakmode);
}
switch (this->currpeakmode) 
{
	case 0: // "No" "Peak Hold"
		dispwrite(0,"       No       "
                            "   Peak Hold    ",2000);
		break;
	case 1: // "Momentary" "Peak Hold"
		dispwrite(0,"   Momentary    "
                            "   Peak Hold    ",2000);
		break;
	case 2: // "Continuous" "Peak Hold"
		dispwrite(0,"   Continuous   "
                            "   Peak Hold    ",2000);
		break;
	default:
		// ???????	
	        break;
}}
        tooltip arm xywh {10 375 50 30} color 8 selection_color 8 labelfont 1 labelsize 10 labelcolor 7
        code0 {o->clear_visible_focus();}
        class Fl_Button
      }
      Fl_Button button_peakclear {
        label {Peak
clear}
        callback {this->currpeakmode=((this->currpeakmode)+1)%3;

for (unsigned int i=0;i<MAXCHANNELS;i++) {
	this->trackchan[i]->peakreset();
}}
        tooltip arm xywh {60 375 50 30} color 8 selection_color 8 labelfont 1 labelsize 10 labelcolor 7
        code0 {o->clear_visible_focus();}
        class Fl_Button
      }
      Fl_Button button_autoinput {
        label {Auto
input}
        callback {/*
if (currenthd24==NULL) return;
if (button_autoinput->value()==1) {
	currenthd24->setautoinput(true);
} else {
	currenthd24->setautoinput(false);
}
*/}
        tooltip arm xywh {110 375 45 30} type Toggle color 8 selection_color 59 labelfont 1 labelsize 10 labelcolor 7
        code0 {o->clear_visible_focus();}
        class Fl_Button
      }
      Fl_Button button_allinput {
        label {All
input}
        callback {/*
if (currenthd24==NULL) return;
if (button_allinput->value()==0) {
	currenthd24->setallinput(false);
} else {
	currenthd24->setallinput(true);
}
*/}
        tooltip arm xywh {155 375 45 30} type Toggle color 8 selection_color 59 labelfont 1 labelsize 10 labelcolor 7
        code0 {o->clear_visible_focus();}
        class Fl_Button
      }
      Fl_Choice stereoinmap {
        label {Stereo input mapping} open
        xywh {463 390 140 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12 deactivate
      } {
        MenuItem {} {
          label Normal
          xywh {5 5 36 21} labelsize 12
        }
        MenuItem {} {
          label {Swap Left and Right}
          xywh {15 15 36 21} labelsize 12
        }
        MenuItem {} {
          label {Mix to mono}
          xywh {15 15 36 21} labelsize 12
        }
        MenuItem {} {
          label {Use Left only}
          xywh {25 25 36 21} labelsize 12
        }
        MenuItem {} {
          label {Use Right only}
          xywh {35 35 36 21} labelsize 12
        }
      }
      Fl_Roller {} {
        label {Drag to Jog}
        callback {// scrubwheel calls button_scrub_call()}
        xywh {310 390 110 20} type Horizontal labelsize 12 align 1 minimum -1 step 2
        code0 {o->setui(this);}
        class ScrubWheel
      }
    }
  }
  decl {/* === Audio/transport ===================================================== */} {}
  decl {int hlbuttons_defaultcolor;} {public
  }
  Function {highlight_setbuttons(int value)} {open return_type void
  } {
    code {if (value==1) {
   if (button_loopstart!=NULL) {
   button_loopstart->up_image(button_lrc_led_on_up->image());
   button_loopstart->down_image(button_lrc_led_on_dn->image());
   }
   if (button_loopend!=NULL) {
   button_loopend->up_image(button_lrc_led_on_up->image());
   button_loopend->down_image(button_lrc_led_on_dn->image());
   }
   if (button_punchin!=NULL) {
   button_punchin->up_image(button_lrc_led_on_up->image());
   button_punchin->down_image(button_lrc_led_on_dn->image());
   }
   if (button_punchout!=NULL) {
   button_punchout->up_image(button_lrc_led_on_up->image());
   button_punchout->down_image(button_lrc_led_on_dn->image());
   }
} else {
   button_loopstart->up_image(button_lrc_led_up->image());
   button_loopstart->down_image(button_lrc_led_dn->image());
   button_loopend->up_image(button_lrc_led_up->image());
   button_loopend->down_image(button_lrc_led_dn->image());
   button_punchin->up_image(button_lrc_led_up->image());
   button_punchin->down_image(button_lrc_led_dn->image());
   button_punchout->up_image(button_lrc_led_up->image());
   button_punchout->down_image(button_lrc_led_dn->image());
}
   if (button_punchout!=NULL) { button_punchout->redraw(); }
   if (button_punchin!=NULL) { button_punchin->redraw(); }
   if (button_loopstart!=NULL) { button_loopstart->redraw(); }
   if (button_loopend!=NULL) { button_loopend->redraw();}} {}
  }
  Function {poll_callback(void* user)} {open return_type {static void}
  } {
    code {//HD24UserInterface* mythis=(HD24UserInterface*)user;
RecorderUI* mythis=(RecorderUI*)user;
int visible=0;
      if (mythis->recordergroup->visible())
      { 
	visible=1;
     } else {
        visible=0;
      }


if (mythis->control->ready()!=1) { return; }

if (mythis->dispwritecountdown>0)
{
	mythis->dispwritecountdown--;
	if (mythis->dispwritecountdown==0) {
		mythis->disprestore();
	}
}

if (mythis->busy!=1) {
	mythis->busy=1;
	mythis->blinkcounter=(mythis->blinkcounter+1)%BLINKRATE;

   if (visible==1) {
	for (unsigned int i=0;i<MAXCHANNELS;i++) {
		mythis->trackchan[i]->setval(mythis->control->data->trackpeak[i]);
	}

	Fl_Image* oldimg;
	Fl_Image* newimg=NULL;
	 
	string* dur=NULL;
               hd24song* mycurrsong=mythis->control->song();
	if (mycurrsong!=NULL) {
		dur=mycurrsong->display_cursor();
	   } else {
		dur=new string("00:00:00.00");
	   }

	   
	   oldimg=mythis->ho1->image(); 
	   mythis->ho1->image(mythis->i7seg[dur->c_str()[0]-'0']->image());
	   if (newimg!=oldimg) mythis->ho1->redraw();
	
	   oldimg=mythis->ho2->image(); 
	   mythis->ho2->image(mythis->i7seg[dur->c_str()[1]-'0']->image());
	   if (newimg!=oldimg) mythis->ho2->redraw();
	
	   oldimg=mythis->mi1->image(); 
	   mythis->mi1->image(mythis->i7seg[dur->c_str()[3]-'0']->image());
	   if (newimg!=oldimg) mythis->mi1->redraw();

	   oldimg=mythis->mi2->image(); 
	   mythis->mi2->image(mythis->i7seg[dur->c_str()[4]-'0']->image());
	   if (newimg!=oldimg) mythis->mi2->redraw();
	
	   oldimg=mythis->se1->image(); 
	   mythis->se1->image(mythis->i7seg[dur->c_str()[6]-'0']->image());
	   if (newimg!=oldimg) mythis->se1->redraw();

	   oldimg=mythis->se2->image(); 
	   mythis->se2->image(mythis->i7seg[dur->c_str()[7]-'0']->image());
	   if (newimg!=oldimg) mythis->se2->redraw();
	   oldimg=mythis->fr1->image(); 
	   mythis->fr1->image(mythis->i7seg[dur->c_str()[9]-'0']->image());
	   if (newimg!=oldimg) mythis->fr1->redraw();

	   oldimg=mythis->fr2->image(); 
	   mythis->fr2->image(mythis->i7seg[dur->c_str()[10]-'0']->image());
	   if (newimg!=oldimg) mythis->fr2->redraw();
	   if ((mythis->mustdisplaytimer) && (mycurrsong !=NULL))
	   {	
	      
	//	mythis->setstatus(*dur);
		__uint32 currloc=mycurrsong->cursorpos();
		if (mycurrsong->songlength_in_samples() >0) {
		    currloc=mycurrsong->cursorpos()/(mycurrsong->songlength_in_samples()/1000);
		} else {
		    currloc=0;
		}
		if (mythis->slidermoved!=0) {
		   mythis->slidermoved--;
		} else {
		   mythis->locationslider->value(currloc);
		}	
	   }
	   delete (dur);         
	}

}
mythis->busy=0;
//Fl::add_timeout(TIMEOUT,poll_callback,user); 

AudioSystem* audio=mythis->control->audio;

if (!audio->isinitialized()) return;
if (!audio->mustloop()) return;
audio->hd24_transport_locate((__sint64)(audio->looppos()));
audio->mustloop(false);
audio->looppos(0);} {}
  }
  Function {fl_check()} {open return_type void
  } {
    code {Fl::check();} {}
  }
  decl {int busy;} {public
  }
  decl {friend class ScrubWheel;} {}
  decl {int uiredrawcount; /* to limit refreshing UI */} {public
  }
  Function {finish()} {open return_type void
  } {
    code {if (this==NULL) return;

this->control->button_stop_call();} {}
  }
  Function {button_light(void* button,bool lit)} {open return_type void
  } {
    code {if (button==NULL) return;
if (((Fl_Image_Button*)button)==button_stop)
{
	if (lit==1)
	{
		button_stop->up_image(button_stop_uplit->image());
		button_stop->down_image(button_stop_dn->image());	
	}
	else
	{
		button_stop->up_image(button_stop_up->image());
		button_stop->down_image(button_stop_dn->image());		
	}
	button_stop->redraw();
	return;
}} {}
  }
  Function {button_up(void* button)} {open return_type void
  } {
    code {if (button==NULL)
{
	return;
}

if ((void*)button==(void*)button_stop)
{
	button_stop->value(0);
	button_stop->redraw();
	return;
}	
if ((void*)button==(void*)button_play)
{
	button_play->value(0);
	button_play->redraw();
	return;
}	
if ((void*)button==(void*)button_rec)
{
	button_rec->value(0);
	button_rec->redraw();
	return;
}	
if ((void*)button==(void*)button_rew)
{
	button_rew->value(0);
	button_rew->redraw();
	return;
}	
if ((void*)button==(void*)button_ffwd)
{
	button_ffwd->value(0);
	button_ffwd->redraw();
	return;
}} {}
  }
  Function {button_down(void* button)} {open return_type void
  } {
    code {if (button==NULL)
{
	return;
}

if ((void*)button==(void*)button_stop)
{
	button_stop->value(1);
	button_stop->redraw();
	return;
}	
if ((void*)button==(void*)button_play)
{
	button_play->value(1);
	button_play->redraw();
	return;
}	
if ((void*)button==(void*)button_rec)
{
	button_rec->value(1);
	button_rec->redraw();
	return;
}	
if ((void*)button==(void*)button_rew)
{
	button_rew->value(1);
	button_rew->redraw();
	return;
}	
if ((void*)button==(void*)button_ffwd)
{
	button_ffwd->value(1);
	button_ffwd->redraw();
	return;
}} {}
  }
}