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
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
|
//############################################################################
//## ##
//## Miles Sound System ##
//## ##
//############################################################################
//## ##
//## Contact RAD Game Tools at 425-893-4300 for technical support. ##
//## ##
//############################################################################
#ifndef MSS_VERSION
// also update versions below for the docs
// for cdep and installs
#define MILESVERSION "9.3m"
// see below in docs section
#define MILESMAJORVERSION 9
#define MILESMINORVERSION 3
#define MILESSUBVERSION 11
#define MILESBUILDVERSION 0
#define MILESVERSIONDATE "20-Jun-14"
#define MILESCOPYRIGHT "Copyright (C) 1991-2014, RAD Game Tools, Inc."
// source files use these defines
#define MSS_VERSION MILESVERSION
#define MSS_MAJOR_VERSION MILESMAJORVERSION
#define MSS_MINOR_VERSION MILESMINORVERSION
#define MSS_SUB_VERSION MILESSUBVERSION
#define MSS_BUILD_VERSION MILESBUILDVERSION
#define MSS_VERSION_DATE MILESVERSIONDATE
#define MSS_COPYRIGHT MILESCOPYRIGHT
#endif
#if !defined(MSS_H) && !defined(__RADRES__)
#define MSS_H
// doc system stuff
#ifndef EXPAPI
#define EXPAPI
#endif
#ifndef EXPTYPE
#define EXPTYPE
#endif
#ifndef EXPMACRO
#define EXPMACRO
#endif
#ifndef EXPCONST
#define EXPCONST
#endif
#ifndef EXPOUT
#define EXPOUT
#endif
#ifndef EXPTYPEBEGIN
#define EXPTYPEBEGIN
#endif
#ifndef EXPTYPEEND
#define EXPTYPEEND
#endif
#ifndef EXPGROUP
#define EXPGROUP(GroupName)
#endif
#ifndef DEFGROUP
#define DEFGROUP(GroupName, Info)
#endif
// For docs
EXPGROUP(_NullGroup)
#define MilesVersion "9.3m" EXPMACRO
#define MilesMajorVersion 9 EXPMACRO
#define MilesMinorVersion 3 EXPMACRO
#define MilesBuildNumber 11 EXPMACRO
#define MilesCustomization 0 EXPMACRO
EXPGROUP(_RootGroup)
// IS_WINDOWS for Windows or Win32
// IS_WIN64 for Win64
// IS_WIN32 for Win32
// IS_WIN32API for Windows, Xbox and Xenon
// IS_64REGS when CPU registers are 64-bit - Xenon, PS3, Win64 and PS2
// IS_32 for at least 32-bit pointers
// IS_LE for little endian (PCs)
// IS_BE for big endian (Macs, x360, ps3)
// IS_X86 for Intel
// IS_MAC for Mac
// IS_MACHO for Macho Mac
// IS_PPC for PPC Mac
// IS_68K for 68K Mac
// IS_LINUX for Linux
// IS_XBOX for Xbox
// IS_XENON for Xbox 360
// IS_PS2 for PS/2
// IS_PS3 for PS/3
// IS_SPU for PS3 SPU
// IS_WII for Wii
#include "rrCore.h"
//#define MILES_CHECK_OFFSETS
#ifdef MILES_CHECK_OFFSETS
#include <stddef.h>
#endif
#ifdef __RADNT__
#define IS_WIN32
#if defined(__RAD64__)
#define IS_WIN64
#endif
#endif
#if defined(__RADWIN__) && !defined(__RADXENON__) && !defined(__RADXBOX__) && !defined(__RADWINRTAPI__)
#define IS_WINDOWS
#endif
#if defined(__RADWIN__)
#define IS_WIN32API
#endif
#if defined(__RAD64__) && defined(__RADWIN__)
#define IS_WIN64
#endif
// 16-bit not supported anymore
#define IS_32
#ifdef __RADLITTLEENDIAN__
#define IS_LE
#endif
#ifdef __RADBIGENDIAN__
#define IS_BE
#endif
#ifdef __RADX86__
#define IS_X86
#endif
#ifdef __RADMAC__
#define IS_MAC
#endif
#ifdef __RADPPC__
#define IS_PPC
#endif
#ifdef __RAD68K__
#define IS_68K
#endif
#ifdef __RADLINUX__
#define IS_LINUX
#endif
//
// MSS_STATIC_RIB is used to determine whether anything loaded
// through the RIB interface is loaded via RIB_load_application_providers
// or via a static declaration from the user (Register_RIB)
// mirror this in rib.h
//
#if defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPSP2__) || \
defined(__RADWII__) || defined(__RADWIIU__) || defined(__RAD3DS__) || defined(__RADIPHONE__) || \
defined(__RADXENON__) || defined(__RADPS4__) || defined(__RADPS3__) || defined(__RADSPU__) || \
defined(__RADDURANGO__) || defined(__RADWINRTAPI__)
#define MSS_STATIC_RIB
// WinRT is weird in that we statically pull in the RIBs, but we dynamically link Midi
#ifndef __RADWINRTAPI__
#define MSS_STATIC_MIDI
#endif
#elif defined(__RADWIN__) || defined(__RADLINUX__) || defined(__RADMAC__)
// not static.
#else
#error "MSS needs to know whether it is being distributed as a static lib!"
#endif
// Retain the old IS_STATIC define for example code
#ifdef MSS_STATIC_RIB
#define IS_STATIC
#endif
#ifdef __RADXBOX__
#define IS_XBOX
#endif
#ifdef __RADXENON__
#define IS_XENON
#endif
#ifdef __RADWII__
#define IS_WII
#endif
#ifdef __RADWIIU__
#define IS_WIIU
#endif
#ifdef __RADPS2__
#define IS_PS2
#endif
#ifdef __RADPS3__
#define IS_PS3
#ifndef HOST_SPU_PROCESS
#define HOST_SPU_PROCESS
#endif
#endif
#ifdef __RADSPU__
#define IS_PS3
#define IS_SPU
#endif
#ifdef __RADPSP__
#define IS_PSP
#endif
#ifdef __RADPSP2__
#define IS_PSP2
#endif
#ifdef __RADDOS__
#define IS_DOS
#endif
#ifdef __RAD64REGS__
#define IS_64REGS
#endif
#ifdef __RADMACH__
#define IS_MACHO
#endif
#ifdef __RADIPHONE__
#define IS_IPHONE
#endif
#ifdef __RADIPHONESIM__
#define IS_IPHONESIM
#endif
#ifdef __RAD3DS__
#define IS_3DS
#endif
#define MSSRESTRICT RADRESTRICT
#define MSS_STRUCT RADSTRUCT
#define C8 char
typedef void VOIDFUNC(void);
#if (!defined(IS_LE) && !defined(IS_BE))
#error MSS.H did not detect your platform. Define _WINDOWS, WIN32, WIN64, or macintosh.
#endif
//
// Pipeline filters supported on following platforms
//
#define MSS_FLT_SUPPORTED 1
#define EXTRA_BUILD_BUFFERS 1
#define FLT_A (MAX_SPEAKERS)
#if defined(IS_WIN32API)
#define MSS_VFLT_SUPPORTED 1
#endif
#define MSS_REVERB_SUPPORTED 1
//================
EXPGROUP(Basic Types)
#define AILCALL EXPTAG(AILCALL)
/*
Internal calling convention that all external Miles functions use.
Usually cdecl or stdcall on Windows.
*/
#define AILCALLBACK EXPTAG(AILCALLBACK docproto)
/*
Calling convention that user supplied callbacks <b>from</b> Miles use.
Usually cdecl or stdcall on Windows.
*/
EXPGROUP(_RootGroup)
#undef AILCALL
#undef AILCALLBACK
//================
RADDEFSTART
#define MSSFOURCC U32
#ifdef IS_LE
#define MSSMAKEFOURCC(ch0, ch1, ch2, ch3) \
((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
#else
#define MSSMAKEFOURCC(ch0, ch1, ch2, ch3) \
(((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \
((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) ))
#endif
#define MSSmmioFOURCC(w,x,y,z) MSSMAKEFOURCC(w,x,y,z)
#if defined(__RADWINRTAPI__)
#define AILLIBCALLBACK RADLINK
#define AILCALL RADLINK
#define AILEXPORT RADEXPLINK
#define AILCALLBACK RADLINK
#define DXDEF RADEXPFUNC
#define DXDEC RADEXPFUNC
#elif defined(IS_WINDOWS)
typedef char CHAR;
typedef short SHORT;
typedef int BOOL;
typedef long LONG;
typedef CHAR *LPSTR, *PSTR;
#ifdef IS_WIN64
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
#else
#ifdef _Wp64
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
#else
typedef unsigned long ULONG_PTR, *PULONG_PTR;
#endif
#else
typedef unsigned long ULONG_PTR, *PULONG_PTR;
#endif
#endif
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef unsigned int UINT;
typedef struct HWAVE__ *HWAVE;
typedef struct HWAVEIN__ *HWAVEIN;
typedef struct HWAVEOUT__ *HWAVEOUT;
typedef HWAVEIN *LPHWAVEIN;
typedef HWAVEOUT *LPHWAVEOUT;
#ifndef WAVE_MAPPER
#define WAVE_MAPPER ((UINT)-1)
#endif
typedef struct waveformat_tag *LPWAVEFORMAT;
typedef struct HMIDIOUT__ *HMIDIOUT;
typedef HMIDIOUT *LPHMIDIOUT;
typedef struct HWND__ *HWND;
typedef struct HINSTANCE__ *HINSTANCE;
typedef HINSTANCE HMODULE;
typedef struct wavehdr_tag *LPWAVEHDR;
#define MSS_MAIN_DEF __cdecl
//
// If compiling MSS DLL, use __declspec(dllexport) for both
// declarations and definitions
//
#ifdef IS_WIN32
#if !defined(FORNONWIN) && !defined(__RADNTBUILDLINUX__)
#define AILLIBCALLBACK __stdcall
#define AILCALL __stdcall
#define AILCALLBACK __stdcall
#define AILEXPORT __stdcall
#else
#define AILLIBCALLBACK __cdecl
#define AILCALL __cdecl
#define AILCALLBACK __cdecl
#define AILEXPORT __cdecl
#endif
#ifdef __RADINDLL__
#define DXDEC __declspec(dllexport)
#define DXDEF __declspec(dllexport)
#else
#if defined( __BORLANDC__ ) || defined( MSS_SPU_PROCESS )
#define DXDEC extern
#else
#define DXDEC __declspec(dllimport)
#endif
#endif
#ifdef IS_WIN64
#define MSSDLLNAME "MSS64.DLL"
#define MSS_REDIST_DIR_NAME "redist64"
#else
#define MSSDLLNAME "MSS32.DLL"
#define MSS_REDIST_DIR_NAME "redist"
#endif
#define MSS_DIR_SEP "\\"
#define MSS_DIR_UP ".." MSS_DIR_SEP
#define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
#endif
typedef void * LPVOID;
typedef LPVOID AILLPDIRECTSOUND;
typedef LPVOID AILLPDIRECTSOUNDBUFFER;
#elif defined( IS_MAC ) || defined(IS_IPHONE) || defined(IS_LINUX)
#if defined(__RADARM__) || defined(__RADX64__)
#define AILLIBCALLBACK
#define AILCALL
#define AILEXPORT
#define AILCALLBACK
#elif defined(__RADX86__)
#define AILLIBCALLBACK __attribute__((cdecl))
#define AILCALL __attribute__((cdecl))
#define AILCALLBACK __attribute__((cdecl))
#define AILEXPORT __attribute__((cdecl))
#else
#error "No fn call decorators specified"
#endif
#ifdef __RADINDLL__
#define DXDEC __attribute__((visibility("default")))
#define DXDEF __attribute__((visibility("default")))
#else
#define DXDEC extern
#define DXDEF
#endif
#ifdef __RADX64__
#define MSS_REDIST_DIR_NAME "redist/x64"
#elif defined(IS_X86)
#define MSS_REDIST_DIR_NAME "redist/x86"
#elif defined(__RADARM__)
#define MSS_REDIST_DIR_NAME ""
#else
#error "No Redist Dir Specified"
#endif
#define MSS_DIR_SEP "/"
#define MSS_DIR_UP ".." MSS_DIR_SEP
#define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
#define MSS_MAIN_DEF
#elif defined(IS_XENON)
#define AILLIBCALLBACK __stdcall
#define AILCALL __stdcall
#define AILEXPORT __stdcall
#define AILCALLBACK __stdcall
#define DXDEC extern
#define DXDEF
typedef void * AILLPDIRECTSOUND;
typedef void * AILLPDIRECTSOUNDBUFFER;
#else
#define AILLIBCALLBACK
#define AILCALL
#define AILEXPORT
#define AILCALLBACK
#define DXDEC extern
#define DXDEF
#endif
//
// Misc. constant definitions
//
#define MAX_DRVRS 16 // Max. # of simultaneous drivers
#define MAX_TIMERS 16 // Max. # of simultaneous timers
#define MAX_NOTES 32 // Max # of notes "on"
#define FOR_NEST 4 // # of nested XMIDI FOR loops
#define NUM_CHANS 16 // # of possible MIDI channels
#define MAX_W_VOICES 16 // Max virtual wave synth voice cnt
#define MAX_W_ENTRIES 512 // 512 wave library entries max.
#ifdef IS_WIN32
#define MAX_SPEAKERS 9 // Up to 9 hardware output channels supported on Win32
#elif defined(IS_PS3) || defined(IS_WII) || defined(IS_WIIU) || defined(__RADWINRTAPI__) || defined(__RADSEKRIT2__)
#define MAX_SPEAKERS 8 // Up to 8 hardware output channels on PS3, PS2, Wii, WiiU
#elif defined(IS_PSP) || defined(IS_IPHONE) || defined(IS_3DS) || defined(IS_PSP2) || defined(__RADANDROID__)
#define MAX_SPEAKERS 2 // Up to 2 hardware output channels on PSP
#else
#define MAX_SPEAKERS 6 // Up to 6 hardware output channels supported on other platforms
#endif
#define MAX_RECEIVER_SPECS 32 // Up to 32 receiver point specifications
#define MAX_BUSSES 4 // # of busses that can be active.
#define MILES_MAX_STATES 4 // # of state pushes allowed.
#define MIN_CHAN ( 1-1) // Min channel recognized (0-based)
#define MAX_CHAN (16-1) // Max channel recognized
#define MIN_LOCK_CHAN ( 1-1) // Min channel available for locking
#define MAX_LOCK_CHAN (16-1) // Max channel available for locking
#define PERCUSS_CHAN (10-1) // Percussion channel (no locking)
#define AIL_MAX_FILE_HEADER_SIZE 8192 // AIL_set_named_sample_file() requires at least 8K
// of data or the entire file image, whichever is less,
// to determine sample format
#define DIG_F_16BITS_MASK 1
#define DIG_F_STEREO_MASK 2
#define DIG_F_ADPCM_MASK 4
#define DIG_F_XBOX_ADPCM_MASK 8
#define DIG_F_MULTICHANNEL_MASK 16
#define DIG_F_OUTPUT_FILTER_IN_USE 32
#define DIG_F_MONO_8 0 // PCM data formats
#define DIG_F_MONO_16 (DIG_F_16BITS_MASK)
#define DIG_F_STEREO_8 (DIG_F_STEREO_MASK)
#define DIG_F_MULTICHANNEL_8 (DIG_F_MULTICHANNEL_MASK) // (not actually supported)
#define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK)
#define DIG_F_MULTICHANNEL_16 (DIG_F_MULTICHANNEL_MASK|DIG_F_16BITS_MASK)
#define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK)
#define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
#define DIG_F_ADPCM_MULTICHANNEL_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
#define DIG_F_XBOX_ADPCM_MONO_16 (DIG_F_XBOX_ADPCM_MASK |DIG_F_16BITS_MASK)
#define DIG_F_XBOX_ADPCM_STEREO_16 (DIG_F_XBOX_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
#define DIG_F_XBOX_ADPCM_MULTICHANNEL_16 (DIG_F_XBOX_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_MULTICHANNEL_MASK)
#define DIG_F_NOT_8_BITS (DIG_F_16BITS_MASK | DIG_F_ADPCM_MASK | DIG_F_XBOX_ADPCM_MASK | DIG_F_MULTICHANNEL_MASK)
#define DIG_F_USING_ASI 16
#define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware
#define DIG_PCM_SPLIT 0x0008
#define DIG_BUFFER_SERVICE 0x0010
#define DIG_DUAL_DMA 0x0020
#define DIG_RECORDING_SUPPORTED 0x8000
#ifndef WAVE_FORMAT_PCM
#define WAVE_FORMAT_PCM 1
#endif
#ifndef WAVE_FORMAT_IMA_ADPCM
#define WAVE_FORMAT_IMA_ADPCM 0x0011
#endif
#ifndef WAVE_FORMAT_XBOX_ADPCM
#define WAVE_FORMAT_XBOX_ADPCM 0x0069
#endif
#ifndef WAVE_FORMAT_EXTENSIBLE
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
#endif
typedef enum
{
MSS_SPEAKER_MONO = 0,
MSS_SPEAKER_FRONT_LEFT = 0, // Speaker order indexes correspond to
MSS_SPEAKER_FRONT_RIGHT = 1, // bitmasks in PSDK's ksmedia.h
MSS_SPEAKER_FRONT_CENTER = 2, // Also see microsoft.com/whdc/device/audio/multichaud.mspx
MSS_SPEAKER_LOW_FREQUENCY = 3,
MSS_SPEAKER_BACK_LEFT = 4,
MSS_SPEAKER_BACK_RIGHT = 5,
MSS_SPEAKER_FRONT_LEFT_OF_CENTER = 6,
MSS_SPEAKER_FRONT_RIGHT_OF_CENTER = 7,
MSS_SPEAKER_BACK_CENTER = 8,
MSS_SPEAKER_SIDE_LEFT = 9,
MSS_SPEAKER_SIDE_RIGHT = 10,
MSS_SPEAKER_TOP_CENTER = 11,
MSS_SPEAKER_TOP_FRONT_LEFT = 12,
MSS_SPEAKER_TOP_FRONT_CENTER = 13,
MSS_SPEAKER_TOP_FRONT_RIGHT = 14,
MSS_SPEAKER_TOP_BACK_LEFT = 15,
MSS_SPEAKER_TOP_BACK_CENTER = 16,
MSS_SPEAKER_TOP_BACK_RIGHT = 17,
MSS_SPEAKER_MAX_INDEX = 17,
MSS_SPEAKER_FORCE_32 = 0x7fffffff
} MSS_SPEAKER;
//
// Pass to AIL_midiOutOpen for NULL MIDI driver
//
#define MIDI_NULL_DRIVER ((U32)(S32)-2)
//
// Non-specific XMIDI/MIDI controllers and event types
//
#define SYSEX_BYTE 105
#define PB_RANGE 106
#define CHAN_MUTE 107
#define CALLBACK_PFX 108
#define SEQ_BRANCH 109
#define CHAN_LOCK 110
#define CHAN_PROTECT 111
#define VOICE_PROTECT 112
#define TIMBRE_PROTECT 113
#define PATCH_BANK_SEL 114
#define INDIRECT_C_PFX 115
#define FOR_LOOP 116
#define NEXT_LOOP 117
#define CLEAR_BEAT_BAR 118
#define CALLBACK_TRIG 119
#define SEQ_INDEX 120
#define GM_BANK_MSB 0
#define MODULATION 1
#define DATA_MSB 6
#define PART_VOLUME 7
#define PANPOT 10
#define EXPRESSION 11
#define GM_BANK_LSB 32
#define DATA_LSB 38
#define SUSTAIN 64
#define REVERB 91
#define CHORUS 93
#define RPN_LSB 100
#define RPN_MSB 101
#define RESET_ALL_CTRLS 121
#define ALL_NOTES_OFF 123
#define EV_NOTE_OFF 0x80
#define EV_NOTE_ON 0x90
#define EV_POLY_PRESS 0xa0
#define EV_CONTROL 0xb0
#define EV_PROGRAM 0xc0
#define EV_CHAN_PRESS 0xd0
#define EV_PITCH 0xe0
#define EV_SYSEX 0xf0
#define EV_ESC 0xf7
#define EV_META 0xff
#define META_EOT 0x2f
#define META_TEMPO 0x51
#define META_TIME_SIG 0x58
//
// SAMPLE.system_data[] usage
//
#define VOC_BLK_PTR 1 // Pointer to current block
#define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block
#define VOC_N_REPS 3 // # of iterations left in repeat loop
#define VOC_MARKER 4 // Marker to search for, or -1 if all
#define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0
#define STR_HSTREAM 6 // Stream, if any, that owns the HSAMPLE
#define SSD_TEMP 7 // Temporary storage location for general use
#define EVT_HANDLE_MAGIC 1 // EventSystem handle.magic
#define EVT_HANDLE_INDEX 2 // EventSystem handle.index
//
// Timer status values
//
#define AILT_FREE 0 // Timer handle is free for allocation
#define AILT_STOPPED 1 // Timer is stopped
#define AILT_RUNNING 2 // Timer is running
//
// SAMPLE.status flag values
//
#define SMP_FREE 0x0001 // Sample is available for allocation
#define SMP_DONE 0x0002 // Sample has finished playing, or has
// never been started
#define SMP_PLAYING 0x0004 // Sample is playing
#define SMP_STOPPED 0x0008 // Sample has been stopped
#define SMP_PLAYINGBUTRELEASED 0x0010 // Sample is playing, but digital handle
// has been temporarily released
//
// SEQUENCE.status flag values
//
#define SEQ_FREE 0x0001 // Sequence is available for allocation
#define SEQ_DONE 0x0002 // Sequence has finished playing, or has
// never been started
#define SEQ_PLAYING 0x0004 // Sequence is playing
#define SEQ_STOPPED 0x0008 // Sequence has been stopped
#define SEQ_PLAYINGBUTRELEASED 0x0010 // Sequence is playing, but MIDI handle
// has been temporarily released
#ifdef IS_WINDOWS
//
// AIL_set_direct_buffer_control() command values
//
#define AILDS_RELINQUISH 0 // App returns control of secondary buffer
#define AILDS_SEIZE 1 // App takes control of secondary buffer
#define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer
#endif
#ifndef MSS_BASIC
#ifndef FILE_ERRS
#define FILE_ERRS
#define AIL_NO_ERROR 0
#define AIL_IO_ERROR 1
#define AIL_OUT_OF_MEMORY 2
#define AIL_FILE_NOT_FOUND 3
#define AIL_CANT_WRITE_FILE 4
#define AIL_CANT_READ_FILE 5
#define AIL_DISK_FULL 6
#define AIL_NO_AVAIL_ASYNC 7
#endif
#define MIN_VAL 0
#define NOM_VAL 1
#define MAX_VAL 2
EXPGROUP(Basic Types)
EXPTYPEBEGIN typedef SINTa HMSSENUM;
#define MSS_FIRST ((HMSSENUM)-1)
EXPTYPEEND
/*
specifies a type used to enumerate through a list of properties.
$:MSS_FIRST use this value to start the enumeration process.
The Miles enumeration functions all work similarly - you set a local variable of type HMSSENUM to MSS_FIRST and then call
the enumeration function until it returns 0.
*/
//
// Preference names and default values
//
#define AIL_MM_PERIOD 0
#define DEFAULT_AMP 1 // Default MM timer period = 5 msec.
#define AIL_TIMERS 1
#define DEFAULT_AT 16 // 16 allocatable HTIMER handles
#define AIL_ENABLE_MMX_SUPPORT 2 // Enable MMX support if present
#define DEFAULT_AEMS YES // (may be changed at any time)
#define DIG_MIXER_CHANNELS 3
#define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures
#define DIG_ENABLE_RESAMPLE_FILTER 4 // Enable resampling filter by
#define DEFAULT_DERF YES // default
#define DIG_RESAMPLING_TOLERANCE 5
#define DEFAULT_DRT 131 // Resampling triggered at +/- 0.2%
// 1 ms per mix. The PS3 has frag count restrictions, so we use 5 ms.
#define DIG_DS_FRAGMENT_SIZE 6
#ifdef __RADPS3__
# define DEFAULT_DDFS 5
#else
# define DEFAULT_DDFS 1
#endif
// We want ~256 ms of buffers. PS3 must be 8, 16, or 32.
#define DIG_DS_FRAGMENT_CNT 7
#ifdef __RADPS3__
# define DEFAULT_DDFC 32
#else
# define DEFAULT_DDFC 256
#endif
// Mix ahead ~48 ms. PS3 is based off on 5 ms frag size above...
#define DIG_DS_MIX_FRAGMENT_CNT 8
#ifdef __RADPS3__
# define DEFAULT_DDMFC 8
#else
# define DEFAULT_DDMFC 48
#endif
#define DIG_LEVEL_RAMP_SAMPLES 9
#define DEFAULT_DLRS 32 // Ramp level changes over first 32 samples in each buffer to reduce zipper noise
#define DIG_MAX_PREDELAY_MS 10
#define DEFAULT_MPDMS 500 // Max predelay reverb time in ms
#define DIG_3D_MUTE_AT_MAX 11
#define DEFAULT_D3MAM YES // on by default
#define DIG_DS_USE_PRIMARY 12
#define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default
#define DIG_DS_DSBCAPS_CTRL3D 13
#define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default
#define DIG_DS_CREATION_HANDLER 14
#define DEFAULT_DDCH 0 // Use DirectSoundCreate() by default
#define DIG_MAX_CHAIN_ELEMENT_SIZE 15
#define DEFAULT_MCES 8192 // max of 8192 bytes/waveOut buffer
#define DIG_MIN_CHAIN_ELEMENT_TIME 16
#define DEFAULT_MCET 100 // 100 milliseconds buffers
#define DIG_USE_WAVEOUT 17
#define DEFAULT_DUW NO // Use DirectSound by default
#define DIG_OUTPUT_BUFFER_SIZE 18
#define DEFAULT_DOBS 49152 // Windows: waveout 48K output buffer size
#define DIG_PREFERRED_WO_DEVICE 19
#define DEFAULT_DPWOD ((UINTa)-1) // Preferred WaveOut device == WAVE_MAPPER
#define DIG_PREFERRED_DS_DEVICE 20
#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default NULL GUID
#define MDI_SEQUENCES 21
#define DEFAULT_MS 8 // 8 sequence handles/driver
#define MDI_SERVICE_RATE 22
#define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz
#define MDI_DEFAULT_VOLUME 23
#define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127)
#define MDI_QUANT_ADVANCE 24
#define DEFAULT_MQA 1 // Beat/bar count +1 interval
#define MDI_ALLOW_LOOP_BRANCHING 25
#define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops
#define MDI_DEFAULT_BEND_RANGE 26
#define DEFAULT_MDBR 2 // Default pitch-bend range = 2
#define MDI_DOUBLE_NOTE_OFF 27
#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards
#define MDI_SYSEX_BUFFER_SIZE 28
#define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
#define DLS_VOICE_LIMIT 29
#define DEFAULT_DVL 64 // 64 voices supported
#define DLS_TIMEBASE 30
#define DEFAULT_DTB 120 // 120 intervals/second by default
#define DLS_BANK_SELECT_ALIAS 31
#define DEFAULT_DBSA NO // Do not treat controller 114 as bank
#define DLS_STREAM_BOOTSTRAP 32 // Don't submit first stream buffer
#define DEFAULT_DSB YES // until at least 2 available
#define DLS_VOLUME_BOOST 33
#define DEFAULT_DVB 0 // Boost final volume by 0 dB
#define DLS_ENABLE_FILTERING 34 // Filtering = on by default
#define DEFAULT_DEF YES // (may be changed at any time)
#define DLS_GM_PASSTHROUGH 35 // Pass unrecognized traffic on to
#define DEFAULT_DGP YES // default GM driver layer
// (may be changed at any time)
#define DLS_ADPCM_TO_ASI_THRESHOLD 36 // Size in samples to switch to ASI
#define DEFAULT_DATAT 32768
#ifdef __RAD3DS__
# define AIL_3DS_USE_SYSTEM_CORE 32 // Defaults to 0
#endif
#define N_PREFS 40 // # of preference types
#if defined(IS_WIN32API) || defined(IS_WII)
#pragma pack(push, 1)
#endif
typedef struct Mwavehdr_tag {
C8 * lpData;
U32 dwBufferLength;
U32 dwBytesRecorded;
UINTa dwUser;
U32 dwFlags;
U32 dwLoops;
struct Mwavehdr_tag *lpNext;
UINTa reserved;
} MWAVEHDR;
typedef MSS_STRUCT Mwaveformat_tag {
U16 wFormatTag;
U16 nChannels;
U32 nSamplesPerSec;
U32 nAvgBytesPerSec;
U16 nBlockAlign;
} MWAVEFORMAT;
typedef MSS_STRUCT Mpcmwaveformat_tag {
MWAVEFORMAT wf;
U16 wBitsPerSample;
} MPCMWAVEFORMAT;
typedef MSS_STRUCT Mwaveformatex_tag {
U16 wFormatTag;
U16 nChannels;
U32 nSamplesPerSec;
U32 nAvgBytesPerSec;
U16 nBlockAlign;
U16 wBitsPerSample;
U16 cbSize;
} MWAVEFORMATEX;
typedef MSS_STRUCT Mwaveformatextensible_tag {
MWAVEFORMATEX Format;
union {
U16 wValidBitsPerSample;
U16 wSamplesPerBlock;
U16 wReserved;
} Samples;
U32 dwChannelMask;
U8 SubFormat[16];
} MWAVEFORMATEXTENSIBLE;
#if defined(IS_WIN32API) || defined(IS_WII)
#pragma pack(pop)
#endif
// This will fail if structure packing isn't correct for the compiler we are running.
RR_COMPILER_ASSERT(sizeof(MWAVEFORMATEXTENSIBLE) == 40);
typedef struct _AILSOUNDINFO {
S32 format;
void const* data_ptr;
U32 data_len;
U32 rate;
S32 bits;
S32 channels;
U32 channel_mask;
U32 samples;
U32 block_size;
void const* initial_ptr;
} AILSOUNDINFO;
// asis use these callbacks
typedef void * (AILCALL MSS_ALLOC_TYPE)( UINTa size, UINTa user, char const * filename, U32 line );
typedef void (AILCALL MSS_FREE_TYPE)( void * ptr, UINTa user, char const * filename, U32 line );
// helper functions that just turn around and call AIL_mem_alloc_lock
DXDEC void * AILCALL MSS_alloc_info( UINTa size, UINTa user, char const * filename, U32 line );
DXDEC void AILCALL MSS_free_info( void * ptr, UINTa user, char const * filename, U32 line );
#if defined(STANDALONEMIXRIB) && !defined(FORNONWIN)
#define MSS_CALLBACK_ALIGNED_NAME( name ) name##_fixup
#define MSS_DEC_CB_STACK_ALIGN( name ) DXDEC void AILCALL MSS_CALLBACK_ALIGNED_NAME(name)(void);
#else
#define MSS_CALLBACK_ALIGNED_NAME( name ) name
#define MSS_DEC_CB_STACK_ALIGN( name )
#endif
MSS_DEC_CB_STACK_ALIGN( MSS_alloc_info )
MSS_DEC_CB_STACK_ALIGN( MSS_free_info)
#ifndef RIB_H // RIB.H contents included if RIB.H not already included
#define RIB_H
#define ARY_CNT(x) (sizeof((x)) / sizeof((x)[0]))
// ----------------------------------
// RIB data types
// ----------------------------------
typedef S32 RIBRESULT;
#define RIB_NOERR 0 // Success -- no error
#define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available
#define RIB_NOT_FOUND 2 // Resource not found
#define RIB_OUT_OF_MEM 3 // Out of system RAM
//
// Handle to interface provider
//
typedef UINTa HPROVIDER;
//
// Handle representing token used to obtain property data
//
// This needs to be large enough to store a function pointer
//
typedef UINTa HPROPERTY;
//
// Data types for RIB properties
//
typedef enum
{
RIB_NONE = 0, // No type
RIB_CUSTOM, // Used for pointers to application-specific structures
RIB_DEC, // Used for 32-bit integer values to be reported in decimal
RIB_HEX, // Used for 32-bit integer values to be reported in hex
RIB_FLOAT, // Used for 32-bit single-precision FP values
RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages
RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE
RIB_STRING, // Used for pointers to null-terminated ASCII strings
RIB_READONLY = 0x80000000 // Property is read-only
}
RIB_DATA_SUBTYPE;
//
// RIB_ENTRY_TYPE structure, used to register an interface or request one
//
typedef enum
{
RIB_FUNCTION = 0,
RIB_PROPERTY, // Property: read-only or read-write data type
RIB_ENTRY_FORCE_32 = 0x7fffffff
}
RIB_ENTRY_TYPE;
//
// RIB_INTERFACE_ENTRY, used to represent a function or data entry in an
// interface
//
typedef struct
{
RIB_ENTRY_TYPE type; // See list above
const C8 *entry_name; // Name of desired function or property
UINTa token; // Function pointer or property token
RIB_DATA_SUBTYPE subtype; // Property subtype
}
RIB_INTERFACE_ENTRY;
//
// Standard RAD Interface Broker provider identification properties
//
#define PROVIDER_NAME ((U32) (S32) (-100)) // RIB_STRING name of decoder
#define PROVIDER_VERSION ((U32) (S32) (-101)) // RIB_HEX BCD version number
//
// Standard function to obtain provider properties (see PROVIDER_ defines
// above)
//
// Each provider of a searchable interface must export this function
//
typedef S32 (AILCALL *PROVIDER_PROPERTY) (HPROPERTY index,
void * before_value,
void const * new_value,
void * after_value
);
//
// Macros to simplify interface registrations/requests for functions,
// and properties
//
#define FN(entry_name) { RIB_FUNCTION, #entry_name, (UINTa) &(entry_name), RIB_NONE }
#define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (UINTa) &(entry_name), RIB_NONE }
#define PR(entry_name,ID) { RIB_PROPERTY, (entry_name), (UINTa) &(ID), RIB_NONE }
#define REG_PR(entry_name,ID,subtype) { RIB_PROPERTY, (entry_name), (UINTa) (ID), subtype }
#define RIB_register(x,y,z) RIB_register_interface ((HPROVIDER)(x), y, ARY_CNT(z), z)
#define RIB_unregister(x,y,z) RIB_unregister_interface((HPROVIDER)(ssx), y, ARY_CNT(z), z)
#define RIB_unregister_all(x) RIB_unregister_interface((HPROVIDER)(x), 0, 0, 0)
#define RIB_free_libraries() RIB_free_provider_library((HPROVIDER)(0));
#define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z)
// passed to RIB DLLs in Miles 9 and up (so RIBS don't have to link to MSS32.dll)
typedef HPROVIDER AILCALL RIB_ALLOC_PROVIDER_HANDLE_TYPE(long module);
typedef RIBRESULT AILCALL RIB_REGISTER_INTERFACE_TYPE (HPROVIDER provider,
C8 const *interface_name,
S32 entry_count,
RIB_INTERFACE_ENTRY const *rlist);
typedef RIBRESULT AILCALL RIB_UNREGISTER_INTERFACE_TYPE (HPROVIDER provider,
C8 const *interface_name,
S32 entry_count,
RIB_INTERFACE_ENTRY const *rlist);
#define RIB_registerP(x,y,z) rib_reg ((HPROVIDER)(x), y, ARY_CNT(z), z)
#define RIB_unregister_allP(x) rib_unreg ((HPROVIDER)(x), 0, 0, 0)
// ----------------------------------
// Standard RIB API prototypes
// ----------------------------------
DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (long module);
DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider);
DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 const *filename);
DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider);
DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider,
C8 const *interface_name,
S32 entry_count,
RIB_INTERFACE_ENTRY const *rlist);
DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider,
C8 const *interface_name,
S32 entry_count,
RIB_INTERFACE_ENTRY const *rlist);
DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider,
C8 const *interface_name,
S32 entry_count,
RIB_INTERFACE_ENTRY *rlist);
DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider,
C8 const *interface_name,
RIB_ENTRY_TYPE entry_type,
C8 const *entry_name,
UINTa *token);
DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider,
C8 const *interface_name,
RIB_ENTRY_TYPE type,
HMSSENUM *next,
RIB_INTERFACE_ENTRY *dest);
DXDEC S32 AILCALL RIB_enumerate_providers (C8 const *interface_name,
HMSSENUM *next,
HPROVIDER *dest);
DXDEC C8 * AILCALL RIB_type_string (void const * data,
RIB_DATA_SUBTYPE subtype);
DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 const *interface_name,
C8 const *property_name,
C8 const *file_suffix);
DXDEC HPROVIDER AILCALL RIB_find_provider (C8 const *interface_name,
C8 const *property_name,
void const *property_value);
//
// Static library definitions
//
#ifdef MSS_STATIC_RIB
#define RIB_MAIN_NAME( name ) name##_RIB_Main
DXDEC S32 AILCALL RIB_MAIN_NAME(SRS)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(DTS)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(DolbySurround)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(MP3Dec)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(OggDec)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(BinkADec)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(SpxDec)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(SpxEnc)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(Voice)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(SpxVoice)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC S32 AILCALL RIB_MAIN_NAME(DSP)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
#ifdef IS_XENON
DXDEC S32 AILCALL RIB_MAIN_NAME(XMADec)( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
#endif
#define Register_RIB(name) RIB_load_static_provider_library(RIB_MAIN_NAME(name),#name)
#else // MSS_STATIC_RIB
#define RIB_MAIN_NAME( name ) RIB_Main
DXDEC S32 AILCALL RIB_Main( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
#endif // MSS_STATIC_RIB
typedef S32 ( AILCALL * RIB_MAIN_FUNC) ( HPROVIDER provider_handle, U32 up_down, RIB_ALLOC_PROVIDER_HANDLE_TYPE * rib_alloc, RIB_REGISTER_INTERFACE_TYPE * rib_reg, RIB_UNREGISTER_INTERFACE_TYPE * rib_unreg );
DXDEC HPROVIDER AILCALL RIB_load_static_provider_library (RIB_MAIN_FUNC main, const char* description);
DXDEC HPROVIDER AILCALL RIB_find_files_provider (C8 const *interface_name,
C8 const *property_name_1,
C8 const *file_suffix_1,
C8 const *property_name_2,
C8 const *file_suffix_2);
DXDEC HPROVIDER AILCALL RIB_find_file_dec_provider (C8 const *interface_name,
C8 const *property_name_1,
U32 decimal_property_value_1,
C8 const *property_name_2,
C8 const *file_suffix_2);
DXDEC S32 AILCALL RIB_load_application_providers
(C8 const *filespec);
DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider,
U32 index,
SINTa value);
DXDEC SINTa AILCALL RIB_provider_user_data (HPROVIDER provider,
U32 index);
DXDEC void AILCALL RIB_set_provider_system_data
(HPROVIDER provider,
U32 index,
SINTa value);
DXDEC SINTa AILCALL RIB_provider_system_data (HPROVIDER provider,
U32 index);
DXDEC C8 * AILCALL RIB_error (void);
#endif // RIB_H
#ifndef MSS_ASI_VERSION // MSSASI.H contents included if MSSASI.H not already included
#define AIL_ASI_VERSION 1
#define AIL_ASI_REVISION 0
//
// Handle to stream being managed by ASI codec
//
typedef SINTa HASISTREAM;
//
// ASI result codes
//
typedef S32 ASIRESULT;
#define ASI_NOERR 0 // Success -- no error
#define ASI_NOT_ENABLED 1 // ASI not enabled
#define ASI_ALREADY_STARTED 2 // ASI already started
#define ASI_INVALID_PARAM 3 // Invalid parameters used
#define ASI_INTERNAL_ERR 4 // Internal error in ASI driver
#define ASI_OUT_OF_MEM 5 // Out of system RAM
#define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
#define ASI_NOT_FOUND 7 // ASI supported device not found
#define ASI_NOT_INIT 8 // ASI not initialized
#define ASI_CLOSE_ERR 9 // ASI not closed correctly
// ----------------------------------
// Application-provided ASI callbacks
// ----------------------------------
//
// AILASIFETCHCB: Called by ASI to obtain data from stream source
//
// offset normally will be either 0 at the first call made by the codec
// or -1 to specify a continuous stream, except when ASI_stream_seek()
// is called to restart the stream codec at a new stream offset. In this
// case, the application must execute the seek operation on the ASI codec's
// behalf.
//
// In response to this callback, the application should read the requested
// data and copy it to the specified destination buffer, returning the number
// of bytes copied (which can be less than bytes_requested if the end of
// the stream is reached).
//
typedef S32 (AILCALLBACK * AILASIFETCHCB) (UINTa user, // User value passed to ASI_open_stream()
void *dest, // Location to which stream data should be copied by app
S32 bytes_requested, // # of bytes requested by ASI codec
S32 offset); // If not -1, application should seek to this point in stream
//############################################################################
//## ##
//## Interface "ASI codec" ##
//## ##
//############################################################################
//
// Initialize ASI stream codec
//
// No other ASI functions may be called outside an ASI_startup() /
// ASI_shutdown() pair, except for the standard RIB function
// PROVIDER_property() where appropriate.
//
typedef ASIRESULT (AILCALL *ASI_STARTUP)(void);
//
// Shut down ASI codec
//
typedef ASIRESULT (AILCALL * ASI_SHUTDOWN)(void);
//
// Return codec error message, or NULL if no errors have occurred since
// last call
//
// The ASI error text state is global to all streams
//
typedef C8 * (AILCALL * ASI_ERROR)(void);
//############################################################################
//## ##
//## Interface "ASI stream" ##
//## ##
//############################################################################
//
// Open a stream, returning handle to stream
//
typedef HASISTREAM (AILCALL *ASI_STREAM_OPEN) (MSS_ALLOC_TYPE * palloc,
MSS_FREE_TYPE * pfree,
UINTa user, // User value passed to fetch callback
AILASIFETCHCB fetch_CB, // Source data fetch handler
U32 total_size); // Total size for %-done calculations (0=unknown)
//
// Translate data in stream, returning # of bytes actually decoded or encoded
//
// Any number of bytes may be requested. Requesting more data than is
// available in the codec's internal buffer will cause the AILASIFETCHCB
// handler to be called to fetch more data from the stream.
//
typedef S32 (AILCALL *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream
void *buffer, // Destination for processed data
S32 buffer_size); // # of bytes to return in buffer
//
// Restart stream decoding process at new offset
//
// Relevant for decoders only
//
// Seek destination is given as offset in bytes from beginning of stream
//
// At next ASI_stream_process() call, decoder will seek to the closest possible
// point in the stream which occurs at or after the specified position
//
// This function has no effect for decoders which do not support random
// seeks on a given stream type
//
// Warning: some decoders may need to implement seeking by reparsing
// the entire stream up to the specified offset, through multiple calls
// to the data-fetch callback. This operation may be extremely
// time-consuming on large files or slow network connections.
//
// A stream_offset value of -1 may be used to inform the decoder that the
// application has changed the input stream offset on its own, e.g. for a
// double-buffering application where the ASI decoder is not accessing the
// stream directly. ASI decoders should respond to this by flushing all
// internal buffers and resynchronizing themselves to the data stream.
//
typedef ASIRESULT (AILCALL *ASI_STREAM_SEEK) (HASISTREAM stream,
S32 stream_offset);
//
// Retrieve or set a property value by index (returns 1 on success)
//
typedef S32 (AILCALL *ASI_STREAM_PROPERTY) (HASISTREAM stream,
HPROPERTY property,
void * before_value,
void const * new_value,
void * after_value
);
//
// Close stream, freeing handle and all internally-allocated resources
//
typedef ASIRESULT (AILCALL *ASI_STREAM_CLOSE) (HASISTREAM stream);
#endif // MSS_ASI_VERSION
//############################################################################
//## ##
//## Interface "MSS mixer services" ##
//## ##
//############################################################################
//
// Operation flags used by mixer and filter modules
//
#define M_DEST_STEREO 1 // Set to enable stereo mixer output
#define M_SRC_16 2 // Set to enable mixing of 16-bit samples
#define M_FILTER 4 // Set to enable filtering when resampling
#define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples
#define M_RESAMPLE 16 // Set to enable playback ratios other than 65536
#define M_VOL_SCALING 32 // Set to enable volume scalars other than 2048
#define M_COPY16_NOVOL 64
#ifdef IS_32
//
// Initialize mixer
//
// No other mixer functions may be called outside a MIXER_startup() /
// MIXER_shutdown() pair, except for the standard RIB function
// PROVIDER_property() as appropriate.
//
typedef void (AILCALL *MIXER_STARTUP)(void);
//
// Shut down mixer
//
typedef void (AILCALL *MIXER_SHUTDOWN)(void);
//
// Flush mixer buffer
//
typedef void (AILCALL *MIXER_FLUSH) (S32 *dest,
S32 len
#ifdef IS_X86
,U32 MMX_available
#endif
);
//
// Perform audio mixing operation
//
typedef void (AILCALL *MIXER_MERGE) (void const * *src,
U32 *src_fract,
void const *src_end,
S32 * *dest,
void *dest_end,
S32 *left_val,
S32 *right_val,
S32 playback_ratio,
S32 scale_left,
S32 scale_right,
U32 operation
#ifdef IS_X86
,U32 MMX_available
#endif
);
//
// Translate mixer buffer contents to final output format
//
// "option" parameter is big_endian_output on Mac, MMX on x86, overwrite flag on PS2
//
typedef void (AILCALL *MIXER_COPY) (void const *src,
S32 src_len,
void *dest,
U32 operation
#if defined(IS_BE) || defined(IS_X86)
,U32 option
#endif
);
#else
//
// Initialize mixer
//
// No other mixer functions may be called outside a MIXER_startup() /
// MIXER_shutdown() pair, except for the standard RIB function
// PROVIDER_property() as appropriate.
//
typedef void (AILCALL *MIXER_STARTUP)(void);
//
// Shut down mixer
//
typedef void (AILCALL *MIXER_SHUTDOWN)(void);
//
// Flush mixer buffer
//
typedef void (AILCALL *MIXER_FLUSH) (S32 *dest,
S32 len,
U32 MMX_available);
//
// Perform audio mixing operation
//
typedef void (AILCALL *MIXER_MERGE) (U32 src_sel,
U32 dest_sel,
U32 *src_fract,
U32 *src_offset,
U32 *dest_offset,
U32 src_end_offset,
U32 dest_end_offset,
S32 *left_val,
S32 *right_val,
S32 playback_ratio,
S32 scale_both,
U32 operation);
//
// Translate mixer buffer contents to final output format
//
typedef void (AILCALL *MIXER_COPY) (void const *src,
S32 src_len,
void *dest,
U32 operation,
U32 option);
#endif
typedef struct _MSS_BB // Used in both MC and conventional mono/stereo configurations
{
S32 *buffer; // Build buffer
S32 bytes; // Size in bytes
S32 chans; // Always mono (1) or stereo (2)
S32 speaker_offset; // Destination offset in interleaved PCM block for left channel
} MSS_BB;
typedef struct _ADPCMDATATAG
{
U32 blocksize;
U32 extrasamples;
U32 blockleft;
U32 step;
UINTa savesrc;
U32 sample;
UINTa destend;
UINTa srcend;
U32 samplesL;
U32 samplesR;
U16 moresamples[16];
} ADPCMDATA;
typedef void (AILCALL * MIXER_MC_COPY) ( MSS_BB * build,
S32 n_build_buffers,
void * lpWaveAddr,
S32 hw_format,
#ifdef IS_X86
S32 use_MMX,
#endif
S32 samples_per_buffer,
S32 physical_channels_per_sample );
typedef void (AILCALL * MIXER_ADPCM_DECODE ) ( void * dest,
void const * in,
S32 out_len,
S32 in_len,
S32 input_format,
ADPCMDATA *adpcm_data);
//
// Type definitions
//
struct _DIG_DRIVER;
struct _MDI_DRIVER;
typedef struct _DIG_DRIVER * HDIGDRIVER; // Handle to digital driver
typedef struct _MDI_DRIVER * HMDIDRIVER; // Handle to XMIDI driver
typedef struct _SAMPLE * HSAMPLE; // Handle to sample
typedef struct _SEQUENCE * HSEQUENCE; // Handle to sequence
typedef S32 HTIMER; // Handle to timer
//
// Function pointer types
//
typedef void (AILCALLBACK* AILINCB) (void const *data, S32 len, UINTa user_data);
typedef void (AILCALLBACK* AILTRACECB) (C8 *text, S32 nest_depth);
typedef void (AILCALLBACK* AILTIMERCB) (UINTa user);
typedef void (AILCALLBACK* AILSAMPLECB) (HSAMPLE sample);
typedef void (AILCALLBACK* AILMIXERCB) (HDIGDRIVER dig);
typedef F32 (AILCALLBACK* AILFALLOFFCB) (HSAMPLE sample, F32 distance, F32 rolloff_factor, F32 min_dist, F32 max_dist);
typedef S32 (AILCALLBACK* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2);
typedef S32 (AILCALLBACK* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch);
typedef S32 (AILCALLBACK* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data);
typedef void (AILCALLBACK* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data);
typedef void (AILCALLBACK* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure);
typedef void (AILCALLBACK* AILSEQUENCECB) (HSEQUENCE seq);
typedef S32 (AILCALLBACK *SS_STREAM_CB) (HSAMPLE S, S16 *dest_mono_sample_buffer, S32 dest_buffer_size);
//
// Handle to sample and driver being managed by pipeline filter
//
typedef SINTa HSAMPLESTATE;
typedef SINTa HDRIVERSTATE;
//
// Digital pipeline stages
//
// These are the points at which external modules may be installed into
// a given HSAMPLE or HDIGDRIVER's processing pipeline
//
typedef enum
{
SP_ASI_DECODER = 0, // Must be "ASI codec stream" provider
SP_FILTER, // Must be "MSS pipeline filter" provider
SP_FILTER_0 = SP_FILTER, // Must be "MSS pipeline filter" provider
SP_FILTER_1, // Must be "MSS pipeline filter" provider
SP_FILTER_2, // Must be "MSS pipeline filter" provider
SP_FILTER_3, // Must be "MSS pipeline filter" provider
SP_FILTER_4, // Must be "MSS pipeline filter" provider
SP_FILTER_5, // Must be "MSS pipeline filter" provider
SP_FILTER_6, // Must be "MSS pipeline filter" provider
SP_FILTER_7, // Must be "MSS pipeline filter" provider
SP_MERGE, // Must be "MSS mixer" provider
N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid sample pipeline stages)
SP_OUTPUT = N_SAMPLE_STAGES, // Used to set/get prefs/attribs on a driver's output or matrix filter (if present)
SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown
}
SAMPLESTAGE;
#define N_SP_FILTER_STAGES 8 // SP_FILTER_0 ... SP_FILTER_7
typedef enum
{
DP_FLUSH = 0, // Must be "MSS mixer" provider
DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default)
DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default)
DP_COPY, // Must be "MSS mixer" provider
DP_MC_COPY, // Must be "MSS mixer" provider
DP_ADPCM_DECODE, // Must be "MSS mixer" provider
N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages)
DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown
}
DIGDRVSTAGE;
typedef struct
{
ASI_STREAM_OPEN ASI_stream_open;
ASI_STREAM_PROCESS ASI_stream_process;
ASI_STREAM_SEEK ASI_stream_seek;
ASI_STREAM_CLOSE ASI_stream_close;
ASI_STREAM_PROPERTY ASI_stream_property;
HPROPERTY INPUT_BIT_RATE;
HPROPERTY INPUT_SAMPLE_RATE;
HPROPERTY INPUT_BITS;
HPROPERTY INPUT_CHANNELS;
HPROPERTY OUTPUT_BIT_RATE;
HPROPERTY OUTPUT_SAMPLE_RATE;
HPROPERTY OUTPUT_BITS;
HPROPERTY OUTPUT_CHANNELS;
HPROPERTY OUTPUT_CHANNEL_MASK;
HPROPERTY OUTPUT_RESERVOIR;
HPROPERTY POSITION;
HPROPERTY PERCENT_DONE;
HPROPERTY MIN_INPUT_BLOCK_SIZE;
HPROPERTY RAW_RATE;
HPROPERTY RAW_BITS;
HPROPERTY RAW_CHANNELS;
HPROPERTY REQUESTED_RATE;
HPROPERTY REQUESTED_BITS;
HPROPERTY REQUESTED_CHANS;
HPROPERTY STREAM_SEEK_POS;
HPROPERTY DATA_START_OFFSET;
HPROPERTY DATA_LEN;
HPROPERTY EXACT_SEEK;
HPROPERTY EXACT_GETPOS;
HPROPERTY SEEK_LOOKUP;
HPROPERTY SET_LOOPING_SAMPLES;
HPROPERTY CLEAR_LOOP_META;
HASISTREAM stream;
}
ASISTAGE;
typedef struct
{
struct _FLTPROVIDER *provider;
HSAMPLESTATE sample_state[MAX_SPEAKERS];
}
FLTSTAGE;
typedef struct
{
S32 active; // Pass-through if 0, active if 1
HPROVIDER provider;
union
{
ASISTAGE ASI;
MIXER_MERGE MSS_mixer_merge;
FLTSTAGE FLT;
}
TYPE;
}
SPINFO;
typedef struct
{
S32 active; // Pass-through if 0, active if 1
HPROVIDER provider;
union
{
MIXER_FLUSH MSS_mixer_flush;
MIXER_COPY MSS_mixer_copy;
MIXER_MC_COPY MSS_mixer_mc_copy;
MIXER_ADPCM_DECODE MSS_mixer_adpcm_decode;
}
TYPE;
}
DPINFO;
//
// Other data types
//
typedef enum
{
WIN32_HWAVEOUT, // waveOut handle for HDIGDRIVER, if any
WIN32_HWAVEIN, // waveIn handle for HDIGINPUT, if any
WIN32_LPDS, // lpDirectSound pointer for HSAMPLE
WIN32_LPDSB, // lpDirectSoundBuffer pointer for HSAMPLE
WIN32_HWND, // HWND that will be used to open DirectSound driver
WIN32_POSITION_ERR, // Nonzero if DirectSound play cursor stops moving (e.g., headphones removed)
PS3_AUDIO_PORT, // cellaudio port that Miles is using
PS3_AUDIO_ADDRESS, // address of cellaudio sound buffer
PS3_AUDIO_LENGTH, // length of cellaudio sound buffer
PS3_AUDIO_POSITION, // current playback position of cellaudio sound buffer
PSP_SUBMIT_THREAD, // Handle to thread submitting chucks of audio to the hw
PSP_AUDIO_PORT, // Port # Miles is using, -1 for simple audio, >= 0 for libwave
PSP2_SUBMIT_THREAD, // Handle to thread submitting chucks of audio to the hw
PSP2_AUDIO_PORT, // Port # Miles is using
OAL_CONTEXT, // OpenAL Context
OAL_DEVICE, // OpenAL Device
XB_LPDS, // lpDirectSound pointer for HSAMPLE
XB_LPDSB, // lpDirectSoundBuffer pointer for HSAMPLE
XB360_LPXAB // IXAudioSourceVoice pointer for HDIGDRIVER
}
MSS_PLATFORM_PROPERTY;
typedef struct _AIL_INPUT_INFO // Input descriptor type
{
AILINCB callback; // Callback function to receive incoming data
UINTa user_data; // this is a user defined value
U32 device_ID; // DS LPGUID or wave device ID
U32 hardware_format; // e.g., DIG_F_STEREO_16
U32 hardware_rate; // e.g., 22050
S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY)
} AIL_INPUT_INFO;
typedef struct _AILTIMER // Timer instance
{
AILTIMERCB callback;
U64 next;
U64 delta;
UINTa user;
U32 status;
} AILTIMERSTR;
#ifndef IS_WIN64
#define OFSblocksize 0 // these constants valid for 32-bit versions only!
#define OFSextrasamples 4
#define OFSblockleft 8
#define OFSstep 12
#define OFSsavesrc 16
#define OFSsample 20
#define OFSdestend 24
#define OFSsrcend 28
#define OFSsamplesL 32
#define OFSsamplesR 36
#define OFSmoresamples 40
#endif
typedef struct LOWPASS_INFO
{
S32 X0, X1;
S32 Y0, Y1;
S32 A, B0, B1;
S32 flags;
S32 queuedA, queuedB;
F32 calculated_cut;
F32 cutoff;
} LOWPASS_INFO;
typedef union STAGE_BUFFER
{
union STAGE_BUFFER * next;
U8 data[ 1 ];
} STAGE_BUFFER;
typedef struct _MSSVECTOR3D
{
F32 x;
F32 y;
F32 z;
} MSSVECTOR3D;
#define MILES_TANGENT_LINEAR 0
#define MILES_TANGENT_CURVE 1
#define MILES_TANGENT_STEP 2
#define MILES_MAX_FALLOFF_GRAPH_POINTS 5
#define MILES_MAX_SEGMENT_COUNT 10
typedef struct _MSSGRAPHPOINT
{
F32 X, Y, ITX, ITY, OTX, OTY; // Point & tangents.
S32 IType, OType;
} MSSGRAPHPOINT;
typedef struct _S3DSTATE // Portion of HSAMPLE that deals with 3D positioning
{
MSSVECTOR3D position; // 3D position
MSSVECTOR3D face; // 3D orientation
MSSVECTOR3D up; // 3D up-vector
MSSVECTOR3D velocity; // 3D velocity
S32 doppler_valid; // TRUE if OK to apply Doppler shift
F32 doppler_shift; // Scalar for S->playback rate
F32 inner_angle; // Cone attenuation parameters
F32 outer_angle; // (Angles divided by two and convered to rads for dot-product comparisons)
F32 outer_volume;
S32 cone_enabled;
F32 max_dist; // Sample distances
F32 min_dist;
S32 dist_changed; // TRUE if min/max distances have changed and need to be sent to the hardware
S32 auto_3D_atten; // TRUE if distance/cone attenuation should be applied to wet signal
F32 atten_3D; // Attenuation due to distance/cone effects, calculated by software 3D positioner
F32 rolloff; // per sample rolloff factor to use instead of global rolloff, if non zero.
F32 exclusion_3D; // exclusion value computed by falloff graph. -1 if not affected.
F32 lowpass_3D; // low pass cutoff computed by falloff graph. -1 if not affected.
F32 spread;
HSAMPLE owner; // May be NULL if used for temporary/internal calculations
AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired
MSSVECTOR3D position_graph[MILES_MAX_SEGMENT_COUNT];
S32 position_graph_count;
MSSGRAPHPOINT volgraph[MILES_MAX_FALLOFF_GRAPH_POINTS];
MSSGRAPHPOINT excgraph[MILES_MAX_FALLOFF_GRAPH_POINTS];
MSSGRAPHPOINT lpgraph[MILES_MAX_FALLOFF_GRAPH_POINTS];
MSSGRAPHPOINT spreadgraph[MILES_MAX_FALLOFF_GRAPH_POINTS];
U8 volgraphcnt;
U8 excgraphcnt;
U8 lpgraphcnt;
U8 spreadgraphcnt;
} S3DSTATE;
typedef struct _SMPBUF
{
void const *start; // Sample buffer address (W)
U32 len; // Sample buffer size in bytes (W)
U32 pos; // Index to next byte (R/W)
U32 done; // Nonzero if buffer with len=0 sent by app
S32 reset_ASI; // Reset the ASI decoder at the end of the buffer
S32 reset_seek_pos; // New destination offset in stream source data, for ASI codecs that care
} SMPBUF;
typedef struct _SAMPLE // Sample instance
{
U32 tag; // HSAM
HDIGDRIVER driver; // Driver for playback
S32 index; // Numeric index of this sample
SMPBUF buf[8]; // Source data buffers
U32 src_fract; // Fractional part of source address
U32 mix_delay; // ms until start mixing (decreased every buffer mix)
F32 max_output_mix_volume; // max_volume of any speaker at last mix
U64 mix_bytes; // total number of bytes sent to the mixer for this sample.
S32 group_id; // ID for grouped operations.
// size of the next dynamic arrays
U32 chan_buf_alloced;
U32 chan_buf_used;
U8* chan_buf_ptr;
// these are dynamic arrays sized as n_channels long (so 1 for mono, 2 stereo, 6 for 5.1)
S32 *left_val;
S32 *right_val;
S32 *last_decomp;
LOWPASS_INFO *lp; // low pass info
// these are dynamic arrays pointing to dynamic arrays, each of the sub arrays are n_channels long or [MAX_SPEAKERS][n_channels]
F32 **user_channel_levels; // Channel levels set by AIL_set_sample_channel_levels() [source_channels][driver->logical_channels]
S32 **cur_scale; // Calculated 11-bit volume scale factors for current/previous mixing interval
S32 **prev_scale; // (These are all indexed by build buffer*2, not speaker indexes!)
S32 **ramps_left;
// these are dynamic arrays
F32 *auto_3D_channel_levels; // Channel levels set by 3D positioner (always 1.0 if not 3D-positioned)
F32 *speaker_levels; // one level per speaker (multiplied after user or 3D)
S8 *speaker_enum_to_source_chan; // array[MSS_SPEAKER_xx] = -1 if not present, else channel #
// 99% of the time this is a 1:1 mapping and is zero.
S32 lp_any_on; // are any of the low pass filters on?
S32 user_channels_need_deinterlace; // do any of the user channels require a stereo sample to be deinterlaced?
S32 n_buffers; // # of buffers (default = 2)
S32 head;
S32 tail;
S32 starved; // Buffer stream has run out of data
S32 exhaust_ASI; // Are we prolonging the buffer lifetime until ASI output is exhausted?
S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite)
S32 loop_start; // Starting offset of loop block (0=SOF)
S32 loop_end; // End offset of loop block (-1=EOF)
S32 orig_loop_count; // Original loop properties specified by app, before any
S32 orig_loop_start; // alignment constraints
S32 orig_loop_end;
S32 format; // DIG_F format (8/16 bits, mono/stereo/multichannel)
S32 n_channels; // # of channels (which can be >2 for multichannel formats)
U32 channel_mask; // Same as WAVEFORMATEXTENSIBLE.dwChannelMask
S32 original_playback_rate; // Playback rate in hertz
F32 playback_rate_factor; // Fractional playback rate, normally 1.0
F32 save_volume; // Sample volume 0-1.0
F32 save_pan; // Mono panpot/stereo balance (0=L ... 1.0=R)
F32 left_volume; // Left/mono volume 0 to 1.0
F32 right_volume; // Right volume 0 to 1.0
F32 wet_level; // reverb level 0 to 1.0
F32 dry_level; // non-reverb level 0 to 1.0
F32 sys_level; // system control
F32 extra_volume; // Volume scalar for ramping or otherwise.
F32 extra_wet;
F32 extra_lp;
F32 extra_rate;
U32 low_pass_changed; // bit mask for what channels changed.
S32 bus; // Bus assignment for this sample.
S32 bus_comp_sends; // Which buses this bus routes compressor input to.
S32 bus_comp_installed; // Nonzero if we have a compressor installed.
U32 bus_comp_input; // The input to use for this bus's compressor, if we have one installed
S32 bus_override_wet; // If true, samples on this bus will use the bus's wet level instead of their own.
U32 bus_signal_strength; // The bus level.
S32 bus_enable_limiter; // If true, a basic limiter will be run on the samples prior to clamping to S16.
S32 bus_limiter_atten; // The attenuation that was applied on the last bus pass.
S32 fade_to_stop; // # of samples to fade to stop over. ( currently fixed at the volramp count )
U64 mix_start_time; // arbitrary non-zero id for starting sounds synced.
S16 pop_fade_total;
S16 pop_fade_time;
U8 pop_fade_stop; // nonzero we end the sample when it fades out.
U8 state_level; // Level the sample was started at.
#ifdef IS_WIIU
S8 route_to_drc;
#endif
F32 obstruction;
F32 occlusion;
F32 exclusion;
S32 service_type; // 1 if single-buffered; 2 if streamed
AILSAMPLECB SOB; // Start-of-block callback function
AILSAMPLECB EOB; // End-of-buffer callback function
AILSAMPLECB EOS; // End-of-sample callback function
SINTa user_data [8]; // Miscellaneous user data
SINTa system_data[8]; // Miscellaneous system data
SINTa hl_marker_list;
ADPCMDATA adpcm;
S32 doeob; // Flags to trigger callbacks
S32 dosob;
S32 doeos;
S32 vol_ramps;
S32 resamp_tolerance;
S32 enable_resamp_filter;
//
// Sample pipeline stages
//
SPINFO pipeline[N_SAMPLE_STAGES];
S32 n_active_filters; // # of SP_FILTER_n stages active
//
// 3D-related state for all platforms (including Xbox)
//
S32 is_3D; // TRUE if channel levels are derived automatically from 3D positional state, FALSE if they're controlled manually
S3DSTATE S3D; // Software version applies 3D positioning only if is_3D == TRUE, but output filters always use it
#ifdef MSS_VFLT_SUPPORTED
void *voice; // Optional object used by output filter to store per-sample information such as DS3D buffers
#endif
F32 leftb_volume; // Left/mono volume 0 to 1.0 (back)
F32 rightb_volume; // Right volume 0 to 1.0 (back)
F32 center_volume; // Center volume 0 to 1.0
F32 low_volume; // Low volume 0 to 1.0
F32 save_fb_pan; // Sample volume 0-1.0
F32 save_center; // saved center level
F32 save_low; // saved sub level
#if defined(HOST_SPU_PROCESS) || defined(MSS_SPU_PROCESS)
S32 spu_on;
U32 align[1];
#endif
#if defined(IS_WINDOWS)
//
// DirectSound-specific data
//
S32 service_interval; // Service sample every n ms
S32 service_tick; // Current service countdown value
S32 buffer_segment_size; // Buffer segment size to fill
S32 prev_segment; // Previous segment # (0...n)
S32 prev_cursor; // Previous play cursor location
S32 bytes_remaining; // # of bytes left to play (if not -1)
S32 direct_control; // 1 if app controls buffer, 0 if MSS
#endif
} SAMPLE;
#ifdef MILES_CHECK_OFFSETS
RR_COMPILER_ASSERT((RR_MEMBER_OFFSET(SAMPLE, save_low) & 3) == 0);
#endif
//
// used for AIL_process
//
typedef struct _AILMIXINFO {
AILSOUNDINFO Info;
ADPCMDATA mss_adpcm;
U32 src_fract;
S32 left_val;
S32 right_val;
} AILMIXINFO;
DXDEC U32 AILCALL AIL_get_timer_highest_delay (void);
DXDEC void AILCALL AIL_serve(void);
#ifdef IS_MAC
typedef void * LPSTR;
#define WHDR_DONE 0
typedef struct _WAVEIN
{
long temp;
} * HWAVEIN;
typedef struct _WAVEHDR
{
S32 dwFlags;
S32 dwBytesRecorded;
S32 dwUser;
S32 temp;
void * lpData;
S32 dwBufferLength;
S32 longdwLoops;
S32 dwLoops;
void * lpNext;
U32 * reserved;
} WAVEHDR, * LPWAVEHDR;
#endif
#define N_WAVEIN_BUFFERS 8 // Use a ring of 8 buffers by default
typedef struct _DIG_INPUT_DRIVER *HDIGINPUT; // Handle to digital input driver
#ifdef IS_MAC
#define AIL_DIGITAL_INPUT_DEFAULT 0
typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver
{
U32 tag; // HDIN
S32 input_enabled; // 1 if enabled, 0 if not
U32 incoming_buffer_size;
void * incoming_buffer[ 2 ];
void* outgoing_buffer;
U32 which_buffer;
AIL_INPUT_INFO info; // Input device descriptor
AILMIXINFO incoming_info;
long device;
#ifdef IS_MAC
char InternalRecordingState[128]; // Hide this so we dont' have to #include OS stuff everywhere.
#endif
} DIG_INPUT_DRIVER;
#else
#define AIL_DIGITAL_INPUT_DEFAULT ((U32)WAVE_MAPPER)
typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver
{
U32 tag; // HDIN
HTIMER background_timer; // Background timer handle
AIL_INPUT_INFO info; // Input device descriptor
S32 input_enabled; // 1 if enabled, 0 if not
UINTa callback_user; // Callback user value
//
// Provider-independent data
//
U32 DMA_size; // Size of each DMA sub-buffer in bytes
void *DMA[N_WAVEIN_BUFFERS]; // Simulated DMA buffers
U32 silence; // Silence value for current format (0 or 128)
S32 device_active; // 1 if buffers submittable, 0 if not
#if defined(IS_WINDOWS) && !defined(__RADWINRTAPI__)
//
// waveOut-specific data
//
HWAVEIN hWaveIn; // Handle to wave input device
volatile MWAVEHDR wavehdr[N_WAVEIN_BUFFERS]; // Handles to wave headers
#endif
} DIG_INPUT_DRIVER;
#endif
typedef struct REVERB_CONSTANT_INFO
{
F32* start0,* start1,* start2,* start3,* start4,* start5;
F32* end0,* end1,* end2,* end3,* end4,* end5;
F32 C0, C1, C2, C3, C4, C5;
F32 A;
F32 B0, B1;
} REVERB_CONSTANT_INFO;
typedef struct REVERB_UPDATED_INFO
{
F32 * address0, * address1, * address2, * address3, * address4, * address5;
F32 X0, X1, Y0, Y1;
} REVERB_UPDATED_INFO;
typedef struct REVERB_INFO
{
REVERB_UPDATED_INFO u;
REVERB_CONSTANT_INFO c;
} REVERB_INFO;
typedef struct REVERB_SETTINGS
{
S32 room_type; // Changes to this drive master_wet and duration/damping/predelay!
F32 master_wet; // Master reverb level 0-1.0
F32 master_dry; // Master non-reverb level 0-1.0
REVERB_INFO ri;
S32 *reverb_build_buffer;
S32 reverb_total_size;
S32 reverb_fragment_size;
S32 reverb_buffer_size;
S32 reverb_on;
U32 reverb_off_time_ms;
U32 reverb_duration_ms;
F32 reverb_decay_time_s;
F32 reverb_predelay_s;
F32 reverb_damping;
S32 reverb_head;
S32 reverb_tail;
} REVERB_SETTINGS;
typedef struct _MSS_RECEIVER_LIST
{
MSSVECTOR3D direction; // Normalized direction vector from listener
S32 speaker_index[MAX_SPEAKERS]; // List of speakers affected by sounds in this direction
F32 speaker_level[MAX_SPEAKERS]; // Each speaker's degree of effect from this source
S32 n_speakers_affected;
} MSS_RECEIVER_LIST;
typedef struct _D3DSTATE
{
S32 mute_at_max;
MSSVECTOR3D listen_position;
MSSVECTOR3D listen_face;
MSSVECTOR3D listen_up;
MSSVECTOR3D listen_cross;
MSSVECTOR3D listen_velocity;
F32 rolloff_factor;
F32 doppler_factor;
F32 distance_factor;
F32 falloff_power;
//
// Precalculated listener info
//
S32 ambient_channels [MAX_SPEAKERS]; // E.g., LFE
S32 n_ambient_channels;
S32 directional_channels[MAX_SPEAKERS+1]; // Channel index, or -1 if virtual
MSSVECTOR3D listener_to_speaker [MAX_SPEAKERS+1];
S32 n_directional_channels;
MSS_RECEIVER_LIST receiver_specifications[MAX_RECEIVER_SPECS]; // Constellation of receiver vectors
S32 n_receiver_specs;
MSSVECTOR3D speaker_positions [MAX_SPEAKERS]; // Listener-relative speaker locations
F32 speaker_wet_reverb_response [MAX_SPEAKERS]; // Reverb sensitivity of each speaker
F32 speaker_dry_reverb_response [MAX_SPEAKERS];
} D3DSTATE;
typedef enum
{
MSS_MC_INVALID = 0, // Used for configuration-function errors
MSS_MC_MONO = 1, // For compatibility with S32 channel param
MSS_MC_STEREO = 2,
MSS_MC_USE_SYSTEM_CONFIG = 0x10, // Leave space between entries for new variations
MSS_MC_HEADPHONES = 0x20, // with similar quality levels/speaker counts
MSS_MC_DOLBY_SURROUND = 0x30,
MSS_MC_SRS_CIRCLE_SURROUND = 0x40,
MSS_MC_40_DTS = 0x48,
MSS_MC_40_DISCRETE = 0x50,
MSS_MC_51_DTS = 0x58,
MSS_MC_51_DISCRETE = 0x60,
MSS_MC_61_DISCRETE = 0x70,
MSS_MC_71_DISCRETE = 0x80,
MSS_MC_81_DISCRETE = 0x90,
MSS_MC_DIRECTSOUND3D = 0xA0,
MSS_MC_EAX2 = 0xC0,
MSS_MC_EAX3 = 0xD0,
MSS_MC_EAX4 = 0xE0,
MSS_MC_FORCE_32 = 0x7fffffff
}
MSS_MC_SPEC;
typedef struct _DIG_DRIVER // Handle to digital audio driver
{
U32 tag; // HDIG
HTIMER backgroundtimer; // Background timer handle
U32 num_mixes; // incrementing number of mixes
S32 mix_ms; // rough ms per mix
F32 master_volume; // Master sample volume 0-1.0
S32 DMA_rate; // Hardware sample rate
S32 hw_format; // DIG_F code in use
S32 n_active_samples; // # of samples being processed
MSS_MC_SPEC channel_spec; // Original "channels" value passed to AIL_open_digital_driver()
D3DSTATE D3D; // 3D listener parms for all platforms
#if defined(IS_PSP2) || defined(IS_PSP) || defined(IS_XENON) || defined(IS_IPHONE) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_3DS) || defined(IS_WIIU) || defined(__RADWINRTAPI__) || defined(__RADSEKRIT2__) || defined(__RADANDROID__) // generic dig platforms
#define IS_GENERICDIG
void* dig_ss; // Sound system ptr (embed in mss.h?)
void* dig_heap; // Sound system heap.
#endif
#ifdef IS_XENON
void* x2_voiceptr; //! \todo get rid of this? Only expose dig_ss?
#endif
S32 quiet; // # of consecutive quiet sample periods
S32 playing; // Playback active if non-zero
S32 bytes_per_channel; // # of bytes per channel (always 1 or 2 for 8- or 16-bit hardware output)
S32 samples_per_buffer; // # of samples per build buffer / half-buffer
S32 physical_channels_per_sample; // # of channels per *physical* sample (1 or 2, or more in discrete MC mode)
S32 logical_channels_per_sample; // # of logical channels per sample (may differ from physical channel count in matrix formats)
#ifdef IS_LINUX
S32 released; // has the sound manager been released?
#endif
HSAMPLE samples; // Pointer to list of SAMPLEs
U32 *sample_status; // SMP_ flags: _FREE, _DONE, _PLAYING, moved out of SAMPLEs for faster iteration
S32 n_samples; // # of SAMPLEs
SINTa system_data[8]; // Miscellaneous system data
HSAMPLE bus_samples[MAX_BUSSES]; // Sample handles the bus will route through.
S32 bus_active_count[MAX_BUSSES]; // Number of samples mixed on the bus last mix.
void* bus_ptrs[MAX_BUSSES]; // Buffers for each bus to mix in to.
void* pushed_states[MILES_MAX_STATES];
U8 state_index;
//
// Build buffers
//
// In multichannel mode, source samples may be mixed into more than one
// build buffer
//
MSS_BB build[MAX_SPEAKERS+EXTRA_BUILD_BUFFERS];
S32 n_build_buffers; // # of build buffers actually used for output processing
S32 hardware_buffer_size; // Size of each output buffer
S32 enable_limiter;
S32 limiter_atten; // attenuation level from last hw copy.
S32 scheduled_sample_count; // # of samples that are waiting to be started at an exact time.
AILMIXERCB mixcb; // callback for each mix.
#if defined(IS_WINDOWS) && !defined(__RADWINRTAPI__)
//
// waveOut-specific interface data
//
HWAVEOUT hWaveOut; // Wave output driver
U32 reset_works; // TRUE if OK to do waveOutReset
U32 request_reset; // If nonzero, do waveOutReset ASAP
LPWAVEHDR first; // Pointer to first WAVEHDR in chain
S32 n_buffers; // # of output WAVEHDRs in chain
LPWAVEHDR volatile *return_list; // Circular list of returned WAVEHDRs
S32 volatile return_head; // Head of WAVEHDR list (insertion point)
S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point)
//
// DirectSound-specific interface data
//
UINTa guid; // The guid id of the ds driver
AILLPDIRECTSOUND pDS; // DirectSound output driver (don't
// use with Smacker directly anymore!)
U32 ds_priority; // priority opened with
S32 emulated_ds; // is ds emulated or not?
AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null
UINTa dsHwnd; // HWND used with DirectSound
AILLPDIRECTSOUNDBUFFER * lpbufflist; // List of pointers to secondary buffers
HSAMPLE *samp_list; // HSAMPLE associated with each buffer
S32 *sec_format; // DIG_F_ format for secondary buffer
S32 max_buffs; // Max. allowable # of secondary buffers
//
// Driver output configuration
//
// Note: # of "logical" (source) channels per sample = dig->channels_per_sample
// # of "physical" (DAC) channels per sample = dig->wformat.wf.nChannels
//
// These may be different if a matrix format (e.g., Dolby/SRS)
// is in use!
//
MPCMWAVEFORMAT wformat; // format from waveout open
C8 wfextra[32]; // Extension to PCMWAVEFORMAT (e.g., WAVE_FORMAT_EXTENSIBLE)
//
// Misc. data
//
S32 released; // has the sound manager been released?
HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
//
// Vars for waveOut emulation
//
S32 DS_initialized;
AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none)
AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim)
S32 DS_buffer_size; // Size of entire output buffer
S32 DS_frag_cnt; // Total fragment count and size, and
S32 DS_frag_size; // last fragment occupied by play cursor
S32 DS_last_frag;
S32 DS_last_write;
S32 DS_last_timer;
S32 DS_skip_time;
S32 DS_use_default_format; // 1 to force use of default DS primary buffer format
U32 position_error; // last status from position report (can be used
// to watch for headset removal)
U32 last_ds_play;
U32 last_ds_write;
U32 last_ds_move;
#endif
#ifdef IS_X86
S32 use_MMX; // Use MMX with this driver if TRUE
#endif
U64 mix_total;
U64 last_polled;
U32 last_percent;
void * MC_buffer;
//
// Digital driver pipeline filter stages
//
DPINFO pipeline[N_DIGDRV_STAGES];
#ifdef MSS_VFLT_SUPPORTED
struct _FLTPROVIDER *voice_filter;
SS_STREAM_CB stream_callback;
#endif
struct _FLTPROVIDER *matrix_filter;
//
// Reverb
// If no busses are active, 0 is still used as the base reverb.
//
REVERB_SETTINGS reverb[MAX_BUSSES];
#ifdef IS_PS3
HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
void * hw_buf;
U32 hw_datarate;
U32 hw_align;
U32 port;
S32 hw_buffer_size;
S32 snd_frag_cnt;
S32 snd_frag_size;
S32 snd_last_frag;
S32 snd_last_write;
S32 snd_skip_time;
U32 snd_last_play;
U32 snd_last_move;
S32 snd_last_timer;
#endif
#ifdef IS_GENERICDIG
HDIGDRIVER next;
#endif
#if defined(IS_WINDOWS)
S32 no_wom_done; // don't process WOM_DONEs on this driver
U32 wom_done_buffers;
#endif
#if defined(HOST_SPU_PROCESS) || defined(MSS_SPU_PROCESS)
U32 spu_num;
S32 spu_on;
U64 spu_total;
U64 spu_last_polled;
U32 spu_last_percent;
#ifdef IS_PS3
U32 align[ 2 ];
#else
U32 align[ 1 ];
#endif
#endif
U64 adpcm_time;
U64 deinterlace_time;
U64 mix_time;
U64 rev_time;
U64 reformat_time;
U64 lowpass_time;
U64 filter_time;
U64 copy_time;
U64 sob_time;
U64 eob_time;
U64 eos_time;
U64 spu_wait_time;
U64 asi_times[4];
HSAMPLE adpcm_sam;
HSAMPLE deinterlace_sam;
HSAMPLE mix_sam;
HSAMPLE rev_sam;
HSAMPLE reformat_sam;
HSAMPLE lowpass_sam;
HSAMPLE filter_sam;
HSAMPLE asi_sams[4];
U32 adpcm_num;
U32 deinterlace_num;
U32 mix_num;
U32 rev_num;
U32 reformat_num;
U32 lowpass_num;
U32 filter_num;
U32 asi_nums[4];
// these clauses have to be at the end of the structure!!
#ifdef IS_WII
HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
U32 hw_datarate;
S32 hw_buffer_size;
S32 each_buffer_size;
S32 snd_frag_cnt;
S32 snd_frag_size;
S32 snd_last_frag;
S32 snd_last_write;
S32 snd_skip_time;
U32 snd_last_play;
U32 snd_last_move;
S32 snd_last_timer;
void * buffer[ 2 ];
U32 physical[ 2 ];
#ifdef AX_OUTPUT_BUFFER_DOUBLE
AXVPB* voice[ 2 ];
#endif
#endif
#ifdef XAUDIOFRAMESIZE_NATIVE
XAUDIOPACKET packet;
#endif
} DIG_DRIVER;
#ifdef MILES_CHECK_OFFSETS
RR_COMPILER_ASSERT((RR_MEMBER_OFFSET(DIG_DRIVER, filter_num) & 3) == 0);
#endif
typedef struct // MIDI status log structure
{
S32 program [NUM_CHANS]; // Program Change
S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB
S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB
S32 c_lock [NUM_CHANS]; // Channel Lock
S32 c_prot [NUM_CHANS]; // Channel Lock Protection
S32 c_mute [NUM_CHANS]; // Channel Mute
S32 c_v_prot [NUM_CHANS]; // Voice Protection
S32 bank [NUM_CHANS]; // Patch Bank Select
S32 gm_bank_l [NUM_CHANS]; // GM Bank Select
S32 gm_bank_m [NUM_CHANS]; // GM Bank Select
S32 indirect [NUM_CHANS]; // ICA indirect controller value
S32 callback [NUM_CHANS]; // Callback Trigger
S32 mod [NUM_CHANS]; // Modulation
S32 vol [NUM_CHANS]; // Volume
S32 pan [NUM_CHANS]; // Panpot
S32 exp [NUM_CHANS]; // Expression
S32 sus [NUM_CHANS]; // Sustain
S32 reverb [NUM_CHANS]; // Reverb
S32 chorus [NUM_CHANS]; // Chorus
S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed)
S32 RPN_L [NUM_CHANS]; // RPN # LSB
S32 RPN_M [NUM_CHANS]; // RPN # MSB
}
CTRL_LOG;
typedef struct _SEQUENCE // XMIDI sequence state table
{
char tag[4]; // HSEQ
HMDIDRIVER driver; // Driver for playback
U32 status; // SEQ_ flagsstruct
void const *TIMB; // XMIDI IFF chunk pointers
void const *RBRN;
void const *EVNT;
U8 const *EVNT_ptr; // Current event pointer
U8 *ICA; // Indirect Controller Array
AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler
AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler
AILBEATCB beat_callback; // XMIDI beat/bar change handler
AILSEQUENCECB EOS; // End-of-sequence callback function
S32 loop_count; // 0=one-shot, -1=indefinite, ...
S32 interval_count; // # of intervals until next event
S32 interval_num; // # of intervals since start
S32 volume; // Sequence volume 0-127
S32 volume_target; // Target sequence volume 0-127
S32 volume_accum; // Accumulated volume period
S32 volume_period; // Period for volume stepping
S32 tempo_percent; // Relative tempo percentage 0-100
S32 tempo_target; // Target tempo 0-100
S32 tempo_accum; // Accumulated tempo period
S32 tempo_period; // Period for tempo stepping
S32 tempo_error; // Error counter for tempo DDA
S32 beat_count; // Sequence playback position
S32 measure_count;
S32 time_numerator; // Sequence timing data
S32 time_fraction;
S32 beat_fraction;
S32 time_per_beat;
U8 const *FOR_ptrs[FOR_NEST]; // Loop stack
S32 FOR_loop_count [FOR_NEST];
S32 chan_map [NUM_CHANS]; // Physical channel map for sequence
CTRL_LOG shadow; // Controller values for sequence
S32 note_count; // # of notes "on"
S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free)
S32 note_num [MAX_NOTES]; // Note # for queued note
S32 note_time [MAX_NOTES]; // Remaining duration in intervals
SINTa user_data [8]; // Miscellaneous user data
SINTa system_data[8]; // Miscellaneous system data
} SEQUENCE;
#if defined(IS_MAC) || defined(IS_LINUX) || defined(IS_XENON) || defined(IS_PS3) || defined(IS_WII) || defined(IS_PSP) || defined(IS_PSP2) || defined(__RADWINRTAPI__) || defined(__RADSEKRIT2__) || defined(__RADANDROID__)
struct MIDIHDR;
struct MIDIOUT;
typedef struct MIDIOUT* HMIDIOUT;
typedef HMIDIOUT* LPHMIDIOUT;
#endif
typedef struct _MDI_DRIVER // Handle to XMIDI driver
{
char tag[4]; // HMDI
HTIMER timer; // XMIDI quantization timer
S32 interval_time; // XMIDI quantization timer interval in uS
HSEQUENCE sequences; // Pointer to list of SEQUENCEs
S32 n_sequences; // # of SEQUENCEs
S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0
HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel
HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel
HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel
S32 state [NUM_CHANS]; // Lock state prior to being locked
S32 notes [NUM_CHANS]; // # of active notes in channel
AILEVENTCB event_trap; // MIDI event trap callback function
AILTIMBRECB timbre_trap; // Timbre request callback function
S32 master_volume; // Master XMIDI note volume 0-127
SINTa system_data[8]; // Miscellaneous system data
#if (defined(IS_WINDOWS) && !defined(__RADWINRTAPI__)) || defined(IS_MAC) || defined(IS_LINUX)
S32 released; // has the hmidiout handle been released
U32 deviceid; // ID of the MIDI device
U8 *sysdata; // SysEx buffer
#endif
#if defined(IS_XENON) || defined(IS_WII) || defined(IS_PS3) || defined(IS_PSP) || defined(IS_3DS) || defined(IS_IPHONE) || defined(IS_PSP2) || defined(IS_WIIU) || defined(__RADWINRTAPI__) || defined(__RADSEKRIT2__) || defined(__RADANDROID__)
HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
#endif
#ifdef IS_LINUX
struct MIDIHDR *mhdr; // SysEx header
HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
HMIDIOUT hMidiOut; // MIDI output driver
#endif
#if defined(IS_WINDOWS) && !defined(__RADWINRTAPI__)
struct midihdr_tag *mhdr; // SysEx header
HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
HMIDIOUT hMidiOut; // MIDI output driver
#else
#if defined(IS_MAC)
struct MIDIHDR *mhdr; // SysEx header
HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
HMIDIOUT hMidiOut; // MIDI output driver
#endif
#endif
} MDI_DRIVER;
#if defined(IS_WIN32API) || defined(IS_WII)
#pragma pack(push, 1)
#endif
typedef MSS_STRUCT // XMIDI TIMB IFF chunk
{
S8 name[4];
U8 msb;
U8 lsb;
U8 lsb2;
U8 lsb3;
U16 n_entries;
U16 timbre[1];
}
TIMB_chunk;
typedef MSS_STRUCT // XMIDI RBRN IFF entry
{
S16 bnum;
U32 offset;
}
RBRN_entry;
#if defined(IS_WIN32API) || defined(IS_WII)
#pragma pack(pop)
#endif
typedef struct // Wave library entry
{
S32 bank; // XMIDI bank, MIDI patch for sample
S32 patch;
S32 root_key; // Root MIDI note # for sample (or -1)
U32 file_offset; // Offset of wave data from start-of-file
U32 size; // Size of wave sample in bytes
S32 format; // DIG_F format (8/16 bits, mono/stereo)
S32 playback_rate; // Playback rate in hertz
}
WAVE_ENTRY;
typedef struct // Virtual "wave synthesizer" descriptor
{
HMDIDRIVER mdi; // MIDI driver for use with synthesizer
HDIGDRIVER dig; // Digital driver for use with synthesizer
WAVE_ENTRY *library; // Pointer to wave library
AILEVENTCB prev_event_fn; // Previous MIDI event trap function
AILTIMBRECB prev_timb_fn; // Previous timbre request trap function
CTRL_LOG controls; // MIDI controller states
WAVE_ENTRY *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel
HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices
S32 n_voices; // Actual # of voices allocated to synth
S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1
S32 note [MAX_W_VOICES]; // MIDI note number for voice
S32 root [MAX_W_VOICES]; // MIDI root note for voice
S32 rate [MAX_W_VOICES]; // Playback rate for voice
S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice
U32 time [MAX_W_VOICES]; // Timestamp for voice
U32 event; // Event counter for LRU timestamps
}
WAVE_SYNTH;
typedef WAVE_SYNTH * HWAVESYNTH;// Handle to virtual wave synthesizer
//
// DIG_DRIVER list
//
extern HDIGDRIVER DIG_first;
//
// MDI_DRIVER list
//
extern HMDIDRIVER MDI_first;
//
// Miscellaneous system services
//
#define FILE_READ_WITH_SIZE ((void*)(SINTa)-1)
typedef void * (AILCALLBACK *AILMEMALLOCCB)(UINTa size);
typedef void (AILCALLBACK *AILMEMFREECB)(void *);
#define AIL_mem_alloc_lock_trk(size) AIL_mem_alloc_lock_info( size, __FILE__, __LINE__ )
#define AIL_file_read_trk(file,dest) AIL_file_read_info( file, dest, __FILE__, __LINE__ )
#define AIL_file_size_trk(file) AIL_file_size_info( file, __FILE__, __LINE__ )
//#define MSS_NONTRACKED
#ifdef MSS_NONTRACKED
DXDEC void * AILCALL AIL_mem_alloc_lock(UINTa size);
DXDEC void * AILCALL AIL_file_read(char const * filename, void * dest );
DXDEC S32 AILCALL AIL_file_size(char const * filename );
#else
#define AIL_mem_alloc_lock(size) AIL_mem_alloc_lock_trk(size)
#define AIL_file_read(file,dest) AIL_file_read_trk(file,dest)
#define AIL_file_size(file) AIL_file_size_trk(file)
#endif
DXDEC void * AILCALL AIL_mem_alloc_lock_info(UINTa size, char const * file, U32 line);
DXDEC void AILCALL AIL_mem_free_lock (void *ptr);
DXDEC S32 AILCALL AIL_file_error (void);
DXDEC S32 AILCALL AIL_file_size_info(char const *filename,
char const * caller,
U32 line);
DXDEC void * AILCALL AIL_file_read_info(char const *filename,
void *dest,
char const * caller,
U32 line);
DXDEC S32 AILCALL AIL_file_write (char const *filename,
void const *buf,
U32 len);
DXDEC S32 AILCALL AIL_WAV_file_write
(char const *filename,
void const *buf,
U32 len,
S32 rate,
S32 format);
DXDEC S32 AILCALL AIL_file_append (char const *filename,
void const *buf, U32 len);
DXDEC AILMEMALLOCCB AILCALL AIL_mem_use_malloc(AILMEMALLOCCB fn);
DXDEC AILMEMFREECB AILCALL AIL_mem_use_free (AILMEMFREECB fn);
#define MSSBreakPoint RR_BREAK
//
// Compiler-independent CRTL helper functions for PS2
// Exported here for use in demo programs as well as MSS itself
//
#if defined(IS_PSP)
DXDEC F32 AILCALL AIL_sin(F32 x);
DXDEC F32 AILCALL AIL_cos(F32 x);
DXDEC F32 AILCALL AIL_tan( F32 x );
DXDEC F32 AILCALL AIL_acos(F32 x);
DXDEC F32 AILCALL AIL_atan(F32 x);
DXDEC F32 AILCALL AIL_ceil( F32 x );
DXDEC F32 AILCALL AIL_floor( F32 x );
DXDEC F32 AILCALL AIL_fsqrt( F32 x );
DXDEC F32 AILCALL AIL_fabs ( F32 x );
DXDEC F32 AILCALL AIL_log10( F32 x );
DXDEC F32 AILCALL AIL_log( F32 x );
DXDEC F32 AILCALL AIL_pow( F32 x, F32 p );
DXDEC F32 AILCALL AIL_frexpf( F32 x, S32 *pw2 );
DXDEC F32 AILCALL AIL_ldexpf( F32 x, S32 pw2 );
#define AIL_exp(x) AIL_pow(2.718281828F,(x))
#else
#ifdef IS_WATCOM
#define AIL_pow powf
#define AIL_tan tanf
#else
#define AIL_tan tan
#define AIL_pow pow
#endif
#define AIL_sin sin
#define AIL_cos cos
#define AIL_acos acos
#define AIL_atan atan
#define AIL_ceil ceil
#define AIL_floor floor
#if defined(IS_PS3) && !defined(IS_SPU)
DXDEC F32 AILCALL AIL_fsqrt( F32 val );
#else
#define AIL_fsqrt(arg) ((F32) sqrt(arg))
#endif
#define AIL_fabs fabs
#define AIL_log10 log10
#define AIL_log log
#define AIL_frexpf(a1,a2) ((F32) frexp(a1,a2))
#define AIL_ldexpf(a1,a2) ((F32) ldexp(a1,a2))
#define AIL_exp exp
#endif
//
// High-level support services
//
DXDEC S32 AILCALL AIL_startup (void);
DXDEC SINTa AILCALL AIL_get_preference (U32 number);
DXDEC void AILCALL AIL_shutdown (void);
DXDEC SINTa AILCALL AIL_set_preference (U32 number,
SINTa value);
DXDEC char *AILCALL AIL_last_error (void);
DXDEC void AILCALL AIL_set_error (char const * error_msg);
#ifdef IS_WIIU
DXDEC void AILCALL AIL_set_wiiu_file_client (void* ptr_to_fsclient, void* ptr_to_fscmdblock);
#endif
#ifdef __RADIPHONE__
//
// On iOS, audio session interruptions stop the audio queues, and we have to manually restart them.
//
// This should be called whenever you get an Interruption Ended msg via your Audio Session callback.
//
DXDEC void AILCALL AIL_ios_post_audio_session_interrupt_end(HDIGDRIVER dig);
#endif
//
// Low-level support services
//
#ifdef IS_X86
DXDEC U32 AILCALL AIL_MMX_available (void);
#endif
#define AIL_lock AIL_lock_mutex
#define AIL_unlock AIL_unlock_mutex
DXDEC void AILCALL AIL_lock_mutex (void);
DXDEC void AILCALL AIL_unlock_mutex (void);
#define AIL_delay AIL_sleep
DXDEC void AILCALL AIL_sleep (U32 ms);
DXDEC AILTRACECB AILCALL AIL_configure_logging (char const * filename,
AILTRACECB cb,
S32 level);
//
// Process services
//
DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn);
DXDEC UINTa AILCALL AIL_set_timer_user (HTIMER timer,
UINTa user);
DXDEC void AILCALL AIL_set_timer_period (HTIMER timer,
U32 microseconds);
DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer,
U32 hertz);
DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer,
U32 PIT_divisor);
DXDEC void AILCALL AIL_start_timer (HTIMER timer);
DXDEC void AILCALL AIL_start_all_timers (void);
DXDEC void AILCALL AIL_stop_timer (HTIMER timer);
DXDEC void AILCALL AIL_stop_all_timers (void);
DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer);
DXDEC void AILCALL AIL_release_all_timers (void);
DXDEC S32 AILCALL AIL_timer_thread_handle(void* o_handle);
#ifdef IS_MAC
#if defined(__PROCESSES__)
DXDEC ProcessSerialNumber AIL_Process(void);
#endif
#endif
//
// high-level digital services
//
#define AIL_OPEN_DIGITAL_FORCE_PREFERENCE 1
#define AIL_OPEN_DIGITAL_NEED_HW_3D 2
#define AIL_OPEN_DIGITAL_NEED_FULL_3D 4
#define AIL_OPEN_DIGITAL_NEED_LIGHT_3D 8
#define AIL_OPEN_DIGITAL_NEED_HW_REVERB 16
#define AIL_OPEN_DIGITAL_NEED_REVERB 32
#define AIL_OPEN_DIGITAL_USE_IOP_CORE0 64
#define AIL_OPEN_DIGITAL_USE_SPU0 (1<<24)
#define AIL_OPEN_DIGITAL_USE_SPU1 (2<<24)
#define AIL_OPEN_DIGITAL_USE_SPU2 (3<<24)
#define AIL_OPEN_DIGITAL_USE_SPU3 (4<<24)
#define AIL_OPEN_DIGITAL_USE_SPU4 (5<<24)
#define AIL_OPEN_DIGITAL_USE_SPU5 (6<<24)
#define AIL_OPEN_DIGITAL_USE_SPU6 (7<<24)
#define AIL_OPEN_DIGITAL_USE_SPU( num ) ( ( num + 1 ) << 24 )
#ifdef IS_GENERICDIG
struct _RadSoundSystem;
typedef S32 (*RADSS_OPEN_FUNC)(struct _RadSoundSystem* i_SoundSystem, U32 i_MinBufferSizeInMs, U32 i_Frequency, U32 i_ChannelCount, U32 i_MaxLockSize, U32 i_Flags);
DXDEC HDIGDRIVER AILCALL AIL_open_generic_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags, RADSS_OPEN_FUNC dig_open);
#ifdef IS_WIN32
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_DSInstallDriver(UINTa, UINTa);
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_WOInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_DSInstallDriver(0, 0))
#elif defined(IS_3DS)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_3DSInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_3DSInstallDriver(0, 0))
#elif defined(__RADANDROID__)
DXDEC void AILCALL AIL_set_asset_manager(void* asset_manager);
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_SLESInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_SLESInstallDriver(0, 0))
#elif defined(IS_PSP2)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_PSP2InstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_PSP2InstallDriver(0, 0))
#elif defined(__RADSEKRIT2__)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_SonyInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_SonyInstallDriver(0, 0))
#elif defined(IS_PSP)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_PSPInstallDriver(UINTa, UINTa);
#define AIL_OPEN_DIGITAL_USE_SIMPLEAUDIO ~0U
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_PSPInstallDriver(0, 0))
#elif defined(IS_XENON) || defined(__RADWINRTAPI__)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_XAudio2InstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_XAudio2InstallDriver(0, 0))
#elif defined(IS_WIIU)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_AXInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_AXInstallDriver(0, 0))
#elif defined(IS_MAC) || defined(IS_IPHONE)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_OalInstallDriver(UINTa, UINTa);
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_CAInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_CAInstallDriver(0, 0))
#elif defined(IS_LINUX)
DXDEC RADSS_OPEN_FUNC AILCALL RADSS_OalInstallDriver(UINTa, UINTa);
#define AIL_open_digital_driver(frequency, bits, channel, flags) \
AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_OalInstallDriver(0, 0))
#endif
#else // IS_GENERICDIG
DXDEC HDIGDRIVER AILCALL AIL_open_digital_driver( U32 frequency,
S32 bits,
S32 channel,
U32 flags );
#endif // not IS_GENERICDIG
DXDEC void AILCALL AIL_close_digital_driver( HDIGDRIVER dig );
#ifdef IS_LINUX
#define AIL_MSS_version(str,len) \
{ \
strncpy(str, MSS_VERSION, len); \
}
DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
DXDEC S32 AILCALL AIL_digital_handle_reacquire
(HDIGDRIVER drvr);
#elif defined( IS_WINDOWS )
#define AIL_MSS_version(str,len) \
{ \
HINSTANCE l=LoadLibrary(MSSDLLNAME); \
if ((UINTa)l<=32) \
*(str)=0; \
else { \
LoadString(l,1,str,len); \
FreeLibrary(l); \
} \
}
DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
DXDEC S32 AILCALL AIL_digital_handle_reacquire
(HDIGDRIVER drvr);
#elif defined( IS_MAC )
#if defined(__RESOURCES__)
typedef MSS_STRUCT MSS_VersionType_
{
Str255 version_name;
} MSS_VersionType;
#define AIL_MSS_version(str,len) \
{ \
long _res = HOpenResFile(0,0,"\p" MSSDLLNAME,fsRdPerm); \
if (_res==-1) \
{ \
str[0]=0; \
} \
else \
{ \
Handle _H; \
short _Err; \
long _cur= CurResFile(); \
UseResFile(_res); \
_H = GetResource('vers', 2); \
_Err = ResError(); \
if((_Err != noErr) || (_H==0)) \
{ \
str[0]=0; \
UseResFile(_cur); \
CloseResFile(_res); \
} \
else \
{ \
if (GetHandleSize(_H)==0) \
{ \
str[0]=0; \
UseResFile(_cur); \
CloseResFile(_res); \
} \
else \
{ \
MSS_VersionType * _vt = (MSS_VersionType*)*_H; \
if ((U32)_vt->version_name[6]>4) \
_vt->version_name[6]-=4; \
else \
_vt->version_name[6]=0; \
if (((U32)len) <= ((U32)_vt->version_name[6])) \
_vt->version_name[6] = (U8)len-1; \
memcpy( str, _vt->version_name+11, _vt->version_name[6] ); \
str[_vt->version_name[6]]=0; \
UseResFile(_cur); \
CloseResFile(_res); \
} \
ReleaseResource(_H); \
} \
} \
}
#endif
DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
DXDEC S32 AILCALL AIL_digital_handle_reacquire
(HDIGDRIVER drvr);
#endif
DXDEC void AILCALL AIL_debug_log (char const * ifmt, ...);
DXDEC S32 AILCALL AIL_sprintf(char *dest,
char const *fmt, ...);
DXDEC char* AILCALL AIL_set_redist_directory(char const*dir);
DXDEC S32 AILCALL AIL_background_CPU_percent (void);
DXDEC S32 AILCALL AIL_digital_CPU_percent (HDIGDRIVER dig);
#ifdef HOST_SPU_PROCESS
DXDEC S32 AILCALL AIL_digital_SPU_percent (HDIGDRIVER dig);
#endif
DXDEC S32 AILCALL AIL_digital_latency (HDIGDRIVER dig);
DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle
(HDIGDRIVER dig);
EXPGROUP(Digital Audio Services)
#define MILES_PUSH_REVERB 1
#define MILES_PUSH_VOLUME 2
#define MILES_PUSH_3D 4
#define MILES_PUSH_RESET 8
DXDEC EXPAPI void AILCALL AIL_push_system_state(HDIGDRIVER dig, U32 flags, S16 crossfade_ms);
/*
Pushes the current system state, allowing for a temporary "clean" driver to use, and then
revert from.
$:dig The driver to push
$:flags Logical "or" of options controlling the extent of the push. See discussion.
$:crossfade_ms The number of milliseconds to fade the transition over. [0, 32767]
By default (ie flags == 0), effectively nothing happens. Since the operation neither affects
any subsystems nor resets the playing samples, a push immediately followed by a pop should
have no audible effects.
However, any samples started during the push will be stopped (via $AIL_end_fade_sample) when the system is popped.
Streams will return SMP_DONE via $AIL_stream_status. It is up to the client code to perform any cleanup required.
The flags can alter the above behavior in the following ways:
$* <b>MILES_PUSH_RESET</b> - This flag causes the system to revert to a "new" state when pushed. Without any
other flags this will only be apparent with samples - any playing samples will cease to be processed
(though they will still report SMP_PLAYING). When the system is popped, these samples will resume.
$* <b>MILES_PUSH_REVERB</b> - When present, reverb state will be affected in addition to sample state.
If MILES_PUSH_RESET is present, the reverb will be cleared to zero on push. Otherwise, it will be retained,
and only affected when popped.
$* <b>MILES_PUSH_3D</b> - When present, 3d listener state will be affected in addition to sample state.
If MILES_PUSH_RESET is present, the 3d listener state will be reverted to the same state as a new driver. Otherwise
it will be retained and only affected when popped.
$* <b>MILES_PUSH_VOLUME</b> - When present, master volume will be affected in addition to sample state.
If MILES_PUSH_RESET is present, the master volume will be set to 1.0f, otherwise it will be retained and only
affected when popped.
$-
If you want more control over whether a sample will be affected by a push or a pop operation,
see $AIL_set_sample_level_mask.
*/
DXDEC EXPAPI void AILCALL AIL_pop_system_state(HDIGDRIVER dig, S16 crossfade_ms);
/*
Pops the current system state and returns the system to the way it
was before the last push.
$:dig The driver to pop.
$:crossfade_ms The number of milliseconds to crossfade the transition over - [0, 32767]
See $AIL_push_system_state for documentation.
*/
DXDEC EXPAPI U8 AILCALL AIL_system_state_level(HDIGDRIVER dig);
/*
Returns the current level the system has been pushed to.
$:dig The driver to inspect
$:return A value between 0 and MILES_MAX_STATES, representing the depth of the current system stack.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_level_mask(HSAMPLE S, U8 mask);
/*
Sets the system levels at which a sample will play.
$:S The sample to set the mask for.
$:mask The bitmask of levels for which the sample will play.
Under normal push/pop operations, a sample's mask is set when it is
started to the level the system is at. If the system is pushed
without a reset, then the mask is adjusted to include the new level.
When a system is popped, if the sample is going to continue playing,
the state mask is adjusted to remove the level the system is popping
<i>from</i>.
If you have a sample playing on a higher system level that needs
to continue after a pop, you can adjust the sample's mask by using
this function in conjunction with $AIL_system_state_level and
$AIL_sample_level_mask:
${
AIL_set_sample_level_mask(S, AIL_sample_level_mask(S) |= (1 << (AIL_system_state_level(dig) - 1)));
$}
*/
DXDEC EXPAPI U8 AILCALL AIL_sample_level_mask(HSAMPLE S);
/*
Return the mask used to determine if the sample will play at a given system level.
$:S The sample to inspect.
$:return The level mask for the sample.
See $AIL_set_sample_level_mask.
*/
DXDEC EXPAPI U64 AILCALL AIL_digital_mixed_samples(HDIGDRIVER dig);
/*
Returns the number of samples that have been mixed in to the hardware.
Used for timing samples for start via $AIL_schedule_start_sample.
*/
#define AIL_digital_samples_per_second(dig) (dig->DMA_rate)
DXDEC EXPAPI void AILCALL AIL_enable_limiter(HDIGDRIVER dig, S32 on_off);
/*
Enables a basic limiter to prevent clipping.
$:dig The driver to enable the limiter on.
$:on_off If non-zero, the limiter will be enabled, otherwise it will be disabled.
By default limiters are off. Currently they are not configurable. They kick on around
-10 db, and with a 0db signal will attenuate by about -18 db. Limiters run prior to
the 16 bit clamp.
See also $AIL_bus_enable_limiter.
*/
EXPGROUP(bus_section)
DXDEC EXPAPI HSAMPLE AILCALL AIL_allocate_bus(HDIGDRIVER dig);
/*
Allocates a bus to mix samples to.
$:dig The HDIGDRIVER to allocate the bus on.
$:return The HSAMPLE for the new bus.
A bus allows you to treat a group of samples as one sample. With the bus sample you can
do almost all of the things you can do with a normal sample handle. The only exception
is you can't adjust the playback rate of the sample.
Use $AIL_bus_sample_handle to get the HSAMPLE associated with a bus.
Each call to AIL_allocate_bus adds a new bus, up to a total bus count of MAX_BUSSES. After
the first call, two busses exist - the main bus and the first aux bus. The HSAMPLE returned
is for the first aux bus (index 1)
*/
DXDEC EXPAPI void AILCALL AIL_bus_enable_limiter(HDIGDRIVER dig, S32 bus_index, S32 on_off);
/*
Enables a basic limiter to prevent clipping.
$:dig The driver containing the bus to enable the limiter on.
$:bus_index The index of the bus to enable the limiter on.
$:on_off If non-zero, the limiter will be enabled, otherwise it will be disabled.
By default limiters are off. Currently they are not configurable. They kick on around
-10 db, and with a 0db signal will attenuate by about -18 db. Limiters run prior to
the 16 bit clamp.
See also $AIL_enable_limiter.
*/
DXDEC EXPAPI HSAMPLE AILCALL AIL_bus_sample_handle(HDIGDRIVER dig, S32 bus_index);
/*
Returns the HSAMPLE associated with a bus.
$:dig The HDIGDRIVER the bus resides within.
$:bus_index The index of the bus to return the HSAMPLE for.
$:return The HSAMPLE for the bus index.
If the bus has not been allocated, or no busses have been allocated, this returns 0. This
means that for the "Main Bus" - index 0 - it will still return zero if no additional busses
have been allocated.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_bus(HSAMPLE S, S32 bus_index);
/*
Assigns an HSAMPLE to a bus.
$:S The HSAMPLE to assign.
$:bus_index The bus index to assign the sample to.
If the given bus has not been allocated, this function has no effect.
*/
DXDEC EXPAPI S32 AILCALL AIL_sample_bus(HSAMPLE S);
/*
Returns the bus an HSAMPLE is assigned to.
$:S The HSAMPLE to check.
$:return The index of the bus the sample is assigned.
All samples by default are assigned to bus 0.
*/
DXDEC EXPAPI S32 AILCALL AIL_install_bus_compressor(HDIGDRIVER dig, S32 bus_index, SAMPLESTAGE filter_stage, S32 input_bus_index);
/*
Installs the Compressor filter on to a bus, using another bus as the input for
compression/limiting.
$:dig The driver the busses exist on.
$:bus_index The index of the bus the compressor will affect.
$:filter_stage The SAMPLESTAGE the compressor will use on the bus HSAMPLE.
$:input_bus_index The bus index the compressor will use as <b>input</b>.
This installs a side chain compressor in to a given bus. It acts exactly like
any other filter you would put on an HSAMPLE, except the input_bus_index bus pipe's
its signal strength to the filter, allowing it to attenuate the bus_index bus based
on another bus's contents.
To control the compressor parameters, access the bus's HSAMPLE via $AIL_bus_sample_handle and
use $AIL_sample_stage_property exactly as you would any other filter. The filter's properties
are documented under $(Compressor Filter)
*/
DXDEC void AILCALL AIL_set_speaker_configuration
(HDIGDRIVER dig,
MSSVECTOR3D *array,
S32 n_channels,
F32 falloff_power);
DXDEC MSSVECTOR3D *
AILCALL AIL_speaker_configuration
(HDIGDRIVER dig,
S32 *n_physical_channels,
S32 *n_logical_channels,
F32 *falloff_power,
MSS_MC_SPEC *channel_spec);
DXDEC void AILCALL AIL_set_listener_relative_receiver_array
(HDIGDRIVER dig,
MSS_RECEIVER_LIST *array,
S32 n_receivers);
DXDEC MSS_RECEIVER_LIST *
AILCALL AIL_listener_relative_receiver_array
(HDIGDRIVER dig,
S32 *n_receivers);
DXDEC void AILCALL AIL_set_speaker_reverb_levels
(HDIGDRIVER dig,
F32 *wet_array,
F32 *dry_array,
MSS_SPEAKER const *speaker_index_array,
S32 n_levels);
DXDEC S32 AILCALL AIL_speaker_reverb_levels (HDIGDRIVER dig,
F32 * *wet_array,
F32 * *dry_array,
MSS_SPEAKER const * *speaker_index_array);
DXDEC
void AILCALL AIL_set_sample_speaker_scale_factors (HSAMPLE S, //)
MSS_SPEAKER const * dest_speaker_indexes,
F32 const * levels,
S32 n_levels );
DXDEC
void AILCALL AIL_sample_speaker_scale_factors (HSAMPLE S, //)
MSS_SPEAKER const * dest_speaker_indexes,
F32 * levels,
S32 n_levels );
DXDEC
S32 AILEXPORT AIL_set_sample_is_3D (HSAMPLE S, //)
S32 onoff);
//DXDEC F32 AILEXPORT AIL_calculate_sample_final_attenuation(HSAMPLE S);
/*
Returns the attenuation that a sample will have.
$:S Sample to compute.
*/
DXDEC
S32 AILEXPORT AIL_calculate_3D_channel_levels (HDIGDRIVER dig, //)
F32 *channel_levels,
MSS_SPEAKER const * *speaker_array,
MSSVECTOR3D *src_pos,
MSSVECTOR3D *src_face,
MSSVECTOR3D *src_up,
F32 src_inner_angle,
F32 src_outer_angle,
F32 src_outer_volume,
F32 src_max_dist,
F32 src_min_dist,
MSSVECTOR3D *listen_pos,
MSSVECTOR3D *listen_face,
MSSVECTOR3D *listen_up,
F32 rolloff_factor,
MSSVECTOR3D *doppler_velocity,
F32 *doppler_shift);
DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S);
DXDEC S32 AILCALL AIL_init_sample (HSAMPLE S,
S32 format);
DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S,
void const *file_image,
S32 block);
DXDEC S32 AILCALL AIL_set_sample_info (HSAMPLE S,
AILSOUNDINFO const * info);
DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S,
C8 const *file_type_suffix,
void const *file_image,
U32 file_size,
S32 block);
DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S,
SAMPLESTAGE pipeline_stage,
HPROVIDER provider);
DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor
(HDIGDRIVER dig,
DIGDRVSTAGE pipeline_stage,
HPROVIDER provider);
DXDEC HPROVIDER AILCALL AIL_sample_processor (HSAMPLE S,
SAMPLESTAGE pipeline_stage);
DXDEC HPROVIDER AILCALL AIL_digital_driver_processor
(HDIGDRIVER dig,
DIGDRVSTAGE pipeline_stage);
DXDEC void AILCALL AIL_set_sample_adpcm_block_size
(HSAMPLE S,
U32 blocksize);
DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S,
void const *start,
U32 len);
DXDEC void AILCALL AIL_start_sample (HSAMPLE S);
EXPGROUP(Digital Audio Services)
DXDEC EXPAPI void AILCALL AIL_schedule_start_sample(HSAMPLE S, U64 mix_time_to_start);
/*
Marks the specified sample to begin at the exact time specified.
$:S The sample to start
$:mix_time_to_start The time to start the sample, in samples.
Once set, the sample will have $AIL_start_sample called automatically
when the mixer reaches the specified time. The sample's delay will
be automatically adjusted such that the sample starts mid-block.
${
// Get the current time.
U64 mix_time = AIL_digital_mixed_samples(dig);
// Schedule to start 1 second out
mix_time += AIL_digital_samples_per_second(dig);
AIL_schedule_start_sample(S, mix_time );
$}
*/
DXDEC EXPAPI U64 AILCALL AIL_sample_schedule_time(HSAMPLE S);
/*
Returns the mix time the sample is scheduled to start at, or 0 if not scheduled.
$:S The sample to query.
*/
DXDEC void AILCALL AIL_stop_sample (HSAMPLE S);
DXDEC void AILCALL AIL_end_fade_sample (HSAMPLE S);
DXDEC void AILCALL AIL_resume_sample (HSAMPLE S);
DXDEC void AILCALL AIL_end_sample (HSAMPLE S);
DXDEC EXPAPI void AILCALL AIL_set_sample_id(HSAMPLE S, S32 id);
/*
Set an ID on a sample for use in synchronized control.
$:S The sample to alter
$:id The id to use.
*/
DXDEC EXPAPI S32 AILCALL AIL_sample_id(HSAMPLE S);
/*
Return the current ID for a sample.
$:S Sample to access
*/
DXDEC EXPAPI void AILCALL AIL_start_sample_group(HDIGDRIVER dig, S32 start_id, S32 set_to_id);
/*
Start a group of samples at the same time.
$:dig The driver the samples are allocated from.
$:start_id The ID to start
$:set_to_id The ID to set the samples to once they have started.
This function atomically calls $AIL_start_sample on all the samples to ensure the samples start in sync.
*/
DXDEC EXPAPI void AILCALL AIL_stop_sample_group(HDIGDRIVER dig, S32 stop_id, S32 set_to_id);
/*
Stops a group of samples at the same time.
$:dig The driver the samples are allocated from.
$:stop_id The ID to stop
$:set_to_id The ID to set the samples to once they have stopped.
This function atomically calls $AIL_stop_sample on all the samples to ensure they stop at the same point.
*/
DXDEC EXPAPI void AILCALL AIL_resume_sample_group(HDIGDRIVER dig, S32 resume_id, S32 set_to_id);
/*
Resumes a group of samples at the same time.
$:dig The driver the samples are allocated from.
$:resume_id The ID to resume
$:set_to_id The ID to set the samples to once they have resumed.
This function atomically calls $AIL_resume_sample on all the samples to ensure the samples start in sync.
*/
DXDEC EXPAPI void AILCALL AIL_end_sample_group(HDIGDRIVER dig, S32 end_id);
/*
Ends a group of samples at the same time.
$:dig The driver the samples are allocated from.
$:end_id The ID to end
This function atomically calls $AIL_end_sample on all the samples.
*/
DXDEC void AILCALL AIL_set_sample_playback_rate
(HSAMPLE S,
S32 playback_rate);
DXDEC void AILCALL AIL_set_sample_playback_rate_factor
(HSAMPLE S,
F32 playback_rate_factor);
DXDEC void AILCALL AIL_set_sample_playback_delay
(HSAMPLE S,
S32 playback_delay);
DXDEC void AILCALL AIL_set_sample_volume_pan (HSAMPLE S,
F32 volume,
F32 pan);
DXDEC void AILCALL AIL_set_sample_volume_levels(HSAMPLE S,
F32 left_level,
F32 right_level);
DXDEC void AILCALL AIL_set_sample_channel_levels (HSAMPLE S,
MSS_SPEAKER const *source_speaker_indexes,
MSS_SPEAKER const *dest_speaker_indexes,
F32 const *levels,
S32 n_levels);
DXDEC void AILCALL AIL_set_sample_reverb_levels(HSAMPLE S,
F32 dry_level,
F32 wet_level);
DXDEC void AILCALL AIL_set_sample_low_pass_cut_off(HSAMPLE S,
S32 /*-1 or MSS_SPEAKER*/ channel,
F32 cut_off);
DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S,
S32 loop_count);
DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S,
S32 loop_start_offset,
S32 loop_end_offset);
DXDEC EXPAPI S32 AILCALL AIL_set_sample_loop_samples(HSAMPLE S, S32 loop_start_samples, S32 loop_end_samples);
/*
Defines the loop points on a sample in samples rather than bytes.
$:S The sample to alter.
$:loop_start_samples The sample count in to the file to start the looping.
$:loop_end_samples The sample count in the file to end the looping.
$:return 1 if successful, 0 otherwise. Check $AIL_last_error for details.
For uncompressed samples, this largely reverts to $AIL_set_sample_loop_block, since the mapping
is straightforward. For compressed formats (like bink audio or mp3), looping in sample space is
non trivial and must be handled on a format-by-format basis. For the moment, only Bink Audio
supports this functionality - all other ASI formats will return failure.
If a loop's length is too short, it may be extended.
*/
DXDEC S32 AILCALL AIL_sample_loop_block (HSAMPLE S,
S32 *loop_start_offset,
S32 *loop_end_offset);
DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S);
DXDEC U32 AILCALL AIL_sample_mixed_ms (HSAMPLE S);
DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S);
DXDEC F32 AILCALL AIL_sample_playback_rate_factor (HSAMPLE S);
DXDEC S32 AILCALL AIL_sample_playback_delay (HSAMPLE S);
DXDEC void AILCALL AIL_sample_volume_pan (HSAMPLE S, F32* volume, F32* pan);
DXDEC S32 AILCALL AIL_sample_channel_count (HSAMPLE S, U32 *mask);
DXDEC void AILCALL AIL_sample_channel_levels (HSAMPLE S,
MSS_SPEAKER const *source_speaker_indexes,
MSS_SPEAKER const *dest_speaker_indexes,
F32 *levels,
S32 n_levels);
DXDEC void AILCALL AIL_sample_volume_levels (HSAMPLE S,
F32 *left_level,
F32 *right_level);
DXDEC void AILCALL AIL_sample_reverb_levels (HSAMPLE S,
F32 *dry_level,
F32 *wet_level);
DXDEC F32 AILCALL AIL_sample_output_levels (HSAMPLE S,
MSS_SPEAKER const *source_speaker_indexes,
MSS_SPEAKER const *dest_speaker_indexes,
F32 *levels,
S32 n_levels);
DXDEC F32 AILCALL AIL_sample_low_pass_cut_off(HSAMPLE S, S32 /*-1 or MSS_SPEAKER*/ channel);
DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S);
DXDEC void AILCALL AIL_set_digital_master_volume_level
(HDIGDRIVER dig,
F32 master_volume);
DXDEC F32 AILCALL AIL_digital_master_volume_level (HDIGDRIVER dig);
DXDEC void AILCALL AIL_set_sample_51_volume_pan( HSAMPLE S,
F32 volume,
F32 pan,
F32 fb_pan,
F32 center_level,
F32 sub_level );
DXDEC void AILCALL AIL_sample_51_volume_pan ( HSAMPLE S,
F32* volume,
F32* pan,
F32* fb_pan,
F32* center_level,
F32* sub_level );
DXDEC void AILCALL AIL_set_sample_51_volume_levels( HSAMPLE S,
F32 f_left_level,
F32 f_right_level,
F32 b_left_level,
F32 b_right_level,
F32 center_level,
F32 sub_level );
DXDEC void AILCALL AIL_sample_51_volume_levels ( HSAMPLE S,
F32* f_left_level,
F32* f_right_level,
F32* b_left_level,
F32* b_right_level,
F32* center_level,
F32* sub_level );
DXDEC void AILCALL AIL_set_digital_master_reverb
(HDIGDRIVER dig,
S32 bus_index,
F32 reverb_decay_time,
F32 reverb_predelay,
F32 reverb_damping);
DXDEC void AILCALL AIL_digital_master_reverb
(HDIGDRIVER dig,
S32 bus_index,
F32* reverb_time,
F32* reverb_predelay,
F32* reverb_damping);
DXDEC void AILCALL AIL_set_digital_master_reverb_levels
(HDIGDRIVER dig,
S32 bus_index,
F32 dry_level,
F32 wet_level);
DXDEC void AILCALL AIL_digital_master_reverb_levels
(HDIGDRIVER dig,
S32 bus_index,
F32 * dry_level,
F32 * wet_level);
//
// low-level digital services
//
DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig,
S32 playback_rate,
S32 format);
DXDEC S32 AILCALL AIL_set_sample_buffer_count (HSAMPLE S,
S32 n_buffers);
DXDEC S32 AILCALL AIL_sample_loaded_len (HSAMPLE S);
DXDEC S32 AILCALL AIL_sample_buffer_count (HSAMPLE S);
DXDEC S32 AILCALL AIL_sample_buffer_available (HSAMPLE S);
DXDEC S32 AILCALL AIL_load_sample_buffer (HSAMPLE S,
S32 buff_num,
void const *buffer,
U32 len);
DXDEC void AILCALL AIL_request_EOB_ASI_reset (HSAMPLE S,
U32 buff_num,
S32 new_stream_position);
DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //)
S32 buff_num,
U32 *pos,
U32 *len,
S32 *head,
S32 *tail);
DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S);
DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S,
U32 pos);
DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S);
DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback
(HSAMPLE S,
AILSAMPLECB SOB);
DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback
(HSAMPLE S,
AILSAMPLECB EOB);
DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback
(HSAMPLE S,
AILSAMPLECB EOS);
DXDEC AILMIXERCB AILCALL AIL_register_mix_callback(HDIGDRIVER dig, AILMIXERCB mixcb);
DXDEC AILFALLOFFCB AILCALL AIL_register_falloff_function_callback
(HSAMPLE S,
AILFALLOFFCB falloff_cb);
DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S,
U32 index,
SINTa value);
DXDEC SINTa AILCALL AIL_sample_user_data (HSAMPLE S,
U32 index);
DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig);
DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig,
S32 *rate,
S32 *format,
char *string);
DXDEC S32 AILCALL AIL_platform_property (void *object,
MSS_PLATFORM_PROPERTY property,
void *before_value,
void const *new_value,
void *after_value);
DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //)
S32 milliseconds);
DXDEC U32 AILCALL AIL_sample_ms_lookup (HSAMPLE S, //)
S32 milliseconds,
S32* actualms);
DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //)
S32 * total_milliseconds,
S32 * current_milliseconds);
//
// Digital input services
//
#if defined(IS_WINDOWS)
#define MSS_HAS_INPUT 1
#elif defined(IS_MAC)
#define MSS_HAS_INPUT 1
#else
#define MSS_HAS_INPUT 0
#endif
#if MSS_HAS_INPUT
DXDEC HDIGINPUT AILCALL AIL_open_input (AIL_INPUT_INFO *info);
DXDEC void AILCALL AIL_close_input (HDIGINPUT dig);
DXDEC AIL_INPUT_INFO *
AILCALL AIL_get_input_info (HDIGINPUT dig);
DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig,
S32 enable);
#endif
//
// High-level XMIDI services
//
DXDEC HMDIDRIVER AILCALL AIL_open_XMIDI_driver( U32 flags );
#define AIL_OPEN_XMIDI_NULL_DRIVER 1
DXDEC void AILCALL AIL_close_XMIDI_driver( HMDIDRIVER mdi );
#if defined(IS_MAC) || defined(IS_LINUX)
DXDEC S32 AILCALL AIL_MIDI_handle_release
(HMDIDRIVER mdi);
DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
(HMDIDRIVER mdi);
#elif defined( IS_WINDOWS )
DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER *drvr,
LPHMIDIOUT *lphMidiOut,
S32 dwDeviceID);
DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi);
DXDEC S32 AILCALL AIL_MIDI_handle_release
(HMDIDRIVER mdi);
DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
(HMDIDRIVER mdi);
#endif
DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle
(HMDIDRIVER mdi);
DXDEC void AILCALL AIL_release_sequence_handle
(HSEQUENCE S);
DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S,
void const *start,
S32 sequence_num);
DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S);
DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S);
DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S);
DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S);
DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S,
S32 tempo,
S32 milliseconds);
DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S,
S32 volume,
S32 milliseconds);
DXDEC void AILCALL AIL_set_sequence_loop_count
(HSEQUENCE S,
S32 loop_count);
DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S);
DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S);
DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S);
DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S);
DXDEC void AILCALL AIL_set_XMIDI_master_volume
(HMDIDRIVER mdi,
S32 master_volume);
DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi);
//
// Low-level XMIDI services
//
DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi);
DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S,
S32 channel,
S32 controller_num);
DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S,
S32 channel);
DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S,
S32 *beat,
S32 *measure);
DXDEC void AILCALL AIL_branch_index (HSEQUENCE S,
U32 marker);
DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback
(HSEQUENCE S,
AILPREFIXCB callback);
DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback
(HSEQUENCE S,
AILTRIGGERCB callback);
DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback
(HSEQUENCE S,
AILSEQUENCECB callback);
DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S,
AILBEATCB callback);
DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi,
AILEVENTCB callback);
DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback
(HMDIDRIVER mdi,
AILTIMBRECB callback);
DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S,
U32 index,
SINTa value);
DXDEC SINTa AILCALL AIL_sequence_user_data (HSEQUENCE S,
U32 index);
DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S,
U8 *array);
DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi);
DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi,
S32 channel);
DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S,
S32 seq_channel,
S32 new_channel);
DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S,
S32 seq_channel);
DXDEC void AILCALL AIL_send_channel_voice_message
(HMDIDRIVER mdi,
HSEQUENCE S,
S32 status,
S32 data_1,
S32 data_2);
DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi,
void const *buffer);
DXDEC HWAVESYNTH
AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig,
HMDIDRIVER mdi,
void const *wave_lib,
S32 polyphony);
DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W);
DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //)
S32 milliseconds);
DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //)
S32 *total_milliseconds,
S32 *current_milliseconds);
//
// red book functions
//
#ifdef IS_WINDOWS
#pragma pack(push, 1)
typedef MSS_STRUCT _REDBOOK {
U32 DeviceID;
U32 paused;
U32 pausedsec;
U32 lastendsec;
} REDBOOK;
#pragma pack(pop)
typedef MSS_STRUCT _REDBOOK* HREDBOOK;
#define REDBOOK_ERROR 0
#define REDBOOK_PLAYING 1
#define REDBOOK_PAUSED 2
#define REDBOOK_STOPPED 3
DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which);
DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive);
DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand);
DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand);
DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand);
DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum,
U32* startmsec,U32* endmsec);
DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec);
DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand);
DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand);
DXDEC F32 AILCALL AIL_redbook_volume_level(HREDBOOK hand);
DXDEC F32 AILCALL AIL_redbook_set_volume_level(HREDBOOK hand, F32 volume);
#endif
DXDEC U32 AILCALL AIL_ms_count(void);
DXDEC U32 AILCALL AIL_us_count(void);
DXDEC U64 AILCALL AIL_ms_count64(void);
DXDEC U64 AILCALL AIL_us_count64(void);
DXDEC U64 AILCALL AIL_get_time(void);
DXDEC U64 AILCALL AIL_time_to_ms(U64 time);
DXDEC U64 AILCALL AIL_ms_to_time(U64 ms);
DXDEC void AILCALL MilesUseTelemetry( void * context );
DXDEC void AILCALL MilesUseTmLite( void* context );
//
//
//
#define MSSIO_FLAGS_DONT_CLOSE_HANDLE 1
#define MSSIO_FLAGS_QUERY_SIZE_ONLY 2
#define MSSIO_FLAGS_DONT_USE_OFFSET 4
#define MSSIO_STATUS_COMPLETE 1
#define MSSIO_STATUS_ERROR_FAILED_OPEN 0x1003
#define MSSIO_STATUS_ERROR_FAILED_READ 0x1004
#define MSSIO_STATUS_ERROR_SHUTDOWN 0x1005
#define MSSIO_STATUS_ERROR_CANCELLED 0x1006
#define MSSIO_STATUS_ERROR_MEMORY_ALLOC_FAIL 0x1007
#define MSSIO_STATUS_ERROR_MASK 0x1000
// returns percent full (1.0 = 100%)
typedef F32 (AILCALLBACK *MilesAsyncStreamCallback)(void* i_User);
struct MilesAsyncRead
{
char FileName[256];
U64 Offset;
S64 Count;
void* Buffer;
void* StreamUserData;
MilesAsyncStreamCallback StreamCB;
char const * caller;
U32 caller_line;
UINTa FileHandle;
S32 Flags;
S32 ReadAmt; // current read amt.
S32 AdditionalBuffer;
S32 volatile Status; // This is only valid after a call to MilesAsyncFileWait or MilesAsyncFileCancel has succeeded.
char Internal[48+128];
};
DXDEC S32 AILCALL MilesAsyncFileRead(struct MilesAsyncRead* i_Request);
DXDEC S32 AILCALL MilesAsyncFileCancel(struct MilesAsyncRead* i_Request); // 1 if the request has completed, 0 otherwise. Use Wait if needed.
DXDEC S32 AILCALL MilesAsyncFileStatus(struct MilesAsyncRead* i_Request, U32 i_MS); // 1 if complete, 0 if timeout exceeded.
DXDEC S32 AILCALL MilesAsyncStartup();
DXDEC S32 AILCALL MilesAsyncShutdown();
DXDEC S32 AILCALL AIL_IO_thread_handle(void* o_Handle);
DXDEC void AILCALL MilesAsyncSetPaused(S32 i_IsPaused);
typedef S32 (AILCALLBACK * MilesAsyncFileRead_callback)(struct MilesAsyncRead* i_Request);
typedef S32 (AILCALLBACK * MilesAsyncFileCancel_callback)(struct MilesAsyncRead* i_Request); // 1 if the request has completed, 0 otherwise. Use Wait if needed.
typedef S32 (AILCALLBACK * MilesAsyncFileStatus_callback)(struct MilesAsyncRead* i_Request, U32 i_MS); // 1 if complete, 0 if timeout exceeded.
typedef S32 (AILCALLBACK * MilesAsyncStartup_callback)();
typedef S32 (AILCALLBACK * MilesAsyncShutdown_callback)();
typedef void (AILCALLBACK * MilesAsyncSetPaused_callback)(S32 i_IsPaused);
typedef S32 (AILCALLBACK * AIL_IO_thread_handle_callback)(void* o_Handle);
DXDEC void AILCALL AIL_set_async_callbacks(
MilesAsyncFileRead_callback read,
MilesAsyncFileCancel_callback cancel,
MilesAsyncFileStatus_callback status,
MilesAsyncStartup_callback startup,
MilesAsyncShutdown_callback shutdown,
MilesAsyncSetPaused_callback setpaused,
AIL_IO_thread_handle_callback threadhandle);
//
//
//
typedef struct _STREAM* HSTREAM; // Handle to stream
typedef void (AILCALLBACK* AILSTREAMCB) (HSTREAM stream);
#define MSS_STREAM_CHUNKS 8
typedef struct _STREAM
{
S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream
S32 using_ASI; // 1 if using ASI decoder to uncompress stream data
ASISTAGE *ASI; // handy pointer to our ASI coded
HSAMPLE samp; // the sample handle
UINTa fileh; // the open file handle
U8* bufs[MSS_STREAM_CHUNKS]; // the data buffers
S32 reset_ASI[MSS_STREAM_CHUNKS]; // should we reset the ASI at the end of the buffer?
S32 reset_seek_pos[MSS_STREAM_CHUNKS]; // new stream position after reset
S32 bufstart[MSS_STREAM_CHUNKS]; // offset of where this buffer started
S32 loadedsizes[MSS_STREAM_CHUNKS]; // sizes of the data to be started
struct MilesAsyncRead asyncs[MSS_STREAM_CHUNKS];
S32 asyncs_loaded[MSS_STREAM_CHUNKS]; // 0=unloaded, 1=loading, 2=loaded, but not started
S32 next_read_offset; // offset to pass to the next read, so the seek occurs internally. -1 to not seek.
S32 into_Miles_index; // index of buffer that we will async into next
S32 read_IO_index; // index of buffer to be loaded into Miles next
S32 bufsize; // size of each buffer
U32 datarate; // datarate in bytes per second
S32 filerate; // original datarate of the file
S32 filetype; // file format type
U32 filemask; // channel mask for stream file
S32 totallen; // total length of the sound data
S32 substart; // subblock loop start
S32 sublen; // subblock loop len
U32 blocksize; // ADPCM block size
S32 loadedsome; // have we done any loads?
U32 startpos; // point that the sound data begins
U32 async_pos; // position if the last async completed
U32 loopsleft; // how many loops are left
U32 error; // read error has occurred
S32 preload; // preload the file into the first buffer
U32 preloadpos; // position to use in preload
U32 noback; // no background processing
S32 alldone; // alldone
S32 primeamount; // amount to load after a seek
S32 primeleft; // amount to read before starting
S32 playcontrol; // control: 0=stopped, 1=started, |8=paused, |16=sample paused
AILSTREAMCB callback; // end of stream callback
SINTa user_data[8]; // Miscellaneous user data
void* next; // pointer to next stream
S32 autostreaming; // are we autostreaming this stream
F32 level; // io percent full
F32 last_level; // old io percent
F32 percent_mult; // factor to scale by
S32 stream_count; // unique number of the stream
S32 docallback; // set when it time to poll for a callback
S32 was_popped; // set to 1 if the stream needs to be freed due to a system push/pop - causes SMP_DONE to be stream_status
} MSTREAM_TYPE;
DXDEC HSTREAM AILCALL AIL_open_stream(HDIGDRIVER dig, char const * filename, S32 stream_mem);
DXDEC void AILCALL AIL_close_stream(HSTREAM stream);
DXDEC HSAMPLE AILCALL AIL_stream_sample_handle(HSTREAM stream);
DXDEC S32 AILCALL AIL_service_stream(HSTREAM stream, S32 fillup);
DXDEC void AILCALL AIL_start_stream(HSTREAM stream);
DXDEC void AILCALL AIL_pause_stream(HSTREAM stream, S32 onoff);
DXDEC S32 AILCALL AIL_stream_loop_count(HSTREAM stream);
DXDEC void AILCALL AIL_set_stream_loop_count(HSTREAM stream, S32 count);
DXDEC void AILCALL AIL_set_stream_loop_block (HSTREAM S,
S32 loop_start_offset,
S32 loop_end_offset);
DXDEC S32 AILCALL AIL_stream_status(HSTREAM stream);
DXDEC F32 AILCALL AIL_stream_filled_percent(HSTREAM stream);
DXDEC void AILCALL AIL_set_stream_position(HSTREAM stream,S32 offset);
DXDEC S32 AILCALL AIL_stream_position(HSTREAM stream);
DXDEC void AILCALL AIL_stream_info(HSTREAM stream, S32* datarate, S32* sndtype, S32* length, S32* memory);
DXDEC AILSTREAMCB AILCALL AIL_register_stream_callback(HSTREAM stream, AILSTREAMCB callback);
DXDEC void AILCALL AIL_auto_service_stream(HSTREAM stream, S32 onoff);
DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S,
U32 index,
SINTa value);
DXDEC SINTa AILCALL AIL_stream_user_data (HSTREAM S,
U32 index);
DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S,
S32 milliseconds);
DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //)
S32 * total_milliseconds,
S32 * current_milliseconds);
//! \todo MSS_FILE not needed anymore?
typedef char MSS_FILE;
typedef U32 (AILCALLBACK*AIL_file_open_callback) (MSS_FILE const* Filename,
UINTa* FileHandle);
typedef void (AILCALLBACK*AIL_file_close_callback) (UINTa FileHandle);
#define AIL_FILE_SEEK_BEGIN 0
#define AIL_FILE_SEEK_CURRENT 1
#define AIL_FILE_SEEK_END 2
typedef S32 (AILCALLBACK*AIL_file_seek_callback) (UINTa FileHandle,
S32 Offset,
U32 Type);
typedef U32 (AILCALLBACK*AIL_file_read_callback) (UINTa FileHandle,
void* Buffer,
U32 Bytes);
DXDEC void AILCALL AIL_set_file_callbacks (AIL_file_open_callback opencb,
AIL_file_close_callback closecb,
AIL_file_seek_callback seekcb,
AIL_file_read_callback readcb);
DXDEC void AILCALL AIL_file_callbacks(AIL_file_open_callback* opencb,
AIL_file_close_callback* closecb,
AIL_file_seek_callback* seekcb,
AIL_file_read_callback* readcb);
#ifdef IS_32
typedef void* (AILCALLBACK *AIL_file_async_read_callback) (UINTa FileHandle,
void* Buffer,
U32 Bytes);
typedef S32 (AILCALLBACK*AIL_file_async_status_callback) (void* async,
S32 wait,
U32* BytesRead);
DXDEC void AILCALL AIL_set_file_async_callbacks (AIL_file_open_callback opencb,
AIL_file_close_callback closecb,
AIL_file_seek_callback seekcb,
AIL_file_async_read_callback areadcb,
AIL_file_async_status_callback statuscb);
#endif
//
// High-level DLS functions
//
typedef struct _DLSFILEID {
SINTa id;
struct _DLSFILEID* next;
} DLSFILEID;
typedef struct _DLSFILEID* HDLSFILEID;
typedef struct _DLSDEVICE {
VOIDFUNC* pGetPref;
VOIDFUNC* pSetPref;
VOIDFUNC* pMSSOpen;
VOIDFUNC* pOpen;
VOIDFUNC* pClose;
VOIDFUNC* pLoadFile;
VOIDFUNC* pLoadMem;
VOIDFUNC* pUnloadFile;
VOIDFUNC* pUnloadAll;
VOIDFUNC* pGetInfo;
VOIDFUNC* pCompact;
VOIDFUNC* pSetAttr;
SINTa DLSHandle;
U32 format;
U32 buffer_size;
void* buffer[2];
HSAMPLE sample;
HMDIDRIVER mdi;
HDIGDRIVER dig;
HDLSFILEID first;
#if defined(__RADNT__)
#ifdef MSS_STATIC_RIB
#error "Bad defines - can't have a static rib on NT"
#endif
HMODULE lib;
#elif defined(MSS_STATIC_RIB)
char* DOSname;
#endif
} DLSDEVICE;
typedef struct _DLSDEVICE* HDLSDEVICE;
typedef struct _AILDLSINFO {
char Description[128];
S32 MaxDLSMemory;
S32 CurrentDLSMemory;
S32 LargestSize;
S32 GMAvailable;
S32 GMBankSize;
} AILDLSINFO;
#ifdef MSS_STATIC_RIB
typedef struct _AILSTATICDLS {
char* description;
VOIDFUNC* pDLSOpen;
VOIDFUNC* pMSSOpen;
VOIDFUNC* pOpen;
VOIDFUNC* pClose;
VOIDFUNC* pLoadFile;
VOIDFUNC* pLoadMem;
VOIDFUNC* pUnloadFile;
VOIDFUNC* pUnloadAll;
VOIDFUNC* pGetInfo;
VOIDFUNC* pCompact;
VOIDFUNC* pSetAttr;
} AILSTATICDLS;
#endif // MSS_STATIC_RIB
DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig,
#ifdef MSS_STATIC_RIB
AILSTATICDLS const * staticdls,
#elif defined(__RADNT__)
char const * libname,
#endif
U32 flags, U32 rate, S32 bits, S32 channels);
//
// Parameters for the dwFlag used in DLSClose() and flags in AIL_DLS_close
//
#define RETAIN_DLS_COLLECTION 0x00000001
#define RETURN_TO_BOOTUP_STATE 0x00000002
#define RETURN_TO_GM_ONLY_STATE 0x00000004
#define DLS_COMPACT_MEMORY 0x00000008
DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags);
DXDEC HDLSFILEID AILCALL AIL_DLS_load_file(HDLSDEVICE dls, char const* filename, U32 flags);
DXDEC HDLSFILEID AILCALL AIL_DLS_load_memory(HDLSDEVICE dls, void const* memfile, U32 flags);
//
// other parameters for AIL_DLS_unload
//
#define AIL_DLS_UNLOAD_MINE 0
#define AIL_DLS_UNLOAD_ALL ((HDLSFILEID)(UINTa)(SINTa)-1)
DXDEC void AILCALL AIL_DLS_unload(HDLSDEVICE dls, HDLSFILEID dlsid);
DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls);
DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO* info, S32* PercentCPU);
DXDEC HSAMPLE AILCALL AIL_DLS_sample_handle(HDLSDEVICE dls);
//
// Quick-integration service functions and data types
//
typedef struct
{
U32 const *data;
S32 size;
S32 type;
void *handle;
S32 status;
void* next;
S32 speed;
F32 volume;
F32 extravol;
F32 dry;
F32 wet;
F32 cutoff;
HDLSFILEID dlsid;
void* dlsmem;
void* dlsmemunc;
S32 milliseconds;
S32 length;
SINTa userdata;
}
AUDIO_TYPE;
#define QSTAT_DONE 1 // Data has finished playing
#define QSTAT_LOADED 2 // Data has been loaded, but not yet played
#define QSTAT_PLAYING 3 // Data is currently playing
typedef AUDIO_TYPE * HAUDIO; // Generic handle to any audio data type
#define AIL_QUICK_USE_WAVEOUT 2
#define AIL_QUICK_MIDI_AND_DLS 2
#define AIL_QUICK_DLS_ONLY 3
#define AIL_QUICK_MIDI_AND_VORTEX_DLS 4
#define AIL_QUICK_MIDI_AND_SONICVIBES_DLS 5
DXDEC S32 AILCALL
AIL_quick_startup (
S32 use_digital,
S32 use_MIDI,
U32 output_rate,
S32 output_bits,
S32 output_channels);
DXDEC void AILCALL AIL_quick_shutdown (void);
DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER* pdig,
HMDIDRIVER* pmdi,
HDLSDEVICE* pdls );
DXDEC HAUDIO AILCALL AIL_quick_load (char const *filename);
DXDEC HAUDIO AILCALL AIL_quick_load_mem (void const *mem,
U32 size);
DXDEC HAUDIO AILCALL AIL_quick_load_named_mem (void const *mem,
char const *filename,
U32 size);
DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio);
DXDEC void AILCALL AIL_quick_unload (HAUDIO audio);
DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio,
U32 loop_count);
DXDEC void AILCALL AIL_quick_halt (HAUDIO audio);
DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio);
DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char const *filename,
U32 loop_count,
S32 wait_request);
DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed);
DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, F32 volume, F32 extravol);
DXDEC void AILCALL AIL_quick_set_reverb_levels (HAUDIO audio,
F32 dry_level,
F32 wet_level);
DXDEC void AILCALL AIL_quick_set_low_pass_cut_off(HAUDIO S,
S32 channel,
F32 cut_off);
DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds);
DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio);
DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio);
#define AIL_QUICK_XMIDI_TYPE 1
#define AIL_QUICK_DIGITAL_TYPE 2
#define AIL_QUICK_DLS_XMIDI_TYPE 3
#define AIL_QUICK_MPEG_DIGITAL_TYPE 4
#define AIL_QUICK_OGG_VORBIS_TYPE 5
#define AIL_QUICK_V12_VOICE_TYPE 6
#define AIL_QUICK_V24_VOICE_TYPE 7
#define AIL_QUICK_V29_VOICE_TYPE 8
#define AIL_QUICK_OGG_SPEEX_TYPE 9
#define AIL_QUICK_S8_VOICE_TYPE 10
#define AIL_QUICK_S16_VOICE_TYPE 11
#define AIL_QUICK_S32_VOICE_TYPE 12
#define AIL_QUICK_BINKA_TYPE 13
DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio);
DXDEC S32 AILCALL AIL_WAV_info(void const* WAV_image, AILSOUNDINFO* info);
DXDEC S32 AILCALL AIL_WAV_marker_count(void const *WAV_image);
DXDEC S32 AILCALL AIL_WAV_marker_by_index(void const *WAV_image, S32 n, C8 const **name);
DXDEC S32 AILCALL AIL_WAV_marker_by_name(void const *WAV_image, C8 *name);
DXDEC S32 AILCALL AIL_size_processed_digital_audio(
U32 dest_rate,
U32 dest_format,
S32 num_srcs,
AILMIXINFO const * src);
DXDEC S32 AILCALL AIL_process_digital_audio(
void *dest_buffer,
S32 dest_buffer_size,
U32 dest_rate,
U32 dest_format,
S32 num_srcs,
AILMIXINFO* src);
#define AIL_LENGTHY_INIT 0
#define AIL_LENGTHY_SET_PROPERTY 1
#define AIL_LENGTHY_UPDATE 2
#define AIL_LENGTHY_DONE 3
typedef S32 (AILCALLBACK* AILLENGTHYCB)(U32 state,UINTa user);
typedef S32 (AILCALLBACK* AILCODECSETPROP)(char const* property,void const * value);
DXDEC S32 AILCALL AIL_compress_ASI(AILSOUNDINFO const * info, //)
char const* filename_ext,
void** outdata,
U32* outsize,
AILLENGTHYCB callback);
DXDEC S32 AILCALL AIL_decompress_ASI(void const* indata, //)
U32 insize,
char const* filename_ext,
void** wav,
U32* wavsize,
AILLENGTHYCB callback);
DXDEC S32 AILCALL AIL_compress_ADPCM(AILSOUNDINFO const * info,
void** outdata, U32* outsize);
DXDEC S32 AILCALL AIL_decompress_ADPCM(AILSOUNDINFO const * info,
void** outdata, U32* outsize);
DXDEC S32 AILCALL AIL_compress_DLS(void const* dls,
char const* compression_extension,
void** mls, U32* mlssize,
AILLENGTHYCB callback);
DXDEC S32 AILCALL AIL_merge_DLS_with_XMI(void const* xmi, void const* dls,
void** mss, U32* msssize);
DXDEC S32 AILCALL AIL_extract_DLS( void const *source_image, //)
U32 source_size,
void * *XMI_output_data,
U32 *XMI_output_size,
void * *DLS_output_data,
U32 *DLS_output_size,
AILLENGTHYCB callback);
#define AILFILTERDLS_USINGLIST 1
DXDEC S32 AILCALL AIL_filter_DLS_with_XMI(void const* xmi, void const* dls,
void** dlsout, U32* dlssize,
S32 flags, AILLENGTHYCB callback);
#define AILMIDITOXMI_USINGLIST 1
#define AILMIDITOXMI_TOLERANT 2
DXDEC S32 AILCALL AIL_MIDI_to_XMI (void const* MIDI,
U32 MIDI_size,
void* *XMIDI,
U32 * XMIDI_size,
S32 flags);
#define AILDLSLIST_ARTICULATION 1
#define AILDLSLIST_DUMP_WAVS 2
#if defined(IS_WIN32) || defined(IS_MAC) || defined(IS_LINUX)
DXDEC S32 AILCALL AIL_list_DLS (void const* DLS,
char** lst,
U32 * lst_size,
S32 flags,
C8 * title);
#define AILMIDILIST_ROLANDSYSEX 1
#define AILMIDILIST_ROLANDUN 2
#define AILMIDILIST_ROLANDAB 4
DXDEC S32 AILCALL AIL_list_MIDI (void const* MIDI,
U32 MIDI_size,
char** lst,
U32 * lst_size,
S32 flags);
#endif
#define AILFILETYPE_UNKNOWN 0
#define AILFILETYPE_PCM_WAV 1
#define AILFILETYPE_ADPCM_WAV 2
#define AILFILETYPE_OTHER_WAV 3
#define AILFILETYPE_VOC 4
#define AILFILETYPE_MIDI 5
#define AILFILETYPE_XMIDI 6
#define AILFILETYPE_XMIDI_DLS 7
#define AILFILETYPE_XMIDI_MLS 8
#define AILFILETYPE_DLS 9
#define AILFILETYPE_MLS 10
#define AILFILETYPE_MPEG_L1_AUDIO 11
#define AILFILETYPE_MPEG_L2_AUDIO 12
#define AILFILETYPE_MPEG_L3_AUDIO 13
#define AILFILETYPE_OTHER_ASI_WAV 14
#define AILFILETYPE_XBOX_ADPCM_WAV 15
#define AILFILETYPE_OGG_VORBIS 16
#define AILFILETYPE_V12_VOICE 17
#define AILFILETYPE_V24_VOICE 18
#define AILFILETYPE_V29_VOICE 19
#define AILFILETYPE_OGG_SPEEX 20
#define AILFILETYPE_S8_VOICE 21
#define AILFILETYPE_S16_VOICE 22
#define AILFILETYPE_S32_VOICE 23
#define AILFILETYPE_BINKA 24
DXDEC S32 AILCALL AIL_file_type(void const* data, U32 size);
DXDEC S32 AILCALL AIL_file_type_named(void const* data, char const* filename, U32 size);
DXDEC S32 AILCALL AIL_find_DLS (void const* data, U32 size,
void** xmi, U32* xmisize,
void** dls, U32* dlssize);
typedef struct
{
//
// File-level data accessible to app
//
// This is valid after AIL_inspect_MP3() is called (even if the file contains no valid frames)
//
U8 *MP3_file_image; // Original MP3_file_image pointer passed to AIL_inspect_MP3()
S32 MP3_image_size; // Original MP3_image_size passed to AIL_inspect_MP3()
U8 *ID3v2; // ID3v2 tag, if not NULL
S32 ID3v2_size; // Size of tag in bytes
U8 *ID3v1; // ID3v1 tag, if not NULL (always 128 bytes long if present)
U8 *start_MP3_data; // Pointer to start of data area in file (not necessarily first valid frame)
U8 *end_MP3_data; // Pointer to last valid byte in MP3 data area (before ID3v1 tag, if any)
//
// Information about current frame being inspected, valid if AIL_enumerate_MP3_frames() returns
// TRUE
//
S32 sample_rate; // Sample rate in Hz (normally constant across all frames in file)
S32 bit_rate; // Bits/second for current frame
S32 channels_per_sample; // 1 or 2
S32 samples_per_frame; // Always 576 or 1152 samples in each MP3 frame, depending on rate
S32 byte_offset; // Offset of frame from start_MP3_data (i.e., suitable for use as loop point)
S32 next_frame_expected; // Anticipated offset of next frame to be enumerated, if any
S32 average_frame_size; // Average source bytes per frame, determined solely by bit rate and sample rate
S32 data_size; // # of data-only bytes in this particular frame
S32 header_size; // 4 or 6 bytes, depending on CRC
S32 side_info_size; // Valid for layer 3 side info only
S32 ngr; // Always 2 for MPEG1, else 1
S32 main_data_begin; // Always 0 in files with no bit reservoir
S32 hpos; // Current bit position in header/side buffer
S32 MPEG1; // Data copied directly from frame header, see ISO docs for info...
S32 MPEG25;
S32 layer;
S32 protection_bit;
S32 bitrate_index;
S32 sampling_frequency;
S32 padding_bit;
S32 private_bit;
S32 mode;
S32 mode_extension;
S32 copyright;
S32 original;
S32 emphasis;
//
// LAME/Xing info tag data
//
S32 Xing_valid;
S32 Info_valid;
U32 header_flags;
S32 frame_count;
S32 byte_count;
S32 VBR_scale;
U8 TOC[100];
S32 enc_delay;
S32 enc_padding;
//
// Private (undocumented) data used during frame enumeration
//
U8 *ptr;
S32 bytes_left;
S32 check_valid;
S32 check_MPEG1;
S32 check_MPEG25;
S32 check_layer;
S32 check_protection_bit;
S32 check_sampling_frequency;
S32 check_mode;
S32 check_copyright;
S32 check_original;
}
MP3_INFO;
DXDEC void AILCALL AIL_inspect_MP3 (MP3_INFO *inspection_state,
U8 *MP3_file_image,
S32 MP3_image_size);
DXDEC S32 AILCALL AIL_enumerate_MP3_frames (MP3_INFO *inspection_state);
typedef struct
{
//
// File-level data accessible to app
//
// This is valid after AIL_inspect_Ogg() is called (even if the file contains no valid pages)
//
U8 *Ogg_file_image; // Originally passed to AIL_inspect_Ogg()
S32 Ogg_image_size; // Originally passed to AIL_inspect_Ogg()
U8 *start_Ogg_data; // Pointer to start of data area in file
U8 *end_Ogg_data; // Pointer to last valid byte in data area
// Information lifted from the header after AIL_inspect_Ogg() is called.
S32 channel_count;
S32 sample_rate;
//
// Information about current page being inspected, valid if AIL_enumerate_Ogg_pages() returns
// TRUE
//
S32 page_num; // 32-bit page sequence number from OggS header at byte offset 16
S32 sample_count; // Total # of samples already generated by encoder at the time the current page was written
S32 byte_offset; // Offset of page from start_Ogg_data (i.e., suitable for use as loop point)
S32 next_page_expected; // Anticipated offset of next page to be enumerated, if any
//
// Private (undocumented) data used during page enumeration
//
U8 *ptr;
S32 bytes_left;
}
OGG_INFO;
DXDEC void AILCALL AIL_inspect_Ogg (OGG_INFO *inspection_state,
U8 *Ogg_file_image,
S32 Ogg_file_size);
DXDEC S32 AILCALL AIL_enumerate_Ogg_pages (OGG_INFO *inspection_state);
typedef struct
{
const char* file_image;
S32 image_size;
S32 channel_count;
S32 sample_rate;
S32 total_samples;
S32 samples_per_frame;
const char* current_frame;
// output data - byte offset for current frame.
S32 byte_offset;
} BINKA_INFO;
DXDEC U32 AILCALL AIL_inspect_BinkA(BINKA_INFO* state, char const* file_image, S32 file_size);
DXDEC S32 AILCALL AIL_enumerate_BinkA_frames(BINKA_INFO* state);
//
// RAD room types - currently the same as EAX
//
enum
{
ENVIRONMENT_GENERIC, // factory default
ENVIRONMENT_PADDEDCELL,
ENVIRONMENT_ROOM, // standard environments
ENVIRONMENT_BATHROOM,
ENVIRONMENT_LIVINGROOM,
ENVIRONMENT_STONEROOM,
ENVIRONMENT_AUDITORIUM,
ENVIRONMENT_CONCERTHALL,
ENVIRONMENT_CAVE,
ENVIRONMENT_ARENA,
ENVIRONMENT_HANGAR,
ENVIRONMENT_CARPETEDHALLWAY,
ENVIRONMENT_HALLWAY,
ENVIRONMENT_STONECORRIDOR,
ENVIRONMENT_ALLEY,
ENVIRONMENT_FOREST,
ENVIRONMENT_CITY,
ENVIRONMENT_MOUNTAINS,
ENVIRONMENT_QUARRY,
ENVIRONMENT_PLAIN,
ENVIRONMENT_PARKINGLOT,
ENVIRONMENT_SEWERPIPE,
ENVIRONMENT_UNDERWATER,
ENVIRONMENT_DRUGGED,
ENVIRONMENT_DIZZY,
ENVIRONMENT_PSYCHOTIC,
ENVIRONMENT_COUNT // total number of environments
};
//
// enumerated values for EAX
//
#ifndef EAX_H_INCLUDED
enum
{
EAX_ENVIRONMENT_GENERIC, // factory default
EAX_ENVIRONMENT_PADDEDCELL,
EAX_ENVIRONMENT_ROOM, // standard environments
EAX_ENVIRONMENT_BATHROOM,
EAX_ENVIRONMENT_LIVINGROOM,
EAX_ENVIRONMENT_STONEROOM,
EAX_ENVIRONMENT_AUDITORIUM,
EAX_ENVIRONMENT_CONCERTHALL,
EAX_ENVIRONMENT_CAVE,
EAX_ENVIRONMENT_ARENA,
EAX_ENVIRONMENT_HANGAR,
EAX_ENVIRONMENT_CARPETEDHALLWAY,
EAX_ENVIRONMENT_HALLWAY,
EAX_ENVIRONMENT_STONECORRIDOR,
EAX_ENVIRONMENT_ALLEY,
EAX_ENVIRONMENT_FOREST,
EAX_ENVIRONMENT_CITY,
EAX_ENVIRONMENT_MOUNTAINS,
EAX_ENVIRONMENT_QUARRY,
EAX_ENVIRONMENT_PLAIN,
EAX_ENVIRONMENT_PARKINGLOT,
EAX_ENVIRONMENT_SEWERPIPE,
EAX_ENVIRONMENT_UNDERWATER,
EAX_ENVIRONMENT_DRUGGED,
EAX_ENVIRONMENT_DIZZY,
EAX_ENVIRONMENT_PSYCHOTIC,
EAX_ENVIRONMENT_COUNT // total number of environments
};
#define EAX_REVERBMIX_USEDISTANCE (-1.0F)
#endif
#define MSS_BUFFER_HEAD (-1)
//
// Auxiliary 2D interface calls
//
DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary);
//
// 3D-related calls
//
DXDEC S32 AILCALL AIL_room_type (HDIGDRIVER dig,
S32 bus_index);
DXDEC void AILCALL AIL_set_room_type (HDIGDRIVER dig,
S32 bus_index,
S32 room_type);
DXDEC F32 AILCALL AIL_3D_rolloff_factor (HDIGDRIVER dig);
DXDEC void AILCALL AIL_set_3D_rolloff_factor (HDIGDRIVER dig,
F32 factor);
DXDEC F32 AILCALL AIL_3D_doppler_factor (HDIGDRIVER dig);
DXDEC void AILCALL AIL_set_3D_doppler_factor (HDIGDRIVER dig,
F32 factor);
DXDEC F32 AILCALL AIL_3D_distance_factor (HDIGDRIVER dig);
DXDEC void AILCALL AIL_set_3D_distance_factor (HDIGDRIVER dig,
F32 factor);
DXDEC void AILCALL AIL_set_sample_obstruction (HSAMPLE S,
F32 obstruction);
DXDEC void AILCALL AIL_set_sample_occlusion (HSAMPLE S,
F32 occlusion);
DXDEC void AILCALL AIL_set_sample_exclusion (HSAMPLE S,
F32 exclusion);
DXDEC F32 AILCALL AIL_sample_obstruction (HSAMPLE S);
DXDEC F32 AILCALL AIL_sample_occlusion (HSAMPLE S);
DXDEC F32 AILCALL AIL_sample_exclusion (HSAMPLE S);
EXPGROUP(3D Digital Audio Services)
DXDEC EXPAPI void AILCALL AIL_set_sample_3D_volume_falloff(HSAMPLE S, MSSGRAPHPOINT* graph, S32 pointcount);
/*
Sets a sample's volume falloff graph.
$:S Sample to affect
$:graph The array of points to use as the graph.
$:pointcount The number of points passed in. Must be less than or equal to MILES_MAX_FALLOFF_GRAPH_POINTS. Passing 0 removes the graph.
This marks a sample as having a volume falloff graph. If a sample has a volume graph, it no
longer attenuates as per the default falloff function, and as such, its "minimum distance" no
longer has any effect. However, the "max distance" still clamps the sample to full attenuation.
A graph with only one point is treated as a line, returning graph[0].Y always.
Otherwise, the graph is evaluated as follows:
The distance to the listener is evaluated.
The two points with X values bounding "distance" are located.
If the distance is past the last graph point, graph[pointcount-1].Y is returned.
If either the output tangent type of the previous point, or the input tangent type of the next point are
MILES_TANGENT_STEP, previous->Y is returned.
Otherwise, the segment is evaluated as a hermite curve. ITX and ITY are ignore if ITYpe is MILES_TANGENT_LINEAR,
and likewise OTX and OTY are ignored if OType is MILES_TANGENT_LINEAR.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_3D_lowpass_falloff(HSAMPLE S, MSSGRAPHPOINT* graph, S32 pointcount);
/*
Sets a sample's low pass cutoff falloff graph.
$:S Sample to affect
$:graph The array of points to use as the graph.
$:pointcount The number of points passed in. Must be less than or equal to MILES_MAX_FALLOFF_GRAPH_POINTS. Passing 0 removes the graph.
This marks a sample as having a low pass cutoff that varies as a function of distance to the listener. If
a sample has such a graph, $AIL_set_sample_low_pass_cut_off will be called constantly, and thus shouldn't be
called otherwise.
The graph is evaluated the same as $AIL_set_sample_3D_volume_falloff.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_3D_exclusion_falloff(HSAMPLE S, MSSGRAPHPOINT* graph, S32 pointcount);
/*
Sets a sample's exclusion falloff graph.
$:S Sample to affect
$:graph The array of points to use as the graph.
$:pointcount The number of points passed in. Must be less than or equal to MILES_MAX_FALLOFF_GRAPH_POINTS. Passing 0 removes the graph.
This marks a sample as having an exclusion that varies as a function of distance to the listener. If
a sample has such a graph, auto_3D_wet_atten will be disabled to prevent double affects, as exclusion
affects reverb wet level.
The graph is evaluated the same as $AIL_set_sample_3D_volume_falloff.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_3D_spread_falloff(HSAMPLE S, MSSGRAPHPOINT* graph, S32 pointcount);
/*
Sets a sample's spread falloff graph.
$:S Sample to affect
$:graph The array of points to use as the graph.
$:pointcount The number of points passed in. Must be less than or equal to MILES_MAX_FALLOFF_GRAPH_POINTS. Passing 0 removes the graph.
This marks a sample as having a spread that varies as a function of distance to the listener. See
$AIL_set_sample_3D_spread.
The graph is evaluated the same as $AIL_set_sample_3D_volume_falloff.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_3D_position_segments(HSAMPLE S, MSSVECTOR3D* points, S32 point_count);
/*
Sets a sample's position as a series of line segments.
$:S Sample to affect
$:points The 3D points representing the line segments. 0 reverts to classic point based positioning. All
segments are connected - N points represents N - 1 chained line segments.
$:point_count Size of points array. Minimum 2 (unless removing), max MILES_MAX_SEGMENT_COUNT
This marks a sample as having a position that is not a single point. When 3D attenuation is computed,
the closest point to the listener is found by walking each segment. That position is then used in all
other computations (cones, falloffs, etc). Spatialization is done using all segments as a directional
source.
If there is neither spread falloff nor volume falloff specified, spread will be automatically applied
when the listener is within min_distance to the closest point. See $AIL_set_sample_3D_spread_falloff
and $AIL_set_sample_3D_volume_falloff.
*/
DXDEC EXPAPI void AILCALL AIL_set_sample_3D_spread(HSAMPLE S, F32 spread);
/*
Sets a sample's "spread" value.
$:S Sample to affect.
$:spread The value to set the spread to.
Spread is how much the directionality of a sample "spreads" to more speakers - emulating
the effect a sound has when it occupies more than a point source. For instance, a sound
point source that sits directly to the left of the listener would have a very strong left
speaker signal, and a fairly weak right speaker signal. Via spread, the signal would be
more even, causing the source to feel as though it is coming from an area, rather than
a point source.
A spread of 1 will effectively negate any spatialization effects other than distance attenuation.
*/
DXDEC void AILCALL AIL_set_sample_3D_distances (HSAMPLE S,
F32 max_dist,
F32 min_dist,
S32 auto_3D_wet_atten);
DXDEC void AILCALL AIL_sample_3D_distances (HSAMPLE S,
F32 * max_dist,
F32 * min_dist,
S32 * auto_3D_wet_atten);
DXDEC void AILCALL AIL_set_sample_3D_cone (HSAMPLE S,
F32 inner_angle,
F32 outer_angle,
F32 outer_volume_level);
DXDEC void AILCALL AIL_sample_3D_cone (HSAMPLE S,
F32* inner_angle,
F32* outer_angle,
F32* outer_volume_level);
DXDEC void AILCALL AIL_set_sample_3D_position (HSAMPLE obj,
F32 X,
F32 Y,
F32 Z);
DXDEC void AILCALL AIL_set_sample_3D_velocity (HSAMPLE obj,
F32 dX_per_ms,
F32 dY_per_ms,
F32 dZ_per_ms,
F32 magnitude);
DXDEC void AILCALL AIL_set_sample_3D_velocity_vector (HSAMPLE obj,
F32 dX_per_ms,
F32 dY_per_ms,
F32 dZ_per_ms);
DXDEC void AILCALL AIL_set_sample_3D_orientation (HSAMPLE obj,
F32 X_face,
F32 Y_face,
F32 Z_face,
F32 X_up,
F32 Y_up,
F32 Z_up);
DXDEC S32 AILCALL AIL_sample_3D_position (HSAMPLE obj,
F32 *X,
F32 *Y,
F32 *Z);
DXDEC void AILCALL AIL_sample_3D_velocity (HSAMPLE obj,
F32 *dX_per_ms,
F32 *dY_per_ms,
F32 *dZ_per_ms);
DXDEC void AILCALL AIL_sample_3D_orientation (HSAMPLE obj,
F32 *X_face,
F32 *Y_face,
F32 *Z_face,
F32 *X_up,
F32 *Y_up,
F32 *Z_up);
DXDEC void AILCALL AIL_update_sample_3D_position (HSAMPLE obj,
F32 dt_milliseconds);
DXDEC void AILCALL AIL_set_listener_3D_position (HDIGDRIVER dig,
F32 X,
F32 Y,
F32 Z);
DXDEC void AILCALL AIL_set_listener_3D_velocity (HDIGDRIVER dig,
F32 dX_per_ms,
F32 dY_per_ms,
F32 dZ_per_ms,
F32 magnitude);
DXDEC void AILCALL AIL_set_listener_3D_velocity_vector (HDIGDRIVER dig,
F32 dX_per_ms,
F32 dY_per_ms,
F32 dZ_per_ms);
DXDEC void AILCALL AIL_set_listener_3D_orientation (HDIGDRIVER dig,
F32 X_face,
F32 Y_face,
F32 Z_face,
F32 X_up,
F32 Y_up,
F32 Z_up);
DXDEC void AILCALL AIL_listener_3D_position (HDIGDRIVER dig,
F32 *X,
F32 *Y,
F32 *Z);
DXDEC void AILCALL AIL_listener_3D_velocity (HDIGDRIVER dig,
F32 *dX_per_ms,
F32 *dY_per_ms,
F32 *dZ_per_ms);
DXDEC void AILCALL AIL_listener_3D_orientation (HDIGDRIVER dig,
F32 *X_face,
F32 *Y_face,
F32 *Z_face,
F32 *X_up,
F32 *Y_up,
F32 *Z_up);
DXDEC void AILCALL AIL_update_listener_3D_position (HDIGDRIVER dig,
F32 dt_milliseconds);
#if defined( HOST_SPU_PROCESS )
DXDEC S32 AILCALL MilesStartAsyncThread( S32 thread_num, void const * param );
DXDEC S32 AILCALL MilesRequestStopAsyncThread( S32 thread_num );
DXDEC S32 AILCALL MilesWaitStopAsyncThread( S32 thread_num );
#endif
//-----------------------------------------------------------------------------
//
// MSS 8 Bank API
//
//-----------------------------------------------------------------------------
EXPGROUP(Miles High Level Event System)
// misc character maxes.
#define MSS_MAX_ASSET_NAME_BYTES 512
#define MSS_MAX_PATH_BYTES 512
#ifdef DOCS_ONLY
EXPTYPE typedef struct MSSSOUNDBANK {};
/*
Internal structure.
Use $HMSOUNDBANK instead.
*/
#endif
EXPTYPE typedef struct SoundBank *HMSOUNDBANK;
/*
Describes a handle to an open sound bank.
This handle typedef refers to an open soundbank which is usually obtained from the $AIL_add_soundbank function.
*/
EXPGROUP(highlevel_util)
DXDEC EXPAPI HMSOUNDBANK AILCALL AIL_open_soundbank(char const *filename, char const* name);
/*
Open a sound bank. If you are using the event execution engine, use the add soundbank function
provided there.
$:return 0 on fail, or a valid HMSOUNDBANK.
$:filename The filename of the soundbank to open.
Opens a sound bank for use with the MSS8 high level functions. The sound bank must be
closed with $AIL_close_soundbank. Use $AIL_add_soundbank if the Miles Event system is used.
*/
DXDEC EXPAPI void AILCALL AIL_close_soundbank(HMSOUNDBANK bank);
/*
Close a soundbank previously opened with $AIL_open_soundbank.
$:bank Soundbank to close.
Close a soundbank previously opened with $AIL_open_soundbank. Presets/events loaded from
this soundbank are no longer valid.
*/
DXDEC EXPAPI char const * AILCALL AIL_get_soundbank_filename(HMSOUNDBANK bank);
/*
Return the filename used to open the given soundbank.
$:bank Soundbank to query.
$:return A pointer to the filename for the given soundbank, or 0 if bank is invalid.
Returns a pointer to the filename for a soundbank. This pointer should not be deleted.
*/
DXDEC EXPAPI char const * AILCALL AIL_get_soundbank_name(HMSOUNDBANK bank);
/*
Return the name of the given soundbank.
$:bank Soundbank to query.
$:return A pointer to the name of the sound bank, or 0 if the bank is invalid.
The name of the bank is the name used in asset names. This is distinct from the
file name of the bank.
The return value should not be deleted.
*/
DXDEC EXPAPI S32 AILCALL AIL_get_soundbank_mem_usage(HMSOUNDBANK bank);
/*
Returns the amount of data used by the soundbank management structures.
$:bank Soundbank to query.
$:return Total memory allocated.
Returns the memory used via AIL_mem_alloc_lock during the creation of this structure.
*/
DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_presets(HMSOUNDBANK bank, HMSSENUM* next, char const* list, char const** name);
/*
Enumerate the sound presets stored in a soundbank.
$:bank Containing soundbank.
$:next Enumeration token. Prior to first call, initialize to MSS_FIRST
$:list Optional filter. If specified, presets will only enumerate from the given preset sound preset list.
$:name The pointer to the currently enumerated preset name. This should not be deleted.
$:return Returns 0 when enumeration is complete.
Enumerates the sound presets available inside of a bank file. Example usage:
${
HMSSENUM Token = MSS_FIRST;
const char* PresetName = 0;
while (AIL_enumerate_sound_presets(MyBank, &Token, 0, &PresetName))
{
printf("Found a preset named %s!", PresetName);
$AIL_apply_sound_preset(MySample, MyBank, PresetName);
}
$}
Note that name should NOT be deleted by the caller - this points at memory owned by
Miles.
*/
DXDEC EXPAPI S32 AILCALL AIL_enumerate_environment_presets(HMSOUNDBANK bank, HMSSENUM* next, char const* list, char const** name);
/*
Enumerate the environment presets stored in a soundbank.
$:bank Containing soundbank.
$:next Enumeration token. Prior to first call, initialize to MSS_FIRST
$:list Optional filter. If specified, presets will only enumerate from the given environment preset list.
$:name The pointer to the currently enumerated preset name. This should not be deleted.
$:return Returns 0 when enumeration is complete.
Enumerates the environment presets available inside of a bank file. Example usage:
${
HMSSENUM Token = MSS_FIRST;
const char* PresetName = 0;
while (AIL_enumerate_environment_presets(MyBank, &Token, 0, &PresetName))
{
printf("Found a preset named %s!", PresetName);
AIL_apply_environment_preset(MyDriver, MyBank, PresetName);
}
$}
Note that name should NOT be deleted by the caller - this points at memory owned by
Miles.
*/
DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_assets(HMSOUNDBANK bank, HMSSENUM* next, char const** name);
/*
Enumerate sounds stored in a soundbank.
$:bank Containing soundbank.
$:next Enumeration token. Prior to first call, initialize to MSS_FIRST
$:name The pointer to the currently enumerated sound name. This should not be deleted.
$:return Returns 0 when enumeration is complete.
Enumerates the sounds available inside of a bank file. Example usage:
${
HMSSENUM Token = MSS_FIRST;
const char* SoundName = 0;
while (AIL_enumerate_sound_assets(MyBank, &Token, &SoundName))
{
char filename[MSS_MAX_PATH_BYTES];
AIL_sound_asset_filename(MyBank, SoundName, filename);
printf("Found a sound named %s!", SoundName);
S32* pData = (S32*)AIL_file_read(filename, FILE_READ_WITH_SIZE);
AIL_mem_free_lock(pData);
}
$}
Note that name should NOT be deleted by the caller - this points at memory owned by
Miles.
*/
DXDEC EXPAPI S32 AILCALL AIL_enumerate_events(HMSOUNDBANK bank, HMSSENUM* next, char const * list, char const ** name);
/*
Enumerate the events stored in a soundbank.
$:bank Soundbank to enumerate within.
$:next Enumeration token. Prior to first call, initialize to MSS_FIRST
$:list Optional filter. If specified, event will only enumerate from the given event list.
$:name The pointer to the currently enumerated preset name. This should not be deleted.
$:return Returns 0 when enumeration is complete.
Enumerates the events available inside of a bank file. Example usage:
${
HMSSENUM Token = MSS_FIRST;
const char* EventName = 0;
while (AIL_enumerate_events(MyBank, &Token, 0, &EventName))
{
printf("Found an event named %s!", EventName);
const U8* EventContents = 0;
AIL_get_event_contents(MyBank, EventName, &EventContents);
AIL_enqueue_event(EventContents, 0, 0, 0, 0);
}
$}
Note that name should NOT be deleted by the caller - this points at memory owned by
Miles.
*/
DXDEC EXPAPI void* AILCALL AIL_find_environment_preset(HMSOUNDBANK bank, char const *name);
/*
Returns the raw environment data associated with the given name.
$:bank The bank to look within
$:name The name of the asset to search for, including bank name.
$:return Raw environment data. This should not be deleted.
This function is designed to be used with $AIL_apply_raw_environment_preset.
*/
DXDEC EXPAPI void* AILCALL AIL_find_sound_preset(HMSOUNDBANK bank, char const* name);
/*
Returns the raw preset data associated with the given name.
$:bank The bank to look within
$:name The name of the asset to search for, including bank name.
$:return Raw preset data. This should not be deleted.
This function is designed to be used with $AIL_apply_raw_sound_preset.
*/
DXDEC EXPAPI S32 AILCALL AIL_apply_raw_sound_preset(HSAMPLE sample, void* preset);
/*
Applies the sound preset to the given sample.
$:sample The sample to modify.
$:preset The raw preset data to apply, returned from $AIL_find_sound_preset
Updates sample properties based on the desired settings specified in the given preset.
*/
DXDEC EXPAPI S32 AILCALL AIL_apply_sound_preset(HSAMPLE sample, HMSOUNDBANK bank, char const *name);
/*
Apply the sound preset to the given sample.
$:sample The sample that will have its properties updated by the preset.
$:bank The sound bank containing the named preset.
$:name The name of the preset to apply.
$:return Returns 0 on fail - check for sample/bank validity, and that the preset is in the correct bank.
This will alter the properties on a given sample, based on the given preset.
*/
DXDEC EXPAPI S32 AILCALL AIL_unapply_raw_sound_preset(HSAMPLE sample, void* preset);
/*
Returns the properties altered by the preset to their default state.
$:sample The sample to update.
$:preset The raw preset data to unapply, returned from $AIL_find_sound_preset
*/
DXDEC EXPAPI S32 AILCALL AIL_unapply_sound_preset(HSAMPLE sample, HMSOUNDBANK bank, char const *name);
/*
Restore the properties affected by the given preset to defaults.
$:sample The sample that will have its properties updated by the preset.
$:bank The sound bank containing the named preset.
$:name The name of the preset to apply.
$:return Returns 0 on fail - check for sample/bank validity, and that the preset is in the correct bank.
Presets may or may not affect any given property. Only the properties affected by the specified
preset will have their values restored to default.
*/
typedef S32 (*MilesResolveFunc)(void* context, char const* exp, S32 explen, EXPOUT void* output, S32 isfloat);
/*
Callback type for resolving variable expressions to values.
$:context Value passed to AIL_resolve_raw_*_preset().
$:exp The string expression to resolve.
$:explen Length of exp.
$:output Pointer to the memory to receive the result value.
$:isfloat nonzero if the output needs to be a float.
The function callback should convert variable expressions in to an output value of the
requested type.
*/
DXDEC EXPAPI S32 AILCALL AIL_resolve_raw_sound_preset(void* preset, void* context, MilesResolveFunc eval);
/*
Compute the value of properties for the current value of variables using the given lookup function.
$:preset The raw preset as returns from $AIL_find_sound_preset.
$:context The context to pass in to the resolution function.
$:eval A function pointer to use for resolving expressions to values.
$:return 0 if the preset is invalid.
This function converts variable expressions that were stored in the preset in to values
that can be used by the event system. The values are stored in the preset itself, all that
has to happen is this is called with a valid resolve function prior to calling
$AIL_apply_raw_sound_preset.
*/
DXDEC EXPAPI S32 AILCALL AIL_resolve_raw_environment_preset(void* env, MilesResolveFunc eval);
/*
Compute the value of properties for the current value of variables using the given lookup function.
$:env The raw preset as returns from $AIL_find_environment_preset.
$:context The context to pass in to the resolution function.
$:eval A function pointer to use for resolving expressions to values.
$:return 0 if the preset is invalid.
This function converts variable expressions that were stored in the environment in to values
that can be used by the event system. The values are stored in the environment itself, all that
has to happen is this is called with a valid resolve function prior to calling
$AIL_apply_raw_environment_preset.
*/
DXDEC EXPAPI S32 AILCALL AIL_apply_raw_environment_preset(HDIGDRIVER dig, void* environment);
/*
Applies the environment to the given driver.
$:dig The driver to modify.
$:environment The raw environment data to apply, returned from $AIL_find_environment_preset
Updates driver properties based on the desired settings specified in the given environment.
*/
DXDEC EXPAPI S32 AILCALL AIL_apply_environment_preset(HDIGDRIVER dig, HMSOUNDBANK bank, char const *name);
/*
Apply the environment preset to the given driver.
$:dig The driver that will have its properties updated by the preset.
$:bank The sound bank containing the named preset.
$:name The name of the preset to apply.
$:return Returns 0 on fail - check for sample/bank validity, and that the preset is in the correct bank.
This will alter properties on a given driver, based on the given preset.
*/
DXDEC EXPAPI S32 AILCALL AIL_unapply_raw_environment_preset(HDIGDRIVER dig, void* environment);
/*
Returns the properties the environment affects to default state.
$:dig The driver to modify.
$:environment The raw environment data to unapply, returned from $AIL_find_environment_preset
*/
DXDEC EXPAPI S32 AILCALL AIL_unapply_environment_preset(HDIGDRIVER dig, HMSOUNDBANK bank, char const *name);
/*
Restore the properties affected by the given preset to defaults.
$:dig The driver that will have its properties updated by the preset.
$:bank The sound bank containing the named preset.
$:name The name of the preset to apply.
$:return Returns 0 on fail - check for sample/bank validity, and that the preset is in the correct bank.
Presets may or may not affect any given property. Only the properties affected by the specified
preset will have its value restored to default.
*/
EXPTYPE typedef struct _MILESBANKSOUNDINFO
{
// If this changes at all, compiled banks must be versioned...
S32 ChannelCount;
U32 ChannelMask;
S32 Rate;
S32 DataLen;
S32 SoundLimit;
S32 IsExternal;
U32 DurationMs;
S32 StreamBufferSize;
S32 IsAdpcm;
S32 AdpcmBlockSize;
F32 MixVolumeDAC;
} MILESBANKSOUNDINFO;
/*
Structure containing all metadata associated with a sound asset.
$:ChannelCount The number of channels the sound assets contains.
$:ChannelMask The channel mask for the sound asset.
$:Rate The sample rate for the sound asset.
$:DataLen The byte count the asset requires if fully loaded.
$:SoundLimit The maximum number of instances of this sound that is allowed to play at once.
$:IsExternal Nonzero if the sound is stored external to the sound bank. See the eventexternal sample.
$:DurationMs The length of the sound asset, in milliseconds.
$:StreamBufferSize If the sound is played as a stream, this is the buffer to use for this sound.
$:IsAdpcm Nonzero if the asset is an adpcm sound, and needs to be initialized as such.
$:AdpcmBlockSize The adpcm block size if the asset is adpcm encoded.
$:MixVolumeDAC The attenuation to apply to all instances of this sound, as a DAC scalar.
See $AIL_sound_asset_info.
*/
DXDEC EXPAPI S32 AILCALL AIL_sound_asset_info(HMSOUNDBANK bank, char const* name, char* out_name, MILESBANKSOUNDINFO* out_info);
/*
Return the meta data associated with a sound assets in a sound bank.
$:bank The soundbank containing the sound asset.
$:name The name of the sound asset to find.
$:out_name Optional - Pointer to a buffer that is filled with the sound filename to use for loading.
$:out_info Pointer to a $MILESBANKSOUNDINFO structure that is filled with meta data about the sound asset.
$:return Returns the byte size of the buffer required for out_name.
This function must be called in order to resolve the sound asset name to
something that can be used by miles. To ensure safe buffer containment, call
once with out_name as null to get the size needed.
For external deployment see the eventexternal example program.
*/
DXDEC EXPAPI SINTa AILCALL AIL_get_marker_list(HMSOUNDBANK bank, char const* sound_name);
/*
Return an opaque value representing the list of markers attached to a given sound name.
$:bank The bank containing the sound asset.
$:sound_name The name of the sound asset.
$:return on fail/nonexistent list, or a nonzero opaque value to be passed to $AIL_find_marker_in_list.
Returns the marker list for a given sound asset. This value should just be passed directly to $AIL_find_marker_in_list
to retrieve the offset for a marker by name.
*/
DXDEC EXPAPI S32 AILCALL AIL_find_marker_in_list(SINTa marker_list, char const * marker_name, S32* is_samples);
/*
Returns the byte offset into a sample corresponding to the given marker name.
$:marker_list The marker list returned from $AIL_get_marker_list.
$:marker_name The name of the marker to look up.
$:is_samples returns whether the marker is at a sample location instead of a byte location.
$:return -1 if the marker was not found, or the byte offset of the marker.
Looks up an offset to use in functions such as $AIL_set_sample_position. marker_list can be retrieved with
$AIL_get_marker_list.
*/
// ----------------------------
// End MSS8 declarations
// ----------------------------
//
// Event routines
//
typedef struct _MEMDUMP* HMEMDUMP;
#define HMSSEVENTCONSTRUCT HMEMDUMP
/*!
function
{
ExcludeOn = 1
Name = "AIL_create_event", "Creates an empty event to be filled with steps."
ReturnType = "HMSSEVENTCONSTRUCT", "An empty event to be passed to the various step addition functions, or 0 if out of memory."
Discussion = "Primarily designed for offline use, this function is the first step in
creating an event that can be consumed by the MilesEvent system. Usage is as follows:
HMSSEVENTCONSTRUCT hEvent = AIL_create_event();
// misc add functions
AIL_add_start_sound_event_step(hEvent, ...);
AIL_add_control_sounds_event_step(hEvent, ...);
// etc
char* pEvent = AIL_close_event(hEvent);
// Do something with the event
AIL_mem_free_lock(pEvent);
Note that if immediately passed to AIL_enqueue_event(), the memory must remain valid until the following
$AIL_complete_event_queue_processing.
Events are generally tailored to the MilesEvent system, even though there is nothing preventing you
from writing your own event system, or creation ui.
"
}
*/
DXDEC HMSSEVENTCONSTRUCT AILCALL AIL_create_event(void);
/*!
function
{
ExcludeOn = 1
Name = "AIL_close_event", "Returns a completed event, ready for enqueueing in to the MilesEvent system."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to complete."
ReturnType = "char*", "An allocated event string that can be passed to AIL_next_event_step or enqueued in the
MilesEvent system via AIL_enqueue_event."
Discussion = "The returned pointer must be deleted via AIL_mem_free_lock(). Note that if the MilesEvent system
is used, the event pointer must remain valid through the following $AIL_complete_event_queue_processing call."
}
*/
DXDEC U8* AILCALL AIL_close_event(HMSSEVENTCONSTRUCT i_Event);
EXPTYPEBEGIN typedef S32 MILES_START_STEP_EVICTION_TYPE;
#define MILES_START_STEP_PRIORITY 0
#define MILES_START_STEP_DISTANCE 1
#define MILES_START_STEP_VOLUME 2
#define MILES_START_STEP_OLDEST 3
EXPTYPEEND
/*
Determines the behavior of a sound if it encounters a limit trying to play.
$:MILES_START_STEP_PRIORITY Evict a sound less than our priority.
$:MILES_START_STEP_DISTANCE Evict the farthest sound from the listener.
$:MILES_START_STEP_VOLUME Evict the quietest sound after mixing, using the loudest channel as the qualifier.
$:MILES_START_STEP_OLDEST Evict the sound that has been playing the longest.
See also $AIL_add_start_sound_event_step.
*/
EXPTYPEBEGIN typedef S32 MILES_START_STEP_SELECTION_TYPE;
#define MILES_START_STEP_RANDOM 0
#define MILES_START_STEP_NO_REPEATS 1
#define MILES_START_STEP_IN_ORDER 2
#define MILES_START_STEP_RANDOM_ALL_BEFORE_REPEAT 3
#define MILES_START_STEP_BLENDED 4
#define MILES_START_STEP_SELECT_MASK 0x7
#define MILES_START_STEP_SELECT_BITS 3
EXPTYPEEND
/*
Determines the usage of the sound names list in the $AIL_add_start_sound_event_step.
$:MILES_START_STEP_RANDOM Randomly select from the list, and allow the same
sound to play twice in a row. This is the only selection type that doesn't require
a state variable.
$:MILES_START_STEP_NO_REPEATS Randomly select from the list, but prevent the last sound from being the same.
$:MILES_START_STEP_IN_ORDER Play the list in order, looping.
$:MILES_START_STEP_RANDOM_ALL_BEFORE_REPEAT Randomly select from the list, but don't allow duplicates until all sounds have been played.
$:MILES_START_STEP_BLENDED Play *all* of the sounds, using the state variable as both the variable name to poll,
and the name of the blend function to look up. The blend should have been specified prior to execution of
this step in the runtime, see $AIL_add_setblend_event_step.
$:MILES_START_STEP_SELECT_MASK Expect a value from the game to determine which sound to play, added in to the other selection type.
*/
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_start_sound_event_step", "Adds a step to a given event to start a sound with the given specifications."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add the step to."
In = "const char*", "i_SoundNames", "The names and associated weights for the event step to choose from.
If there are multiple names listed, the sound will be chosen at random based on the given weights. This
string is of the form 'BankName1/SoundName1:Weight1:BankName2/SoundName2:Weight2:' etc. The string must always
terminate in a ':'. Weight must be between 0 and 200. To provide a null sound to randomly choose to not play anything, use
an empty string as an entry."
In = "const char*", "i_PresetName", "[optional] The name of the preset, of the form 'PresetList/PresetName'"
In = "U8", "i_PresetIsDynamic", "Nonzero if the preset should poll the value of variables every frame, instead of only when applied."
In = "const char*", "i_EventName", "[optional] The name of the event to execute upon completion of the sound, of the form 'PresetList/PresetName'"
In = "const char*", "i_StartMarker", "[optional] The name of a marker to use as the loop start point."
In = "const char*", "i_EndMarker", "[optional] The name of a marker to use as the loop end point."
In = "const char*", "i_StateVar", "[optional] The name of a variable to use for storing state associated with this start sound step."
In = "char const*", "i_VarInit", "[optional] A list of variable names, mins, and maxes to use for randomizing the sound instance state."
In = "const char*", "i_Labels", "[optional] A comma delimited list of labels to assign to the sound."
In = "U32", "i_Streaming", "If nonzero, the sound will be set up and started as a stream."
In = "U8", "i_CanLoad", "If nonzero, the sound is allowed to hit the disk instead of only accessing cached sounds. If true, this might cause a hitch."
In = "U16", "i_Delay", "The minimum delay in ms to apply to the sound before start."
In = "U16", "i_DelayMax", "The maximum delay in ms to apply to the sound before start."
In = "U8", "i_Priority", "The priority to assign to the sound. If a sound encounters a limit based on its labels, it will evict any sound
with a priority strictly less than the given priority."
In = "U8", "i_LoopCount", "The loop count as per AIL_set_sample_loop_count."
In = "const char*", "i_StartOffset", "[optional] The name of the marker to use as the sound's initial offset."
In = "F32", "i_VolMin", "The min volume value to randomly select for initial volume for the sound. In LinLoud."
In = "F32", "i_VolMax", "The max volume value to randomly select for initial volume for the sound. In LinLoud."
In = "F32", "i_PitchMin", "The min pitch to randomly select from for initial playback. In sT."
In = "F32", "i_PitchMax", "The max pitch to randomly select from for initial playback. In sT."
In = "F32", "i_FadeInTime", "The time to fade the sound in over. Interpolation is linear in loudness."
In = "U8", "i_EvictionType", "The basis for deciding what sound will get kicked out if a limit is hit when trying to play this sound. See $MILES_START_STEP_EVICTION_TYPE."
In = "U8", "i_SelectType", "The method to use for selecting the sound to play from the sound name list. See $MILES_START_SOUND_SELECTION_TYPE."
ReturnType = "S32", "Returns 1 on success."
Discussion = "Adds an event that can start a sound. If the sound names list contains multiple entries, one will be selected
randomly based on the given weights and the selection type. Weights are effectively ratios for likelihood. A sound with 100 weight will be twice as likely
as a sound with 50 weight. Some times you may want to have an event that only *might* play a sound. To do this, add a empty sound name
with an associated weight.
"
}
*/
DXDEC
S32
AILCALL
AIL_add_start_sound_event_step(
HMSSEVENTCONSTRUCT i_Event,
const char* i_SoundNames,
const char* i_PresetName,
U8 i_PresetIsDynamic,
const char* i_EventName,
const char* i_StartMarker, const char* i_EndMarker,
char const* i_StateVar, char const* i_VarInit,
const char* i_Labels, U32 i_Streaming, U8 i_CanLoad,
U16 i_Delay, U16 i_DelayMax, U8 i_Priority, U8 i_LoopCount,
const char* i_StartOffset,
F32 i_VolMin, F32 i_VolMax, F32 i_PitchMin, F32 i_PitchMax,
F32 i_FadeInTime,
U8 i_EvictionType,
U8 i_SelectType
);
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_cache_sounds_event_step", "Adds a step to an event to load a list of sounds in to memory for play."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "bankName", "The bank filename containing all of the sounds."
In = "const char*", "i_Sounds", "A list of colon separated sounds to load from the bank file."
ReturnType = "S32", "Returns 1 on success."
Discussion = "In general events are not allowed to hit the disk in order to prevent unexpected hitching during
gameplay. In order to facilitate that, sounds need to be preloaded by this event. Each cache step can only
load sounds from a single bank file, so for multiple bank files, multiple steps will be needed.
In order to release the data loaded by this event, AIL_add_uncache_sounds_event_step() needs to
be called with the same parameters.
If you are using MilesEvent, the data is refcounted so the sound will not be freed until all
samples using it complete."
}
*/
DXDEC
S32
AILCALL
AIL_add_cache_sounds_event_step(
HMSSEVENTCONSTRUCT i_Event, const char* bankName, const char* i_Sounds);
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_uncache_sounds_event_step", "Adds a step to an event to free a list of sounds previously loaded in to memory for play."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "bankName", "The bank filename containing all of the sounds."
In = "const char*", "i_Sounds", "A list of colon separated sounds from the bank file to uncache."
ReturnType = "S32", "Returns 1 on success."
Discussion = "This event released sounds loaded via AIL_add_cache_sounds_event_step()"
}
*/
DXDEC
S32
AILCALL
AIL_add_uncache_sounds_event_step(
HMSSEVENTCONSTRUCT i_Event, const char* bankName, const char* i_Sounds);
EXPTYPEBEGIN typedef S32 MILES_CONTROL_STEP_TYPE;
#define MILES_CONTROL_STEP_STOP 3
#define MILES_CONTROL_STEP_STOP_NO_EVENTS 4
#define MILES_CONTROL_STEP_PASS 0
#define MILES_CONTROL_STEP_PAUSE 1
#define MILES_CONTROL_STEP_RESUME 2
#define MILES_CONTROL_STEP_STOP_FADE 5
EXPTYPEEND
/*
Determines how the playhead is adjusted during a $AIL_add_control_sounds_event_step.
$:MILES_CONTROL_STEP_STOP Stop the affected sounds.
$:MILES_CONTROL_STEP_PASS Do not change the playhead.
$:MILES_CONTROL_STEP_PAUSE Pause the affected sounds.
$:MILES_CONTROL_STEP_RESUME Resume the affected sounds.
$:MILES_CONTROL_STEP_STOP_NO_EVENTS Stop the affected sounds, and prevent their completion events from playing.
$:MILES_CONTROL_STEP_STOP_FADE Stop the sound after fading the sound out linearly in loudness.
*/
#define MILES_CONTROL_STEP_IGNORELOOP 255
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_control_sounds_event_step", "Adds a step to an event to control sample playback by label."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "i_Labels", "[optional] A comma seperated list of labels to control."
In = "const char*", "i_MarkerStart", "[optional] If exists, sets the loop start to the marker's offset."
In = "const char*", "i_MarkerEnd", "[optional] If exists, sets the loop end to the marker's offset."
In = "const char*", "i_Position", "[optional] If exists, sets the current playback position to the marker's offset."
In = "const char*", "i_PresetName", "[optional] The name of the preset to apply, of the form Bank/PresetList/PresetName."
In = "U8", "i_PresetApplyType", "If nonzero, the preset is applied dynamically(the variables are polled every frame)."
In = "U8", "i_LoopCount", "If the loop count is not to be affected, pass MILES_CONTROL_STEP_IGNORELOOP. Otherwise, the sample's loop count will be set to this value."
In = "U8", "i_Type", "The control type requested. See $MILES_CONTROL_STEP_TYPE."
ReturnType = "S32", "Returns 1 on success."
Discussion = "Controls playback of current instances. The sounds are matched either on name or label. If
i_Labels is null, all sounds will be controlled.
"
}
*/
DXDEC
S32
AILCALL
AIL_add_control_sounds_event_step(
HMSSEVENTCONSTRUCT i_Event,
const char* i_Labels, const char* i_MarkerStart, const char* i_MarkerEnd, const char* i_Position,
const char* i_PresetName,
U8 i_PresetApplyType,
F32 i_FadeOutTime,
U8 i_LoopCount, U8 i_Type);
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_apply_environment_event_step", "Adds a step to an event to apply an environment preset."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "i_EnvName", "The name of the environment preset to apply, of the form EnvList/EnvName."
In = "U8", "i_IsDynamic", "If nonzero, any variables in the environment are polled every frame."
ReturnType = "S32", "Returns 1 on success."
Discussion = "Applies the specified environment preset to the current HDIGDRIVER."
}
*/
DXDEC S32 AILCALL AIL_add_apply_environment_event_step(HMSSEVENTCONSTRUCT i_Event, const char* i_EnvName, U8 i_IsDynamic);
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_comment_event_step", "Adds a step that represents a comment to the user of the editing tool."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "i_Comment", "A string to display in the editing tool."
ReturnType = "S32", "Returns 1 on success."
Discussion = "This event is ignored in the runtime, and only exist for editing convenience."
}
*/
DXDEC S32 AILCALL AIL_add_comment_event_step(HMSSEVENTCONSTRUCT i_Event, const char* i_Comment);
EXPTYPEBEGIN typedef S32 MILES_RAMP_TYPE;
#define MILES_RAMPTYPE_VOLUME 0
#define MILES_RAMPTYPE_WET 1
#define MILES_RAMPTYPE_LOWPASS 2
#define MILES_RAMPTYPE_RATE 3
EXPTYPEEND
/*
The different values the ramps can affect.
$:MILES_RAMPTYPE_VOLUME The ramp will adjust the sample's volume, and will interpolate in loudness level. Target is in dB.
$:MILES_RAMPTYPE_WET The ramp will affect the sample's reverb wet level, and will interpolate in loudness. Target is in dB.
$:MILES_RAMPTYPE_LOWPASS The ramp will affect the sample's low pass cutoff. Interpolation and target are in Hz.
$:MILES_RAMPTYPE_RATE The ramp will affect the sample's playback rate. Interpolation and target are in sT.
*/
EXPTYPEBEGIN typedef S32 MILES_INTERP_TYPE;
#define MILES_INTERP_LINEAR 0
#define MILES_INTERP_EXP 1
#define MILES_INTERP_SCURVE 2
EXPTYPEEND
/*
The different ways the interpolation occurs for a ramp.
$:MILES_INTERP_LINEAR The ramp will lerp between the current value and the target.
$:MILES_INTERP_EXP The ramp will move toward the target slowly at first, then faster as it closes on its total time.
$:MILES_INTERP_SCURVE The ramp will quickly move to about halfway, then slowly move, then move more quickly as it ends.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_ramp_event_step(
HMSSEVENTCONSTRUCT i_Event, char const* i_Name, char const* i_Labels,
F32 i_Time, char const* i_Target, U8 i_Type, U8 i_ApplyToNew, U8 i_InterpolationType);
/*
Add an event step that updates or creates a new ramp in the runtime.
$:i_Event The event to add the step to.
$:i_Name The name of the ramp. If this name already exists, the ramp will shift its target to the new value.
$:i_Labels The label query determining the sounds the ramp will affect.
$:i_Time The length the time in seconds the ramp will take to reach its target.
$:i_Target The target value, or a variable expression representing the target value. The target's type is
dependent on i_Type.
$:i_Type One of the $MILES_RAMP_TYPE values.
$:i_ApplyToNew If 1, the ramp will affect sounds that start after the ramp is created. If not, it will only affect sounds that
are playing when the ramp is created. This value can not be changed once the ramp has been created.
$:i_InterpolationType The method the ramp will affect the target values. One of $MILES_INTERP_TYPE values.
Ramps are means of interpolating aspects of samples. They are removed from the system if they are targeted to
a value for their type that is a non-op - meaning 0 dB, 0 sT, or >24000 Hz.
Ramps use the current value as the start point for the interpolation. They stay at the target point,
so you can use the same ramp name to adjust a sound's volume down, and later ramp it back up.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_setblend_event_step(HMSSEVENTCONSTRUCT i_Event,
char const* i_Name, S32 i_SoundCount, F32 const* i_InMin, F32 const* i_InMax,
F32 const* i_OutMin, F32 const* i_OutMax, F32 const* i_MinP, F32 const* i_MaxP);
/*
Defines a named blend function to be referenced by a blended sound later.
$:i_Event The event to add the step to.
$:i_Name The name of the blend. This is the name that will be
referenced by the state variable in start sound, as well as the variable name
to set by the game to update the blend for an instance.
$:i_SoundCount The number of sounds this blend will affect. Max 10.
$:i_InMin Array of length i_SoundCount representing the value of the blend variable the sound will start to fade in.
$:i_InMax Array of length i_SoundCount representing the value of the blend variable the sound will reach full volume.
$:i_OutMin Array of length i_SoundCount representing the value of the blend variable the sound will start to fade out.
$:i_OutMax Array of length i_SoundCount representing the value of the blend variable the sound will cease to be audible.
$:i_MinP Array of length i_SoundCount representing the pitch of the sound when it starts to fade in.
$:i_MaxP Array of length i_SoundCount representing the pitch of the sound when it has completed fading out.
This step only sets up the lookup for when a blended sound is actually started. When a blended sound plays, every frame it
polls its state variable, then searches for a blend of the same name. If it finds both, then it uses its index in
the start sounds list to find its relevant values from the blended sound definition.
Once it has the correct values, it uses them to affect the sample as stated in the parameter docs above.
*/
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_sound_limit_event_step", "Adds a step that defines the maximum number of playing sounds per label."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "i_SoundLimits", "A string of the form `"label count:anotherlabel count`"."
ReturnType = "S32", "Returns 1 on success."
Discussion = "Defines limits for instances of sounds on a per label basis. Sounds with multiple labels
must fit under the limits for all of their labels. By default sounds are not limited other than the
Miles max sample count."
}
*/
DXDEC S32 AILCALL
AIL_add_sound_limit_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_LimitName, const char* i_SoundLimits);
/*!
function
{
ExcludeOn = 1
Name = "AIL_add_persist_preset_event_step", "Adds a preset that applies to current sound instances, and continues to be applied to new sounds as they are started."
In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add on to."
In = "const char*", "i_PresetName", "The name of the preset, of the form PresetList/PresetName. See discussion."
In = "const char*", "i_PersistName", "The name of this persisted preset, for future removal."
In = "const char*", "i_Labels", "The labels to apply this preset to."
In = "U8", "i_IsDynamic", "If nonzero, the preset polls its variables every frame."
ReturnType = "S32", "Returns 1 on success."
Discussion = "Defines a preset by name that remains in the system, testing against all started sounds for label match. If a
match occurs, then the preset is applied to the new sound, before the preset specified in the startsound step itself.
In order to remove a persisted preset, refer to it by name, but leave all other parameters null.
Example:
// Persist a preset for players.
AIL_add_persist_preset_event_step(hEvent, , `"Bank/PlayerEffects/Underwater`", `"Underwater`", `"player`");
// Remove the above preset.
AIL_add_persist_preset_event_step(hEvent, 0, `"Underwater`", 0);"
}
*/
DXDEC S32 AILCALL
AIL_add_persist_preset_event_step(HMSSEVENTCONSTRUCT i_Event, const char* i_PresetName, const char* i_PersistName,
const char* i_Labels, U8 i_IsDynamic
);
DXDEC EXPAPI S32 AILCALL AIL_get_event_contents(HMSOUNDBANK bank, char const * name, U8 const** event);
/*
Return the event data for an event, by name.
$:bank Soundbank containing the event.
$:name Name of the event to retrieve.
$:event Returns an output pointer to the event contents. Note that this string isn't null terminated, and
thus shouldn't be checked via strlen, etc.
$:return Returns 0 on fail.
Normally, event contents are meant to be handled by the Miles high-level system via $AIL_enqueue_event,
rather than inspected directly.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_clear_state_event_step(HMSSEVENTCONSTRUCT i_Event);
/*
Clears all persistent state in the runtime.
$:i_Event The event to add the step to.
This removes all state that can stick around after an event in done executing. Ramps, Blends, Persisted
Preset, etc.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_exec_event_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_EventName);
/*
Adds a step to run another named event.
$:i_Event The event to add the step to.
$:i_EventName The name of the event, of the form "Bank/Path/To/Event".
When this step is encountered, the event is enqueued, so it will be executed the following frame (currently). It has the same parent
event mechanics as a completion event, so the QueuedId for a sound started by it will be for the event
that fired this step.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_enable_limit_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_LimitName);
/*
Adds a step to set the currently active limit.
$:i_Event The event to add the step to.
$:i_EventName The name of the limit, as defined by a set_limits event.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_set_lfo_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_Name, char const* i_Base, char const* i_Amp, char const* i_Freq, S32 i_Invert, S32 i_Polarity, S32 i_Waveform, S32 i_DutyCycle, S32 i_IsLFO);
/*
Adds a step to define a variable that oscillates over time.
$:i_Event The event to add the step to.
$:i_Name The nane of the variable to oscillate.
$:i_Base The value to oscillate around, or a variable name to use as the base.
$:i_Amp The maximum value to reach, or a variable name to use as the amplitude.
$:i_Freq The rate at which the oscillation occurs, or a variable name to use as the rate. Rate should not exceed game tick rate / 2.
$:i_Invert Whether the waveform should be inverted.
$:i_Polarity Bipolar (1) or Unipolar (0) - whether the waveform goes around the base or only above it.
$:i_Waveform Sine wave (0), Triangle (1), Saw (2), or Square(3)
$:i_DutyCycle Only valid for square, determines what percent of the wave is "on". (0-100)
$:i_IsLFO If zero, Base is the default value to assign the variable when the settings are applied, and the rest of the parameters are ignored.
*/
DXDEC EXPAPI S32 AILCALL AIL_add_move_var_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_Name, const F32 i_Times[2], const S32 i_InterpolationTypes[2], const F32 i_Values[3]);
/*
Adds a step to set and move a variable over time on a curve.
$:i_Event The event to add the step to.
$:i_Name The variable to move.
$:i_Times The midpoint and final times for the curves
$:i_InterpolationTypes The curve type for the two curves - Curve In (0), Curve Out (1), S-Curve (2), Linear (3)
$:i_Values The initial, midpoint, and final values for the variable.
The variable is locked to this curve over the timeperiod - no interpolation from a previous value is done.
If an existing move var exists when the new one is added, the old one is replaced.
*/
enum EVENT_STEPTYPE
{
EVENT_STEPTYPE_STARTSOUND = 1,
EVENT_STEPTYPE_CONTROLSOUNDS,
EVENT_STEPTYPE_APPLYENV,
EVENT_STEPTYPE_COMMENT,
EVENT_STEPTYPE_CACHESOUNDS,
EVENT_STEPTYPE_PURGESOUNDS,
EVENT_STEPTYPE_SETLIMITS,
EVENT_STEPTYPE_PERSIST,
EVENT_STEPTYPE_VERSION,
EVENT_STEPTYPE_RAMP,
EVENT_STEPTYPE_SETBLEND,
EVENT_STEPTYPE_CLEARSTATE,
EVENT_STEPTYPE_EXECEVENT,
EVENT_STEPTYPE_ENABLELIMIT,
EVENT_STEPTYPE_SETLFO,
EVENT_STEPTYPE_MOVEVAR
};
//! Represents an immutable string that is not null terminated, and shouldn't be deleted.
struct _MSSSTRINGC
{
const char* str;
S32 len;
};
typedef struct _MSSSTRINGC MSSSTRINGC;
/*!
Represents a single step that needs to be executed for an event.
All of the members in the structures share the same definition as
their counterpart params in the functions that added them during
event construction.
*/
struct EVENT_STEP_INFO
{
//! type controls which struct in the union is accessed.
enum EVENT_STEPTYPE type;
union
{
struct
{
MSSSTRINGC soundname;
MSSSTRINGC presetname;
MSSSTRINGC eventname;
MSSSTRINGC labels;
MSSSTRINGC markerstart;
MSSSTRINGC markerend;
MSSSTRINGC startoffset;
MSSSTRINGC statevar;
MSSSTRINGC varinit;
U32 stream;
F32 volmin,volmax,pitchmin,pitchmax;
F32 fadeintime;
U16 delaymin;
U16 delaymax;
U8 canload;
U8 priority;
U8 loopcount;
U8 evictiontype;
U8 selecttype;
U8 presetisdynamic;
} start;
struct
{
MSSSTRINGC labels;
MSSSTRINGC markerstart;
MSSSTRINGC markerend;
MSSSTRINGC position;
MSSSTRINGC presetname;
F32 fadeouttime;
U8 presetapplytype;
U8 loopcount;
U8 type;
} control;
struct
{
MSSSTRINGC envname;
U8 isdynamic;
} env;
struct
{
MSSSTRINGC comment;
} comment;
struct
{
MSSSTRINGC lib;
const char** namelist;
S32 namecount;
} load;
struct
{
MSSSTRINGC limits;
MSSSTRINGC name;
} limits;
struct
{
MSSSTRINGC name;
MSSSTRINGC presetname;
MSSSTRINGC labels;
U8 isdynamic;
} persist;
struct
{
MSSSTRINGC name;
MSSSTRINGC labels;
MSSSTRINGC target;
F32 time;
U8 type;
U8 apply_to_new;
U8 interpolate_type;
} ramp;
struct
{
MSSSTRINGC name;
F32 inmin[10];
F32 inmax[10];
F32 outmin[10];
F32 outmax[10];
F32 minp[10];
F32 maxp[10];
U8 count;
} blend;
struct
{
MSSSTRINGC eventname;
} exec;
struct
{
MSSSTRINGC limitname;
} enablelimit;
struct
{
MSSSTRINGC name;
MSSSTRINGC base;
MSSSTRINGC amplitude;
MSSSTRINGC freq;
S32 invert;
S32 polarity;
S32 waveform;
S32 dutycycle;
S32 islfo;
} setlfo;
struct
{
MSSSTRINGC name;
F32 time[2];
S32 interpolate_type[2];
F32 value[3];
} movevar;
};
};
/*!
function
{
ExcludeOn = 1
Name = "AIL_next_event_step", "Retrieves the next step in the event buffer, parsing it in to a provided buffer."
In = "const U8*", "i_EventString", "The event returned by $AIL_close_event, or a previous call to $AIL_next_event_step"
Out = "const EVENT_STEP_INFO*", "o_Step", "A pointer to the step struct will be stored here."
In = "void*", "i_Buffer", "A working buffer for the function to use for parsing."
In = "S32", "i_BufferSize", "The size in bytes of the working buffer."
ReturnType = "U8 char*", "Returns 0 on fail or when the event string has been exhausted of steps. Otherwise, returns
the string location of the next event step in the buffer."
Discussion = "This function parses the event string in to a struct for usage by the user. This function should only be
used by the MilesEvent system. It returns the pointer to the next step to be passed to this function to get the
next step. In this manner it can be used in a loop:
// Create an event to stop all sounds.
HMSSEVENTCONSTRUCT hEvent = AIL_create_event();
AIL_add_control_sound_event_step(hEvent, 0, 0, 0, 0, 0, 0, 255, 3);
char* pEvent = AIL_close_event(hEvent);
char EventBuffer[4096];
EVENT_STEP_INFO* pStep = 0;
char* pCurrentStep = pEvent;
while (pCurrentStep)
{
pStep = 0;
pCurrentStep = AIL_next_event_step(pCurrentStep, &pStep, EventBuffer, 4096);
if (pStep == 0)
{
// Error, or an empty event. If $AIL_last_error is an empty string, then it was an empty event.
break;
}
// Handle event step.
switch (pStep->type)
{
default: break;
}
}
AIL_mem_free_lock(pEvent);
"
}
*/
DXDEC const U8* AILCALL AIL_next_event_step(const U8* i_EventString, struct EVENT_STEP_INFO** o_Step, void* i_Buffer, S32 i_BufferSize);
// Old style names.
#define AIL_find_event MilesFindEvent
#define AIL_clear_event_queue MilesClearEventQueue
#define AIL_register_random MilesRegisterRand
#define AIL_enumerate_sound_instances MilesEnumerateSoundInstances
#define AIL_enumerate_preset_persists MilesEnumeratePresetPersists
#define AIL_enqueue_event MilesEnqueueEvent
#define AIL_enqueue_event_system MilesEnqueueEventContext
#define AIL_enqueue_event_by_name MilesEnqueueEventByName
#define AIL_begin_event_queue_processing MilesBeginEventQueueProcessing
#define AIL_complete_event_queue_processing MilesCompleteEventQueueProcessing
#define AIL_startup_event_system MilesStartupEventSystem
#define AIL_shutdown_event_system MilesShutdownEventSystem
#define AIL_add_soundbank MilesAddSoundBank
#define AIL_release_soundbank MilesReleaseSoundBank
#define AIL_set_sound_label_limits MilesSetSoundLabelLimits
#define AIL_text_dump_event_system MilesTextDumpEventSystem
#define AIL_event_system_state MilesGetEventSystemState
#define AIL_get_event_length MilesGetEventLength
#define AIL_stop_sound_instances MilesStopSoundInstances
#define AIL_pause_sound_instances MilesPauseSoundInstances
#define AIL_resume_sound_instances MilesResumeSoundInstances
#define AIL_start_sound_instance MilesStartSoundInstance
#define AIL_set_event_error_callback MilesSetEventErrorCallback
#define AIL_set_event_bank_functions MilesSetBankFunctions
#define AIL_get_event_bank_functions MilesGetBankFunctions
#define AIL_set_variable_int MilesSetVarI
#define AIL_set_variable_float MilesSetVarF
#define AIL_variable_int MilesGetVarI
#define AIL_variable_float MilesGetVarF
#define AIL_set_sound_start_offset MilesSetSoundStartOffset
#define AIL_requeue_failed_asyncs MilesRequeueAsyncs
#define AIL_add_event_system MilesAddEventSystem
#define AIL_audition_local_host MilesAuditionLocalHost
#define AIL_audition_connect MilesAuditionConnect
#define AIL_audition_startup MilesAuditionStartup
#define AIL_audition_shutdown MilesAuditionShutdown
EXPGROUP(Miles High Level Event System)
EXPTYPE typedef void* HEVENTSYSTEM;
/*
The type used to distinguish between running event systems.
Only used if multiple event systems are running. See the eventmultiple example.
*/
DXDEC EXPAPI HEVENTSYSTEM AILCALL AIL_startup_event_system(HDIGDRIVER dig, S32 command_buf_len, EXPOUT char* memory_buf, S32 memory_len);
/*
Initializes the Miles Event system and associates it with an open digital driver.
$:dig The digital sound driver that this event system should use.
$:command_buf_len An optional number of bytes to use for the command buffer. If you pass 0, a reasonable default will be used (currently 5K).
$:memory_buf An optional pointer to a memory buffer buffer that the event system will use for all event allocations.
Note that the sound data itself is not stored in this buffer - it is only for internal buffers, the command buffer, and instance data.
Use 0 to let Miles to allocate this buffer itself.
$:memory_len If memory_buf is non-null, then this parameter provides the length. If memory_buf is null, the Miles will
allocate this much memory for internal buffers. If both memory_buf and memory_len are null, the Miles will allocate reasonable default (currently 64K).
$:return Returns 0 on startup failure.
This function starts up the Miles Event System, which is used to trigger events throughout your game.
You call it after $AIL_open_digital_driver.
*/
DXDEC EXPAPI HEVENTSYSTEM AILCALL AIL_add_event_system(HDIGDRIVER dig);
/*
Creates an additional event system attached to a different driver, in the event that you need to trigger events
tied to different sound devices.
$:dig The digital sound driver to attach the new event system to.
$:return A handle to the event system to use in various high level functions.
Both systems will access the same set of loaded soundbanks, and are updated when $AIL_begin_event_queue_processing is called.
To enqueue events to the new system, use $AIL_enqueue_event_system.
To iterate the sounds for the new system, pass the $HEVENTSYSTEM as the first parameter to $AIL_enumerate_sound_instances.
To access or set global variables for the new system, pass the $HEVENTSYSTEM as the context in the variable access functions.
See also the <i>eventmultiple.cpp</i> example program.
*/
DXDEC EXPAPI void AILCALL AIL_shutdown_event_system( void );
/*
Shuts down the Miles event system.
This function will closes everything in the event system - it ignores reference counts. It will free
all event memory, sound banks, and samples used by the system.
*/
DXDEC EXPAPI HMSOUNDBANK AILCALL AIL_add_soundbank(char const * filename, char const* name);
/*
Open and add a sound bank for use with the event system.
$:filename Filename of the bank to load.
$:name The name of the soundbank to load - this is only used for auditioning.
$:return The handle to the newly loaded soundbank (zero on failure).
This function opens the sound bank and makes it available to the event system. The filename
is the name on the media, and the name is the symbolic name you used in the Miles Sound Studio.
You might, for example, be using a soundbank with a platform extension, like: 'gamebank_ps3.msscmp',
and while using the name 'gamebank' for authoring and auditioning.
Sound data is not loaded when this function is called - it is only loaded when the relevant Cache Sounds
is played, or a sound requiring it plays.
This function will access the disc, so you will usually call it at level load time.
If you are using the Auditioner, $AIL_audition_startup and $AIL_audition_connect must be called prior
to this function.
*/
DXDEC EXPAPI S32 AILCALL AIL_release_soundbank(HMSOUNDBANK bank);
/*
Releases a sound bank from the event system.
$:bank The bank to close.
$:return Returns non-zero for success (zero on failure).
This function closes a given soundbank. Any data references in the event system need to be removed beforehand - with
$AIL_enqueue_event_by_name usage this should only be pending sounds with completion events.
Any other data references still existing (queued events, persisted presets, etc) will report errors when used,
but will not crash.
Releasing a sound bank does not free any cached sounds loaded from the bank - any sounds from the bank should be freed
via a Purge Sounds event step. If this does not occur, the sound data will still be loaded, but the
sound metadata will be gone, so Start Sound events will not work. Purge Sounds will still work.
This is different from Miles 8, which would maintain a reference count for all data.
*/
DXDEC U8 const * AILCALL AIL_find_event(HMSOUNDBANK bank,char const* event_name);
/*
(EXPAPI removed to prevent release in docs)
Searches for an event by name in the event system.
$:bank The soundbank to search within, or 0 to search all open banks (which is the normal case).
$:event_name The name of the event to find. This name should be of the form "soundbank/event_list/event_name".
$:return A pointer to the event contents (or 0, if the event isn't found).
This function is normally used as the event parameter for $AIL_enqueue_event. It
searches one or all open soundbanks for a particular event name.
<b>This is deprecated</b>. If you know the event name, you should use $AIL_enqueue_event_by_name, or $AIL_enqueue_event with
MILESEVENT_ENQUEUE_BY_NAME.
Events that are not enqueued by name can not be tracked by the Auditioner.
*/
DXDEC EXPAPI U64 AILCALL AIL_enqueue_event_system(HEVENTSYSTEM system, U8 const * event, void* user_buffer, S32 user_buffer_len, S32 enqueue_flags, U64 apply_to_ID );
/*
Enqueue an event to a specific system. Used only if you have multiple event systems running.
$:system The event system to attach the event to.
$:return See $AIL_enqueue_event for return description.
For full information on the parameters, see $AIL_enqueue_event.
*/
DXDEC EXPAPI U64 AILCALL AIL_enqueue_event_by_name(char const* name);
/*
Enqueue an event by name.
$:name The full name of the event, eg "soundbank/path/to/event".
$:return See $AIL_enqueue_event for return description.
This is the most basic way to enqueue an event. It enqueues an event by name, and as a result the event will be tracked by the auditioner.
For when you need more control over the event, but still want it to be tracked by the auditioner, it is equivalent
to calling $AIL_enqueue_event_end_named($AIL_enqueue_event_start(), name)
For introduction to the auditioning system, see $integrating_events.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_start();
/*
Start assembling a packet to use for enqueuing an event.
$:return A token used for passing to functions that add data to the event.
This is used to pass more data to an event that will be executed. For instance, if
an event is going to spatialize a sound, but there's no need to move the sound over the course of
its lifetime, you can add positional data to the event via $AIL_enqueue_event_position. When a
sound is started it will use that for its initial position, and there is no need to do any
game object <-> event id tracking.
${
// Start the enqueue.
S32 enqueue_token = AIL_enqueue_event_start();
// Tell all sounds started by the event to position at (100, 100, 100)
AIL_enqueue_event_position(&enqueue_token, 100, 100, 100);
// Complete the token and enqueue the event to the command buffer.
AIL_enqueue_event_end_named(enqueue_token);
$}
The enqueue process is still completely thread safe. No locks are used, however only 8
enqueues can be "assembling" at the same time - if more than that occur, the $AIL_enqueue_event_start
will yield the thread until a slot is open.
The ONLY time that should happen is if events enqueues are started but never ended:
${
// Start the enqueue
S32 enqueue_token = AIL_enqueue_event_start();
// Try to get the game position
Vector3* position = GetPositionOfSomething(my_game_object);
if (position == 0)
return; // OOPS! enqueue_token was leaked here, never to be reclaimed.
$}
Each event has a limit to the amount of data that can be attached to it. Currently this
amount is 512 bytes - which should cover all use cases. If any enqueue functions return 0,
then this amount has been reached. The ErrorHandler will be called as well, with $AIL_last_error
reporting that the enqueue buffer was filled.
*/
DXDEC EXPAPI void AILCALL AIL_enqueue_event_cancel(S32 token);
/*
Clears a enqueue token without passing it to the command buffer
$:token A token created with $AIL_enqueue_event_start.
Used to handle the case where you decided to not actually enqueue the event you've assembled.
In general it's better to handle anything that can fail before actually starting
to create the enqueue.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_position(S32* token, F32 x, F32 y, F32 z);
/*
Pass an initial position to an event to use for sound spatialization.
$:token A token created with $AIL_enqueue_event_start.
$:return 0 if the enqueue buffer is full
If the event queued starts a sound, the sound's position will be set to the given coordinates.
Setting the position of a sample automatically enables 3D spatialization.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_velocity(S32* token, F32 vx, F32 vy, F32 vz, F32 mag);
/*
Pass an initial velocity to an event to use for sound spatialization.
$:token A token created with $AIL_enqueue_event_start.
$:return 0 if the enqueue buffer is full
If the event queued starts a sound, the sound's velocity will be set to the given vector.
Setting the velocity of a sample does NOT automatically enable 3D spatialization.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_buffer(S32* token, void* user_buffer, S32 user_buffer_len, S32 user_buffer_is_ptr);
/*
Attaches a user buffer to the event.
$:token A token created with $AIL_enqueue_event_start.
$:user_buffer Pointer to a user buffer to pass with the event. If user_buffer_is_ptr is 1, the pointer is copied
directly and user_buffer_len is ignored.
$:user_buffer_len The size of the user_buffer to attach to the event.
$:user_buffer_is_ptr If 1, the pointer is copied and user_buffer_len is ignored.
$:return 0 if the enqueue buffer is full
User buffers are helpful for bridging the gap between game objects and sound objects.
There are two use cases available in this function
$* <b>Pointer</b> If user_buffer_is_ptr is 1, then the value passed to user_buffer is copied directly as the
user buffer contents, and then exposed during sound enumeration. This is equivalent in spirit to
the void* value that often accompanies callbacks. In this case, user_buffer_len is ignored, as
user_buffer is never dereferenced.
$* <b>Buffer</b> If user_buffer_is_ptr is 0, then user_buffer_len bytes are copied from user_buffer and
carried with the event. During sound enumeration this buffer is made available, and you never have to
worry about memory management.
$-
Pointer-
${
struct useful_data
{
S32 game_stat;
S32 needed_info;
};
useful_data* data = (useful_data*)malloc(sizeof(useful_data));
data->game_stat = 1;
data->needed_info = 2;
// Pointer - the "data" pointer will be copied directly, so we can't free() "data" until after the sound
// completes and we're done using it in the enumeration loop.
S32 ptr_token = AIL_enqueue_event_start();
AIL_enqueue_event_buffer(&ptr_token, data, 0, 1);
AIL_enqueue_event_end_named(ptr_token, "mybank/myevent");
$}
Buffer-
${
struct useful_data
{
S32 game_stat;
S32 needed_info;
};
useful_data data;
data.game_stat = 1;
data.needed_info = 2;
// Buffer - the "data" structure will be copied internally, so we can free() the data - or just use
// a stack variable like this
S32 buf_token = AIL_enqueue_event_start();
AIL_enqueue_event_buffer(&buf_token, &data, sizeof(data), 0);
AIL_enqueue_event_end_named(buf_token, "mybank/myevent");
$}
As noted in $AIL_enqueue_event_start(), there's only 512 bytes available to an enqueue, so that
places an upper limit on the amount of data you can pass along. If the data is huge, then you
should use user_buffer_is_ptr.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_variablef(S32* token, char const* name, F32 value);
/*
Attaches a variable's value to the event enqueue.
$:token A token created with $AIL_enqueue_event_start
$:name The variable name to set.
$:value The value of the variable to set.
$:return 0 if the enqueue buffer is full
When a sound starts, the given variable will be set to the given value prior to any possible
references being used by presets.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_filter(S32* token, U64 apply_to_ID);
/*
Limits the effects of the event to sounds started by the given ID.
$:token A token created with $AIL_enqueue_event_start
$:apply_to_ID The ID to use for filtering. This can be either a sound or event ID. For an
event, it will apply to all sounds started by the event, and any events queued by that event.
$:return 0 if the enqueue buffer is full
IDs are assigned to events and sounds - for events, it is returned via the $AIL_enqueue_event_end_named function
(or any other enqueue function). For sounds, you can access the assigned id during the enumeration process.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_context(S32* token, HEVENTSYSTEM system);
/*
Causes the event to run on a separate running event system.
$:token A token created with $AIL_enqueue_event_start
$:system An event system $AIL_add_event_system
$:return 0 if the enqueue buffer is full
If you are running multiple event systems, this is required to get events
to queue on the additional event systems.
*/
DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_selection(S32* token, U32 selection);
/*
Passes in a selection value for start sound events to use for picking sounds.
$:token A token created with $AIL_enqueue_event_start.
$:selection The value to use for selecting the sound to play.
$:return 0 if the enqueue buffer is full
The selection index is used to programatically select a sound from the
loaded banks. The index passed in replaces any numeric value at the end
of the sound name existing in any start sound event step. For example, if
a start sound event plays "mybank/sound1", and the event is queued with
a selection, then the selection will replace the "1" with the number passed in:
${
// Enqueue with a selection of 5
S32 token = AIL_enqueue_event_start();
AIL_enqueue_event_selection(&token, 50;
AIL_enqueue_event_end_named(token, "mybank/myevent");
$}
Assuming mybank/myevent starts sound "mybank/sound1", the sound
that will actually be played will be "mybank/sound5". If the sound does
not exist, it is treated the same as if any other sound was not found.
The selection process replaces ALL trailing numbers with a representation
of the selection index using the same number of digits, meaning in the above
example, "mybank/sound123" would have become "mybank/sound005".
*/
DXDEC EXPAPI U64 AILCALL AIL_enqueue_event_end_named(S32 token, char const* event_name);
/*
Completes assembling the event and queues it to the command buffer to be run during next tick.
$:token A token created with $AIL_enqueue_event_start.
$:event_name The name of the event to run.
$:return A unique ID for the event that can be used to identify sounds started by this event,
or for filtering future events to the sounds started by this event.
This function takes all of the data accumulated via the various enqueue functions and assembles
it in to the command buffer to be run during the next $AIL_begin_event_queue_processing.
As with all of the enqueue functions it is completely thread-safe.
Upon completion of this function, the enqueue slot is release and available for another
$AIL_enqueue_event_start.
*/
DXDEC EXPAPI U64 AILCALL AIL_enqueue_event(U8 const * event_or_name, void* user_buffer, S32 user_buffer_len, S32 enqueue_flags, U64 apply_to_ID );
/*
Enqueue an event to be processed by the next $AIL_begin_event_queue_processing function.
$:event_or_name Pointer to the event contents to queue, or the name of the event to find and queue.
If an event, the contents must be valid until the next call to $AIL_begin_event_queue_processing.
If a name, the string is copied internally and does not have any lifetime requirements, and MILES_ENQUEUE_BY_NAME must be present in enqueue_flags.
$:user_buffer Pointer to a user buffer. Depending on $(AIL_enqueue_event::enqueue_flags), this pointer can be saved directly, or its contents copied into the sound instance.
This data is then accessible later, when enumerating the instances.
$:user_buffer_len Size of the buffer pointed to by user_buffer.
$:enqueue_flags Optional $MILESEVENTENQUEUEFLAGS logically OR'd together that control how to enqueue this event (default is 0).
$:apply_to_ID Optional value that is used for events that affect sound instances. Normally,
when Miles triggers one of these event steps, it matches the name and labels stored with the event step. However, if
you specify an apply_to_ID value, then event step will only run on sounds that matches this QueuedID,InstanceID,or EventID too. This is how you
execute events only specific sound instances. QueuedIDs are returned from each call $AIL_enqueue_event.
InstanceIDs and EventIDs are returned from $AIL_enumerate_sound_instances.
$:return On success, returns QueuedID value that is unique to this queued event for the rest of this
program run (you can use this ID to uniquely identify sounds triggered from this event).
This function enqueues an event to be triggered - this is how you begin execution of an event. First, you
queue it, and then later (usually once a game frame), you call $AIL_begin_event_queue_processing to
execute an event.
This function is very lightweight. It does nothing more than post the event and data to a
command buffer that gets executed via $AIL_begin_event_queue_processing.
The user_buffer parameter can be used in different ways. If no flags are passed in, then
Miles will copy the data from user_buffer (user_buffer_len bytes long) and store the data with
the queued sound - you can then free the user_buffer data completely! This lets Miles keep track
of all your sound related memory directly and is the normal way to use the system (it is very
convenient once you get used to it).
If you instead pass the MILESEVENT_ENQUEUE_BUFFER_PTR flag, then user_buffer pointer will
simply be associated with each sound that this event may start. In this case, user_buffer_len
is ignored.
In both cases, when you later enumerate the sound instances, you can access your sound data
with the $(MILESEVENTSOUNDINFO::UserBuffer) field.
You can call this function from any number threads - it's designed to be called from anywhere in your game.
If you want events you queue to be captured by Miles Studio, then they have to be passed by name. This can be done
by either using the convenience function $AIL_enqueue_event_by_name, or by using the MILESEVENT_ENQUEUE_BY_NAME flag and
passing the name in event_or_name. For introduction to the auditioning system, see $integrating_events.
*/
EXPTYPEBEGIN typedef S32 MILESEVENTENQUEUEFLAGS;
#define MILESEVENT_ENQUEUE_BUFFER_PTR 0x1
#define MILESEVENT_ENQUEUE_FREE_EVENT 0x2
#define MILESEVENT_ENQUEUE_BY_NAME 0x4
// 0x8 can't be used, internal.
EXPTYPEEND
/*
The available flags to pass in $AIL_enqueue_event or $AIL_enqueue_event_system.
$:MILESEVENT_ENQUEUE_BUFFER_PTR The user_buffer parameter passed in should not be duplicated, and instead
should just tranparently pass the pointer on to the event, so that the $(MILESEVENTSOUNDINFO::UserBuffer)
during sound iteration is just the same pointer. user_buffer_len is ignored in this case.
$:MILESEVENT_ENQUEUE_FREE_EVENT The ownership of the memory for the event is passed to the event system. If this
is present, once the event completes $AIL_mem_free_lock will be called on the raw pointer passed in to $AIL_enqueue_event or
$AIL_enqueue_event_system. This is rarely used.
$:MILESEVENT_ENQUEUE_BY_NAME The event passed in is actually a string. The event system will then look for this event
in the loaded sound banks during queue processing.
*/
DXDEC EXPAPI S32 AILCALL AIL_begin_event_queue_processing( void );
/*
Begin execution of all of the enqueued events.
$:return Return 0 on failure. The only failures are unrecoverable errors in the queued events
(out of memory, bank file not found, bad data, etc). You can get the specific error by
calling $AIL_last_error.
This function executes all the events currently in the queue. This is where all major
processing takes place in the event system.
Once you execute this functions, then sound instances will be in one of three states:
$(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PENDING)[MILESEVENT_SOUND_STATUS_PENDING] - these are new sound instances that were
created by events that had a "Start Sound Step". Note that these instances aren't audible yet,
so that you have a chance to modify game driven properties (like the 3D position)
on the sound before Miles begins to play it.
$(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PLAYING)[MILESEVENT_SOUND_STATUS_PLAYING] - these are sound instances that were previously
started and are continuing to play (you might update the 3D position for these, for example).
$(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_COMPLETE)[MILESEVENT_SOUND_STATUS_COMPLETE] - these are sound instances that finished playing
since the last this frame (you might use this status to free any game related memory, for example).
You will normally enumerate the active sound instances in-between calls to $AIL_begin_event_queue_processing
and $AIL_complete_event_queue_processing with $AIL_enumerate_sound_instances.
$AIL_complete_event_queue_processing must be called after this function to commit
all the changes.
Example usage:
${
// enqueue an event
$AIL_enqueue_event( EventThatStartsSounds, game_data_ptr, 0, MILESEVENT_ENQUEUE_BUFFER_PTR, 0 );
// now process that event
$AIL_begin_event_queue_processing( );
// next, enumerate the pending and complete sounds for game processing
MILESEVENTSOUNDINFO Info;
HMSSENUM SoundEnum = MSS_FIRST;
while ( $AIL_enumerate_sound_instances( &SoundEnum, MILESEVENT_SOUND_STATUS_PENDING | MILESEVENT_SOUND_STATUS_COMPLETE, 0, &Info ) )
{
game_type * game_data = (game_type*) Info.UserBuffer; // returns the game_data pointer from the enqueue
if ( Info.Status == MILESEVENT_SOUND_STATUS_PENDING )
{
// setup initial state
AIL_set_sample_3D_position( Info.Sample, game_data->x, game_data->y, game_data->z );
}
else if ( Info.Status == MILESEVENT_SOUND_STATUS_COMPLETE )
{
// Free some state we have associated with the sound now that its done.
game_free( game_data );
}
}
$AIL_complete_event_queue_processing( );
$}
Note that if any event step drastically fails, the rest of the command queue is
skipped, and this function returns 0! For this reason, you shouldn't assume
that a start sound event will always result in a completed sound later.
Therefore, you should allocate memory that you want associated with a sound instance
during the enumeration loop, rather than at enqueue time. Otherwise, you
need to detect that the sound didn't start and then free the memory (which can be complicated).
*/
// Returned by AIL_enumerate_sound_instances()
EXPTYPE typedef struct _MILESEVENTSOUNDINFO
{
U64 QueuedID;
U64 InstanceID;
U64 EventID;
HSAMPLE Sample;
HSTREAM Stream;
void* UserBuffer;
S32 UserBufferLen;
S32 Status;
U32 Flags;
S32 UsedDelay;
F32 UsedVolume;
F32 UsedPitch;
char const* UsedSound;
S32 HasCompletionEvent;
} MILESEVENTSOUNDINFO;
/*
Sound instance data that is associated with each active sound instance.
$:QueuedID A unique ID that identifies the queued event that started this sound. Returned from each call to $AIL_enqueue_event.
$:EventID A unique ID that identifies the actual event that started this sound. This is the same as QueuedID unless the sound
was started by a completion event or a event exec step. In that case, the QueuedID represents the ID returned from
$AIL_enqueue_event, and EventID represents the completion event.
$:InstanceID A unique ID that identified this specific sound instance (note that one QueuedID can trigger multiple InstanceIDs).
$:Sample The $HSAMPLE for this playing sound.
$:Stream The $HSTREAM for this playing sound (if it is being streamed, zero otherwise).
$:UserBuffer A pointer to the user data for this sound instance.
$:UserBufferLen The length in bytes of the user data (if known by Miles).
$:Status One of the $MILESEVENTSOUNDSTATUS status values.
$:Flags One or more of the $MILESEVENTSOUNDFLAG flags.
$:UsedDelay The value actually used as a result of the randomization of delay for this instance
$:UsedVolume The value actually used as a result of the randomization of pitch for this instance
$:UsedPitch The value actually used as a result of the randomization of volume for this instance
$:UsedSound The name of the sound used as a result of randomization. This pointer should NOT be deleted
and is only valid for the until the next call in to Miles.
$:HasCompletionEvent Nonzero if the sound will fire an event upon completion.
This structure is returned by the $AIL_enumerate_sound_instances function. It
returns information about an active sound instance.
*/
DXDEC EXPAPI void AILCALL AIL_set_variable_int(UINTa context, char const* name, S32 value);
/*
Sets a named variable that the designer can reference in the tool.
$:context The context the variable is set for. Can be either a $HEVENTSYSTEM
to set a global variable for a specific system, 0 to set a global variable
for the default system, or an $HMSSENUM from $AIL_enumerate_sound_instances.
$:name The name of the variable to set.
$:value The value of the variable to set.
Variables are tracked per sound instance and globally, and when a variable is needed
by an event, it will check the relevant sound instance first, before falling back to
the global variable list:
${
$HMSSENUM FirstSound = MSS_FIRST;
$MILESEVENTSOUNDINFO Info;
// Grab the first sound, whatever it is.
$AIL_enumerate_sound_instances(0, &FirstSound, 0, 0, 0, &Info);
// Set a variable on that sound.
$AIL_set_variable_int(FirstSound, "MyVar", 10);
// Set a global variable by the same name.
$AIL_set_variable_int(0, "MyVar", 20);
// A preset referencing "MyVar" for FirstSound will get 10. Any other sound will
// get 20.
$}
*/
DXDEC EXPAPI void AILCALL AIL_set_variable_float(UINTa context, char const* name, F32 value);
/*
Sets a named variable that the designer can reference in the tool.
$:context The context the variable is set for. Can be either a $HEVENTSYSTEM
to set a global variable for a specific system, 0 to set a global variable
for the default system, or an $HMSSENUM from $AIL_enumerate_sound_instances.
$:name The name of the variable to set.
$:value The value of the variable to set.
Variables are tracked per sound instance and globally, and when a variable is needed
by an event, it will check the relevant sound instance first, before falling back to
the global variable list.
${
$HMSSENUM FirstSound = MSS_FIRST;
$MILESEVENTSOUNDINFO Info;
// Grab the first sound, whatever it is.
$AIL_enumerate_sound_instances(0, &FirstSound, 0, 0, 0, &Info);
// Set a variable on that sound.
$AIL_set_variable_float(FirstSound, "MyVar", 10.0);
// Set a global variable by the same name.
$AIL_set_variable_float(0, "MyVar", 20.0);
// A preset referencing "MyVar" for FirstSound will get 10. Any other sound will
// get 20.
$}
*/
DXDEC EXPAPI S32 AILCALL AIL_variable_int(UINTa context, char const* name, S32* value);
/*
Retrieves a named variable.
$:context The context to start the lookup at, same as $AIL_set_variable_int.
$:name The name to look up.
$:value Pointer to an int to store the value in.
$:return 1 if the variable was found, 0 otherwise.
This function follows the same lookup pattern as the runtime - if the context is a
sound instance, it checks the instance before falling back to global variables.
*/
DXDEC EXPAPI S32 AILCALL AIL_variable_float(UINTa context, char const* name, F32* value);
/*
Retrieves a named variable.
$:context The context to start the lookup at, same as $AIL_set_variable_float.
$:name The name to look up.
$:value Pointer to a float to store the value in.
$:return 1 if the variable was found, 0 otherwise.
This function follows the same lookup pattern as the runtime - if the context is a
sound instance, it checks the instance before falling back to global variables.
*/
DXDEC EXPAPI void AILCALL AIL_requeue_failed_asyncs();
/*
Requeues any failed asynchronous loads for sound sources.
Use this function when a disc error causes a slew of failed caches. Any sound source that
has failed due to asynchronous load will get retried.
*/
DXDEC EXPAPI void AILCALL AIL_set_sound_start_offset(HMSSENUM sound, S32 offset, S32 isms);
/*
Specify the starting position for a pending sound.
$:sound The enumeration from $AIL_enumerate_sound_instances representing the desired sound.
The sound must be in the pending state.
$:offset The offset to use for the starting position of the sound.
$:isms If nonzero, the offset is in milliseconds, otherwise bytes.
Use this function instead of manipulating the sample position directly via low level Miles calls prior to
the sound starting. Generally you don't need to do this manually, since the sound designer should do
this, however if you need to restart a sound that stopped - for example a stream that went to error -
you will have to set the start position via code.
However, since there can be a delay between the time the sound is first seen in the sound iteration and
the time it gets set to the data, start positions set via the low level miles calls can get lost, so
use this.
See the <i>eventstreamerror.cpp</i> example program for usage.
*/
DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_instances(HEVENTSYSTEM system, HMSSENUM* next, S32 statuses, char const* label_query, U64 search_for_ID, EXPOUT MILESEVENTSOUNDINFO* info);
/*
Enumerated the active sound instances managed by the event system.
$:next Enumeration token - initialize to MSS_FIRST before the first call. You can pass 0 here, if you just want the first instance that matches.
$:statuses Or-ed list of status values to enumerate. Use 0 for all status types.
$:label_query A query to match sound instance labels against. Use 0 to skip label matching.
$:search_for_ID Match only instances that have a QueuedID,InstanceID,or EventID that matches this value. Use 0 to skip ID matching.
$:info Returns the data for each sound instance.
$:return Returns 0 when enumeration is complete.
Enumerates the sound instances. This will generally be used between
calls to $AIL_begin_event_queue_processing and $AIL_complete_event_queue_processing to
manage the sound instances.
The label_query is a list of labels to match, separated by commas. By default, comma-separated
values only have to match at least one label. So, if you used "level1, wind", then all sound instances
that had either "level1" <i>or</i> "wind" would match. If you want to match <i>all</i> labels,
then use the + sign first (for example, "+level1, +wind" would only match sound instances that
had <i>both</i> "level1" and "wind"). You can also use the - sign before a label to <i>not</i>
match that label (so, "level1, -wind" would match all "level1" labeled sound instances that didn't have
a "wind" label). Finally, you can also use * and ? to match wildcard style labels (so, "gun*"
would match any sound instance with a label that starts with "gun").
Valid status flags are:
$(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PENDING)[MILESEVENT_SOUND_STATUS_PENDING] - these are new sound instances that were
created by events that had a "Start Sound Step". Note that these instances aren't audible yet,
so that you have a chance to modify game driven properties (like the 3D position)
on the sound before Miles begins to play it.
$(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PLAYING)[MILESEVENT_SOUND_STATUS_PLAYING] - these are sound instances that were previously
started and are continuing to play (you might update the 3D position for these, for example).
$(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_COMPLETE)[MILESEVENT_SOUND_STATUS_COMPLETE] - these are sound instances that finished playing
since the last this frame (you might use this status to free any game related memory, for example).
Example Usage:
${
HMSSENUM SoundEnum = MSS_FIRST;
MILESEVENTSOUNDINFO Info;
while ( $AIL_enumerate_sound_instances( &SoundEnum, 0, 0, &Info ) )
{
if ( Info.Status != MILESEVENT_SOUND_STATUS_COMPLETE )
{
game_SoundState* game_data= (game_SoundState*)( Info.UserBuffer );
$AIL_set_sample_is_3D( Info.Sample, 1 );
$AIL_set_sample_3D_position( Info.Sample, game_data->x, game_data->y, game_date->z );
}
}
$}
*/
EXPTYPEBEGIN typedef S32 MILESEVENTSOUNDSTATUS;
#define MILESEVENT_SOUND_STATUS_PENDING 0x1
#define MILESEVENT_SOUND_STATUS_PLAYING 0x2
#define MILESEVENT_SOUND_STATUS_COMPLETE 0x4
EXPTYPEEND
/*
Specifies the status of a sound instance.
$:MILESEVENT_SOUND_STATUS_PENDING New sound instances that were
created by events that had a "Start Sound Step". Note that these instances aren't audible yet,
so that you have a chance to modify game driven properties (like the 3D position)
on the sound before Miles begins to play it.
$:MILESEVENT_SOUND_STATUS_PLAYING Sound instances that were previously
started and are continuing to play (you might update the 3D position for these, for example).
$:MILESEVENT_SOUND_STATUS_COMPLETE Sound instances that finished playing
since the last this frame (you might use this status to free any game related memory, for example).
These are the status values that each sound instance can have. Use $AIL_enumerate_sound_instances to retrieve them.
*/
EXPTYPEBEGIN typedef U32 MILESEVENTSOUNDFLAG;
#define MILESEVENT_SOUND_FLAG_MISSING_SOUND 0x1
#define MILESEVENT_SOUND_FLAG_EVICTED 0x2
#define MILESEVENT_SOUND_FLAG_WAITING_ASYNC 0x4
#define MILESEVENT_SOUND_FLAG_PENDING_ASYNC 0x8
#define MILESEVENT_SOUND_FLAG_FAILED_HITCH 0x10
#define MILESEVENT_SOUND_FLAG_FAILED_ASYNC 0x20
EXPTYPEEND
/*
Specifies the status of a sound instance.
$:MILESEVENT_SOUND_FLAG_MISSING_SOUND The event system tried to look up the sound requested from a Start Sound event
and couldn't find anything in the loaded banks.
$:MILESEVENT_SOUND_FLAG_EVICTED The sound was evicted due to a sound instance limit being hit. Another sound was selected
as being higher priority, and this sound was stopped as a result. This can be the result of either a Label Sound Limit,
or a limit on the sound itself.
$:MILESEVENT_SOUND_FLAG_WAITING_ASYNC The sound is pending because the data for it is currently being loaded.
The sound will start when sufficient data has been loaded to hopefully avoid a skip.
$:MILESEVENT_SONUD_FLAG_PENDING_ASYNC The sound has started playing, but the data still isn't completely loaded, and it's possible
that the sound playback will catch up to the read position under poor I/O conditions.
$:MILESEVENT_SOUND_FLAG_FAILED_HITCH The sound meta data was found, but the sound was not in memory, and the Start Sound event
was marked as "Must Be Cached". To prevent this, either clear the flag in the event, which will cause a start delay as the
sound data is asynchronously loaded, or specify the sound in a Cache Sounds step prior to attempting to start it.
$:MILESEVENT_SOUND_FLAG_FAILED_ASYNC The sound tried to load and the asynchronous I/O operation failed - most likely either the media
was removed during load, or the file was not found.
These are the flag values that each sound instance can have. Use $AIL_enumerate_sound_instances to retrieve them. Instances
may have more than one flag, logically 'or'ed together.
*/
DXDEC EXPAPI S32 AILCALL AIL_complete_event_queue_processing( void );
/*
Completes the queue processing (which is started with $AIL_begin_event_queue_processing ).
$:return Returns 0 on failure.
This function must be called as a pair with $AIL_begin_event_queue_processing.
In $AIL_begin_event_queue_processing, all the new sound instances are queued up, but they haven't
started playing yet. Old sound instances that have finished playing are still valid - they
haven't been freed yet. $AIL_complete_event_queue_processing actually starts the sound instances
and frees the completed ones - it's the 2nd half of the event processing.
Usually you call $AIL_enumerate_sound_instances before this function to manage all the sound
instances.
*/
DXDEC EXPAPI U64 AILCALL AIL_stop_sound_instances(char const * label_query, U64 apply_to_ID);
/*
Allows the programmer to manually enqueue a stop sound event into the event system.
$:label_query A query to match sound instance labels against. Use 0 to skip label matching.
$:apply_to_ID An optional value returned from a previous $AIL_enqueue_event or $AIL_enumerate_sound_instances that
tells Miles to stop only those instances who's QueuedID,InstanceID,or EventID matches this value.
$:return Returns a non-zero queue ID on success.
Enqueues an event to stop all sounds matching the specified label query (see $AIL_enumerate_sound_instances
for a description of the label_query format).
Usually the programmer should trigger a named event that the sound designed can fill out to stop the necessary sounds,
however, if a single sound (for example associated with an enemy that the player just killed) needs to be stopped,
this function accomplishes that, and is captured by the auditioner for replay.
*/
DXDEC EXPAPI U64 AILCALL AIL_pause_sound_instances(char const * label_query, U64 apply_to_ID);
/*
Allows the programmer to manually enqueue a pause sound event into the event system.
$:label_query A query to match sound instance labels against. Use 0 to skip label matching.
$:apply_to_ID An optional value returned from a previous $AIL_enqueue_event or $AIL_enumerate_sound_instances that
tells Miles to pause only those instances who's QueuedID,InstanceID,or EventID matches this value.
$:return Returns a non-zero queue ID on success.
Enqueues an event to pause all sounds matching the specified label query (see $AIL_enumerate_sound_instances
for a description of the label_query format).
Usually the programmer should trigger a named event that the sound designed can fill out to pause the necessary sounds,
however, if a single sound (for example associated with an enemy that has been put in to stasis) needs to be paused,
this function accomplishes that, and is captured by the auditioner for replay.
*/
DXDEC EXPAPI U64 AILCALL AIL_resume_sound_instances(char const * label_query, U64 apply_to_ID);
/*
Allows the programmer to manually enqueue a resume sound event into the event system.
$:label_query A query to match sound instance labels against. Use 0 to skip label matching.
$:apply_to_ID An optional value returned from a previous $AIL_enqueue_event or $AIL_enumerate_sound_instances that
tells Miles to resume only those instances who's QueuedID,InstanceID,or EventID matches this value.
$:return Returns a non-zero enqueue ID on success.
Enqueues an event to resume all sounds matching the specified label query (see $AIL_enumerate_sound_instances
for a description of the label_query format).
Usually the programmer should trigger a named event that the sound designed can fill out to resume the necessary sounds,
however, if a single sound (for example associated with an enemy that has been restored from stasis) needs to be resumed,
this function accomplishes that, and is captured by the auditioner for replay.
*/
DXDEC EXPAPI U64 AILCALL AIL_start_sound_instance(HMSOUNDBANK bank, char const * sound, U8 loop_count,
S32 should_stream, char const * labels, void* user_buffer, S32 user_buffer_len, S32 enqueue_flags );
/*
Allows the programmer to manually enqueue a start sound event into the event system.
$:bank The bank containing the sound to start.
$:sound The name of the sound file to start, including bank name, e.g. "BankName/SoundName"
$:loop_count The loop count to assign to the sound. 0 for infinite, 1 for play once, or just the number of times to loop.
$:stream Non-zero if the sound playback should stream off the disc.
$:labels An optional comma-delimited list of labels to assign to the sound playback.
$:user_buffer See the user_buffer description in $AIL_enqueue_event.
$:user_buffer_len See the user_buffer_len description in $AIL_enqueue_event.
$:enqueue_flags See the enqueue_flags description in $AIL_enqueue_event.
$:return Returns a non-zero EnqueueID on success.
Enqueues an event to start the specified sound asset.
Usually the programmer should trigger an event that the sound designer has specifically
create to start the appropriate sounds, but this function gives the programmer
manual control, if necessary. <b>This function is not captured by the auditioner.</b>
*/
DXDEC EXPAPI void AILCALL AIL_clear_event_queue( void );
/*
Removes all pending events that you have enqueued.
This function will clears the list of all events that you have previously enqueued.
*/
DXDEC EXPAPI S32 AILCALL AIL_set_sound_label_limits(HEVENTSYSTEM system, char const* sound_limits);
/*
Sets the maximum number of sounds that matches a particular label.
$:sound_limits A string that defines one or more limits on a label by label basis. The string should
be of the form "label1name label1count:label2name label2count".
$:return Returns 0 on failure (usually a bad limit string).
Every time an event triggers a sound to be played, the sound limits are checked, and, if exceeded, a sound is dropped (based
on the settings in the event step).
Usually event limits are set by a sound designer via an event, but this lets the programmer override the limits at runtime.
Note that this replaces those events, it does not supplement.
*/
DXDEC EXPAPI S32 AILCALL AIL_enumerate_preset_persists(HEVENTSYSTEM system, HMSSENUM* next, EXPOUT char const ** name);
/*
Enumerates the current persisted presets that active in the system.
$:system The system to enumerate the persists for, or 0 to use the default system.
$:next Enumeration token - initialize to MSS_FIRST before the first call.
$:name Pointer to a char* that receives the name of the persist. NOTE
that this pointer can change frame to frame and should be immediately copied to a client-allocated
buffer if persistence is desired.
$:return Returns 0 when enumeration is complete.
This function lets you enumerate all the persisting presets that are currently active in the system. It
is mostly a debugging aid.
*/
DXDEC EXPAPI char * AILCALL AIL_text_dump_event_system(void);
/*
Returns a big string describing the current state of the event system.
$:return String description of current systems state.
This function is a debugging aid - it can be used to show all of the active allocations,
active sounds, etc.
You must delete the pointer returned from this function with $AIL_mem_free_lock.
*/
EXPTYPE typedef struct _MILESEVENTSTATE
{
S32 CommandBufferSize;
S32 HeapSize;
S32 HeapRemaining;
S32 LoadedSoundCount;
S32 PlayingSoundCount;
S32 LoadedBankCount;
S32 PersistCount;
S32 SoundBankManagementMemory;
S32 SoundDataMemory;
} MILESEVENTSTATE;
/*
returns the current state of the Miles Event System.
$:CommandBufferSize The size of the command buffer in bytes. See also the $AIL_startup_event_system.
$:HeapSize The total size of memory used by the event system for management structures, and is allocated during startup. This does not include loaded file sizes.
$:HeapRemaining The number of bytes in HeapSize that is remaining.
$:LoadedSoundCount The number of sounds loaded and ready to play via cache event steps.
$:PlayingSoundCount The number of sounds currently playing via start sound event steps.
$:LoadedBankCount The number of sound banks loaded in the system via cache event steps, or AIL_add_soundbank.
$:PersistCount The number of presets persisted via the persist event step.
$:SoundBankManagementMemory The number of bytes used for the management of the loaded sound banks.
$:SoundDataMemory The number of bytes used in file sizes - remember this is not included in HeapSize. Streaming overhead is not included in this number, only fully loaded sounds.
This structure returns debugging info about the event system. It is used with $AIL_event_system_state.
*/
EXPGROUP(Miles High Level Callbacks)
EXPAPI typedef void AILCALLBACK MilesBankFreeAll( void );
/*
callback to free all user managed bank memory.
*/
EXPAPI typedef void * AILCALLBACK MilesBankGetPreset( char const * name );
/*
callback to retrieve a sound preset.
*/
EXPAPI typedef void * AILCALLBACK MilesBankGetEnvironment( char const * name );
/*
callback to retrieve an environment preset.
*/
EXPAPI typedef S32 AILCALLBACK MilesBankGetSound(char const* SoundAssetName, char* SoundFileName, MILESBANKSOUNDINFO* o_SoundInfo );
/*
callback to return whether the sound asset is in the bank, and, if so, what the final data filename is.
In order to externally deploy sound files, you will need to register your own GetSound callback. This is detailed in the
eventexternal example program.
This returns the len of the buffer required for the output file name if SoundFileName is zero.
*/
EXPAPI typedef void * AILCALLBACK MilesBankGetEvent( char const * name );
/*
callback to retrieve an event.
*/
EXPAPI typedef void * AILCALLBACK MilesBankGetMarkerList( char const * name );
/*
callback to retrieve a sound marker list.
*/
EXPAPI typedef S32 AILCALLBACK MilesBankGetLoadedCount( void );
/*
callback to retrieve the number of loaded sound banks.
*/
EXPAPI typedef S32 AILCALLBACK MilesBankGetMemUsage( void );
/*
callback to retrieve the total memory in use.
*/
EXPAPI typedef char const * AILCALLBACK MilesBankGetLoadedName( S32 index );
/*
callback to retrieve the file name of a sound index.
*/
EXPTYPE typedef struct _MILESBANKFUNCTIONS
{
MilesBankFreeAll * FreeAll;
MilesBankGetPreset * GetPreset;
MilesBankGetEnvironment * GetEnvironment;
MilesBankGetSound * GetSound;
MilesBankGetEvent * GetEvent;
MilesBankGetMarkerList * GetMarkerList;
MilesBankGetLoadedCount * GetLoadedCount;
MilesBankGetMemUsage * GetMemUsage;
MilesBankGetLoadedName * GetLoadedName;
} MILESBANKFUNCTIONS;
/*
specifies callbacks for each of the Miles event system.
$:FreeAll Callback that tells you to free all user-side bank memory.
$:GetPreset Callback to retrieve a sound preset.
$:GetEnvironment Callback to retrieve an environment preset.
$:GetSound Callback to return the actual filename of a sound asset.
$:GetEvent Callback to retrieve a sound event.
$:GetMarkerList Callback to retrieve a sound marker list.
$:GetLoadedCount Callback to retrieve a count of loaded sound banks.
$:GetMemUsage Callback to retrieve the amount of memory in use.
$:GetLoadedName Callback to retrieve the filename for a sound asset index.
This structure is used to provide overrides for all of the high-level loading
functionality.
*/
EXPGROUP(Miles High Level Event System)
DXDEC EXPAPI void AILCALL AIL_set_event_sample_functions(HSAMPLE (*CreateSampleCallback)(char const* SoundName, char const* SoundFileName, HDIGDRIVER dig, void* UserBuffer, S32 UserBufferLen), void (*ReleaseSampleCallback)(HSAMPLE));
/*
Allows you to manage sound data availability and sample handles.
$:CreateSampleCallback Function that will be called when a sample handle is needed.
$:ReleaseSampleCallback Function that will be called when a sample is no longer needed.
A created sample is required to have all data pointers necessary to play - e.g.
the event system needs to be able to just do a AIL_start_sample() on the returned
handle and have it work.
In the callback, SoundName is the name of the asset in Miles Studio, and SoundFileName
is the value returned from Container_GetSound() (see also $AIL_set_event_bank_functions).
*/
DXDEC EXPAPI void AILCALL AIL_set_event_bank_functions(MILESBANKFUNCTIONS const * Functions);
/*
Allows you to override the internal bank file resource management..
$:Functions A pointer to a structure containing all the callback functions.
This function is used to completely override the high-level resource management system.
It's not for overriding the IO - it's when you need much higher-level of control. Primarily
targeted internally for the Auditioner to use, it also is used when deploying sound files
externally.
*/
DXDEC EXPAPI MILESBANKFUNCTIONS const* AILCALL AIL_get_event_bank_functions();
/*
Returns the current functions used to retrieve and poll bank assets.
*/
typedef S32 AILCALLBACK AuditionStatus();
typedef S32 AILCALLBACK AuditionPump();
typedef void* AILCALLBACK AuditionOpenBank(char const* i_FileName);
typedef S32 AILCALLBACK AuditionOpenComplete(void* i_Bank);
typedef void AILCALLBACK AuditionCloseBank(void* i_Bank);
typedef void AILCALLBACK AuditionSuppress(S32 i_IsSuppressed);
typedef void AILCALLBACK AuditionFrameStart();
typedef void AILCALLBACK AuditionFrameEnd();
typedef void AILCALLBACK AuditionDefragStart();
typedef void AILCALLBACK AuditionSetBlend(U64 i_EventId, char const* i_Name);
typedef void AILCALLBACK AuditionSetPersist(U64 i_EventId, char const* i_Name, char const* i_Preset);
typedef void AILCALLBACK AuditionEvent(char const* i_EventName, U64 i_EventId, U64 i_Filter, S32 i_Exists, void* i_InitBlock, S32 i_InitBlockLen);
typedef void AILCALLBACK AuditionSound(U64 i_EventId, U64 i_SoundId, char const* i_Sound, char const* i_Labels, float i_Volume, S32 i_Delay, float i_Pitch);
typedef void AILCALLBACK AuditionSoundComplete(U64 i_SoundId);
typedef void AILCALLBACK AuditionSoundPlaying(U64 i_SoundId);
typedef void AILCALLBACK AuditionSoundFlags(U64 i_SoundId, S32 i_Flags);
typedef void AILCALLBACK AuditionSoundLimited(U64 i_SoundId, char const* i_Label);
typedef void AILCALLBACK AuditionSoundEvicted(U64 i_SoundId, U64 i_ForSound, S32 i_Reason);
typedef void AILCALLBACK AuditionControl(U64 i_EventId, char const* i_Labels, U8 i_ControlType, U64 i_Filter);
typedef void AILCALLBACK AuditionSoundBus(U64 i_SoundId, U8 i_BusIndex);
typedef void AILCALLBACK AuditionError(U64 i_Id, char const* i_Details);
typedef void AILCALLBACK AuditionAsyncQueued(U64 i_RelevantId, S32 i_AsyncId, char const* i_Asset);
typedef void AILCALLBACK AuditionAsyncLoad(S32 i_AsyncId, S32 i_ExpectedData);
typedef void AILCALLBACK AuditionAsyncError(S32 i_AsyncId);
typedef void AILCALLBACK AuditionAsyncComplete(S32 i_AsyncId, S32 i_DataLoaded);
typedef void AILCALLBACK AuditionAsyncCancel(S32 i_AsyncId);
typedef void AILCALLBACK AuditionListenerPosition(float x, float y, float z);
typedef void AILCALLBACK AuditionSoundPosition(U64 i_Sound, float x, float y, float z);
typedef void AILCALLBACK AuditionSendCPU(HDIGDRIVER i_Driver);
typedef void AILCALLBACK AuditionUpdateDataCount(S32 i_CurrentDataLoaded);
typedef void AILCALLBACK AuditionSendCount(S32 i_Count);
typedef void AILCALLBACK AuditionHandleSystemLoad(S32 i_Avail, S32 i_Total);
typedef void AILCALLBACK AuditionVarState(char const* i_Var, U64 i_SoundId, S32 i_Int, void* i_4ByteValue);
typedef void AILCALLBACK AuditionRampState(char const* i_Ramp, U64 i_SoundId, S32 i_Type, float i_Current);
typedef void AILCALLBACK AuditionSoundState(U64 i_SoundId, float i_FinalVol, float i_3DVol, float i_BlendVol, float i_BlendPitch, float i_RampVol, float i_RampWet, float i_RampLp, float i_RampRate);
typedef void AILCALLBACK AuditionClearState();
typedef void AILCALLBACK AuditionCompletionEvent(U64 i_CompletionEventId, U64 i_ParentSoundId);
typedef void AILCALLBACK AuditionAddRamp(U64 i_ParentSoundId, S32 i_Type, char const* i_Name, char const* i_Query, U64 i_EventId);
typedef struct _MILESAUDITIONFUNCTIONS
{
AuditionStatus* Status;
AuditionPump* Pump;
AuditionOpenBank* OpenBank;
AuditionOpenComplete* OpenComplete;
AuditionCloseBank* CloseBank;
AuditionSuppress* Suppress;
AuditionFrameStart* FrameStart;
AuditionFrameEnd* FrameEnd;
AuditionDefragStart* DefragStart;
AuditionSetBlend* SetBlend;
AuditionSetPersist* SetPersist;
AuditionEvent* Event;
AuditionSound* Sound;
AuditionSoundComplete* SoundComplete;
AuditionSoundPlaying* SoundPlaying;
AuditionSoundFlags* SoundFlags;
AuditionSoundLimited* SoundLimited;
AuditionSoundEvicted* SoundEvicted;
AuditionControl* Control;
AuditionSoundBus* SoundBus;
AuditionError* Error;
AuditionAsyncQueued* AsyncQueued;
AuditionAsyncLoad* AsyncLoad;
AuditionAsyncError* AsyncError;
AuditionAsyncComplete* AsyncComplete;
AuditionAsyncCancel* AsyncCancel;
AuditionListenerPosition* ListenerPosition;
AuditionSoundPosition* SoundPosition;
AuditionSendCPU* SendCPU;
AuditionSendCount* SendCount;
AuditionUpdateDataCount* UpdateDataCount;
AuditionHandleSystemLoad* HandleSystemLoad;
AuditionVarState* VarState;
AuditionRampState* RampState;
AuditionSoundState* SoundState;
AuditionClearState* ClearState;
AuditionCompletionEvent* CompletionEvent;
AuditionAddRamp* AddRamp;
} MILESAUDITIONFUNCTIONS;
DXDEC void AILCALL MilesEventSetAuditionFunctions(MILESAUDITIONFUNCTIONS const* i_Functions);
// Auditioner lib functions.
EXPGROUP(auditioning)
EXPTYPEBEGIN typedef S32 MILESAUDITIONCONNECTRESULT;
#define MILES_CONNECTED 0
#define MILES_CONNECT_FAILED 1
#define MILES_HOST_NOT_FOUND 2
#define MILES_SERVER_ERROR 3
EXPTYPEEND
/*
Return values for $AIL_audition_connect.
$:MILES_CONNECTED The Auditioner connected and successfully executed the handshake.
$:MILES_CONNECT_FAILED The Auditioner couldn't connect - either the IP wasn't valid, or Miles Sound Studio wasn't accepting connections.
$:MILES_HOST_NOT_FOUND The given host name could not be resolved to an IP.
$:MILES_SERVER_ERROR We connected, but the server was either another app on the same port, or the server version was incorrect.
*/
DXDEC EXPAPI S32 AILCALL AIL_audition_connect(char const* i_Address);
/*
Connect to a currently running Miles Sound Studio.
$:i_Address The IP or host name of the computer running Miles Sound Studio. Use $AIL_audition_local_host to connect to the same machine as the runtime.
$:return One of $MILESAUDITIONCONNECTRESULT
The is a synchronous connection attempt to Miles Sound Studio - it will not return until it is happy with the connection
and the server, or a failure occurs.
This must be called before any $AIL_add_soundbank calls.
*/
DXDEC EXPAPI char const* AILCALL AIL_audition_local_host();
/*
Return the host name of the local machine.
*/
// Defines - must match values in studio/Common.h
EXPTYPEBEGIN typedef S32 MILESAUDITIONLANG;
#define MILES_LANG_ENGLISH 1
#define MILES_LANG_FRENCH 2
#define MILES_LANG_GERMAN 3
#define MILES_LANG_SPANISH 4
#define MILES_LANG_ITALIAN 5
#define MILES_LANG_JAPANESE 6
#define MILES_LANG_KOREAN 7
#define MILES_LANG_CHINESE 8
#define MILES_LANG_RUSSIAN 9
EXPTYPEEND
/*
Values representing the various languages the high level tool allows.
$:MILES_LANG_ENGLISH English
$:MILES_LANG_FRENCH French
$:MILES_LANG_GERMAN German
$:MILES_LANG_SPANISH Spanish
$:MILES_LANG_ITALIAN Italian
$:MILES_LANG_JAPANESE Japanese
$:MILES_LANG_KOREAN Korean
$:MILES_LANG_CHINESE Chinese
$:MILES_LANG_RUSSIAN Russian
Values representing the various languages the high level tool allows.
*/
EXPTYPEBEGIN typedef S32 MILESAUDITIONPLAT;
#define MILES_PLAT_WIN 1
#define MILES_PLAT_MAC 2
#define MILES_PLAT_PS3 3
#define MILES_PLAT_360 4
#define MILES_PLAT_3DS 5
#define MILES_PLAT_PSP 6
#define MILES_PLAT_IPHONE 7
#define MILES_PLAT_LINUX 8
#define MILES_PLAT_WII 9
#define MILES_PLAT_PSP2 10
#define MILES_PLAT_WIIU 11
#define MILES_PLAT_SEKRIT 12
#define MILES_PLAT_SEKRIT2 13
#define MILES_PLAT_WIN64 14
#define MILES_PLAT_LINUX64 15
#define MILES_PLAT_MAC64 16
#define MILES_PLAT_WINRT32 17
#define MILES_PLAT_WINRT64 18
#define MILES_PLAT_WINPH32 19
#define MILES_PLAT_ANDROID 20
EXPTYPEEND
/*
Values representing the various platforms the high level tool allows.
$:MILES_PLAT_WIN Microsoft Win32/64
$:MILES_PLAT_MAC Apple OSX
$:MILES_PLAT_PS3 Sony PS3
$:MILES_PLAT_360 Microsoft XBox360
$:MILES_PLAT_3DS Nintendo 3DS
$:MILES_PLAT_PSP Sony PSP
$:MILES_PLAT_IPHONE Apple iDevices
$:MILES_PLAT_LINUX Linux Flavors
$:MILES_PLAT_WII Nintendo Wii
$:MILES_PLAT_PSP2 Sony NGP
Values representing the various platforms the high level tool allows.
*/
DXDEC EXPAPI S32 AILCALL AIL_audition_startup(S32 i_ProfileOnly, S32 i_Language, S32 i_Platform);
/*
Binds the Auditioner to the Miles Event Runtime.
$:i_ProfileOnly Specify 0 to use assets from the connected Miles Sound Studio, and 1 to use assets from disc.
$:i_Language One of $MILESAUDITIONLANG, or zero to use Default assets. See comments below.
$:i_Platform One of $MILESAUDITIONPLAT, or zero to use the current platform. See comments below.
The Auditioner can run in one of two modes - the first is standard mode, where all assets
are loaded from the server, and profiling data is sent back to the server. The second is
Profiling mode, where the assets are loaded exactly as they would be under normal execution,
but all of the profiling data is sent to the server.
The $(AIL_audition_startup::i_Language) and the $(AIL_audition_startup::i_Platform) are used to determine what assets Miles Sound Studio sends
the Auditioner, and as a result are not used in Profiling Mode. Otherwise these are equivalent to
the options selected for compiling banks.
This must be called before any $AIL_add_soundbank calls.
*/
DXDEC EXPAPI void AILCALL AIL_audition_shutdown();
/*
Removes the Auditioner from the Miles Event Runtime.
*/
EXPGROUP(Miles High Level Event System)
DXDEC EXPAPI void AILCALL AIL_event_system_state(HEVENTSYSTEM system, MILESEVENTSTATE* state);
/*
Returns an information structure about the current state of the Miles Event System.
$:system The system to retrieve information for, or zero for the default system.
$:state A pointer to a structure to receive the state information.
This function is a debugging aid - it returns information for the event system.
*/
DXDEC EXPAPI U32 AILCALL AIL_event_system_command_queue_remaining();
/*
Returns the number of bytes remaining in the command buffer.
This can be invalid for a number of reasons - first, if the
command buffer will need to wrap for the next queue, the effective
bytes remaining will be lower. Second, if an enqueue occurs on another
thread in the interim, the value will be outdated.
*/
DXDEC EXPAPI S32 AILCALL AIL_get_event_length(char const* i_EventName);
/*
Returns the length of the first sound referenced in the named event, in milliseconds.
$:i_EventName The name of an event that starts a sound.
$:return The length in milliseconds, or 0 if there is an error, or the event has no sound references, or the sound was not found.
This looks up the given event and searches for the first Start Sound event step, then
uses the first sound name in its list to look up the length. As such, if the start sound
step has multiple sounds, the rest will be ignored.
*/
// Callback for the error handler.
EXPAPI typedef void AILCALLBACK AILEVENTERRORCB(S64 i_RelevantId, char const* i_Resource);
/*
The function prototype to use for a callback that will be made when the event system
encounters an unrecoverable error.
$:i_RelevantId The ID of the asset that encountered the error, as best known. EventID or SoundID.
$:i_Resource A string representing the name of the resource the error is in regards to, or 0 if unknown.
The error description can be retrieved via $AIL_last_error.
*/
EXPAPI typedef S32 AILCALLBACK MSS_USER_RAND( void );
/*
The function definition to use when defining your own random function.
You can define a function with this prototype and pass it to $AIL_register_random
if you want to tie the Miles random calls in with your game's (for logging and such).
*/
DXDEC EXPAPI void AILCALL AIL_set_event_error_callback(AILEVENTERRORCB * i_ErrorCallback);
/*
Set the error handler for the event system.
$:i_ErrorHandler The function to call when an error is encountered.
Generally the event system handles errors gracefully - the only noticeable effect
is that a given sound won't play, or a preset doesn't get set. As a result, the errors
can sometimes be somewhat invisible. This function allows you to see what went wrong,
when it went wrong.
The basic usage is to have the callback check $AIL_last_error() for the overall category of
failure. The parameter passed to the callback might provide some context, but it can and will
be zero on occasion. Generally it will represent the resource string that is being worked on when the error
occurred.
Note that there are two out of memory errors - one is the event system ran out of memory - meaning
the value passed in to $AIL_startup_event_system was insufficient for the current load, and
the other is the memory used for sound data - allocated via $AIL_mem_alloc_lock - ran out.
*/
DXDEC EXPAPI void AILCALL AIL_register_random(MSS_USER_RAND * rand_func);
/*
Sets the function that Miles will call to obtain a random number.
Use this function to set your own random function that the Miles Event System will call when it needs a random number.
This lets you control the determinism of the event system.
*/
#ifdef MSS_FLT_SUPPORTED
//
// Filter result codes
//
typedef SINTa FLTRESULT;
#define FLT_NOERR 0 // Success -- no error
#define FLT_NOT_ENABLED 1 // FLT not enabled
#define FLT_ALREADY_STARTED 2 // FLT already started
#define FLT_INVALID_PARAM 3 // Invalid parameters used
#define FLT_INTERNAL_ERR 4 // Internal error in FLT driver
#define FLT_OUT_OF_MEM 5 // Out of system RAM
#define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
#define FLT_NOT_FOUND 7 // FLT supported device not found
#define FLT_NOT_INIT 8 // FLT not initialized
#define FLT_CLOSE_ERR 9 // FLT not closed correctly
//############################################################################
//## ##
//## Interface "MSS pipeline filter" (some functions shared by ##
//## "MSS voice filter") ##
//## ##
//############################################################################
typedef FLTRESULT (AILCALL *FLT_STARTUP)(void);
typedef FLTRESULT (AILCALL *FLT_SHUTDOWN)(void);
typedef C8 * (AILCALL *FLT_ERROR)(void);
typedef HDRIVERSTATE (AILCALL *FLT_OPEN_DRIVER) (MSS_ALLOC_TYPE * palloc,
MSS_FREE_TYPE * pfree,
UINTa user,
HDIGDRIVER dig, void * memory);
typedef FLTRESULT (AILCALL *FLT_CLOSE_DRIVER) (HDRIVERSTATE state);
typedef void (AILCALL *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver);
typedef S32 (AILCALL *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver, void *output_buffer);
//############################################################################
//## ##
//## Interface "Pipeline filter sample services" ##
//## ##
//############################################################################
typedef HSAMPLESTATE (AILCALL * FLTSMP_OPEN_SAMPLE) (HDRIVERSTATE driver,
HSAMPLE S,
void * memory);
typedef FLTRESULT (AILCALL * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state);
typedef void (AILCALL * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state,
void * source_buffer,
void * dest_buffer, // may be the same as src
S32 n_samples,
S32 is_stereo );
typedef S32 (AILCALL * FLTSMP_SAMPLE_PROPERTY) (HSAMPLESTATE state,
HPROPERTY property,
void* before_value,
void const* new_value,
void* after_value
);
//############################################################################
//## ##
//## Interface "MSS output filter" ##
//## ##
//############################################################################
typedef S32 (AILCALL * VFLT_ASSIGN_SAMPLE_VOICE) (HDRIVERSTATE driver,
HSAMPLE S);
typedef void (AILCALL * VFLT_RELEASE_SAMPLE_VOICE) (HDRIVERSTATE driver,
HSAMPLE S);
typedef S32 (AILCALL * VFLT_START_SAMPLE_VOICE) (HDRIVERSTATE driver,
HSAMPLE S);
//############################################################################
//## ##
//## Interface "Voice filter driver services" ##
//## ##
//############################################################################
typedef S32 (AILCALL * VDRV_DRIVER_PROPERTY) (HDRIVERSTATE driver,
HPROPERTY property,
void* before_value,
void const* new_value,
void* after_value
);
typedef S32 (AILCALL * VDRV_FORCE_UPDATE) (HDRIVERSTATE driver);
//############################################################################
//## ##
//## Interface "Voice filter sample services" ##
//## ##
//############################################################################
typedef S32 (AILCALL * VSMP_SAMPLE_PROPERTY) (HSAMPLE S,
HPROPERTY property,
void* before_value,
void const* new_value,
void* after_value
);
//
// Pipeline filter calls
//
DXDEC HPROVIDER AILCALL AIL_digital_output_filter (HDIGDRIVER dig);
DXDEC S32 AILCALL AIL_enumerate_filters (HMSSENUM *next,
HPROVIDER *dest,
C8 * *name);
DXDEC HDRIVERSTATE
AILCALL AIL_open_filter (HPROVIDER lib,
HDIGDRIVER dig);
DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter);
DXDEC S32 AILCALL AIL_find_filter (C8 const *name,
HPROVIDER *ret);
DXDEC S32 AILCALL AIL_enumerate_filter_properties
(HPROVIDER lib,
HMSSENUM * next,
RIB_INTERFACE_ENTRY * dest);
DXDEC S32 AILCALL AIL_filter_property (HPROVIDER lib,
C8 const* name,
void* before_value,
void const* new_value,
void* after_value
);
DXDEC S32 AILCALL AIL_enumerate_output_filter_driver_properties
(HPROVIDER lib,
HMSSENUM * next,
RIB_INTERFACE_ENTRY * dest);
DXDEC S32 AILCALL AIL_output_filter_driver_property
(HDIGDRIVER dig,
C8 const * name,
void* before_value,
void const* new_value,
void* after_value
);
DXDEC S32 AILCALL AIL_enumerate_output_filter_sample_properties
(HPROVIDER lib,
HMSSENUM * next,
RIB_INTERFACE_ENTRY * dest);
DXDEC S32 AILCALL AIL_enumerate_filter_sample_properties
(HPROVIDER lib,
HMSSENUM * next,
RIB_INTERFACE_ENTRY * dest);
DXDEC S32 AILCALL AIL_enumerate_sample_stage_properties
(HSAMPLE S,
SAMPLESTAGE stage,
HMSSENUM * next,
RIB_INTERFACE_ENTRY * dest);
DXDEC S32 AILCALL AIL_sample_stage_property
(HSAMPLE S,
SAMPLESTAGE stage,
C8 const * name,
S32 channel,
void* before_value,
void const* new_value,
void* after_value
);
#define AIL_filter_sample_property(S,name,beforev,newv,afterv) AIL_sample_stage_property((S),SP_FILTER_0,(name),-1,(beforev),(newv),(afterv))
typedef struct _FLTPROVIDER
{
S32 provider_flags;
S32 driver_size;
S32 sample_size;
PROVIDER_PROPERTY PROVIDER_property;
FLT_STARTUP startup;
FLT_ERROR error;
FLT_SHUTDOWN shutdown;
FLT_OPEN_DRIVER open_driver;
FLT_CLOSE_DRIVER close_driver;
FLT_PREMIX_PROCESS premix_process;
FLT_POSTMIX_PROCESS postmix_process;
FLTSMP_OPEN_SAMPLE open_sample;
FLTSMP_CLOSE_SAMPLE close_sample;
FLTSMP_SAMPLE_PROCESS sample_process;
FLTSMP_SAMPLE_PROPERTY sample_property;
VFLT_ASSIGN_SAMPLE_VOICE assign_sample_voice;
VFLT_RELEASE_SAMPLE_VOICE release_sample_voice;
VFLT_START_SAMPLE_VOICE start_sample_voice;
VDRV_DRIVER_PROPERTY driver_property;
VDRV_FORCE_UPDATE force_update;
VSMP_SAMPLE_PROPERTY output_sample_property;
HDIGDRIVER dig;
HPROVIDER provider;
HDRIVERSTATE driver_state;
struct _FLTPROVIDER *next;
} FLTPROVIDER;
//
// Values for "Flags" property exported by all MSS Pipeline Filter and MSS Output Filter
// providers
//
#define FPROV_ON_SAMPLES 0x0001 // Pipeline filter that operates on input samples (and is enumerated by AIL_enumerate_filters)
#define FPROV_ON_POSTMIX 0x0002 // Pipeline filter that operates on the post mixed output (capture filter)
#define FPROV_MATRIX 0x0004 // This is a matrix output filter (e.g., SRS/Dolby)
#define FPROV_VOICE 0x0008 // This is a per-voice output filter (e.g., DirectSound 3D)
#define FPROV_3D 0x0010 // Output filter uses S3D substructure for positioning
#define FPROV_OCCLUSION 0x0020 // Output filter supports occlusion (doesn't need per-sample lowpass)
#define FPROV_EAX 0x0040 // Output filter supports EAX-compatible environmental reverb
#define FPROV_SIDECHAIN 0x0080 // Filter has an "Input" property on the 3rd index for side chaining.
#define FPROV_SPU_MASK 0xff0000 // Mask here the SPU INDEX STARTS
#define FPROV_SPU_INDEX( val ) ( ( val >> 16 ) & 0xff )
#define FPROV_MAKE_SPU_INDEX( val ) ( val << 16 )
#ifdef IS_WIN32
#define MSS_EAX_AUTO_GAIN 1
#define MSS_EAX_AUTOWAH 2
#define MSS_EAX_CHORUS 3
#define MSS_EAX_DISTORTION 4
#define MSS_EAX_ECHO 5
#define MSS_EAX_EQUALIZER 6
#define MSS_EAX_FLANGER 7
#define MSS_EAX_FSHIFTER 8
#define MSS_EAX_VMORPHER 9
#define MSS_EAX_PSHIFTER 10
#define MSS_EAX_RMODULATOR 11
#define MSS_EAX_REVERB 12
typedef struct EAX_SAMPLE_SLOT_VOLUME
{
S32 Slot; // 0, 1, 2, 3
S32 Send;
S32 SendHF;
S32 Occlusion;
F32 OcclusionLFRatio;
F32 OcclusionRoomRatio;
F32 OcclusionDirectRatio;
} EAX_SAMPLE_SLOT_VOLUME;
typedef struct EAX_SAMPLE_SLOT_VOLUMES
{
U32 NumVolumes; // 0, 1, or 2
EAX_SAMPLE_SLOT_VOLUME volumes[ 2 ];
} EAX_SAMPLE_SLOT_VOLUMES;
// Use this structure for EAX REVERB
typedef struct EAX_REVERB
{
S32 Effect; // set to MSS_EAX_REVERB
S32 Volume; // -10000 to 0
U32 Environment; // one of the ENVIRONMENT_ enums
F32 EnvironmentSize; // environment size in meters
F32 EnvironmentDiffusion; // environment diffusion
S32 Room; // room effect level (at mid frequencies)
S32 RoomHF; // relative room effect level at high frequencies
S32 RoomLF; // relative room effect level at low frequencies
F32 DecayTime; // reverberation decay time at mid frequencies
F32 DecayHFRatio; // high-frequency to mid-frequency decay time ratio
F32 DecayLFRatio; // low-frequency to mid-frequency decay time ratio
S32 Reflections; // early reflections level relative to room effect
F32 ReflectionsDelay; // initial reflection delay time
F32 ReflectionsPanX; // early reflections panning vector
F32 ReflectionsPanY; // early reflections panning vector
F32 ReflectionsPanZ; // early reflections panning vector
S32 Reverb; // late reverberation level relative to room effect
F32 ReverbDelay; // late reverberation delay time relative to initial reflection
F32 ReverbPanX; // late reverberation panning vector
F32 ReverbPanY; // late reverberation panning vector
F32 ReverbPanZ; // late reverberation panning vector
F32 EchoTime; // echo time
F32 EchoDepth; // echo depth
F32 ModulationTime; // modulation time
F32 ModulationDepth; // modulation depth
F32 AirAbsorptionHF; // change in level per meter at high frequencies
F32 HFReference; // reference high frequency
F32 LFReference; // reference low frequency
F32 RoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
U32 Flags; // modifies the behavior of properties
} EAX_REVERB;
// Use this structure for EAX AUTOGAIN
typedef struct EAX_AUTOGAIN
{
S32 Effect; // set to MSS_EAX_AUTO_GAIN
S32 Volume; // -10000 to 0
U32 OnOff; // Switch Compressor on or off (1 or 0)
} EAX_AUTOGAIN;
// Use this structure for EAX AUTOWAH
typedef struct EAX_AUTOWAH
{
S32 Effect; // set to MSS_EAX_AUTOWAH
S32 Volume; // -10000 to 0
F32 AttackTime; // Attack time (seconds)
F32 ReleaseTime; // Release time (seconds)
S32 Resonance; // Resonance (mB)
S32 PeakLevel; // Peak level (mB)
} EAX_AUTOWAH;
// Use this structure for EAX CHORUS
typedef struct EAX_CHORUS
{
S32 Effect; // set to MSS_EAX_CHORUS
S32 Volume; // -10000 to 0
U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle
S32 Phase; // Phase (Degrees)
F32 Rate; // Rate (Hz)
F32 Depth; // Depth (0 to 1)
F32 Feedback; // Feedback (-1 to 1)
F32 Delay; // Delay (seconds)
} EAX_CHORUS;
// Use this structure for EAX DISTORTION
typedef struct EAX_DISTORTION
{
S32 Effect; // set to MSS_EAX_DISTORTION
S32 Volume; // -10000 to 0
F32 Edge; // Controls the shape of the distortion (0 to 1)
S32 Gain; // Controls the post distortion gain (mB)
F32 LowPassCutOff; // Controls the cut-off of the filter pre-distortion (Hz)
F32 EQCenter; // Controls the center frequency of the EQ post-distortion (Hz)
F32 EQBandwidth; // Controls the bandwidth of the EQ post-distortion (Hz)
} EAX_DISTORTION;
// Use this structure for EAX ECHO
typedef struct EAX_ECHO
{
S32 Effect; // set to MSS_EAX_ECHO
S32 Volume; // -10000 to 0
F32 Delay; // Controls the initial delay time (seconds)
F32 LRDelay; // Controls the delay time between the first and second taps (seconds)
F32 Damping; // Controls a low-pass filter that dampens the echoes (0 to 1)
F32 Feedback; // Controls the duration of echo repetition (0 to 1)
F32 Spread; // Controls the left-right spread of the echoes
} EAX_ECHO;
// Use this structure for EAXEQUALIZER_ALLPARAMETERS
typedef struct EAX_EQUALIZER
{
S32 Effect; // set to MSS_EAX_EQUALIZER
S32 Volume; // -10000 to 0
S32 LowGain; // (mB)
F32 LowCutOff; // (Hz)
S32 Mid1Gain; // (mB)
F32 Mid1Center; // (Hz)
F32 Mid1Width; // (octaves)
F32 Mid2Gain; // (mB)
F32 Mid2Center; // (Hz)
F32 Mid2Width; // (octaves)
S32 HighGain; // (mB)
F32 HighCutOff; // (Hz)
} EAX_EQUALIZER;
// Use this structure for EAX FLANGER
typedef struct EAX_FLANGER
{
S32 Effect; // set to MSS_EAX_FLANGER
S32 Volume; // -10000 to 0
U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle
S32 Phase; // Phase (Degrees)
F32 Rate; // Rate (Hz)
F32 Depth; // Depth (0 to 1)
F32 Feedback; // Feedback (0 to 1)
F32 Delay; // Delay (seconds)
} EAX_FLANGER;
// Use this structure for EAX FREQUENCY SHIFTER
typedef struct EAX_FSHIFTER
{
S32 Effect; // set to MSS_EAX_FSHIFTER
S32 Volume; // -10000 to 0
F32 Frequency; // (Hz)
U32 LeftDirection; // direction - 0 = down, 1 = up, 2 = off
U32 RightDirection; // direction - 0 = down, 1 = up, 2 = off
} EAX_FSHIFTER;
// Use this structure for EAX VOCAL MORPHER
typedef struct EAX_VMORPHER
{
S32 Effect; // set to MSS_EAX_VMORPHER
S32 Volume; // -10000 to 0
U32 PhonemeA; // phoneme: 0 to 29 - A E I O U AA AE AH AO EH ER IH IY UH UW B D G J K L M N P R S T V Z
S32 PhonemeACoarseTuning; // (semitones)
U32 PhonemeB; // phoneme: 0 to 29 - A E I O U AA AE AH AO EH ER IH IY UH UW B D G J K L M N P R S T V Z
S32 PhonemeBCoarseTuning; // (semitones)
U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle, 2 = sawtooth
F32 Rate; // (Hz)
} EAX_VMORPHER;
// Use this structure for EAX PITCH SHIFTER
typedef struct EAX_PSHIFTER
{
S32 Effect; // set to MSS_EAX_PSHIFTER
S32 Volume; // -10000 to 0
S32 CoarseTune; // Amount of pitch shift (semitones)
S32 FineTune; // Amount of pitch shift (cents)
} EAX_PSHIFTER;
// Use this structure for EAX RING MODULATOR
typedef struct EAX_RMODULATOR
{
S32 Effect; // set to MSS_EAX_RMODULATOR
S32 Volume; // -10000 to 0
F32 Frequency; // Frequency of modulation (Hz)
F32 HighPassCutOff; // Cut-off frequency of high-pass filter (Hz)
U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle, 2 = sawtooth
} EAX_RMODULATOR;
#endif
#else // MSS_FLT_SUPPORTED
typedef struct _FLTPROVIDER
{
U32 junk;
} FLTPROVIDER;
#endif // MSS_FLT_SUPPORTED
#endif // MSS_BASIC
RADDEFEND
#endif // MSS_H
|