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
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
//------------------------------------------------------------------------------
//! \file ARAInterface.h
//! definition of the ARA application programming interface
//! \project ARA API Specification
//! \copyright Copyright (c) 2012-2025, Celemony Software GmbH, All Rights Reserved.
//! Developed in cooperation with PreSonus Software Ltd.
//! \license Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/licenses/LICENSE-2.0
//!
//! Unless required by applicable law or agreed to in writing, software
//! distributed under the License is distributed on an "AS IS" BASIS,
//! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//! See the License for the specific language governing permissions and
//! limitations under the License.
//------------------------------------------------------------------------------
/***************************************************************************************************/
// IMPORTANT:
// Please read ARA_API.pdf for general documentation before studying this header!
/***************************************************************************************************/
/***************************************************************************************************/
/***************************************************************************************************/
/***************************************************************************************************/
// C99 standard includes for the basic data types
/***************************************************************************************************/
// Auxiliary defines for Doxygen code generation, must evaluate to 0 for actual code compilation
// Enable this when building Doxygen documentation
/***************************************************************************************************/
// Various configurations/decorations to ensure binary compatibility across compilers:
// struct packing and alignment, calling conventions, etc.
namespace ARA
|| || ||
//#elif defined(__ppc__) || defined(__ppc64__)
// #define ARA_CPU_PPC 1
// To prevent any alignment/padding settings from the surrounding code to modify the ARA data layout,
// we need to explicitly define the layout here. Ideally, we would stick with the C standard
// alignment/padding (struct alignment defined by largest member, each member aligned by its size),
// but at the time when ARA 1 was developed there was no way to achieve this in code.
// As a workaround, ARA started using 1-byte packing. However, this causes some members in some of
// the ARA structs to be not naturally aligned on 64 bit systems. But moreover, this also affects
// the possible alignment of all ARA structs in some compilers. Thus developers that directly use
// the C API must carefully align any struct that they pass across the API boundary in order to avoid
// performance penalties. When using the ARA library C++ dispatch code, the SizedStruct<> template
// which is used as central low-level wrapper for any data crossing the API takes care of this issue.
// This is for historical reason only - current MSVC defaults are 8 on x86 and 16 on x64.
// MSVC default for ARM64 is 8, this also fits the standard packing by member size for
// the vast majority of the structs in the ARA API on 64 bit processors.
// Override any custom calling conventions, enforce the C standard calling convention.
/***************************************************************************************************/
//! @addtogroup API_generations API Generations
// Macros to mark API added or deprecated as the API evolves - see ARAAPIGeneration.
//! @{
// Internal macro to trigger deprecation warnings (not fully supported by all compilers).
// C++14 standard
// Vendor-specific: gcc & clang.
// Vendor-specific: Visual Studio.
//! Markup for outdated API that should no longer be used in future development, but can still
//! be supported for backwards compatibility with older plug-ins/hosts if desired. \br
//! By defining ARA_ENABLE_DEPRECATION_WARNINGS as non-zero value it is possible to get deprecation
//! warnings in the most common compilers, for inspecting deprecated API usage in a given project.
//! These warnings are disabled by default in order to not interfere with code that supports older APIs.
//! Markup for struct elements which were added in later revisions of the API and may be omitted
//! from the struct when dealing with older plug-ins/hosts.
//! Markup for draft API that is still under active development and not yet properly versioned -
//! when using those struct elements, host and plug-in must agree on a specific draft header version! \br
//! All uses of this macro will be replaced by ARA_ADDENDUM() upon final release.
//! To quickly find all places in your project that use draft API, it's possible to temporarily
//! redefine ARA_DRAFT to ARA_WARN_DEPRECATED(...).
// use this alternate definition to trigger a "deprecation" warning for every location draft API is used
//#undef ARA_DRAFT
//#define ARA_DRAFT ARA_WARN_DEPRECATED(2_X_Draft)
//! @}
/***************************************************************************************************/
//! @defgroup Basic_Types Basic Types
//! Pre-defined types to ensure binary compatibility between plug-in and host.
//! These types must be used when crossing the API boundary, but intermediate types can be used internally.
//! For example, you can use your own struct representing color, but when defining color for ARA operations
//! your internal color struct must be converted to ARAColor.
//! @{
/***************************************************************************************************/
/***************************************************************************************************/
//! @defgroup Fixed-size_integers Fixed-size Integers
//! ARA defines platform-independent signed integers with fixed size of 32 or 64 bits
//! and for a pointer-sized signed integer.
//! @{
//! Byte: 8 bits wide unsigned integer.
typedef uint8_t ARAByte;
//! 32 bits wide signed integer.
typedef int32_t ARAInt32;
//! 64 bits wide signed integer.
typedef int64_t ARAInt64;
//! Pointer-wide size value for ARA structs.
typedef size_t ARASize;
//! @}
/***************************************************************************************************/
//! @defgroup Boolean_values Boolean Values
//! Since Microsoft still doesn't fully support C99 and fails to provide <stdbool.h>,
//! we need to roll our own. On the other hand this ensures a fixed size of 32 bits, too.
//! 32 bits were chosen so that ARABool is consistent with the other enum-like data types such as
//! ARAContentType. Since ARABool is only used in temporary structs that are valid only for the
//! duration of a call and likely passed in a register in most cases, there's no point in trying
//! to optimize for size by using 8 bit boolean types.
//! Note that in order to avoid conversion warnings in Visual Studio, you should not directly cast
//! bool to ARABool or vice versa, but instead use a ternary operator or a comparison like this:
//! \code{.c}
//! araBool = (cppBool) ? kARATrue : kARAFalse;
//! cppBool = (araBool != kARAFalse);
//! \endcode
//! Providing conversion operators for ARABool for C++ that handle this automatically is alas no
//! viable option, because ARABool is only a typedef so this would lead to side-effects for all
//! conversions from the integer type that ARABool is defined upon.
//! @{
//! Platform independent 32-bit boolean value.
typedef ARAInt32 ARABool;
//! "true" value for ARABool.
constexpr ARABool kARATrue ;
//! "false" value for ARABool.
constexpr ARABool kARAFalse ;
//! @}
/***************************************************************************************************/
//! @defgroup Enums Enums
//! ARA enums can either be used to represent distinct enumerations, or to
//! declare C-compatible constant integer flags that can be or'd together as bit masks.
//! To ensure binary compatibility between plug-in and host, the underlying type
//! of ARA enums is always ARAInt32.
//! @{
//! Define a 32-bit ARA enum type.
//! The actual enum declaration is encapsulated in a macro to allow for adjusting it between
//! C++, C and Doxygen builds.
//! @}
/***************************************************************************************************/
//! @defgroup Strings Strings
//! User-readable texts are stored as UTF-8 encoded unicode strings.
//! It's not defined if and how the string is normalized - if either side has requirements regarding
//! normalization, it needs to apply these after reading the string from the other side.
//! Unicode rules apply regarding normalization, comparison etc.
//! Both hosts and plug-ins are required to support at least all ISO/IEC 8859-1 based characters
//! (from U+0020 up to U+007E and from U+00A0 up to U+00FF) in their text display rendering.
//! @{
//! A single character.
typedef char ARAUtf8Char;
//! A string, 0-terminated.
typedef const ARAUtf8Char * ARAUtf8String;
//! @}
/***************************************************************************************************/
//! @defgroup Common_time-related_data_types Common Time-Related Data Types
//! Some basic data types used in several contexts.
//! @{
//! A point in time in seconds.
typedef double ARATimePosition;
//! A duration of time in seconds - the start of the duration is part of the interval, the end is not.
typedef double ARATimeDuration;
//! Integer sample index, always related to a particular sample rate defined by the context it is used in.
typedef ARAInt64 ARASamplePosition;
//! Integer sample count, always related to a particular sample rate defined by the context this is used in.
typedef ARAInt64 ARASampleCount;
//! A position in musical time measured in quarter notes.
typedef double ARAQuarterPosition;
//! A duration in musical time measured in quarter notes - the start of the duration is part of the interval, the end is not.
typedef double ARAQuarterDuration;
//! @}
/***************************************************************************************************/
//! @defgroup Sampled_audio_data Sampled Audio Data
//! The audio samples are encoded using these format descriptions.
//! The data alignment and byte order always matches the machine's native layout.
//! @{
//! Specified in Hz.
typedef double ARASampleRate;
//! Count of discrete channels of an audio signal.
//! The spacial positioning of the channels may be provided via ARAChannelArrangementDataType.
typedef ARAInt32 ARAChannelCount;
//! To avoid defining yet another abstraction of spacial layout information for the individual
//! channels of an audio signal, ARA directly uses the respective companion API's model of
//! spacial arrangement. Since different companion APIs are available, this enum specifies which
//! abstraction is used.
typedef ;
//! @}
/***************************************************************************************************/
//! @defgroup Color Color
//! ARA color representation.
//! @{
//! R/G/B color, values range from 0.0f to 1.0f.
//! Does not include transparency because it must not depend on the background its drawn upon
//! in order to be equally represented in both the host and plug-in UI - any transparency on
//! either side must be converted depending on internal drawing before/after the ARA calls.
typedef struct ARAColor;
//! @}
/***************************************************************************************************/
//! @defgroup Object_References Object References
//! ARA uses pointer-sized unique identifiers to reference objects at runtime -
//! typical C++-based implementations will use the this-pointer as ID.
//! C-style code could do the same, or instead choose to use array indices as ID. \br
//! Those objects that are archived by the host can be persistently identified
//! by an ::ARAPersistentID that the host assigns as a property of the object.
//! @{
//! @name Markup Types
//! Type-safe representations of the opaque refs/host refs.
//! The markup types allow for overloaded custom conversion functions if using C++,
//! or for re-defining the markup types to actual implementations in C like this:
//! \code{.c}
//! #define ARAAudioSourceRefMarkupType MyAudioFileClass
//! #define ARAMusicalContextRefMarkupType MyGlobalTracksClass
//! \endcode
//! ... etc ...
//! @{
//! Plug-in reference markup type identifier. \br\br
//! Examples: \br
//! ::ARAMusicalContextRef \br
//! ::ARARegionSequenceRef \br
//! ::ARAAudioSourceRef \br
//! ::ARAAudioModificationRef \br
//! ::ARAPlaybackRegionRef \br
//! ::ARAContentReaderRef \br
//! ::ARADocumentControllerRef \br
//! ::ARAPlaybackRendererRef \br
//! ::ARAEditorRendererRef \br
//! ::ARAEditorViewRef \br
//! Host reference markup type identifier. \br\br
//! Examples: \br
//! ::ARAMusicalContextHostRef \br
//! ::ARARegionSequenceHostRef \br
//! ::ARAAudioSourceHostRef \br
//! ::ARAAudioModificationHostRef \br
//! ::ARAPlaybackRegionHostRef \br
//! ::ARAContentReaderHostRef \br
//! ::ARAAudioAccessControllerHostRef \br
//! ::ARAAudioReaderHostRef \br
//! ::ARAArchivingControllerHostRef \br
//! ::ARAArchiveReaderHostRef \br
//! ::ARAArchiveWriterHostRef \br
//! ::ARAContentAccessControllerHostRef \br
//! ::ARAModelUpdateControllerHostRef \br
//! ::ARAPlaybackControllerHostRef \br
//! @}
//! @name Persistent IDs
//! @{
//! Persistent object reference representation.
//! Persistent IDs are used to encode object references between plug-in and host when dealing
//! with persistency. Contrary to the user-readable ARAUtf8String, ARAPersistentIDs are seven-bit
//! US-ASCII-encoded strings, such as "com.manufacturerDomain.someIdentifier", and can thus be
//! directly compared using strcmp() and its siblings. They can be copied using strcpy() and must
//! always be compared by value, not by address.
typedef const char * ARAPersistentID;
//! @}
//! @}
//! @}
/***************************************************************************************************/
//! @defgroup API_versions API Versions
//! ARA implements two patterns for its ongoing evolution of the API: incremental, fully-backwards
//! compatible additions by appending features to it versioned structs, and major, potentially
//! incompatible updates through its API generations.
//! @{
/***************************************************************************************************/
/***************************************************************************************************/
//! @defgroup API_generations API Generations
//! While purely additive features can be handled through ARA's versioned structs,
//! ARA API generations allow for non-backwards-compatible, fundamental API changes.
//! For hosts that rely on a certain minimum ARA feature set provided by the plug-ins, it also
//! offers a convenient way to filter incompatible plug-ins.
//! Plug-ins on the other hand can use the API generation chosen by the host to optimize their
//! feature set for the given environment, such as disabling potentially costly fallback code
//! required for older hosts when running in a modern host.
//! @{
typedef
;
//! @}
/***************************************************************************************************/
//! @defgroup Versioned_structs Versioned Structs
//! In the various interface and data structs used in the ARA API, callback pointers or data fields
//! may be added in later revisions of the current API generation. Each of these extensible structs
//! starts with a structSize data field that describes how much data is actually contained in the
//! given instance of the struct, thus allowing to determine which of the additional features are
//! supported by the other side.
//! All struct members that are later additions will be marked with the macro ARA_ADDENDUM.
//! Members that are not marked as addendum must always be present in the struct.
//! Accordingly, the minimum value of structSize is the size of the struct in the first API revision.
//! When creating such a struct in your code, the maximum value is the size of the struct in the
//! current API revision used at compile time. When parsing a struct received from the other side,
//! the value may be even larger since the other side may use an even later API revision.
//! \br
//! Note that when implementing ARA, it is important not to directly use sizeof() when filling in
//! the structSize values. If you later update to newer API headers, the values of sizeof() will
//! change and your code thus will be broken until you've implemented all additions.
//! Instead, use the ARA_IMPLEMENTED_STRUCT_SIZE macro or similar techniques added in the ARA
//! C++ library dispatcher code, see \ref ARA_Library_Utility_SizedStructs "there".
//! @{
//! Macro that calculates the proper value for the structSize field of a versioned struct based
//! on which features are actually implemented by the code that provides the struct.
//! This may be different from sizeof() whenever features are added in the API, but not yet
//! implemented in the current code base. Only after adding that implementation, the \p memberName
//! parameter provided to ARA_IMPLEMENTED_STRUCT_SIZE should be updated accordingly.
//! \br
//! The ARA library C++ dispatchers implement a similar feature via templates,
//! see ARA::SizedStruct<>.
//! Convenience macro to test if a field is present in a given struct.
//! \br
//! The ARA library C++ dispatchers implement a similar feature via templates,
//! see ARA::SizedStructPtr::implements<>().
//! @}
//! @}
/***************************************************************************************************/
//! @defgroup Debugging Debugging
//! ARA strictly separates programming errors from runtime error conditions such as missing files,
//! CPU or I/O overloads etc.
//! Runtime errors occur when accessing external data and resources, which is always done on the host
//! side of the ARA API. Accordingly, the host has the responsibility to detect any such errors and
//! to properly communicate the issue to the user. Since ARA leverages existing technologies, host
//! implementations usually already feature proper code for this.
//! With the error reporting done on the host side, plug-ins do not need to know any details about
//! runtime errors - a simple bool to indicate success or failure is sufficient for implementing
//! normal operation or graceful error recovery. Thus, ARA does not need to define error codes for
//! communicating error details across the API.
//! As an example, consider audio data being read from a server across the network - if the connection
//! breaks, the host will recognize the issue and bring up an according user notification. If the
//! plug-in requests the now inaccessible audio data, the host simply flags that an error occurred and
//! the plug-in can either retry later or use silence as fallback data.
//! \br
//! A different kind of errors are programming errors. If either side fails to properly follow the
//! API contract, undefined behavior can occur. Tracking down such bugs from one side only can be
//! difficult and very time consuming, thus ARA strives to aid developers in this process by defining
//! a global assert function that both sides call whenever detecting programming errors related to
//! the ARA API.
//! When debugging (or when running unit tests), either side can provide the code for the assert
//! function, so that no matter what side you're debugging from you can always inject your custom
//! assert handling in order to be able to set proper breakpoints etc.
//! The assert function is only a debug facility: it will usually be disabled on end user systems,
//! and it must never be used for flow control in a shipping product. Instead, each side should
//! implement graceful fallback behavior after asserting the programming error, e.g. by defining a
//! special value for invalid object refs (NULL or -1, depending on the implementation) which will
//! be returned as a placeholder whenever object creation fails due to a programming error on the
//! other side and then filtering this value accordingly whenever objects are referenced.
//! @{
/***************************************************************************************************/
//! Hint about the nature of the programming error.
typedef
;
//! Global assert function pointer.
//! The assert categories passed to the global assert function are useful both for guiding developers
//! when debugging and for automatic assert evaluation when building unit tests. \br
//! The diagnosis text is intended solely to aid the developer debugging an issue "from the
//! other side"; they must not be presented to the user (or even parsed for flow control).
//! If applicable (i.e. if the category is kARAAssertInvalidArgument), the diagnosis should contain
//! a hint about what problematicArgument actually points to - for example if a struct is too small,
//! you'd pass the pointer to the struct along with a diagnosis message a la:
//! "someExampleInterfacePointer->structSize < kExampleStructMinSize".
//! Creating such appropriate texts automatically can be easily accomplished by custom assert macros. \br
//! Finally, problematicArgument should point to the argument that contains the invalid data, so that
//! the developer on that end can quickly identify the problem. If you can't provide a meaningful
//! address for it, e.g. because the category is kARAAssertInvalidThread, pass NULL here.
typedef void ;
//! @}
/***************************************************************************************************/
//! @defgroup ARA_Model_Graph ARA Model Graph
//! @{
/***************************************************************************************************/
/***************************************************************************************************/
//! @defgroup Model_Document Document
//! The document is the root object for a model graph and typically represents a piece of music
//! such as a song or an entire performance.
//! It is bound to a document controller in a 1:1 relationship. The document controller is used to
//! manage the entire graph it contains. Because of the 1:1 relationship, the document is never
//! specified when calling into the document controller.
//! Edits of the document and any of the objects it contains are done in cycles started with
//! ARADocumentControllerInterface::beginEditing() and concluded with
//! ARADocumentControllerInterface::endEditing().
//! This allows plug-ins to deal with any render thread synchronization that may be necessary,
//! as well as postponing any internal updates until the end of the cycle when the ARA graph has
//! its full state available.
//! A document is the root object for persistency and is the owner of any amount of associated
//! audio sources, region sequences and musical contexts.
//! \br
//! Plug-in developers using the C++ ARA Library can use the ARA::PlugIn::Document class.
//! @{
//! Document properties.
//! Note that like all properties, a pointer to this struct is only valid for the duration of the
//! call receiving the pointer - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
typedef struct ARADocumentProperties
ARADocumentProperties;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Musical_Context Musical Context
//! A musical context describes both rhythmical concepts of the music such as bars and beats and
//! their distribution over time, as well as harmonic structures and their distribution over time.
//! A musical context is always owned by one document.
//! Musical contexts are not persistent when storing documents, instead the host re-creates them
//! as needed.
//! \br
//! Plug-in developers using the C++ ARA Library can use the ARA::PlugIn::MusicalContext class.
//! @{
//! Reference to the plug-in side representation of a musical context (opaque to the host).
typedef ;
//! Reference to the host side representation of a musical context (opaque to the plug-in).
typedef ;
//! Musical context properties.
//! Note that like all properties, a pointer to this struct is only valid for the duration of the
//! call receiving the pointer - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
typedef struct ARAMusicalContextProperties
ARAMusicalContextProperties;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Region_Sequences Region Sequences (Added In ARA 2.0)
//! Region sequences allow hosts to group playback regions, typically by "tracks" or "lanes" in
//! their arrangement.
//! Each sequence is associated with a musical context, and all regions in a sequence will be adapted
//! to that same context.
//! Further, all regions within a sequence are expected to play back through the same routing (incl.
//! same latency), typically the same "mixer track" or "audio channel".
//! Regions in a sequence can overlap, and such overlapping regions will sound concurrently.
//! A region sequence is always owned by one document, and refers to a musical context.
//! Region sequences are not persistent when storing documents, instead the host re-creates them
//! as needed.
//! \br
//! Plug-in developers using the C++ ARA Library can use the ARA::PlugIn::RegionSequence class.
//! @{
//! Reference to the plug-in side representation of a region sequence (opaque to the host).
typedef ;
//! Reference to the host side representation of a region sequence (opaque to the plug-in).
typedef ;
//! Region sequence properties.
//! Note that like all properties, a pointer to this struct is only valid for the duration of the
//! call receiving the pointer - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
typedef struct ARARegionSequenceProperties;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Audio_Source Audio Source
//! An audio source represents a continuous sequence of sampled audio data. Typically a host will
//! create an audio source object for each audio file used with ARA plug-ins.
//! Conceptually, the contents of an audio source are immutable (even though updates are possible,
//! this is an expensive process, and user edits based on the modified content may get lost).
//! An audio source is always owned by one document, and in turn owns any amount of associated
//! audio modifications.
//! Audio sources are persistent when storing documents.
//! \br
//! Plug-in developers using the C++ ARA Library can use the ARA::PlugIn::AudioSource class.
//! @{
//! Reference to the plug-in side representation of an audio source (opaque to the host).
typedef ;
//! Reference to the host side representation of an audio source (opaque to the plug-in).
typedef ;
//! Audio source properties.
//! Note that like all properties, a pointer to this struct is only valid for the duration of the
//! call receiving the pointer - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
typedef struct ARAAudioSourceProperties
ARAAudioSourceProperties;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Audio_Modification Audio Modification
//! An audio modification contains a set of musical edits that the user has made to transform
//! the content of an audio source when rendered by the ARA plug-in.
//! An audio modification is always owned by one audio source, and in turn owns any amount of
//! associated playback regions.
//! Audio modifications are persistent when storing documents.
//! \br
//! Plug-in developers using the C++ ARA Library can use the ARA::PlugIn::AudioModification class.
//! @{
//! Reference to the plug-in side representation of an audio modification (opaque to the host).
typedef ;
//! Reference to the host side representation of an audio modification (opaque to the plug-in).
typedef ;
//! Audio modification properties.
//! Note that like all properties, a pointer to this struct is only valid for the duration of the
//! call receiving the pointer - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
typedef struct ARAAudioModificationProperties
ARAAudioModificationProperties;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Playback_Region Playback Region
//! A playback region is a reference to an arbitrary time section of an audio modification,
//! mapped to a certain section of playback time.
//! It is linked to a region sequence, which in turn is linked to a musical context.
//! All playback regions that share the same audio modification play back the same musical
//! content, but may adapt that content to the given section of the musical context and to the
//! content of other regions in the same region sequence (see content based fades).
//! Note that if a plug-in offers any user settings to control this adaptation (such as groove settings),
//! then these settings should be part of the audio modification state, not of the individual
//! playback regions.
//! A playback is always owned by one audio modification, and refers to a region sequence.
//! Playback regions are not persistent when storing documents, instead the host re-creates them
//! as needed.
//! \br
//! Plug-in developers using the C++ ARA Library can use the ARA::PlugIn::PlaybackRegion class.
//! @{
//! Reference to the plug-in side representation of a playback region (opaque to the host).
typedef ;
//! Reference to the host side representation of a playback region (opaque to the plug-in).
typedef ;
//! Playback region transformations.
//! Plug-ins may or may not support all transformations that can be configured in a playback region.
//! They express these capabilities at factory level, and the host must respect this.
//! Also used in ARAFactory::supportedPlaybackTransformationFlags.
typedef
;
//! Playback region properties.
//! Note that like all properties, a pointer to this struct is only valid for the duration of the
//! call receiving the pointer - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
typedef struct ARAPlaybackRegionProperties
ARAPlaybackRegionProperties;
// Convenience constant for easy struct validation.
;
//! @}
//! @}
/***************************************************************************************************/
// Note: when reading this header for the first time, you may want to skip the topic of content
// updates and content reading - proceed directly to the host controller interfaces to gain a better
// overall understanding of ARA, then come back to content reading later.
//! @defgroup Content_Reading Content Reading
//! @{
/***************************************************************************************************/
/***************************************************************************************************/
//! @defgroup Model_Content_Updates Content Updates
//! \br
//! There are several levels of abstraction when analyzing musical recordings.
//! Initially, there is the signal in its "physical" form.
//! On the next level, the signal interpreted as a series of musical events - the notes played when
//! creating the signal.
//! These notes and their relationship in time and pitch can be interpreted further, leading to
//! abstractions like tempo, bar signatures, key signatures, tuning and chords.
//! \br
//! Updates may happen on any of these levels, both independently or concurrently.
//! In the most simple but most unlikely case, the signal is completely replaced, and all the
//! higher abstractions therefore also invalidated. This also means that all user edits done in an
//! audio modification will be lost.
//! More likely is a minor modification of the signal, such as applying a high pass filtering to
//! remove rumble in the audio source. This will not change any higher abstractions (all notes etc.
//! remain the same), so any edits inside the audio modification or any notation of the music based
//! on the analysis will remain intact.
//! Another case is the correction of the analysis by the user. The signal does not change in this
//! case, but mis-detected notes are added or removed so the mid-level abstraction which is
//! considered with the notes changes. Whether or not this also changes higher interpretations
//! such as the detected harmonic structure depends on the case at hand.
//! \br
//! ARA defines a set of flags that allow to communicate the level of change, which helps to avoid
//! unnecessary flushing of the user edits inside an audio modification and allows for optimizations
//! of the analysis. The flags are providing a guarantee what has NOT changed.
//! This may seem odd at first but if for example a given host does not know about harmonies, it
//! cannot make any assumption about whether these have changed or not.
//! @{
//! Flags indicating the scope of a content update.
//! If notifying the API partner about a content update, the caller can make guarantees about which
//! abstractions of the signal are unaffected by the given change.
//! The enum flags describing these abstractions are or'd together into a single ARAInt32 value.
//! \br
//! The C++ ARA Library encapsulates content updates in the ARA::ContentUpdateScopes class.
typedef
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Content_Readers_and_Content_Events Content Readers And Content Events
//! \br
//! Reading content description follows the same pattern both from the host and from the plug-in side.
//! ARA establishes iterator objects called content reader to access the data in small units called
//! content events. There are several types available, each defining a certain abstract representation
//! of its associated events.
//! \br
//! Upon creation, content readers are bound to a given content type and to an object of which the
//! content shall be read. Optionally the reader can be restricted to only cover a given time range.
//! Once created, its event count is queried and the individual events are read, then the reader is
//! disposed of. This is all done immediately, reader objects are only temporary objects that are
//! created and destroyed from the same stack frame.
//! \br
//! The data pointer returned when reading an event's data remains owned by the content reader and
//! must remain valid until the reader is either another event is read or the reader is destroyed.
//! \br
//! The events returned by the reader are sorted in an order that depends on the content type, but
//! generally follows their appearance on the timeline. If several events appear at the same
//! (start-)time, their order is not defined and the receiver must apply further sorting if desired.
//! \br
//! The C++ ARA Library offers convenient content reader classes for host and plug-in developers.
//! Host developers can read plug-in content using ARA::Host::ContentReader, and plug-in developers
//! can use ARA::PlugIn::HostContentReader to read host content.
//! @{
//! Reference to the plug-in side representation of a content reader (opaque to the host).
typedef ;
//! Reference to the host side representation of a content reader (opaque to the plug-in).
typedef ;
//! Types of data that can be shared between host and plug-in.
typedef
;
//! Content reader optional creation parameter: a range in time to filter content events.
//! As an optimization hint, a content reader can be asked to restrict its data to only those events
//! that intersect with the given time range. Reader implementations should strive to respect this
//! request, but focus on overall performance - the events actually returned may exceed the specified
//! range by any amount, and calling code must evaluate the returned event positions/event durations.
//! \br
//! Note that when calls accept a pointer to a content time range, that pointer is only valid for
//! the duration of the call - the data must be evaluated/copied inside the call, and the pointer
//! must not be stored anywhere.
//! Further, in most of these calls the pointer to a content range may be NULL, indicating that the
//! entire content range of the object should be read.
typedef struct ARAContentTimeRange
ARAContentTimeRange;
//! Content grade: degree of reliability of the provided content information.
//! The most prominent use of the content grade is to solve conflicts between data provided by the
//! host and data found via analysis on the plug-in side. Another example is that when being notified
//! about content changes in the plug-in, a host may choose to trigger certain automatic updates only
//! if the grade of the content is above a certain reliability threshold.
typedef
;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Timeline Timeline
//! \br
//! ARA expresses musical timing as a mapping between song time measured in seconds and musical
//! time measured in quarter notes. The mapping is created by dividing the timeline into sections
//! of constant musical tempo. These tempo sections are then annotated as a list of tempo sync
//! points, where each point represents both the end of one and the beginning of another section.
//! The location of a tempo sync point is specified both in song time and musical time. The actual
//! tempo of a section can be easily derived from the relationship of the duration of the section
//! in song time and the duration of the section in musical time (note that neither the quarters nor
//! the seconds must necessarily be integer values here):
//! \verbatim
//! rightTempoEntry.quarterPosition - leftTempoEntry.quarterPosition
//! sectionTempoInBpm = ----------------------------------------------------------------- * 60.0 sec
//! rightTempoEntry.timePosition - leftTempoEntry.timePosition
//! \endverbatim
//! The advantage of providing such sync points whenever the tempo changes instead of specifying
//! the tempo directly is that there are no rounding errors that sum up over time - whenever the
//! tempo changes, this happens fully in sync.
//! The disadvantage of this representation is that there is no way to express the tempo before
//! the first and after the last tempo sync point, because the initial and final tempo sections
//! stretch "forever" into the past resp. future. ARA works around this by defining that the
//! initial tempo is equal to the tempo between the first and the second tempo sync point and that
//! the final tempo is equal to the tempo between the last-but-one and the last tempo sync point.
//! This means that there must always be at least 2 sync points in a valid ARA time line definition.
//! \br
//! To ease parsing the timeline, ARA further requires that there must be a tempo sync point given
//! at quarter 0, even if there is no actual tempo change at this point in time. This allows for
//! precisely determining any offset between time 0 seconds and quarter 0 without introducing possible
//! rounding errors. (If a content range is specified, this only applies if quarter 0 is part of the
//! content range.)
//! \br
//! Musical timing is commonly not notated by simply counting quarter notes - instead bars are
//! defined that form repeating patterns. ARA expresses this by providing a list of bar signatures.
//! Like in standard musical notation, the bar signatures are expressed as a fraction of two integer
//! values: numerator/denominator.
//! The location of a bar signature is specified in musical time. To make sense musically, the
//! distance between two bar signatures must be an integer multiple of the bar length of the earlier
//! of the two signatures (even though the bar length itself may not be integer, e.g. when using a
//! measure of 7/8). Note that when implementing the translation of these values to/from your code,
//! potential rounding issues must be handled properly to ensure the desired positions are extracted.
//! @{
//! Content reader event class: tempo map provided by kARAContentTypeTempoEntries.
//! Event sort order is by timePosition.
//! As with all content readers, a pointer to this struct retrieved via getContentReaderDataForEvent()
//! is still owned by the callee and must remain valid until either getContentReaderDataForEvent()
//! is called again or the reader is destroyed via destroyContentReader().
typedef struct ARAContentTempoEntry
ARAContentTempoEntry;
//! Content reader event class: bar signatures provided by kARAContentTypeBarSignatures.
//! The event position relates to ARAContentTempoEntry, a valid tempo map must be provided
//! by any provider of ARAContentBarSignature.
//! Each bar signature is valid until the following one, and the first bar signature is assumed to
//! also be valid any time before it is actually defined.
//! The location of the first bar signature is also considered to be the location of bar 1.
//! Event sort order is by position.
//! As with all content readers, a pointer to this struct retrieved via getContentReaderDataForEvent()
//! is still owned by the callee and must remain valid until either getContentReaderDataForEvent()
//! is called again or the reader is destroyed via destroyContentReader().
typedef struct ARAContentBarSignature
ARAContentBarSignature;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Notes Notes
//! \br
//! Notes in ARA correspond to what a composer would notate to describe the music.
//! Notes are described by their position in time, their pitch and their relative volume.
//! The pitch can be interpreted as frequency, but ARA also offers a musical description of the
//! pitch very similar to MIDI: it defines the tuning for the overall musical scale and provides
//! an integer number to identify the pitch for each note within this tuning, along with an average
//! detune for each note actually played.
//! ARA pitch numbers match MIDI note numbers, so that the note A4 has the value 69.
//! This note is also used to specify the tuning reference, commonly at 440 Hz.
//! At 440 Hz reference tuning the ARA pitch number 0 thus equals 8.1757989 Hz.
//! Some notes may not have a well-defined pitch, such as percussive notes. For such notes,
//! a frequency of kARAInvalidFrequency and a pitch number of kARAInvalidPitchNumber are used.
//! @{
//! Quantized pitch, corresponds to the MIDI note number in the range 0...127, but may exceed this range.
typedef ARAInt32 ARAPitchNumber;
//! Used if there is no pitch associated with a note (e.g. purely percussive note).
constexpr ARAPitchNumber kARAInvalidPitchNumber ;
//! Used if there is no pitch associated with a note (e.g. purely percussive note).
constexpr float kARAInvalidFrequency ;
//! Default tuning reference.
constexpr float kARADefaultConcertPitchFrequency ;
//! Content reader event class: notes provided by kARAContentTypeNotes.
//! Event sort order is by startPosition.
//! As with all content readers, a pointer to this struct retrieved via getContentReaderDataForEvent()
//! is still owned by the callee and must remain valid until either getContentReaderDataForEvent()
//! is called again or the reader is destroyed via destroyContentReader().
typedef struct ARAContentNote
ARAContentNote;
//! @}
/***************************************************************************************************/
//! @defgroup Model_Tuning_Key_Signatures_and_Chords Tuning, Key Signatures and Chords (Added In ARA 2.0)
//! \br
//! ARA expresses "western standard" octave-cyclic, 12-tone scales as tunings and key signatures.
//! While some applications such as Melodyne offer a much more complex model that allows for acyclic
//! and/or micro-tonal scales, those models usually don't map well to each others, and introduce
//! a complexity that can not meaningfully be handled by applications with the "main stream" model.
//! Further, there is no standardized musical theory for expressing chords in such scales.
//! Should the actual need to deal with more complex scales arise in the future, a new content type
//! may be added to cover this.
//! @{
//! The root of a key signature or chord as an index (or angle) in the circle of fifths from 'C'.
//! Enharmonic equivalents such as Db and C# are distinguished:
//! \verbatim
//! ...
//! -5: Db
//! ...
//! -1: F
//! 0: C
//! 1: G
//! 2: D
//! ...
//! 7: C#
//! ...
//! 11: E#
//! ...
//! \endverbatim
typedef ARAInt32 ARACircleOfFifthsIndex;
//! Content reader event class: periodic 12-tone tuning table provided by kARAContentTypeStaticTuning.
//! Defines the tuning of each pitch class in the octave-cyclic 12-tone pitch system.
//! Allows to import (12-tone) Scala files.
//! Stretched tunings are not supported by ARA at this point, but may be added in a future release
//! as an additional tuning stretch curve applied on top of this average tuning.
//! ARA defines a single overall tuning (i.e. there's always only one event for this reader).
//! As with all content readers, a pointer to this struct retrieved via getContentReaderDataForEvent()
//! is still owned by the callee and must remain valid until either getContentReaderDataForEvent()
//! is called again or the reader is destroyed via destroyContentReader().
typedef struct ARAContentTuning;
//! The ARAKeySignatureIntervalUsage defines whether a particular interval is used
//! (kARAKeySignatureIntervalUsed) or not (kARAKeySignatureIntervalUnused).
//! Future extensions of the API could further specify the usage of a given interval, similar to the
//! chord intervals below. However since there are currently no clear-cut use cases for such a
//! distinction, this is not yet specified.
typedef ARAByte ARAKeySignatureIntervalUsage;
//! @name Markup values of ARAKeySignatureIntervalUsage.
//! @{
//! Marks an interval of the ARAContentKeySignature as unused.
constexpr ARAKeySignatureIntervalUsage kARAKeySignatureIntervalUnused ;
//! Marks an interval of the ARAContentKeySignature as used.
constexpr ARAKeySignatureIntervalUsage kARAKeySignatureIntervalUsed ;
//! @}
//! Content reader event class: key signature provided by kARAContentTypeKeySignatures.
//! Defines the usage of each pitch class in the octave-cyclic 12-tone pitch system.
//! This content type describes the key signatures as would be annotated in a score, not the local
//! scales (which may be using some out-of-key notes via additional per-note accidentals).
//! The event position relates to ARAContentTempoEntry, a valid tempo map must be provided
//! by any provider of ARAContentBarSignature.
//! Each key signature is valid until the following one, the first key signature is assumed to also
//! be valid any time before it is actually defined.
//! Event sort order is by position.
//! As with all content readers, a pointer to this struct retrieved via getContentReaderDataForEvent()
//! is still owned by the callee and must remain valid until either getContentReaderDataForEvent()
//! is called again or the reader is destroyed via destroyContentReader().
typedef struct ARAContentKeySignature;
//! The ARAChordIntervalUsage defines whether a particular interval is used
//! (kARAChordIntervalUsed) or not (kARAChordIntervalUnused), or if used may instead further
//! specify the function of the interval in the chord by specifying its diatonic degree:
//! 1 = unison, 3 = third, up to 13 = thirteenth
//! Note that the bass note of a chord is treated separately, see below.
typedef ARAByte ARAChordIntervalUsage;
//! @name Markup values of ARAChordIntervalUsage.
//! \verbatim
//! common degrees per note if root is C:
//! C D E F G A B
//! 1 b9 2/9 #9/3 3 4/11 #11/b5 5 #5/b6/b13 6/7/13 7/#13 7
//! (7 only if dim)
//! \endverbatim
//! @{
//! ARAChordIntervalUsage value when the corresponding chromatic interval is used with the given diatonic function.
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree1 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree2 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree3 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree4 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree5 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree6 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree7 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree9 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree11 ;
constexpr ARAChordIntervalUsage kARAChordDiatonicDegree13 ;
//! ARAChordIntervalUsage value when the corresponding chromatic interval is used, but its diatonic function is unknown.
constexpr ARAChordIntervalUsage kARAChordIntervalUsed ;
//! ARAChordIntervalUsage value when the corresponding chromatic interval is not used.
constexpr ARAChordIntervalUsage kARAChordIntervalUnused ;
//! @}
//! Content reader event class: chords provided by kARAContentTypeSheetChords.
//! The event position relates to ARAContentTempoEntry, a valid tempo map must be provided
//! by any provider of ARAContentBarSignature.
//! Each chord is valid until the following one, and the first chord is assumed to also be valid
//! any time before it is actually defined (i.e. its position is effectively ignored).
//! The "undefined chord" markup (all intervals unused) can be used to express a range where no
//! chord is applicable. Such gaps may appear between "regular" chords, or they can be used
//! to limit the otherwise infinite duration of the first and last "regular" chord if desired.
//! Event sort order is by position.
//! As with all content readers, a pointer to this struct retrieved via getContentReaderDataForEvent()
//! is still owned by the callee and must remain valid until either getContentReaderDataForEvent()
//! is called again or the reader is destroyed via destroyContentReader().
typedef struct ARAContentChord;
//! @}
//! @}
/***************************************************************************************************/
//! @defgroup Host_Interfaces Host Interfaces
//! @{
/***************************************************************************************************/
/***************************************************************************************************/
//! @defgroup Host_Audio_Access_Controller Audio Access Controller
//! This interface allows plug-ins to read the audio data from the host in a random access order.
//! It is used from multiple threads, both host and plug-in need to carefully observe the threading
//! rules for each function. The basic design idea is that each audio reader is used single-threaded,
//! but multiple audio readers can work concurrently (even on the same audio source).
//! Audio readers can be considered random access iterators, and like most iterators operate on
//! conceptually constant data structures. If the host changes sample rate, channel count or other
//! audio source properties that the reader relies upon, the plug-in must discard any existing
//! audio readers for the source and later re-create them based on the new configuration.
//! The host can temporarily disable access to the audio source in order to control the exact timing
//! of stopping the readers from accessing the source.
//! Whenever an audio reader is destroyed, the plug-in is responsible for thread safety - it may
//! need to block until a concurrent read operation on the I/O thread has finished. Hosts must take
//! care in their audio reader implementation to avoid potential deadlocks in this situation.
//! Note that when rendering, the audio source will often not be read in a consecutive order -
//! depending on the edits the user applied at audio modification level, the access may jump back
//! and forth quite often. The reader implementation should be optimized accordingly.
//! \br
//! Host developer using C++ ARA Library can implement the ARA::Host::AudioAccessControllerInterface.
//! For plug-in developers this interface is wrapped by the ARA::PlugIn::HostAudioAccessController.
//! @{
//! Reference to the host side representation of an audio access controller (opaque to the plug-in).
typedef ;
//! Reference to the host side representation of an audio reader (opaque to the plug-in).
typedef ;
//! Host interface: audio access controller.
//! As with all host interfaces, the function pointers in this struct must remain valid until
//! all document controllers on the plug-in side that use it have been destroyed.
typedef struct ARAAudioAccessControllerInterface
ARAAudioAccessControllerInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Host_Archiving_Controller Archiving Controller
//! This interface allows plug-ins to read and write archives with minimal memory impact.
//! It also allows for displaying progress when archiving or unarchiving model graphs.
//! Its functions may only be called during the archiving/unarchiving process.
//! \br
//! Because of the potentially large size of the archives, ARA does not use simple monolithic memory
//! blocks as known from many companion APIs. Instead, it establishes a stream-like archive format
//! so that copying large blocks of memory can be avoided.
//! Plug-ins that create large archives should use any mean of data reduction that is appropriate
//! to reduce the archive size. For example, they may implement gzip compression. Since it has good
//! knowledge of the characteristics of the data, it can configure the compression algorithms so
//! that optimal results are achieved. Consequently, there's no point for host to try to compress
//! the data any further with generic algorithms.
//! \br
//! Hosts that support both 32 and 64 bit architectures shall be aware of the fact that ARA archive
//! sizes are pointer-sized data types, so they will differ in bit width between these architectures.
//! This must be taken into account when storing the archive size in the host's document structure.
//! Also, when importing documents from 64 bit into 32 bit, the host must check whether the archive
//! is small enough to be loaded at all (i.e. its size fits into 32 bits). If not, it shall refuse
//! to load the archive and provide a proper error message.
//! This may seem like a restriction, but the reasoning behind this is that if the archive already
//! exceeds the available address space, the resulting unarchived graph will do so too.
//! \br
//! There's no creation or destruction call for the archive readers/writers because they are provided
//! by the host for the duration of the (un-)archiving process, so the lifetime is implicitly defined.
//! \br
//! When using API generation 1 or older and loading an archive through the deprecated functions
//! begin-/endRestoringDocumentFromArchive(), plug-ins may choose to access the associated archive reader
//! upon either begin- or endRestoringDocumentFromArchive() or even upon both calls, as suitable for their
//! implementation - hosts must be able to provide the requested data during the duration of both calls.
//! \br
//! Host developer using C++ ARA Library can implement the ARA::Host::ArchivingControllerInterface.
//! For plug-in developers this interface is wrapped by the ARA::PlugIn::HostArchivingController.
//! @{
//! Reference to the host side representation of an archiving controller (opaque to the plug-in).
typedef ;
//! Reference to the host side representation of an archive reader (opaque to the plug-in).
typedef ;
//! Reference to the host side representation of an archive writer (opaque to the plug-in).
typedef ;
//! Host interface: archive controller.
//! As with all host interfaces, the function pointers in this struct must remain valid until
//! all document controllers on the plug-in side that use it have been destroyed.
typedef struct ARAArchivingControllerInterface
ARAArchivingControllerInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Host_Model_Content_Access_Controller Model Content Access Controller
//! This optional interface provides access to host model data such as the musical context.
//! Its functions may only be called from ARADocumentControllerInterface.create...() or update...()
//! for the object currently created/updated, or from ARADocumentControllerInterface::endEditing()
//! for any object.
//! \br
//! Host developer using C++ ARA Library can implement the ARA::Host::ContentAccessControllerInterface.
//! For plug-in developers this interface is wrapped by the ARA::PlugIn::HostContentAccessController.
//! @{
//! Reference to the host side representation of a content access controller (opaque to the plug-in).
typedef ;
//! Host interface: content access controller.
//! As with all host interfaces, the function pointers in this struct must remain valid until
//! all document controllers on the plug-in side that use it have been destroyed.
typedef struct ARAContentAccessControllerInterface
ARAContentAccessControllerInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Host_Model_Update_Controller_Interface Model Update Controller Interface
//! This optional host interface allows the host to be notified about content changes in the plug-in.
//! Its functions may only be called from ARADocumentControllerInterface::notifyModelUpdates().
//! \br
//! Host developer using C++ ARA Library can implement the ARA::Host::ModelUpdateControllerInterface.
//! For plug-in developers this interface is wrapped by the ARA::PlugIn::HostModelUpdateController.
//! @{
//! Reference to the host side representation of a model update controller (opaque to the plug-in).
typedef ;
//! Audio source analysis progress indication.
typedef
;
//! Host interface: model update controller.
//! As with all host interfaces, the function pointers in this struct must remain valid until
//! all document controllers on the plug-in side that use it have been destroyed.
typedef struct ARAModelUpdateControllerInterface
ARAModelUpdateControllerInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Host_Playback_Controller_Interface Playback Controller Interface
//! This optional host interface allows the plug-in to request playback state changes.
//! The functions in this interface may be called concurrently, but not from render-threads.
//! The host may choose to ignore any of these requests.
//! The requests will typically be scheduled and executed with some delay.
//! The current state of playback is transmitted via the companion API.
//! \br
//! Host developer using C++ ARA Library can implement the ARA::Host::PlaybackControllerInterface.
//! For plug-in developers this interface is wrapped by the ARA::PlugIn::HostPlaybackController.
//! @{
//! Reference to the host side representation of a playback controller (opaque to the plug-in).
typedef ;
//! Host interface: playback controller.
//! As with all host interfaces, the function pointers in this struct must remain valid until
//! all document controllers on the plug-in side that use it have been destroyed.
typedef struct ARAPlaybackControllerInterface
ARAPlaybackControllerInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Host_Document_Controller_Instance Document Controller Instance
//! The callbacks into the host are published by the host when creating a document controller on
//! the plug-in side to maintain an ARA model graph. The instance struct and all interfaces and
//! host refs therein must remain valid until the document controller is destroyed.
//! The host can choose to create its controller objects per document controller instance, or it
//! can share a single instance between all document controllers, whatever fits its needs.
//! It may even mix-and-match both approaches per individual interface.
//! @{
//! The document controller host instance struct and all interfaces and refs therein must remain valid
//! until all plug-in document controllers created with this struct have been destroyed by the host.
typedef struct ARADocumentControllerHostInstance
ARADocumentControllerHostInstance;
// Convenience constant for easy struct validation.
;
//! @}
//! @}
/***************************************************************************************************/
//! @defgroup Plug_In_Interfaces Plug-In Interfaces
//! @{
/***************************************************************************************************/
// forward-declaration, defined below
;
typedef struct ARAFactory ARAFactory;
//! @defgroup Partial_Document_Persistency Partial Document Persistency
//! \br
//! These optional filters allow to only store a subset of the document graph into an archive,
//! or only restore a subset of an archive into the document graph.
//! @{
//! Optional filter when restoring objects.
//! \br
//! Allows the host to specify a subset of the persistent objects in the archive to restore in
//! ARADocumentControllerInterface::restoreObjectsFromArchive().
//! \br
//! The given IDs refer to objects in the archive, but can optionally be mapped to those used in the
//! current document. This may be necessary to resolve potential conflicts between persistent IDs
//! from different documents when importing parts of one document into another (since persistent IDs
//! are only required to be unique within a document, not across documents).
//! \br
//! The C++ ARA Library offers plug-in developers the ARA::PlugIn::RestoreObjectsFilter
//! utility class to ease the implementation of partial persistency.
typedef struct ARARestoreObjectsFilter;
// Convenience constant for easy struct validation.
;
//! Optional filter when storing objects.
//! \br
//! Allows the host to specify a subset of the objects in the model graph to be stored in
//! ARADocumentControllerInterface::storeObjectsToArchive().
//! \br
//! The C++ ARA Library offers plug-in developers the ARA::PlugIn::StoreObjectsFilter
//! utility class to ease the implementation of partial persistency.
typedef struct ARAStoreObjectsFilter;
// Convenience constant for easy struct validation.
;
//! @}
//! @defgroup Processing_Algorithm_Selection Processing Algorithm Selection
//! @{
//! Processing algorithm description returned by ARADocumentControllerInterface::getProcessingAlgorithmProperties()
//! Provides a unique identifier and a user-readable name of the algorithm, as displayed in the plug-in.
//! The pointers contained in this struct must remain valid until the document controller that has
//! provided the struct is destroyed.
typedef struct ARAProcessingAlgorithmProperties;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Plug-In_Document_Controller Document Controller
//! ARA model objects are created and managed by the ARA Document Controller provided by the plug-in.
//! The host uses the factory and management functions of the Document Controller to create a partial
//! copy of its model translated into the ARA world.
//! It is created using a factory which can be either retrieved by scanning the plug-in binaries
//! for a dedicated factory or by requesting it from a living companion plug-in instance.
//! The host is responsible for keeping the document controller alive as long as any objects created
//! through it are still living (kind of implicit ref-counting). This means that its live time is
//! independent of the companion plug-in instances - they may all be gone at some point but the
//! ARA graph may still be accessed through its document controller.
//! The host must also keep the document controller alive as long as any companion plug-in instance
//! which it has bound to it is actively used. The actual destruction of the plug-in instance may
//! be done later (to ease reference counting implementation), but rendering the plug-in, accessing
//! its state or showing its UI is only valid as long as the ARA document controller it has been
//! bound is still alive.
//! Except for some rare, explicitly documented functions like getPlaybackRegionHeadAndTailTime(),
//! the document controller interface must always be called from the same thread - usually hosts
//! will manage their internal model as well as the attached ARA graph from the application's main
//! thread, triggered from the main run loop. If a host decides to use a different thread for
//! maintaining the ARA model, it may need to implement some sort of locking so that its updates on
//! the ARA model thread do not interfere concurrently with the main run loop's event processing
//! as it drives the plug-in's UI code and notification system.
//! \br
//! Plug-in developers using C++ ARA Library can implement the ARA::PlugIn::DocumentControllerInterface,
//! or extend the already implemented ARA::PlugIn::DocumentController class as needed.
//! For host developers this interface is wrapped by the ARA::Host::DocumentController.
//! @{
//! Reference to the plug-in side representation of a document controller (opaque to the host).
typedef ;
//! Plug-in interface: document controller.
//! The function pointers in this struct must remain valid until the document controller is
//! destroyed by the host.
typedef struct ARADocumentControllerInterface
ARADocumentControllerInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Plug-In_Document_Controller_Instance Document Controller Instance
//! The callbacks into the plug-in are published by the plug-in when the host requests the creation
//! of a document controller via the factory. The instance struct and all interfaces and
//! host refs therein must remain valid until the document controller is destroyed.
//! The plug-in can choose to create its controller objects per document controller instance, or it
//! can share a single instance between all document controllers, whatever fits its needs.
//! It may even mix-and-match both approaches per individual interface.
//! @{
//! The document controller instance struct and all interfaces and refs therein must remain valid
//! until the document controller is destroyed by the host.
typedef struct ARADocumentControllerInstance
ARADocumentControllerInstance;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Plug-In_Factory Plug-In Factory
//! Static entry into ARA, allows to create ARA objects.
//! @{
//! API configuration.
//! This configuration struct allows for setting the desired API version, the debug callback etc.
//! Note that a pointer to this struct is only valid for the duration of the call to
//! initializeARAWithConfiguration() - the data must be fully evaluated/copied inside the call.
typedef struct ARAInterfaceConfiguration
ARAInterfaceConfiguration;
// Convenience constant for easy struct validation.
;
//! Static plug-in factory.
//! All pointers herein must remain valid as long as the binary is loaded.
//! The declaration of this struct will not change when updating to a new generation of the API,
//! only additions are possible.
/*typedef*/ struct ARAFactory // the typedef was forward-declared above
/*ARAFactory*/;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Plug-In_Extension Plug-In Extension
//! The plug-in extension provides ARA-specific additional functionality per companion plug-in instance.
//! On a conceptual level, the plug-in extension is not an object of its own, but merely a set of
//! additional interfaces of the companion plug-in instance, augmenting it with a few ARA-specific
//! features in a fashion that is independent from the actual companion API in use.
//! Accordingly, it is coupled 1:1 to the companion plug-in instance and its lifetime matches the
//! lifetime of the companion plug-in instance (no separate destruction function needed).
//! Along the same lines, plug-in extensions themselves are not persistent.
//! \br
//! The plug-in extension is exposed towards the host when it binds a plug-in instance as created by the
//! companion APIs to a specific ARA model graph, represented by its associated document controller.
//! This setup call is executed via a vendor-specific extension of the companion API and may only be
//! made once. It shifts the "normal" companion plug-in into the ARA world, and once established, this
//! coupling cannot be undone, it remains active until the plug-in instance is destroyed.
//! \br
//! Note that both performing the explicit binding and the implicit unbinding upon destruction will
//! likely need to access plug-in internal data structures shared with with the document controller
//! implementation. To avoid adding costly thread safety measures when maintaining this shared state,
//! hosts should always perform these operations from the document controller thread (typically the
//! main thread). This restriction may or may not apply when using the same companion API without ARA,
//! so host developers might need to add extra precaution for the ARA case.
//! \br
//! When ARA is enabled, the renderer behavior has slightly different semantics compared to the
//! non-ARA use case. Since ARA renderers are essentially generators that use non-realtime data to
//! generate realtime signals, they do not use the realtime input signal for processing.
//! Playback renderers will simply ignore their inputs, but editor renderers will always add their
//! output signal to the input signal provided by the host. If a plug-in assumes both rendering
//! roles, playback rendering will already ignore the inputs, so the editor rendering will directly
//! add to the playback output, not to the input.
//! \br
//! Since ARA 2.0, the host can explicitly establish the roles that the given instance will assume
//! in its specific implementation upon binding the plug-in instance to the ARA document controller.
//! Each role is associated with a dedicated feature set that only is available when the particular
//! role has been established.
//! Depending on the chosen roles, the following calls control which playback regions are to be
//! rendered according to which rule.
//! Separating roles allows for more flexible ARA integrations and optimizes resource usage.
//! A host could for example use a playback renderer plug-in instance playback region, plus
//! one plug-in instance per track for editor rendering and viewing all regions on that track.
//! Amongst other behavior, the roles heavily affect the relationship between plug-in instances
//! and playback regions.
//! For rendering, each plug-in extension can handle multiple playback regions if desired, albeit
//! the semantics for modifying the set of associated regions per renderer are somewhat different
//! between playback and editor renderers, see below.
//! For editor view purposes, the relationship is not explicit to accommodate for a very broad range
//! of user interface concepts that need to interact with the API. Generally, each editor view is
//! associated with all playback regions in the document controller to which the plug-in is bound.
//! However, typically only a varying subset of those regions will be shown at any point in time,
//! depending on the intrinsic feature set of the plug-in, and reflecting the selection that the
//! user has performed in the host - see notifySelection().
//! @{
//! Plug-in instance role flags.
typedef
;
/***************************************************************************************************/
//! @defgroup Playback_Renderer_Interface Playback Renderer Interface (Added In ARA 2.0)
//! See ::kARAPlaybackRendererRole.
//! \br
//! Plug-in developers using C++ ARA Library can implement the ARA::PlugIn::PlaybackRendererInterface,
//! or extend the already implemented ARA::PlugIn::PlaybackRenderer class as needed.
//! For host developers this interface is wrapped by the ARA::Host::PlaybackRenderer.
//! @{
//! Reference to the plug-in side representation of a playback renderer (opaque to the host).
typedef ;
//! Plug-in interface: playback renderer.
//! The function pointers in this struct must remain valid until the companion API plug-in instance
//! (and accordingly its plug-in extension) is destroyed by the host.
typedef struct ARAPlaybackRendererInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Editor_Renderer_Interface Editor Renderer Interface (Added In ARA 2.0)
//! See ::kARAEditorRendererRole.
//! \br
//! Plug-in developers using C++ ARA Library can implement the ARA::PlugIn::EditorRendererInterface,
//! or extend the already implemented ARA::PlugIn::EditorRenderer class as needed.
//! For host developers this interface is wrapped by the ARA::Host::EditorRenderer.
//! @{
//! Reference to the plug-in side representation of a editor renderer (opaque to the host).
typedef ;
//! Plug-in interface: editor renderer.
//! The function pointers in this struct must remain valid until the companion API plug-in instance
//! (and accordingly its plug-in extension) is destroyed by the host.
typedef struct ARAEditorRendererInterface;
// Convenience constant for easy struct validation.
;
//! @}
/***************************************************************************************************/
//! @defgroup Editor_View_Interface Editor View Interface (Added In ARA 2.0)
//! See ::kARAEditorViewRole.
//! \br
//! Users will often reconfigure the plug-in view through scrolling, zooming, navigating lists of
//! entities, etc. to select the subset of ARA entities that they currently need to view or edit.
//! Those selection features can be implemented in the plug-in (which was the only available
//! solution in ARA 1). However, the host applications already have established user workflows for
//! selecting their representations of the ARA objects. Making those workflows available to the
//! plug-ins is leads to a much more consistent, streamlined user experience.
//! Since the views are implemented through the companion API, there is no matching ARA entity yet.
//! Instead, the companion plug-in instance is used as a controller for its associated view.
//! (Note that while some companion APIs allow for multiple views of a given plug-in used at the
//! same time, this is not recommended when using ARA editor views.)
//! These calls only affect views, not the audio rendering.
//! They only should be made while the plug-in is showing its UI, or before entering this
//! state (i.e. during GUI setup phase), in order to optimize resource usage. Accordingly, the
//! host should send an update of the selection when (re-)opening an ARA plug-in view.
//! These calls also may be made while changes are being made to the model graph (i.e. inside of pairs
//! of ARADocumentControllerInterface::beginEditing() and ARADocumentControllerInterface::endEditing()).
//! \br
//! Plug-in developers using C++ ARA Library can implement the ARA::PlugIn::EditorViewInterface,
//! or extend the already implemented ARA::PlugIn::EditorView class as needed.
//! For host developers this interface is wrapped by the ARA::Host::EditorView.
//! @{
//! Host generated ARA view selection.
typedef struct ARAViewSelection
ARAViewSelection;
// Convenience constant for easy struct validation.
;
//! Reference to the plug-in side representation of a editor view (opaque to the host).
typedef ;
//! Plug-in interface: view controller.
//! The function pointers in this struct must remain valid until the document controller is
//! destroyed by the host.
typedef struct ARAEditorViewInterface;
// Convenience constant for easy struct validation.
;
//! @}
//! @defgroup Plug-In_Extension_Interface Deprecated: Plug-In Extension Interface.
//! This interface was used before ARA 2.0 defined dedicated plug-in roles.
//! It is only to be implemented when ARA 1 backwards compatibility is desired.
//! An ARA 1 call to set/removePlaybackRegion() in this interface is equivalent
//! to calling both set/removePlaybackRegion() in ARAPlaybackRendererInterface
//! and add/removePlaybackRegion() in ARAEditorRendererInterface.
//! To some extend ARA 1 also uses this to for tasks now associated with
//! ARAEditorViewInterface: opening the UI of an ARA 1 plug-in instance is
//! interpreted as selection of the playback region set via this interface.
//! @{
typedef ;
typedef struct ARAPlugInExtensionInterface;
;
//! @}
//! The plug-in extension instance struct and all interfaces and refs therein must remain valid
//! until the companion plug-in is destroyed by the host.
//! Note that the companion plug-in destruction may happen before or after destroying the document
//! controller it has been bound to, plug-ins must handle both possible destruction orders.
//! Plug-ins must provide all interfaces that have been requested by the host through the role
//! assignment, and suppress interfaces explicitly excluded by the roles - e.g. if the host did
//! not assign kARAEditorRendererRole even it was known, editorRendererInterface will be NULL.
typedef struct ARAPlugInExtensionInstance
ARAPlugInExtensionInstance;
// Convenience constant for easy struct validation.
;
//! @}
//! @}
/***************************************************************************************************/
// various configurations/decorations to ensure binary compatibility
} // extern "C"
} // namespace ARA
// ARAInterface_h