/usr/share/doc/libmikmod-dev/mikmod.html is in libmikmod-dev 3.3.10-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <html lang="en">
<head>
<title>MikMod sound library</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="MikMod sound library">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="top" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<h1 class="settitle">MikMod sound library</h1>
<div class="node">
<a name="Top"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>,
Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>,
Up: <a rel="up" accesskey="u" href="#dir">(dir)</a>
</div>
<h2 class="unnumbered">MikMod Sound Library</h2>
<p>This manual documents the MikMod Sound Library, version 3.3.10.<!-- /@w -->
<ul class="menu">
<li><a accesskey="1" href="#Introduction">Introduction</a>: What is MikMod ?
<li><a accesskey="2" href="#Tutorial">Tutorial</a>: Your first steps with MikMod.
<li><a accesskey="3" href="#Using-the-Library">Using the Library</a>: A thematic presentation of the library.
<li><a accesskey="4" href="#Library-Reference">Library Reference</a>: Detailed description of the functions and variables.
<li><a accesskey="5" href="#Index">Index</a>
</ul>
<!-- ========================================================== Introduction -->
<div class="node">
<a name="Introduction"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Tutorial">Tutorial</a>,
Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">1 Introduction</h2>
<p>The MikMod sound library is an excellent way for a programmer to add music
and sound effects to an application. It is a powerful and flexible library,
with a simple and easy-to-learn API.
<p>Besides, the library is very portable and runs under a lot of Unices, as well
as under OS/2, MacOS and Windows. Third party individuals also maintain ports
on other systems, including MS-DOS, and BeOS.
<p>MikMod is able to play a wide range of module formats, as well as digital sound
files. It can take advantage of particular features of your system, such as
sound redirection over the network. And due to its modular nature, the library
can be extended to support more sound or module formats, as well as new
hardware or other sound output capabilities, as they appear.
<!-- ========================================================== Tutorial -->
<div class="node">
<a name="Tutorial"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Using-the-Library">Using the Library</a>,
Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">2 Tutorial</h2>
<p>This chapter will describe how to quickly incorporate MikMod's power into
your programs. It doesn't cover everything, but that's a start and I hope
it will help you understand the library philosophy.
<p>If you have a real tutorial to put here, you're welcome ! Please send it to
me<small class="enddots">...</small>
<ul class="menu">
<li><a accesskey="1" href="#MikMod-Concepts">MikMod Concepts</a>: A few things you'll need to know.
<li><a accesskey="2" href="#A-Skeleton-Program">A Skeleton Program</a>: The shortest MikMod program.
<li><a accesskey="3" href="#Playing-Modules">Playing Modules</a>: How to create a simple module player.
<li><a accesskey="4" href="#Playing-Sound-Effects">Playing Sound Effects</a>: How to play simple sound effects.
<li><a accesskey="5" href="#More-Sound-Effects">More Sound Effects</a>: How to play more complex sound effects.
</ul>
<!-- ========================================================== Concepts -->
<div class="node">
<a name="MikMod-Concepts"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#A-Skeleton-Program">A Skeleton Program</a>,
Previous: <a rel="previous" accesskey="p" href="#Tutorial">Tutorial</a>,
Up: <a rel="up" accesskey="u" href="#Tutorial">Tutorial</a>
</div>
<h3 class="section">2.1 MikMod Concepts</h3>
<p>MikMod's sound output is composed of several sound <em>voices</em> which are
mixed, either in software or in hardware, depending of your hardware
configuration. Simple sounds, like sound effects, use only one voice, whereas
sound modules, which are complex arrangements of sound effects, use several
voices.
<p>MikMod's functions operate either globally, or at the voice level. Differences
in the handling of sound effects and modules are kept minimal, at least for
the programmer.
<p>The sound playback is done by a <em>sound driver</em>. MikMod provides several
sound drivers: different hardware drivers, and some software drivers to
redirect sound in a file, or over the network. You can even add your own
driver, register it to make it known by the library, and select it (this is
exactly what the module plugin of xmms does).
<!-- ========================================================== Skeleton -->
<div class="node">
<a name="A-Skeleton-Program"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Playing-Modules">Playing Modules</a>,
Previous: <a rel="previous" accesskey="p" href="#MikMod-Concepts">MikMod Concepts</a>,
Up: <a rel="up" accesskey="u" href="#Tutorial">Tutorial</a>
</div>
<h3 class="section">2.2 A Skeleton Program</h3>
<p>To use MikMod in your program, there are a few steps required:
<ul>
<li>Include <samp><span class="file">mikmod.h</span></samp> in your program.
<li>Register the MikMod drivers you need.
<li>Initialize the library with MikMod_Init() before using any other MikMod
function.
<li>Give up resources with MikMod_Exit() at the end of your program, or before
when MikMod is not needed anymore.
<li>Link your application with the MikMod sound library.
</ul>
<p>Here's a program which meets all those conditions:
<pre class="example"> /* MikMod Sound Library example program: a skeleton */
#include <mikmod.h>
main()
{
/* register all the drivers */
MikMod_RegisterAllDrivers();
/* initialize the library */
MikMod_Init("");
/* we could play some sound here... */
/* give up */
MikMod_Exit();
}
</pre>
<p>This program would be compiled with the following command line:
<code>cc -o example example.c `libmikmod-config --cflags` `libmikmod-config --libs`</code>
<p>Although this programs produces no useful result, many things happen when you
run it. The call to <code>MikMod_RegisterAllDrivers</code> registers all the drivers
embedded in the MikMod library. Then, <code>MikMod_Init</code> chooses the more
adequate driver and initializes it. The program is now ready to produce sound.
When sound is not needed any more, <code>MikMod_Exit</code> is used to relinquish
memory and let other programs have access to the sound hardware.
<!-- ========================================================== Modules -->
<div class="node">
<a name="Playing-Modules"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Playing-Sound-Effects">Playing Sound Effects</a>,
Previous: <a rel="previous" accesskey="p" href="#A-Skeleton-Program">A Skeleton Program</a>,
Up: <a rel="up" accesskey="u" href="#Tutorial">Tutorial</a>
</div>
<h3 class="section">2.3 Playing Modules</h3>
<p>Our program is not really useful if it doesn't produce sound. Let's suppose
you've got this good old module, “Beyond music”, in the file
<samp><span class="file">beyond music.mod</span></samp>. How about playing it ?
<p>To do this, we'll use the following code:
<pre class="example"> /* MikMod Sound Library example program: a simple module player */
#include <unistd.h>
#include <mikmod.h>
main()
{
MODULE *module;
/* register all the drivers */
MikMod_RegisterAllDrivers();
/* register all the module loaders */
MikMod_RegisterAllLoaders();
/* initialize the library */
md_mode |= DMODE_SOFT_MUSIC;
if (MikMod_Init("")) {
fprintf(stderr, "Could not initialize sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
/* load module */
module = Player_Load("beyond music.mod", 64, 0);
if (module) {
/* start module */
Player_Start(module);
while (Player_Active()) {
/* we're playing */
usleep(10000);
MikMod_Update();
}
Player_Stop();
Player_Free(module);
} else
fprintf(stderr, "Could not load module, reason: %s\n",
MikMod_strerror(MikMod_errno));
/* give up */
MikMod_Exit();
}
</pre>
<p>What's new here ? First, we've not only registered MikMod's device driver,
but also the module loaders. MikMod comes with a large choice of module
loaders, each one for a different module type. Since <em>every</em> loader is
called to determine the type of the module when we try to load them, you may
want to register only a few of them to save time. In our case, we don't matter,
so we happily register every module loader.
<p>Then, there's an extra line before calling <code>MikMod_Init</code>. We change the
value of MikMod's variable <code>md_mode</code> to tell the library that we want the
module to be processed by the software. If you're the happy owner of a GUS-type
card, you could use the specific hardware driver for this card, but in this
case you should not set the <code>DMODE_SOFT_MUSIC</code> flag.
<p>We'll ensure that <code>MikMod_Init</code> was successful. Note that, in case of
error, MikMod provides the variable <code>MikMod_errno</code>, an equivalent of
the C library <code>errno</code> for MikMod errors, and the function
<code>MikMod_strerror</code>, an equivalent to <code>strerror</code>.
<p>Now onto serious business ! The module is loaded with the <code>Player_Load</code>
function, which takes the name of the module file, and the number of voices
afforded to the module. In this case, the module has only 4 channels, so 4
voices, but complex Impulse Tracker modules can have a lot of voices (as they
can have as many as 256 virtual channels with so-called “new note actions”).
Since empty voices don't cost time to be processed, it is safe to use a big
value, such as 64 or 128. The third parameter is the “curiosity” of the
loader: if nonzero, the loader will search for hidden parts in the module.
However, only a few module formats can embed hidden or non played parts, so
we'll use 0 here.
<p>Now that the module is ready to play, let's play it. We inform the player that
the current module is <code>module</code> with <code>Player_Start</code>. Playback starts,
but we have to update it on a regular basis. So there's a loop on the result
of the <code>Player_Active</code> function, which will tell us if the module has
finished. To update the sound, we simply call <code>MikMod_Update</code>.
<p>After the module has finished, we tell the player its job is done with
<code>Player_Stop</code>, and we free the module with <code>Player_Free</code>.
<!-- ========================================================== Sound effects -->
<div class="node">
<a name="Playing-Sound-Effects"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#More-Sound-Effects">More Sound Effects</a>,
Previous: <a rel="previous" accesskey="p" href="#Playing-Modules">Playing Modules</a>,
Up: <a rel="up" accesskey="u" href="#Tutorial">Tutorial</a>
</div>
<h3 class="section">2.4 Playing Sound Effects</h3>
<p>MikMod is not limited to playing modules, it can also play sound effects, that
is, module samples. It's a bit more complex than playing a module, because the
module player does a lot of things for us, but here we'll get more control over
what is actually played by the program. Let's look at an example:
<pre class="example"> /* MikMod Sound Library example program: sound effects */
#include <unistd.h>
#include <mikmod.h>
main()
{
int i;
/* sound effects */
SAMPLE *sfx1, *sfx2;
/* voices */
int v1, v2;
/* register all the drivers */
MikMod_RegisterAllDrivers();
/* initialize the library */
md_mode |= DMODE_SOFT_SNDFX;
if (MikMod_Init("")) {
fprintf(stderr, "Could not initialize sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
/* load samples */
sfx1 = Sample_Load("first.wav");
if (!sfx1) {
MikMod_Exit();
fprintf(stderr, "Could not load the first sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
sfx2 = Sample_Load("second.wav");
if (!sfx2) {
Sample_Free(sfx1);
MikMod_Exit();
fprintf(stderr, "Could not load the second sound, reason: %s\n",
MikMod_strerror(MikMod_errno));
return;
}
/* reserve 2 voices for sound effects */
MikMod_SetNumVoices(-1, 2);
/* get ready to play */
MikMod_EnableOutput();
/* play first sample */
v1 = Sample_Play(sfx1, 0, 0);
for(i = 0; i < 5; i++) {
MikMod_Update();
usleep(100000);
}
/* half a second later, play second sample */
v2 = Sample_Play(sfx2, 0, 0);
do {
MikMod_Update();
usleep(100000);
} while (!Voice_Stopped(v2));
MikMod_DisableOutput();
Sample_Free(sfx2);
Sample_Free(sfx1);
MikMod_Exit();
}
</pre>
<p>As in the previous example, we begin by registering the sound drivers and
initializing the library. We also ask for software mixing by modifying the
variable <code>md_mode</code>.
<p>It's time to load our files, with the <code>Sample_Load</code> function. Don't forget
to test the return value — it looks ugly here on such a small example, but
it's a good practice<small class="enddots">...</small>
<p>Since we want to play two samples, we have to use at least two voices for this,
so we reserve them with a <code>MikMod_SetNumVoices</code> call. The first parameter
sets the number of module voices, and the second parameter the number of sound
effect voices. We don't want to set the number of module voices here (it's part
of the module player's duty), so we use the value <code>-1</code> to keep the current
value, and we reserve two sound effect voices.
<p>Now we're ready to play, so we call <code>MikMod_EnableOutput</code> to make the
driver ready. Sound effects are played by the <code>Sample_Play</code> function.
You just have to specify which sample you want to play, the offset from which
you want to start, and the playback flags. More on this later. The function
returns the number of the voice associated to the sample.
<p>We play the first sample for half a second, then we start to play the second
sample. Since we've reserved two channels, both samples play simultaneously. We
use the <code>Voice_Stopped</code> function to stop the playback: it returns the
current status of the voice argument, which is zero when the sample plays and
nonzero when it has finished. So the <code>do</code> loop will stop exactly when
the second sample is finished, regardless of the length of the first sample.
<p>To finish, we get rid of the samples with <code>Sample_Free</code>.
<!-- ========================================================== More effects -->
<div class="node">
<a name="More-Sound-Effects"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Playing-Sound-Effects">Playing Sound Effects</a>,
Up: <a rel="up" accesskey="u" href="#Tutorial">Tutorial</a>
</div>
<h3 class="section">2.5 More Sound Effects</h3>
<p>Sound effects have some attributes that can be affected to control the playback.
These are speed, panning, and volume. Given a voice number, you can affect these
attributes with the <code>Voice_SetFrequency</code>, <code>Voice_SetPanning</code> and
<code>Voice_SetVolume</code> functions.
<p>In the previous example, we'll replace the actual sound code, located between
the calls to <code>MikMod_EnableOutput</code> and <code>MikMod_DisableOutput</code>, with
the following code:
<pre class="example"> Sample_Play(sfx1, 0, 0);
for(i = 0; i < 5; i++) {
MikMod_Update();
usleep(100000);
}
v2 = Sample_Play(sfx2, 0, SFX_CRITICAL);
i = 0;
do {
MikMod_Update();
usleep(100000);
v1 = Sample_Play(sfx1, 0, 0);
Voice_SetVolume(v1, 160);
Voice_SetFrequency(v1, (sfx1->speed * (100 + i)) / 100);
Voice_SetPanning(v2, (i++ & 1) ? PAN_LEFT : PAN_RIGHT);
} while (!Voice_Stopped(v2));
</pre>
<p>The first thing you'll notice, is the <code>SFX_CRITICAL</code> flag used to play the
second sample. Since the <code>do</code> loop will add another sample every 100
<span class="dmn">milliseconds</span>, and we reserved only two voices, the oldest voice will be
cut each time this is necessary. Doing this would cut the second sample in the
second iteration of the loop. However, since we flagged this sound as
“critical”, it won't be cut until it is finished or we stop it with a
<code>Voice_Stop</code> call. So the second sample will play fine, whereas the first
sample will be stopped every loop iteration.
<p>Then, we choose to play the first sample a bit lower, with
<code>Voice_SetVolume</code>. Volume voices range from 0 (silence) to 256. In
this case we play the sample at 160. To make the sound look weird, we also
change its frequency with <code>Voice_SetFrequency</code>. The computation in the
example code makes the frequency more and more high (starting from the sample
frequency and then increasing from 1% each iteration).
<p>And to demonstrate the <code>Voice_SetPanning</code> function, we change the panning
of the second sample at each iteration from the left to the right. The argument
can be one of the standard panning <code>PAN_LEFT</code>, <code>PAN_RIGHT</code>,
<code>PAN_CENTER</code> and <code>PAN_SURROUND</code><a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>, or a numeric value between 0 (<code>PAN_LEFT</code>) and
255 (<code>PAN_RIGHT</code>).
<!-- ========================================================== Using -->
<div class="node">
<a name="Using-the-Library"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Library-Reference">Library Reference</a>,
Previous: <a rel="previous" accesskey="p" href="#Tutorial">Tutorial</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">3 Using the Library</h2>
<p>This chapter describes the various parts of the library and their uses.
<ul class="menu">
<li><a accesskey="1" href="#Library-Version">Library Version</a>
<li><a accesskey="2" href="#Type-Definitions">Type Definitions</a>
<li><a accesskey="3" href="#Error-Handling">Error Handling</a>
<li><a accesskey="4" href="#Library-Initialization">Library Initialization</a>
<li><a accesskey="5" href="#Samples-and-Voice-Control">Samples and Voice Control</a>
<li><a accesskey="6" href="#Modules-and-Player-Control">Modules and Player Control</a>
<li><a accesskey="7" href="#Loading-Data-from-Memory">Loading Data from Memory</a>
</ul>
<!-- ========================================================== Version -->
<div class="node">
<a name="Library-Version"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Type-Definitions">Type Definitions</a>,
Previous: <a rel="previous" accesskey="p" href="#Using-the-Library">Using the Library</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.1 Library Version</h3>
<p>If your program is dynamically linked with the MikMod library, you should check
which version of the library you're working with.
To do this, the library defines a few constants and a function to help you
determine if the current library is adequate for your needs or if it has to
be upgraded.
<p>When your program includes <code>mikmod.h</code>, the following constants are
defined:
<ul>
<li><code>LIBMIKMOD_VERSION_MAJOR</code> is equal to the major version number of
the library.
<li><code>LIBMIKMOD_VERSION_MINOR</code> is equal to the minor version number of
the library.
<li><code>LIBMIKMOD_REVISION</code> is equal to the revision number of the library.
<li><code>LIBMIKMOD_VERSION</code> is the sum of <code>LIBMIKMOD_VERSION_MAJOR</code> shifted 16 times, <code>LIBMIKMOD_VERSION_MINOR</code> shifted 8 times, and
<code>LIBMIKMOD_REVISION</code>.
</ul>
<p>So your program can tell with which version of the library it has been compiled
this way:
<pre class="example"> printf("Compiled with MikMod Sound Library version %ld.%ld.%ld\n",
LIBMIKMOD_VERSION_MAJOR,
LIBMIKMOD_VERSION_MINOR,
LIBMIKMOD_REVISION);
</pre>
<p>The library defines the function <code>MikMod_GetVersion</code> which returns the
value of LIBMIKMOD_VERSION for the library. If this value is greater than or
equal to the value of LIBMIKMOD_VERSION for your program, your program will
work; otherwise, you'll have to inform the user that he has to upgrade the
library:
<pre class="example"> {
long engineversion = MikMod_GetVersion();
if (engineversion < LIBMIKMOD_VERSION) {
printf("MikMod library version (%ld.%ld.%ld) is too old.\n",
(engineversion >> 16) & 255,
(engineversion >> 8) & 255,
(engineversion) & 255);
printf("This programs requires at least version %ld.%ld.%ld\n",
LIBMIKMOD_VERSION_MAJOR,
LIBMIKMOD_VERSION_MINOR,
LIBMIKMOD_REVISION);
puts("Please upgrade your MikMod library.");
exit(1);
}
}
</pre>
<!-- ========================================================== Types -->
<div class="node">
<a name="Type-Definitions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Error-Handling">Error Handling</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Version">Library Version</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.2 Type Definitions</h3>
<p>MikMod defines several data types to deal with modules and sample data.
These types have the same memory size on every platform MikMod has been ported
to.
<p>These types are:
<ul>
<li><code>CHAR</code> is a printable character. For now it is the same as the
<code>char</code> type, but in the future it may be wide char (Unicode) on some
platforms.
<li><code>SBYTE</code> is a signed 8 bit number (can range from -128 to 127).
<li><code>UBYTE</code> is an unsigned 8 bit number (can range from 0 to 255).
<li><code>SWORD</code> is a signed 16 bit number (can range from -32768 to 32767).
<li><code>UWORD</code> is an unsigned 16 bit number (can range from 0 to 65535).
<li><code>SLONG</code> is a signed 32 bit number (can range from -2.147.483.648 to
2.147.483.647).
<li><code>ULONG</code> is an unsigned 32 bit number (can range from 0 to
4.294.967.296).
<li><code>BOOL</code> is a boolean value. A value of 0 means false, any other value
means true.
</ul>
<!-- ========================================================== Errors -->
<div class="node">
<a name="Error-Handling"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Library-Initialization">Library Initialization</a>,
Previous: <a rel="previous" accesskey="p" href="#Type-Definitions">Type Definitions</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.3 Error Handling</h3>
<p>Although MikMod does its best to do its work, there are times where it can't.
For example, if you're trying to play a corrupted file, well, it can't.
<p>A lot of MikMod functions return pointers or <code>BOOL</code> values. If the pointer
is <code>NULL</code> or the <code>BOOL</code> is 0 (false), an error has occurred.
<p>MikMod errors are returned in the variable <code>MikMod_errno</code>. Each possible
error has a symbolic error code, beginning with <code>MMERR_</code>. For example, if
MikMod can't open a file, <code>MikMod_errno</code> will receive the value
<code>MMERR_OPENING_FILE</code>.
<p>You can get an appropriate error message to display from the function
<code>MikMod_strerror</code>.
<p>There is a second error variable named <code>MikMod_critical</code>. As its name
suggests, it is only set if the error lets the library in an unstable state.
This variable can only be set by the functions <code>MikMod_Init</code>,
<code>MikMod_SetNumVoices</code> and <code>MikMod_EnableOutput</code>. If one of these
functions return an error and <code>MikMod_critical</code> is set, the library is left
in the uninitialized state (i.e. it was not initialized, or <code>MikMod_Exit</code>
was called).
<p>If you prefer, you can use a callback function to get notified of errors. This
function must be prototyped as <code>void MyFunction(void)</code>. Then, call
<code>MikMod_RegisterHandler</code> with your function as argument to have it notified
when an error occurs. There can only be one callback function registered, but
<code>MikMod_RegisterHandler</code> will return you the previous handler, so you can
chain handlers if you want to.
<!-- ========================================================== Initialization -->
<div class="node">
<a name="Library-Initialization"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Samples-and-Voice-Control">Samples and Voice Control</a>,
Previous: <a rel="previous" accesskey="p" href="#Error-Handling">Error Handling</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.4 Library Initialization and Core Functions</h3>
<p>To initialize the library, you must register some sound drivers first. You can
either register all the drivers embedded in the library for your platform with
<code>MikMod_RegisterAllDrivers</code>, or register only some of them with
<code>MikMod_RegisterDriver</code>. If you choose to register the drivers manually,
you must be careful in their order, since <code>MikMod_Init</code> will try them in
the order you registered them. The <code>MikMod_RegisterAllDrivers</code> function
registers the network drivers first (for playing sound over the network), then
the hardware drivers, then the disk writers, and in last resort, the nosound
driver. Registering the nosound driver first would not be a very good
idea<small class="enddots">...</small>
<p>You can get some printable information regarding the registered drivers with
<code>MikMod_InfoDriver</code>; don't forget to call <code>MikMod_free</code> on the
returned string when you don't need it anymore.
<p>After you've registered your drivers, you can initialize the sound playback
with <code>MikMod_Init</code>, passing specific information to the driver if
necessary. If you set the variable <code>md_device</code> to zero, which
is its default value, the driver will be autodetected, that is, the first driver
in the list that is available on the system will be used; otherwise only
the driver whose order in the list of the registered drivers is equal to
<code>md_device</code> will be tried. If your playback settings, in the variables
<code>md_mixfreq</code> and <code>md_mode</code>, are not supported by the device,
<code>MikMod_Init</code> will fail.
<p>You can then choose the number of voices you need with
<code>MikMod_SetNumVoices</code>, and activate the playback with
<code>MikMod_EnableOutput</code>.
<p>Don't forget to call <code>MikMod_Update</code> as often as possible to process the
sound mixing. If necessary, fork a dedicated process to do this, or if the
library is thread-safe on your system, use a dedicated thread.
<p>If you want to change playback settings, most of them can't be changed on the
fly. You'll need to stop the playback and reinitialize the driver. Use
<code>MikMod_Active</code> to check if there is still sound playing; in this case,
call <code>MikMod_DisableOutput</code> to end playback. Then, change your settings
and call <code>MikMod_Reset</code>. You're now ready to select your number of voices
and restart playback.
<p>When your program ends, don't forget to stop playback and call
<code>MikMod_Exit</code> to leave the sound hardware in a coherent state.
<p>On systems that have pthreads, libmikmod is thread-safe<a rel="footnote" href="#fn-2" name="fnd-2"><sup>2</sup></a>. You can check this in your programs with the
<code>MikMod_InitThreads</code> function. If this function returns 1, the library is
thread-safe.
<p>The main benefit of thread-safety is that <code>MikMod_Update</code> can be called
from a separate thread, which often makes application design easier. However,
several libmikmod global variables are accessible from all your threads, so
when more than one thread need to access libmikmod variables, you'll have to
protect these access with the <code>MikMod_Lock</code> and <code>MikMod_Unlock</code>
functions. If libmikmod is not thread-safe, these functions are no-ops.
<!-- ========================================================== Samples -->
<div class="node">
<a name="Samples-and-Voice-Control"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Modules-and-Player-Control">Modules and Player Control</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Initialization">Library Initialization</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.5 Samples and Voice Control</h3>
<p>Currently, MikMod only supports uncompressed mono WAV files as samples. You can
load a sample by calling <code>Sample_Load</code> with a filename, or by calling
<code>Sample_LoadFP</code> with an open <code>FILE*</code> pointer. These functions return
a pointer to a <code>SAMPLE</code> structure, or <code>NULL</code> in case of error.
<p>The <code>SAMPLE</code> structure has a few interesting fields:
<ul>
<li><code>speed</code> contains the default frequency of the sample.
<li><code>volume</code> contains the default volume of the sample, ranging from 0 (silence)
to 64.
<li><code>panning</code> contains the default panning position of the sample.
</ul>
<p>Altering one of those fields will affect all voices currently playing the
sample. You can achieve the same result on a single voice with the functions
<code>Voice_SetFrequency</code>, <code>Voice_SetVolume</code> and <code>Voice_SetPanning</code>.
Since the same sample can be played with different frequency, volume and panning
parameters on each voice, you can get voice specific information with
<code>Voice_GetFrequency</code>, <code>Voice_GetVolume</code> and <code>Voice_GetPanning</code>.
<p>You can also make your sample loop by setting the fields <code>loopstart</code> and
<code>loopend</code> and or'ing <code>flags</code> with <code>SF_LOOP</code>. To compute your loop
values, the field <code>length</code> will be useful. However, you must know that
all the sample length are expressed in samples, i.e. 8 bits for an 8 bit sample,
and 16 bit for a 16 bit sample<small class="dots">...</small> Test <code>flags</code> for the value
<code>SF_16BITS</code> to know this.
<p>Speaking of flags, if you're curious and want to know the original format of the
sample on disk (since libmikmod does some work on the sample data internally),
refer to the <code>inflags</code> field.
<p>If the common forward loop isn't enough, you can play with some other flags:
<code>SF_BIDI</code> will make your sample loop “ping pong” (back and forth), and
<code>SF_REVERSE</code> will make it play backwards.
<p>To play your sample, use the <code>Sample_Play</code> function. This function
will return a voice number which enable you to use the <code>Voice_xx</code>
functions.
<p>The sample will play until another sample takes over its voice (when you play
more samples than you reserved sound effect voices), unless it has been flagged
as <code>SFX_CRITICAL</code>. You can force it to stop with <code>Voice_Stop</code>, or you
can force another sample to take over this voice with <code>Voice_Play</code>;
however <code>Voice_Play</code> doesn't let you flag the new sample as critical.
<p>Non looping samples will free their voice channel as soon as they are finished;
you can know the current playback position of your sample with
<code>Voice_GetPosition</code>. If it is zero, either the sample has finished playing
or it is just beginning; use <code>Voice_Stopped</code> to know.
<p>When you don't need a sample anymore, don't forget to free its memory with
<code>Sample_Free</code>.
<!-- ========================================================== Module player -->
<div class="node">
<a name="Modules-and-Player-Control"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Loading-Data-from-Memory">Loading Data from Memory</a>,
Previous: <a rel="previous" accesskey="p" href="#Samples-and-Voice-Control">Samples and Voice Control</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.6 Modules and Player Control</h3>
<p>As for the sound drivers, you have to register the module loaders you want to
use for MikMod to be able to load modules. You can either register all the
module loaders with <code>MikMod_RegisterAllLoaders</code>, or only a few of them with
<code>MikMod_RegisterLoader</code>. Be careful if you choose this solution, as the
15 instrument MOD loader has to be registered last, since loaders are called in
the order they were register to identify modules, and the detection of this
format is not fully reliable, so other modules might be mistaken as 15
instrument MOD files.
<p>You can get some printable information regarding the registered loaders with
<code>MikMod_InfoLoader</code>; don't forget to call <code>MikMod_free</code> on the returned
string when you don't need it anymore.
<p>Note that, contrary to the sound drivers, you can register module loaders at
any time, it doesn't matter.
<p>For playlists, you might be interested in knowing the module title first, and
<code>Player_LoadTitle</code> will give you this information. Don't forget to call
<code>MikMod_free</code> on the returned text when you don't need it anymore.
<p>You can load a module either with <code>Player_Load</code> and the name of the
module, or with <code>Player_LoadFP</code> and an open <code>FILE*</code> pointer. These
functions also expect a maximal number of voices, and a curiosity flag. Unless
you have excellent reasons not to do so, choose a big limit, such as 64 or even
128 for complex Impulse Tracker modules. Both functions return a pointer to an
<code>MODULE</code> structure, or <code>NULL</code> if an error occurs.
<p>You'll find some useful information in this structure:
<ul>
<li><code>numchn</code> contains the number of module “real” channels.
<li><code>numvoices</code> contains the number of voices reserved by the player for
the real channels and the virtual channels (NNA).
<li><code>numpas</code> and <code>numpat</code> contain the number of song positions and
song patterns.
<li><code>numins</code> and <code>numsmp</code> contain the number of instruments and
samples.
<li><code>songname</code> contains the song title.
<li><code>modtype</code> contains the name of the tracker used to create the song.
<li><code>comment</code> contains the song comment, if it has one.
<li><code>sngtime</code> contains the time elapsed in the module, in
2^−10 <span class="dmn">seconds</span> (not exactly a millisecond).
<li><code>sngspd</code> and <code>bpm</code> contain the song speed and tempo.
<li><code>realchn</code> contains the actual number of active channels.
<li><code>totalchn</code> contains the actual number of active virtual channels,
i.e. the sum of <code>realchn</code> and the number of NNA virtual channels.
</ul>
<p>Now that the module is loaded, you need to tell the module player that you want
to play this particular module with <code>Player_Start</code> (the player can only
play one module, but you can have several modules in memory). The playback
begins. Should you forget which module is playing, <code>Player_GetModule</code> will
return it to you.
<p>You can change the current song position with the functions
<code>Player_NextPosition</code>, <code>Player_PrevPosition</code> and
<code>Player_SetPosition</code>, the speed with <code>Player_SetSpeed</code> and
<code>Player_SetTempo</code>, and the volume (ranging from 0 to 128) with
<code>Player_SetVolume</code>.
<p>Playback can be paused or resumed with <code>Player_TogglePause</code>. Be sure to
check with <code>Player_Paused</code> that it isn't already in the state you want !
<p>Fine player control is achieved by the functions <code>Player_Mute</code>,
<code>Player_UnMute</code> and <code>Player_ToggleMute</code> which can silence or resume
a set of module channels. The function <code>Player_Muted</code> will return the
state of a given channel. And if you want even more control, you can get the
voice corresponding to a module channel with <code>Player_GetChannelVoice</code> and
act directly on the voice.
<p>Modules play only once, but can loop indefinitely if they are designed to do so.
You can change this behavior with the <code>wrap</code> and <code>loop</code> of the
<code>MODULE</code> structure; the first one, if set, will make the module restart
when it's finished, and the second one, if set, will prevent the module from
jumping backwards.
<p>You can test if the module is still playing with <code>Player_Active</code>, and you
can stop it at any time with <code>Player_Stop</code>. When the module isn't needed
anymore, get rid of it with <code>Player_Free</code>.
<!-- ========================================================== Mreaders -->
<div class="node">
<a name="Loading-Data-from-Memory"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Modules-and-Player-Control">Modules and Player Control</a>,
Up: <a rel="up" accesskey="u" href="#Using-the-Library">Using the Library</a>
</div>
<h3 class="section">3.7 Loading Data from Memory</h3>
<p>If you need to load modules or sound effects from other places than plain
files, you can use the <code>MREADER</code> and <code>MWRITER</code> objects to achieve
this.
<p>The <code>MREADER</code> and <code>MWRITER</code> structures contain a list of function
pointers, which emulate the behaviour of a regular <code>FILE *</code> object. In
fact, all functions which take filenames or <code>FILE *</code> as arguments are only
wrappers to a real function which takes an <code>MREADER</code> or an <code>MWRITER</code>
argument.
<p>So, if you need to load a module from memory, or for a multi-file archive, for
example, all you need is to build an adequate <code>MREADER</code> object, and use
<code>Player_LoadGeneric</code> instead of <code>Player_Load</code> or
<code>Player_LoadFP</code>. For samples, use <code>Sample_LoadGeneric</code> instead of
<code>Sample_Load</code> or <code>Sample_LoadFP</code>.
<!-- ========================================================== Reference -->
<div class="node">
<a name="Library-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Index">Index</a>,
Previous: <a rel="previous" accesskey="p" href="#Using-the-Library">Using the Library</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">4 Library Reference</h2>
<p>This chapter describes in more detail all the functions and variables provided
by the library. See <a href="#Type-Definitions">Type Definitions</a>, for the basic type reference.
<ul class="menu">
<li><a accesskey="1" href="#Variable-Reference">Variable Reference</a>
<li><a accesskey="2" href="#Structure-Reference">Structure Reference</a>
<li><a accesskey="3" href="#Error-Reference">Error Reference</a>
<li><a accesskey="4" href="#Function-Reference">Function Reference</a>
<li><a accesskey="5" href="#Loader-Reference">Loader Reference</a>
<li><a accesskey="6" href="#Driver-Reference">Driver Reference</a>
</ul>
<!-- ========================================================== Variable reference -->
<div class="node">
<a name="Variable-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Structure-Reference">Structure Reference</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Reference">Library Reference</a>,
Up: <a rel="up" accesskey="u" href="#Library-Reference">Library Reference</a>
</div>
<h3 class="section">4.1 Variable Reference</h3>
<h4 class="subsection">4.1.1 Error Variables</h4>
<p>The following variables are set by the library to return error information.
<a name="index-MikMod_005ferrno-1"></a>
<dl><dt><code>int MikMod_errno</code><dd>When an error occurs, this variable contains the error code.
See <a href="#Error-Reference">Error Reference</a>, for more information.
<a name="index-MikMod_005fcritical-2"></a><br><dt><code>BOOL MikMod_critical</code><dd>When an error occurs, this variable informs of the severity of the error. Its
value has sense only if the value of <code>MikMod_errno</code> is different from zero.
If the value of <code>MikMod_critical</code> is zero, the error wasn't fatal and the
library is in a stable state. However, if it is nonzero, then the library can't
be used and has reseted itself to the uninitialized state. This often means
that the mixing parameters you choose were not supported by the driver, or that
it doesn't has enough voices for your needs if you called
<code>MikMod_SetNumVoices</code>.
</dl>
<h4 class="subsection">4.1.2 Sound Settings</h4>
<p>The following variables control the sound output parameters and their changes
take effect immediately.
<a name="index-md_005fmusicvolume-3"></a>
<dl><dt><code>UBYTE md_musicvolume</code><dd>Volume of the module. Allowed values range from
0 to 128. The default value is 128.
<a name="index-md_005fpansep-4"></a><br><dt><code>UBYTE md_pansep</code><dd>Stereo channels separation. Allowed values range
from 0 (no separation, thus mono sound) to 128 (full channel separation). The
default value is 128.
<a name="index-md_005freverb-5"></a><br><dt><code>UBYTE md_reverb</code><dd>Amount of sound reverberation. Allowed values range
from 0 (no reverberation) to 15 (a rough estimate for chaos<small class="dots">...</small>). The
default value is 0.
<a name="index-md_005fsndfxvolume-6"></a><br><dt><code>UBYTE md_sndfxvolume</code><dd>Volume of the sound effects. Allowed values range
from 0 to 128. The default value is 128.
<a name="index-md_005fvolume-7"></a><br><dt><code>UBYTE md_volume</code><dd>Overall sound volume. Allowed values range from 0
to 128. The default value is 128.
</dl>
<h4 class="subsection">4.1.3 Driver Settings</h4>
<p>The following variables control more in-depth sound output parameters. Except
for some <code>md_mode</code> flags, their changes do not have any effect until you
call <code>MikMod_Init</code> or <code>MikMod_Reset</code>.
<a name="index-md_005fdevice-8"></a>
<dl><dt><code>UWORD md_device</code><dd>This variable contains the order, in the list of the registered drivers, of the
sound driver which will be used for sound playback. This order is one-based; if
this variable is set to zero, the driver is autodetected, which means the list
is tested until a driver is present on the system. The default value is 0, thus
driver is autodetected.
<a name="index-md_005fdriver-9"></a><br><dt><code>MDRIVER* md_driver</code><dd>This variable points to the driver which is being used for sound playback, and
is undefined when the library is uninitialized (before <code>MikMod_Init</code> and
after <code>MikMod_Exit</code>). This variable is for information only, you should
never attempt to change its value. Use <code>md_driver</code> and <code>MikMod_Init</code>
(or <code>MikMod_Reset</code>) instead.
<a name="index-md_005fmixfreq-10"></a><br><dt><code>UWORD md_mixfreq</code><dd>Sound playback frequency, in hertz. High values
yield high sound quality, but need more computing power than lower values. The
default value is 44100 Hz, which is compact disc quality. Other common values
are 22100 Hz (radio quality), 11025 Hz (phone quality), and 8000 Hz (mu-law
quality).
<a name="index-md_005fmode-11"></a><br><dt><code>UWORD md_mode</code><dd>This variable is a combination of several flags, to select which output mode
to select.
The following flags have a direct action to the sound output (i.e. changes take
effect immediately):
<dl>
<dt>‘<samp><span class="samp">DMODE_INTERP</span></samp>’<dd>This flag, if set, enables the interpolated mixers. Interpolated mixing gives
better sound but takes a bit more time than standard mixing. If the library
is built with the high quality mixer, interpolated mixing is always enabled,
regardless of this flag.
<br><dt>‘<samp><span class="samp">DMODE_REVERSE</span></samp>’<dd>This flag, if set, exchanges the left and right stereo channels.
<br><dt>‘<samp><span class="samp">DMODE_SURROUND</span></samp>’<dd>This flag, if set, enables the surround mixers. Since surround mixing works
only for stereo sound, this flag has no effect if the sound playback is in
mono.
</dl>
<p>The following flags aren't taken in account until the sound driver is changed
or reset:
<dl>
<dt>‘<samp><span class="samp">DMODE_16BIT</span></samp>’<dd>This flag, if set, selects 16 bit sound mode. This mode yields better sound
quality, but needs twice more mixing time.
<br><dt>‘<samp><span class="samp">DMODE_HQMIXER</span></samp>’<dd>This flag, if set, selects the high-quality software mixer. This mode yields
better sound quality, but needs more mixing time. Of course, this flag has no
effect if no <code>DMODE_SOFT_xx</code> flag is set.
<br><dt>‘<samp><span class="samp">DMODE_SOFT_MUSIC</span></samp>’<dd>This flag, if set, selects software mixing of the module.
<br><dt>‘<samp><span class="samp">DMODE_SOFT_SNDFX</span></samp>’<dd>This flag, if set, selects software mixing of the sound effects.
<br><dt>‘<samp><span class="samp">DMODE_STEREO</span></samp>’<dd>This flag, if set, selects stereo sound.
</dl>
<p>The default value of this variable is ‘<samp><span class="samp">DMODE_STEREO | DMODE_SURROUND |
DMODE_16BITS | DMODE_SOFT_MUSIC | DMODE_SOFT_SNDFX</span></samp>’.
</dl>
<!-- ========================================================== Structure reference -->
<div class="node">
<a name="Structure-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Error-Reference">Error Reference</a>,
Previous: <a rel="previous" accesskey="p" href="#Variable-Reference">Variable Reference</a>,
Up: <a rel="up" accesskey="u" href="#Library-Reference">Library Reference</a>
</div>
<h3 class="section">4.2 Structure Reference</h3>
<p>Only the useful fields are described here; if a structure field is not
described, you must assume that it's an internal field which must not be
modified.
<h4 class="subsection">4.2.1 Drivers</h4>
<p><a name="index-MDRIVER-12"></a>
The <code>MDRIVER</code> structure is not meant to be used by anything else than the
core of the library, but its first four fields contain useful information for
your programs:
<dl>
<dt><code>const CHAR* Name</code><dd>Name of the driver, usually never more than 20 characters.
<br><dt><code>const CHAR* Description</code><dd>Description of the driver, usually never more than 50 characters.
<br><dt><code>UBYTE HardVoiceLimit</code><dd>Maximum number of hardware voices for this driver, 0 if the driver has no
hardware mixing support.
<br><dt><code>UBYTE SoftVoiceLimit</code><dd>Maximum number of software voices for this driver, 0 if the driver has no
software mixing support.
<br><dt><code>const CHAR* Alias</code><dd>A short name for the driver, without spaces, usually never more than 10
characters.
</dl>
<h4 class="subsection">4.2.2 Modules</h4>
<p><a name="index-MODULE-13"></a>
The <code>MODULE</code> structure gathers all the necessary information needed to
play a module file, regardless of its initial format.
<h5 class="subsubsection">4.2.2.1 General Module Information</h5>
<p>The fields described in this section contain general information about the
module and should not be modified.
<dl>
<dt><code>CHAR* songname</code><dd>Name of the module.
<br><dt><code>CHAR* modtype</code><dd>Type of the module (which tracker format).
<br><dt><code>CHAR* comment</code><dd>Either the module comments, or NULL if the module doesn't have comments.
</dl>
<dl>
<dt><code>UWORD flags</code><dd>Several module flags or'ed together.
<dl>
<dt>‘<samp><span class="samp">UF_ARPMEM</span></samp>’<dd>If set, arpeggio effects have memory.
<br><dt>‘<samp><span class="samp">UF_BGSLIDES</span></samp>’<dd>If set, volume slide effects continue until a new note or a new effect is played.
<br><dt>‘<samp><span class="samp">UF_HIGHBPM</span></samp>’<dd>If set, the module is allowed to have its tempo value (bpm) over 255.
<br><dt>‘<samp><span class="samp">UF_INST</span></samp>’<dd>If set, the module has instruments and samples; otherwise, the
module has only samples.
<br><dt>‘<samp><span class="samp">UF_LINEAR</span></samp>’<dd>If set, slide periods are linear; otherwise, they are logarithmic.
<br><dt>‘<samp><span class="samp">UF_NNA</span></samp>’<dd>If set, module uses new note actions (NNA) and the <code>numvoices</code> field is
valid.
<br><dt>‘<samp><span class="samp">UF_NOWRAP</span></samp>’<dd>If set, pattern break on the last pattern does not continue to the first
pattern.
<br><dt>‘<samp><span class="samp">UF_S3MSLIDES</span></samp>’<dd>If set, module uses old-S3M style volume slides (slides processed every tick);
otherwise, it uses the standard style (slides processed every tick except the
first).
<br><dt>‘<samp><span class="samp">UF_XMPERIODS</span></samp>’<dd>If set, module uses XM-type periods; otherwise, it uses Amiga periods.
<br><dt>‘<samp><span class="samp">UF_FT2QUIRKS</span></samp>’<dd>If set, module player will reproduce some FastTracker 2 quirks during playback.
<br><dt>‘<samp><span class="samp">UF_PANNING</span></samp>’<dd>If set, module use panning commands.
</dl>
<br><dt><code>UBYTE numchn</code><dd>The number of channels in the module.
<br><dt><code>UBYTE numvoices</code><dd>If the module uses NNA, and this variable is not zero, it contains the limit
of module voices; otherwise, the limit is set to the <code>maxchan</code> parameter
of the <code>Player_Loadxx</code> functions.
<br><dt><code>UWORD numpos</code><dd>The number of sound positions in the module.
<br><dt><code>UWORD numpat</code><dd>The number of patterns.
<br><dt><code>UWORD numins</code><dd>The number of instruments.
<br><dt><code>UWORD numsmp</code><dd>The number of samples.
</dl>
<dl>
<dt><code>INSTRUMENT* instruments</code><dd>Points to an array of instrument structures.
<br><dt><code>SAMPLE* samples</code><dd>Points to an array of sample structures.
</dl>
<dl>
<dt><code>UBYTE realchn</code><dd>During playback, this variable contains the number of active channels (not
counting NNA channels).
<br><dt><code>UBYTE totalchn</code><dd>During playback, this variable contains the total number of channels (including
NNA channels).
<br><dt><code>ULONG sngtime</code><dd>Elapsed song time, in 2^−10 <span class="dmn">seconds</span> units (not exactly a
millisecond). To convert this value to seconds, divide by 1024, not 1000 !
</dl>
<h5 class="subsubsection">4.2.2.2 Playback Settings</h5>
<p>The fields described here control the module playback and can be modified at
any time, unless otherwise specified.
<dl>
<dt><code>UBYTE initspeed</code><dd>The initial speed of the module (Protracker compatible). Valid range is 1-32.
<br><dt><code>UBYTE inittempo</code><dd>The initial tempo of the module (Protracker compatible). Valid range is
32-255.
<br><dt><code>UBYTE initvolume</code><dd>The initial overall volume of the module. Valid range is 0-128.
<br><dt><code>UWORD panning[]</code><dd>The current channel panning positions. Only the first <code>numchn</code> values are
defined.
<br><dt><code>UBYTE chanvol[]</code><dd>The current channel volumes. Only the first <code>numchn</code> values are defined.
<br><dt><code>UWORD bpm</code><dd>The current tempo of the module. Use <code>Player_SetTempo</code> to change its value.
<br><dt><code>UBYTE sngspd</code><dd>The current speed of the module. Use <code>Player_SetSpeed</code> to change its value.
<br><dt><code>UBYTE volume</code><dd>The current overall volume of the module, in range 0-128. Use
<code>Player_SetVolume</code> to change its value.
</dl>
<dl>
<dt><code>BOOL extspd</code><dd>If zero, Protracker extended speed effect (in-module tempo modification) is
not processed. The default value is 1, which causes this effect to be processed.
However, some old modules might not play correctly if this effect is not
neutralized.
<br><dt><code>BOOL panflag</code><dd>If zero, panning effects are not processed. The default value is 1, which cause
all panning effects to be processed. However, some old modules might not play
correctly if panning is not neutralized.
<br><dt><code>BOOL wrap</code><dd>If nonzero, module wraps to its restart position when it is finished, to
play continuously. Default value is zero (play only once).
<br><dt><code>UBYTE reppos</code><dd>The restart position of the module, when it wraps.
<br><dt><code>BOOL loop</code><dd>If nonzero, all in-module loops are processed; otherwise, backward loops which
decrease the current position are not processed (i.e. only forward loops, and
backward loops in the same pattern, are processed). This ensures that the module
never loops endlessly. The default value is 1 (all loops are processed).
<br><dt><code>BOOL fadeout</code><dd>If nonzero, volume fades out during when last position of the module is being
played. Default value us zero (no fadeout).
</dl>
<dl>
<dt><code>UWORD patpos</code><dd>Current position (row) in the pattern being played. Must not be changed.
<br><dt><code>SWORD sngpos</code><dd>Current song position. Do not change this variable directly, use
<code>Player_NextPosition</code>, <code>Player_PrevPosition</code> or
<code>Player_SetPosition</code> instead.
</dl>
<dl>
<dt><code>SWORD relspd</code><dd>Relative playback speed. The value of this variable is added to the module
tempo to define the actual playback speed. The default value is 0, which make
modules play at their intended speed.
</dl>
<h4 class="subsection">4.2.3 Module Instruments</h4>
<p><a name="index-INSTRUMENT-14"></a>
Although the <code>INSTRUMENT</code> structure is intended for internal use, you
might need to know its name:
<dl>
<dt><code>CHAR* insname</code><dd>The instrument text, theoretically its name, but often a message line.
</dl>
<h4 class="subsection">4.2.4 Samples</h4>
<p><a name="index-SAMPLE-15"></a>
The <code>SAMPLE</code> structure is used for sound effects and module samples as
well. You can play with the following fields:
<dl>
<dt><code>SWORD panning</code><dd>Panning value of the sample. Valid values range from PAN_LEFT (0) to
PAN_RIGHT (255), or PAN_SURROUND.
<br><dt><code>ULONG speed</code><dd>Playing frequency of the sample, it hertz.
<br><dt><code>UBYTE volume</code><dd>Sample volume. Valid range is 0-64.
<br><dt><code>UWORD flags</code><dd>Several format flags or'ed together describing the format of the sample in
memory.
<p>Format flags:
<dl>
<dt>‘<samp><span class="samp">SF_16BITS</span></samp>’<dd>If set, sample data is 16 bit wide; otherwise, it is 8 bit wide.
<br><dt>‘<samp><span class="samp">SF_BIG_ENDIAN</span></samp>’<dd>If set, sample data is in big–endian (Motorola) format; otherwise, it is in
little–endian (Intel) format.
<br><dt>‘<samp><span class="samp">SF_DELTA</span></samp>’<dd>If set, sample is stored as delta values (differences between two consecutive
samples); otherwise, sample is stored as sample values.
<br><dt>‘<samp><span class="samp">SF_ITPACKED</span></samp>’<dd>If set, sample data is packed with Impulse Tracker's compression method;
otherwise, sample is not packed.
<br><dt>‘<samp><span class="samp">SF_SIGNED</span></samp>’<dd>If set, sample data is made of signed values; otherwise, it is made of
unsigned values.
<br><dt>‘<samp><span class="samp">SF_STEREO</span></samp>’<dd>If set, sample data is stereo (two channels); otherwise, it is mono.
</dl>
<p>Playback flags:
<dl>
<dt>‘<samp><span class="samp">SF_BIDI</span></samp>’<dd>If set, sample loops “ping pong” (back and forth).
<br><dt>‘<samp><span class="samp">SF_LOOP</span></samp>’<dd>If set, sample loops forward.
<br><dt>‘<samp><span class="samp">SF_REVERSE</span></samp>’<dd>If set, sample plays backwards.
</dl>
<br><dt><code>UWORD inflags</code><dd>Same as “flags”, but describing the format of the sample on disk.
<br><dt><code>ULONG length</code><dd>Length of the sample, in <em>samples</em>. The length of a sample is 8 bits
(1 byte) for a 8 bit sample, and 16 bits (2 bytes) for a 16 bit sample.
<br><dt><code>ULONG loopstart</code><dd>Loop starting position, relative to the start of the sample, in samples.
<br><dt><code>ULONG loopend</code><dd>Loop ending position, relative to the start of the sample, in samples.
</dl>
<h4 class="subsection">4.2.5 MREADER</h4>
<p><a name="index-MREADER-16"></a>
The <code>MREADER</code> contains the following function pointers:
<dl>
<dt><code>int (*Seek)(struct MREADER*, long offset, int whence)</code><dd>This function should have the same behaviour as <code>fseek</code>, with offset 0
meaning the start of the object (module, sample) being loaded.
<br><dt><code>long (*Tell)(struct MREADER*)</code><dd>This function should have the same behaviour as <code>ftell</code>, with offset 0
meaning the start of the object being loaded.
<br><dt><code>BOOL (*Read)(struct MREADER*, void *dest, size_t length)</code><dd>This function should copy <code>length</code> bytes of data into <code>dest</code>, and
return zero if an error occured, and any nonzero value otherwise. Note that an
end-of-file condition will not be considered as an error in this case.
<br><dt><code>int (*Get)(struct MREADER*)</code><dd>This function should have the same behaviour as <code>fgetc</code>.
<br><dt><code>BOOL (*Eof)(struct MREADER*)</code><dd>This function should have the same behaviour as <code>feof</code>.
<br><dt><code>long iobase</code><dd>Data start base offset. Managed by libmikmod, do not manipulate.
<br><dt><code>long prev_iobase</code><dd>Data start base offset, previous value. Managed by libmikmod, do not manipulate.
</dl>
<p>For an example of how to build an <code>MREADER</code> object, please refer to the
<code>MFILEREADER</code> and <code>MMEMREADER</code> objects in file <code>mmio/mmio.c</code> in
the library source, as well as the <code>splayMEM</code> example application.
<h4 class="subsection">4.2.6 MWRITER</h4>
<p><a name="index-MWRITER-17"></a>
The <code>MWRITER</code> contains the following function pointers:
<dl>
<dt><code>int (*Seek)(struct MWRITER*, long offset, int whence);</code><dd>This function should have the same behaviour as <code>fseek</code>, with offset 0
meaning the start of the object being written.
<br><dt><code>long (*Tell)(struct MWRITER*);</code><dd>This function should have the same behaviour as <code>ftell</code>, with offset 0
meaning the start of the object being written.
<br><dt><code>BOOL (*Write)(struct MWRITER*, const void *src, size_t length);</code><dd>This function should copy <code>length</code> bytes of data from <code>src</code>, and
return zero if an error occured, and any nonzero value otherwise.
<br><dt><code>int (*Put)(struct MWRITER*, int data);</code><dd>This function should have the same behaviour as <code>fputc</code>.
</dl>
<p>For an example of how to build an <code>MWRITER</code> object, please refer to the
<code>MFILEWRITER</code> object in file <code>mmio/mmio.c</code> in the library sources.
<!-- ========================================================== Error reference -->
<div class="node">
<a name="Error-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Function-Reference">Function Reference</a>,
Previous: <a rel="previous" accesskey="p" href="#Structure-Reference">Structure Reference</a>,
Up: <a rel="up" accesskey="u" href="#Library-Reference">Library Reference</a>
</div>
<h3 class="section">4.3 Error Reference</h3>
<p>The following errors are currently defined:
<h4 class="subsection">4.3.1 General Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_DYNAMIC_LINKING</span></samp>’<dd>This error occurs when a specific driver was requested, but the support shared
library couldn't be loaded. Currently, the only drivers which can yield this
error are the ALSA, EsounD and Ultra drivers.
<br><dt>‘<samp><span class="samp">MMERR_OPENING_FILE</span></samp>’<dd>This error occurs when a file can not be opened, either for read access from a
<code>xx_Loadxx</code> function, or for write access from the disk writer drivers.
<br><dt>‘<samp><span class="samp">MMERR_OUT_OF_MEMORY</span></samp>’<dd>This error occurs when there is not enough virtual memory available to complete
the operation, or there is enough memory but the calling process would exceed
its memory limit. MikMod does not do any resource tuning, your program has to
use the <code>setrlimit</code> function to do this if it needs to load very huge
samples.
</dl>
<h4 class="subsection">4.3.2 Sample Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_SAMPLE_TOO_BIG</span></samp>’<dd>This error occurs when the memory allocation of the sample data yields the
error <code>MMERR_OUT_OF_MEMORY</code>.
<br><dt>‘<samp><span class="samp">MMERR_OUT_OF_HANDLES</span></samp>’<dd>This error occurs when your program reaches the limit of loaded samples,
currently defined as 384, which should be sufficient for most cases.
<br><dt>‘<samp><span class="samp">MMERR_UNKNOWN_WAVE_TYPE</span></samp>’<dd>This error occurs when you're trying to load a sample which format is not
recognized.
</dl>
<h4 class="subsection">4.3.3 Module Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_ITPACK_INVALID_DATA</span></samp>’<dd>This error occurs when a compressed module sample is corrupt.
<br><dt>‘<samp><span class="samp">MMERR_LOADING_HEADER</span></samp>’<dd>This error occurs when you're trying to load a module which has a corrupted
header, or is truncated.
<br><dt>‘<samp><span class="samp">MMERR_LOADING_PATTERN</span></samp>’<dd>This error occurs when you're trying to load a module which has corrupted
pattern data, or is truncated.
<br><dt>‘<samp><span class="samp">MMERR_LOADING_SAMPLEINFO</span></samp>’<dd>This error occurs when you're trying to load a module which has corrupted
sample information, or is truncated.
<br><dt>‘<samp><span class="samp">MMERR_LOADING_TRACK</span></samp>’<dd>This error occurs when you're trying to load a module which has corrupted
track data, or is truncated.
<br><dt>‘<samp><span class="samp">MMERR_MED_SYNTHSAMPLES</span></samp>’<dd>This error occurs when you're trying to load a MED module which has synthsounds
samples, which are currently not supported.<a rel="footnote" href="#fn-3" name="fnd-3"><sup>3</sup></a>
<br><dt>‘<samp><span class="samp">MMERR_NOT_A_MODULE</span></samp>’<dd>This error occurs when you're trying to load a module which format is not
recognized.
<br><dt>‘<samp><span class="samp">MMERR_NOT_A_STREAM</span></samp>’<dd>This error occurs when you're trying to load a sample with a sample which format
is not recognized.
</dl>
<h4 class="subsection">4.3.4 Driver Errors</h4>
<h5 class="subsubsection">4.3.4.1 Generic Driver Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_16BIT_ONLY</span></samp>’<dd>This error occurs when the sound device doesn't support non-16 bit linear
sound output, which are the requested settings.
<br><dt>‘<samp><span class="samp">MMERR_8BIT_ONLY</span></samp>’<dd>This error occurs when the sound device doesn't support non-8 bit linear
sound output, which are the requested settings.
<br><dt>‘<samp><span class="samp">MMERR_DETECTING_DEVICE</span></samp>’<dd>This error occurs when the driver's sound device has not been detected.
<br><dt>‘<samp><span class="samp">MMERR_INITIALIZING_MIXER</span></samp>’<dd>This error occurs when MikMod's internal software mixer could not be initialized
properly.
<br><dt>‘<samp><span class="samp">MMERR_INVALID_DEVICE</span></samp>’<dd>This error occurs when the driver number (in <code>md_device</code>) is out of range.
<br><dt>‘<samp><span class="samp">MMERR_NON_BLOCK</span></samp>’<dd>This error occurs when the driver is unable to set the audio device in non
blocking mode.
<br><dt>‘<samp><span class="samp">MMERR_OPENING_AUDIO</span></samp>’<dd>This error occurs when the driver can not open sound device.
<br><dt>‘<samp><span class="samp">MMERR_STEREO_ONLY</span></samp>’<dd>This error occurs when the sound device doesn't support mono sound output, which
is the requested setting.
<br><dt>‘<samp><span class="samp">MMERR_ULAW</span></samp>’<dd>This error occurs when the sound device only supports uLaw output (which
implies mono, 8 bit, and 8000 Hz sampling rate), which isn't the requested
setting.
<br><dt>‘<samp><span class="samp">MMERR_NO_FLOAT32</span></samp>’<dd>This error occurs when the sound device doesn't support 32 bit float
sound output, which is the requested setting.
</dl>
<h5 class="subsubsection">4.3.4.2 AudioFile Driver Specific Error</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_AF_AUDIO_PORT</span></samp>’<dd>This error occurs when the AudioFile driver can not find a suitable AudioFile
port.
</dl>
<h5 class="subsubsection">4.3.4.3 AIX Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_AIX_CONFIG_CONTROL</span></samp>’<dd>This error occurs when the “Control” step of the device configuration has
failed.
<br><dt>‘<samp><span class="samp">MMERR_AIX_CONFIG_INIT</span></samp>’<dd>This error occurs when the “Init” step of the device configuration has failed.
<br><dt>‘<samp><span class="samp">MMERR_AIX_CONFIG_START</span></samp>’<dd>This error occurs when the “Start” step of the device configuration has failed.
</dl>
<h5 class="subsubsection">4.3.4.4 Ultra Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_GUS_RESET</span></samp>’<dd>This error occurs when the sound device couldn't be reset.
<br><dt>‘<samp><span class="samp">MMERR_GUS_SETTINGS</span></samp>’<dd>This error occurs because the sound device only works in 16 bit linear stereo
sound at 44100 Hz, which is not the requested settings.
<br><dt>‘<samp><span class="samp">MMERR_GUS_TIMER</span></samp>’<dd>This error occurs when the ultra driver could not setup the playback timer.
</dl>
<h5 class="subsubsection">4.3.4.5 HP-UX Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_HP_AUDIO_DESC</span></samp>’<dd>This error occurs when the HP driver can not get the audio hardware description.
<br><dt>‘<samp><span class="samp">MMERR_HP_AUDIO_OUTPUT</span></samp>’<dd>This error occurs when the HP driver can not select the audio output.
<br><dt>‘<samp><span class="samp">MMERR_HP_BUFFERSIZE</span></samp>’<dd>This error occurs when the HP driver can not set the transmission buffer size.
<br><dt>‘<samp><span class="samp">MMERR_HP_CHANNELS</span></samp>’<dd>This error occurs when the HP driver can not set the requested number of
channels.
<br><dt>‘<samp><span class="samp">MMERR_HP_SETSAMPLESIZE</span></samp>’<dd>This error occurs when the HP driver can not set the requested sample size.
<br><dt>‘<samp><span class="samp">MMERR_HP_SETSPEED</span></samp>’<dd>This error occurs when the HP driver can not set the requested sample rate.
</dl>
<h5 class="subsubsection">4.3.4.6 ALSA Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_ALSA_NOCONFIG</span></samp>’<dd>This error occurs when no ALSA playback configuration is available.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_SETPARAMS</span></samp>’<dd>This error occurs when the ALSA driver can not set the requested sample
format, sample rate, number of channels, access type, or latency values.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_SETFORMAT</span></samp>’<dd>This error occurs when the ALSA driver can not set the requested sample format.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_SETRATE</span></samp>’<dd>This error occurs when the ALSA driver does not support the requested sample rate.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_SETCHANNELS</span></samp>’<dd>This error occurs when the ALSA driver does not support the requested number of
channels.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_BUFFERSIZE</span></samp>’<dd>This error occurs when the ALSA driver can not retrieve the buffer or period size.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_PCM_START</span></samp>’<dd>This error occurs when the ALSA driver can not start the pcm playback.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_PCM_WRITE</span></samp>’<dd>This error occurs when the ALSA driver encounters a write error.
<br><dt>‘<samp><span class="samp">MMERR_ALSA_PCM_RECOVER</span></samp>’<dd>This error occurs when the ALSA driver encounters an error recovery failure.
</dl>
<h5 class="subsubsection">4.3.4.7 Open Sound System Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_OSS_SETFRAGMENT</span></samp>’<dd>This error occurs when the OSS driver can not set audio fragment size.
<br><dt>‘<samp><span class="samp">MMERR_OSS_SETSAMPLESIZE</span></samp>’<dd>This error occurs when the OSS driver can not set the requested sample size.
<br><dt>‘<samp><span class="samp">MMERR_OSS_SETSPEED</span></samp>’<dd>This error occurs when the OSS driver can not set the requested sample rate.
<br><dt>‘<samp><span class="samp">MMERR_OSS_SETSTEREO</span></samp>’<dd>This error occurs when the OSS driver can not set the requested number of
channels.
</dl>
<h5 class="subsubsection">4.3.4.8 SGI Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_SGI_MONO</span></samp>’<dd>This error occurs when the hardware only supports stereo sound.
<br><dt>‘<samp><span class="samp">MMERR_SGI_SPEED</span></samp>’<dd>This error occurs when the hardware does not support the requested sample rate.
<br><dt>‘<samp><span class="samp">MMERR_SGI_STEREO</span></samp>’<dd>This error occurs when the hardware only supports mono sound.
<br><dt>‘<samp><span class="samp">MMERR_SGI_16BIT</span></samp>’<dd>This error occurs when the hardware only supports 16 bit sound.
<br><dt>‘<samp><span class="samp">MMERR_SGI_8BIT</span></samp>’<dd>This error occurs when the hardware only supports 8 bit sound.
</dl>
<h5 class="subsubsection">4.3.4.9 Sun Driver Specific Error</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_SUN_INIT</span></samp>’<dd>This error occurs when the sound device initialization failed.
</dl>
<h5 class="subsubsection">4.3.4.10 OS/2 Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_OS2_MIXSETUP</span></samp>’<dd>This error occurs when the DART driver can not set the mixing parameters.
<br><dt>‘<samp><span class="samp">MMERR_OS2_SEMAPHORE</span></samp>’<dd>This error occurs when the MMPM/2 driver can not create the semaphores needed
for playback.
<br><dt>‘<samp><span class="samp">MMERR_OS2_THREAD</span></samp>’<dd>This error occurs when the MMPM/2 driver can not create the thread needed for
playback.
<br><dt>‘<samp><span class="samp">MMERR_OS2_TIMER</span></samp>’<dd>This error occurs when the MMPM/2 driver can not create the timer needed for
playback.
</dl>
<h5 class="subsubsection">4.3.4.11 DirectX Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_DS_BUFFER</span></samp>’<dd>This error occurs when the DirectX driver can not allocate the playback buffers.
<br><dt>‘<samp><span class="samp">MMERR_DS_EVENT</span></samp>’<dd>This error occurs when the DirectX driver can not register the playback event.
<br><dt>‘<samp><span class="samp">MMERR_DS_FORMAT</span></samp>’<dd>This error occurs when the DirectX driver can not set the playback format.
<br><dt>‘<samp><span class="samp">MMERR_DS_NOTIFY</span></samp>’<dd>This error occurs when the DirectX driver can not register the playback
callback.
<br><dt>‘<samp><span class="samp">MMERR_DS_PRIORITY</span></samp>’<dd>This error occurs when the DirectX driver can not set the playback priority.
<br><dt>‘<samp><span class="samp">MMERR_DS_THREAD</span></samp>’<dd>This error occurs when the DirectX driver can not create the playback thread.
<br><dt>‘<samp><span class="samp">MMERR_DS_UPDATE</span></samp>’<dd>This error occurs when the DirectX driver can not initialize the playback
thread.
</dl>
<h5 class="subsubsection">4.3.4.12 Windows Multimedia API Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_WINMM_ALLOCATED</span></samp>’<dd>This error occurs when the playback resource is already allocated by another
application.
<br><dt>‘<samp><span class="samp">MMERR_WINMM_DEVICEID</span></samp>’<dd>This error occurs when the Multimedia API Driver is given an invalid audio
device identificator.
<br><dt>‘<samp><span class="samp">MMERR_WINMM_FORMAT</span></samp>’<dd>This error occurs when the playback output format is not supported by the audio
device.
<br><dt>‘<samp><span class="samp">MMERR_WINMM_HANDLE</span></samp>’<dd>This error occurs when the Multimedia API Driver is given an invalid handle.
<br><dt>‘<samp><span class="samp">MMERR_WINMM_UNKNOWN</span></samp>’<dd>This error should not occur ! If you get this error, please contact the
libmikmod development mailing list.
</dl>
<h5 class="subsubsection">4.3.4.13 MacOS Driver Specific Errors</h5>
<dl>
<dt>‘<samp><span class="samp">MMERR_MAC_SPEED</span></samp>’<dd>This error occurs when the playback speed is not supported by the audio device.
<br><dt>‘<samp><span class="samp">MMERR_MAC_START</span></samp>’<dd>This error occurs when the MacOS driver can not start playback.
</dl>
<h4 class="subsection">4.3.5 MaxOS X Driver Specific Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_OSX_UNKNOWN_DEVICE</span></samp>’<dd>This error occurs if the default audio output device is not an audio device! If
this happens, please contact the maintainer.
<br><dt>‘<samp><span class="samp">MMERR_OSX_BAD_PROPERTY</span></samp>’<dd>This error occurs when the driver encounters a bad parameter when setting device
the properties.
<br><dt>‘<samp><span class="samp">MMERR_OSX_UNSUPPORTED_FORMAT</span></samp>’<dd>This error occurs when the detected audio device does not support
the required format (Linear PCM).
<br><dt>‘<samp><span class="samp">MMERR_OSX_SET_STEREO</span></samp>’<dd>This error occurs when the driver does not support the requested channels setting.
<br><dt>‘<samp><span class="samp">MMERR_OSX_BUFFER_ALLOC</span></samp>’<dd>This error occurs if the driver fails to allocate the audio buffers.
<br><dt>‘<samp><span class="samp">MMERR_OSX_ADD_IO_PROC</span></samp>’<dd>This error occurs if the driver fails to add its Audio IO Proc.
<br><dt>‘<samp><span class="samp">MMERR_OSX_DEVICE_START</span></samp>’<dd>This error occurs if the driver fails to start the audio IO Proc.
<br><dt>‘<samp><span class="samp">MMERR_OSX_PTHREAD</span></samp>’<dd>This error occurs if the initialization of the mutex fails.
</dl>
<h4 class="subsection">4.3.6 Dos “Windows Sound System” Driver Specific Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_DOSWSS_STARTDMA</span></samp>’<dd>This error occurs if the driver failed to start the cyclic DMA transfer.
</dl>
<h4 class="subsection">4.3.7 Dos “SoundBlaster” Driver Specific Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_DOSSB_STARTDMA</span></samp>’<dd>This error occurs if the driver failed to start the cyclic DMA transfer.
</dl>
<h4 class="subsection">4.3.8 OpenAL Driver Specific Errors</h4>
<dl>
<dt>‘<samp><span class="samp">MMERR_OPENAL_CREATECTX</span></samp>’<dd>This error occurs if OpenAL fails to create a context during initialization.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_CTXCURRENT</span></samp>’<dd>This error occurs if OpenAL fails to set current context during initialization.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_GENBUFFERS</span></samp>’<dd>This error occurs if OpenAL fails to generate buffers during initialization.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_GENSOURCES</span></samp>’<dd>This error occurs if OpenAL fails to generate a source during initialization.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_SOURCE</span></samp>’<dd>This error occurs if OpenAL fails to set source parameters during initialization.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_QUEUEBUFFERS</span></samp>’<dd>This error occurs if OpenAL fails to queue buffers on a source.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_UNQUEUEBUFFERS</span></samp>’<dd>This error occurs if OpenAL fails to remove buffers from the queue.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_BUFFERDATA</span></samp>’<dd>This error occurs if OpenAL fails to fill a buffer with audio data.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_GETSOURCE</span></samp>’<dd>This error occurs if OpenAL fails to get source parameters.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_SOURCEPLAY</span></samp>’<dd>This error occurs if OpenAL fails to play the source.
<br><dt>‘<samp><span class="samp">MMERR_OPENAL_SOURCESTOP</span></samp>’<dd>This error occurs if OpenAL fails to stop the source.
</dl>
<!-- ========================================================== Function reference -->
<div class="node">
<a name="Function-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Library-Core-Functions">Library Core Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Error-Reference">Error Reference</a>,
Up: <a rel="up" accesskey="u" href="#Library-Reference">Library Reference</a>
</div>
<h3 class="section">4.4 Function Reference</h3>
<ul class="menu">
<li><a accesskey="1" href="#Library-Core-Functions">Library Core Functions</a>: MikMod_xx functions.
<li><a accesskey="2" href="#Module-Player-Functions">Module Player Functions</a>: Player_xx functions.
<li><a accesskey="3" href="#Sample-Functions">Sample Functions</a>: Sample_xx functions.
<li><a accesskey="4" href="#Voice-Functions">Voice Functions</a>: Voice_xx functions.
</ul>
<!-- ========================================================== MikMod_xx -->
<div class="node">
<a name="Library-Core-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Module-Player-Functions">Module Player Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Function-Reference">Function Reference</a>,
Up: <a rel="up" accesskey="u" href="#Function-Reference">Function Reference</a>
</div>
<h4 class="subsection">4.4.1 Library Core Functions</h4>
<h5 class="subsubsection">4.4.1.1 MikMod_Active</h5>
<p><a name="index-MikMod_005fActive-18"></a><code>BOOL MikMod_Active(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns whether sound output is enabled or not.
<br><dt><i>Result</i><dt><i>0</i><dd>Sound output is disabled.
<br><dt><i>1</i><dd>Sound output is enabled.
<br><dt><i>Notes</i><dd>Calls to <code>MikMod_Update</code> will be ignored when sound output is disabled.
<br><dt><i>See also</i><dd><code>MikMod_DisableOutput</code>, <code>MikMod_EnableOutput</code>.
</dl>
<h5 class="subsubsection">4.4.1.2 MikMod_DisableOutput</h5>
<p><a name="index-MikMod_005fDisableOutput-19"></a><code>void MikMod_DisableOutput(void)</code>
<dl>
<dt><i>Description</i><dd>This function stops the sound mixing.
<br><dt><i>Notes</i><dd>Calls to <code>MikMod_Update</code> will be ignored when sound output is disabled.
<br><dt><i>See also</i><dd><code>MikMod_Active</code>, <code>MikMod_EnableOutput</code>.
</dl>
<h5 class="subsubsection">4.4.1.3 MikMod_EnableOutput</h5>
<p><a name="index-MikMod_005fEnableOutput-20"></a><code>int MikMod_EnableOutput(void)</code>
<dl>
<dt><i>Description</i><dd>This function starts the sound mixing.
<br><dt><i>Result</i><dt><i>0</i><dd>Sound mixing is ready.
<br><dt><i>nonzero</i><dd>An error occurred during the operation.
<br><dt><i>Notes</i><dd>Calls to <code>MikMod_Update</code> will be ignored when sound output is disabled.
<br><dt><i>See also</i><dd><code>MikMod_Active</code>, <code>MikMod_DisableOutput</code>.
</dl>
<h5 class="subsubsection">4.4.1.4 MikMod_Exit</h5>
<p><a name="index-MikMod_005fExit-21"></a><code>void MikMod_Exit(void)</code>
<dl>
<dt><i>Description</i><dd>This function deinitializes the sound hardware and frees all the memory and
resources used by MikMod.
<br><dt><i>See also</i><dd><code>MikMod_Init</code>, <code>MikMod_Reset</code>.
</dl>
<h5 class="subsubsection">4.4.1.5 MikMod_GetVersion</h5>
<p><a name="index-MikMod_005fGetVersion-22"></a><code>long MikMod_GetVersion(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns the version number of the library.
<br><dt><i>Result</i><dd>The version number, encoded as follows:
<code>(maj<<16)|(min<<8)|(rev)</code>,
where ‘<samp><span class="samp">maj</span></samp>’ is the major version number, ‘<samp><span class="samp">min</span></samp>’ is the minor version
number, and ‘<samp><span class="samp">rev</span></samp>’ is the revision number.
</dl>
<h5 class="subsubsection">4.4.1.6 MikMod_InfoDriver</h5>
<p><a name="index-MikMod_005fInfoDriver-23"></a><code>CHAR* MikMod_InfoDriver(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns a formatted list of the registered drivers in a buffer.
<br><dt><i>Result</i><dd>A pointer to a text buffer, or <code>NULL</code> if no drivers are registered.
<br><dt><i>Notes</i><dd>The buffer is created with <code>MikMod_malloc</code>; the caller must free it
with <code>MikMod_free</code> when it is no longer necessary.
<br><dt><i>See also</i><dd><code>MikMod_RegisterDriver</code>, <code>MikMod_RegisterAllDrivers</code>.
</dl>
<h5 class="subsubsection">4.4.1.7 MikMod_InfoLoader</h5>
<p><a name="index-MikMod_005fInfoLoader-24"></a><code>CHAR* MikMod_InfoLoader(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns a formatted list of the registered module loaders in a
buffer.
<br><dt><i>Result</i><dd>A pointer to a text buffer, or <code>NULL</code> if no loaders are registered.
<br><dt><i>Notes</i><dd>The buffer is created with <code>MikMod_malloc</code>; the caller must free it
with <code>MikMod_free</code> when it is no longer necessary.
<br><dt><i>See also</i><dd><code>MikMod_RegisterLoader</code>, <code>MikMod_RegisterAllLoaders</code>.
</dl>
<h5 class="subsubsection">4.4.1.8 MikMod_Init</h5>
<p><a name="index-MikMod_005fInit-25"></a><code>int MikMod_Init(const CHAR *parameters)</code>
<dl>
<dt><i>Description</i><dd>This function performs the library initialization, including the sound driver
choice and configuration, and all the necessary memory allocations.
<br><dt><i>Parameters</i><dt><i>parameters</i><dd>Optional parameters given to the sound driver. These parameters are ignored if
the value of <code>md_device</code> is zero (autodetection).
<br><dt><i>Result</i><dt><i>0</i><dd>Initialization was successful.
<br><dt><i>nonzero</i><dd>An error occurred during initialization.
<br><dt><i>Notes</i><dd>When the initialization fails, the library uses the nosound sound driver to
let other the other MikMod functions work without crashing the application.
<br><dt><i>See also</i><dd><code>MikMod_Exit</code>, <code>MikMod_InitThreads</code>, <code>MikMod_Reset</code>.
</dl>
<h5 class="subsubsection">4.4.1.9 MikMod_InitThreads</h5>
<p><a name="index-MikMod_005fInitThreads-26"></a><code>BOOL MikMod_InitThreads(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns whether libmikmod is thread-safe.
<br><dt><i>Result</i><dt><i>0</i><dd>The library is not thread-safe.
<br><dt><i>1</i><dd>The library is thread-safe.
<br><dt><i>Notes</i><dd>This function should be called before any call to <code>MikMod_Lock</code> or
<code>MikMod_Unlock</code> is made.
<br><dt><i>See also</i><dd><code>MikMod_Lock</code>, <code>MikMod_Unlock</code>.
</dl>
<h5 class="subsubsection">4.4.1.10 MikMod_Lock</h5>
<p><a name="index-MikMod_005fLock-27"></a><code>void MikMod_Lock(void)</code>
<dl>
<dt><i>Description</i><dd>This function obtains exclusive access to libmikmod's variables.
<br><dt><i>Notes</i><dd>This function locks an internal mutex. If the mutex is already locked, it will
block the calling thread until the mutex is unlocked.<br>
Every <code>MikMod_Unlock</code> call should be associated to a <code>MikMod_Lock</code>
call. To be sure this is the case, we advise you to define and use the
following macros:<br>
<code>#define MIKMOD_LOCK MikMod_Lock();{</code><br>
<code>#define MIKMOD_UNLOCK }MikMod_Unlock();</code><br>
The function <code>MikMod_InitThreads</code> must have been invoked before any call
to <code>MikMod_Lock</code> in made.<br>
<br><dt><i>See also</i><dd><code>MikMod_InitThreads</code>, <code>MikMod_Unlock</code>.
</dl>
<h5 class="subsubsection">4.4.1.11 MikMod_RegisterAllDrivers</h5>
<p><a name="index-MikMod_005fRegisterAllDrivers-28"></a><code>void MikMod_RegisterAllDrivers(void)</code>
<dl>
<dt><i>Description</i><dd>This function registers all the available drivers.
<br><dt><i>See also</i><dd><code>MikMod_InfoDriver</code>, <code>MikMod_RegisterDriver</code>.
</dl>
<h5 class="subsubsection">4.4.1.12 MikMod_RegisterAllLoaders</h5>
<p><a name="index-MikMod_005fRegisterAllLoaders-29"></a><code>void MikMod_RegisterAllLoaders(void)</code>
<dl>
<dt><i>Description</i><dd>This function registers all the available module loaders.
<br><dt><i>See also</i><dd><code>MikMod_InfoLoader</code>, <code>MikMod_RegisterLoader</code>.
</dl>
<h5 class="subsubsection">4.4.1.13 MikMod_RegisterDriver</h5>
<p><a name="index-MikMod_005fRegisterDriver-30"></a><code>void MikMod_RegisterDriver(struct MDRIVER* newdriver)</code>
<dl>
<dt><i>Description</i><dd>This function adds the specified driver to the internal list of usable
drivers.
<br><dt><i>Parameters</i><dt><i>newdriver</i><dd>A pointer to the <code>MDRIVER</code> structure identifying the driver.
<br><dt><i>Notes</i><dd>It is safe to register the same driver several times, although it will not
be duplicated in the list.<br>
You should register all the drivers you need before calling <code>MikMod_Init</code>.
If you want to register all the available drivers, use
<code>MikMod_RegisterAllDrivers</code> instead.
<br><dt><i>See also</i><dd><code>MikMod_InfoDriver</code>, <code>MikMod_RegisterAllDrivers</code>.
</dl>
<h5 class="subsubsection">4.4.1.14 MikMod_RegisterErrorHandler</h5>
<p><a name="index-MikMod_005fRegisterErrorHandler-31"></a><code>MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t newhandler)</code>
<dl>
<dt><i>Description</i><dd>This function selects the function which should be called in case of error.
<br><dt><i>Parameters</i><dt><i>newhandler</i><dd>The new error callback function.
<br><dt><i>Result</i><dd>The previous error callback function, or <code>NULL</code> if there was none.
<br><dt><i>Notes</i><dd><code>MikMod_handler_t</code> is defined as <code>void(*function)(void)</code>, this means
your error function has the following prototype:
<code>void MyErrorHandler(void)</code><br>
The error callback function is called when errors are detected, but not
always immediately (the library has to resume to a stable state before calling
your callback).
</dl>
<h5 class="subsubsection">4.4.1.15 MikMod_RegisterLoader</h5>
<p><a name="index-MikMod_005fRegisterLoader-32"></a><code>void MikMod_RegisterLoader(struct MLOADER* newloader)</code>
<dl>
<dt><i>Description</i><dd>This function adds the specified module loader to the internal list of usable
module loaders.
<br><dt><i>Parameters</i><dt><i>newloader</i><dd>A pointer to the <code>MLOADER</code> structure identifying the loader.
<br><dt><i>Notes</i><dd>It is safe to register the same loader several times, although it will not be
duplicated in the list.<br>
You should register all the loaders you need before calling <code>Player_Load</code>
or <code>Player_LoadFP</code>. If you want to register all the available module
loaders, use <code>MikMod_RegisterAllLoaders</code> instead.<br>
The 15 instrument module loader (<code>load_m15</code>) should always be registered
last.
<br><dt><i>See also</i><dd><code>MikMod_InfoLoader</code>, <code>MikMod_RegisterAllLoaders</code>.
</dl>
<h5 class="subsubsection">4.4.1.16 MikMod_RegisterPlayer</h5>
<p><a name="index-MikMod_005fRegisterPlayer-33"></a><code>MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t newplayer)</code>
<dl>
<dt><i>Description</i><dd>This function selects the function which should be used to process module
playback.
<br><dt><i>Parameters</i><dt><i>newplayer</i><dd>The new playback function
<br><dt><i>Result</i><dd>The previous playback function.
<br><dt><i>Notes</i><dd><code>MikMod_player_t</code> is defined as <code>void(*function)(void)</code>, this means
your player function has the following prototype:
<code>void MyPlayer(void)</code><br>
The player function is called every module tick to process module playback.
The rate at which the player function is called is controlled by the sound
driver, and is computed by the following equation:<br>
(bpm*50)/125 calls per second, which means every 125000/(bpm*50)
<span class="dmn">milliseconds</span>. The <code>bpm</code> value is the tempo of the module and can
change from its initial value when requested by the module.<br>
When changing the playback function, you should make sure that you chain to the
default MikMod playback function, otherwise you won't get module sound
anymore<small class="enddots">...</small>
<br><dt><i>Example</i><dd>
<pre class="smallexample"> MikMod_player_t oldroutine;
void MyPlayer(void)
{
oldroutine();
/* your stuff here */
...
}
main()
{
...
/* Register our player */
oldroutine = MikMod_RegisterPlayer(MyPlayer);
...
}
</pre>
</dl>
<h5 class="subsubsection">4.4.1.17 MikMod_Reset</h5>
<p><a name="index-MikMod_005fReset-34"></a><code>int MikMod_Reset(const CHAR *parameters)</code>
<dl>
<dt><i>Description</i><dd>This function resets MikMod and reinitialize the sound hardware.
<br><dt><i>Parameters</i><dt><i>parameters</i><dd>Optional parameters given to the sound driver. If you set the value of
<code>md_device</code> to zero (autodetect), these parameters are ignored.
<br><dt><i>Result</i><dt><i>0</i><dd>Reinitialization was successful.
<br><dt><i>nonzero</i><dd>An error occurred during reinitialization.
<br><dt><i>Notes</i><dd>Use this function when you have changed the global configuration variables:
<code>md_device</code> and <code>md_mixfreq</code>, or one of the <code>md_mode</code> flags
which require sound reinitialization. Sound playback will continue as soon as
the driver is ready.
<br><dt><i>See also</i><dd><code>MikMod_Exit</code>, <code>MikMod_Init</code>.
</dl>
<h5 class="subsubsection">4.4.1.18 MikMod_SetNumVoices</h5>
<p><a name="index-MikMod_005fSetNumVoices-35"></a><code>int MikMod_SetNumVoices(int musicvoices, int samplevoices)</code>
<dl>
<dt><i>Description</i><dd>This function sets the number of mixed voices which can be used for music
and sound effects playback.
<br><dt><i>Parameters</i><dt><i>musicvoices</i><dd>The number of voices to reserve for music playback.
<br><dt><i>samplevoices</i><dd>The number of voices to reserve for sound effects.
<br><dt><i>Result</i><dt><i>0</i><dd>Initialization was successful.
<br><dt><i>nonzero</i><dd>An error occurred during initialization.
<br><dt><i>Notes</i><dd>A value of <code>-1</code> for any of the parameters will retain the current number
of reserved voices.<br>
The maximum number of voices vary from driver to driver (hardware drivers
often have a limit of 32 to 64 voices, whereas the software drivers handle
255 voices). If your settings exceed the driver's limit, they will be truncated.
<br><dt><i>See also</i><dd><code>MikMod_Init</code>, <code>MikMod_Reset</code>.
</dl>
<h5 class="subsubsection">4.4.1.19 MikMod_Unlock</h5>
<p><a name="index-MikMod_005fUnlock-36"></a><code>void MikMod_Unlock(void)</code>
<dl>
<dt><i>Description</i><dd>This function relinquishes exclusive access to libmikmod's variables.
<br><dt><i>Notes</i><dd>This function unlocks an internal mutex, so that other threads waiting for the
lock can be resumed.<br>
Every <code>MikMod_Unlock</code> call should be associated to a <code>MikMod_Lock</code>
call. To be sure this is the case, we advise you to define and use the
following macros:<br>
<code>#define MIKMOD_LOCK MikMod_Lock();{</code><br>
<code>#define MIKMOD_UNLOCK }MikMod_Unlock();</code><br>
The function <code>MikMod_InitThreads</code> must have been invoked before any call
to <code>MikMod_Unlock</code> in made.<br>
<br><dt><i>See also</i><dd><code>MikMod_InitThreads</code>, <code>MikMod_Lock</code>.
</dl>
<h5 class="subsubsection">4.4.1.20 MikMod_Update</h5>
<p><a name="index-MikMod_005fUpdate-37"></a><code>void MikMod_Update(void)</code>
<dl>
<dt><i>Description</i><dd>This routine should be called on a regular basis to update the sound.
<br><dt><i>Notes</i><dd>The sound output buffer is filled each time this function is called; if you
use a large buffer, you don't need to call this routine as frequently as with
a smaller buffer, but you get a bigger shift between the sound being played
and the reported state of the player, since the player is always a buffer
ahead of the playback.<br>
If you play low quality sound (for example, mono 8 bit 11<span class="dmn">kHz</span> sound), you
only need to call this routine a few times per second. However, for high quality
sound (stereo 16 bit 44<span class="dmn">kHz</span>), this rate increases to a few hundred times
per second, but never more, due to the minimal buffer size constraint imposed
to the sound drivers.<br>
If you plan on modifying voice information with the <code>Voice_xx</code> functions,
you should do this before calling <code>MikMod_Update</code>.
</dl>
<h5 class="subsubsection">4.4.1.21 MikMod_strerror</h5>
<p><a name="index-MikMod_005fstrerror-38"></a><code>const char* MikMod_strerror(int errnum)</code>
<dl>
<dt><i>Description</i><dd>This function associates a descriptive message to an error code.
<br><dt><i>Parameters</i><dt><i>errnum</i><dd>The MikMod error code.
<br><dt><i>Result</i><dd>A pointer to a string describing the error.
</dl>
<!-- ========================================================== Player_xx -->
<div class="node">
<a name="Module-Player-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Sample-Functions">Sample Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Core-Functions">Library Core Functions</a>,
Up: <a rel="up" accesskey="u" href="#Function-Reference">Function Reference</a>
</div>
<h4 class="subsection">4.4.2 Module Player Functions</h4>
<h5 class="subsubsection">4.4.2.1 Player_Active</h5>
<p><a name="index-Player_005fActive-39"></a><code>BOOL Player_Active(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns whether the module player is active or not.
<br><dt><i>Result</i><dt><i>0</i><dd>No module is playing.
<br><dt><i>nonzero</i><dd>A module is currently playing.
<br><dt><i>Notes</i><dd>This function will still report that the player is active if the playing module
is paused.
<br><dt><i>See also</i><dd><code>Player_Paused</code>, <code>Player_TogglePause</code>, <code>Player_Start</code>, <code>Player_Stop</code>
</dl>
<h5 class="subsubsection">4.4.2.2 Player_Free</h5>
<p><a name="index-Player_005fFree-40"></a><code>void Player_Free(MODULE* module)</code>
<dl>
<dt><i>Description</i><dd>This function stops the module if it is playing and unloads it from memory.
<br><dt><i>Parameters</i><dt><i>module</i><dd>The module to free.
<br><dt><i>See also</i><dd><code>Player_Load</code>, <code>Player_LoadFP</code>.
</dl>
<h5 class="subsubsection">4.4.2.3 Player_GetChannelVoice</h5>
<p><a name="index-Player_005fGetChannelVoice-41"></a><code>int Player_GetChannelVoice(UBYTE channel)</code>
<dl>
<dt><i>Description</i><dd>This function determines the voice corresponding to the specified module
channel.
<br><dt><i>Parameters</i><dt><i>channel</i><dd>The module channel to use.
<br><dt><i>Result</i><dd>The number of the voice corresponding to the module channel.
<br><dt><i>Notes</i><dd>If the module channel has NNAs, the number will correspond to the main channel
voice.
<br><dt><i>See also</i><dd><code>Voice_SetPanning</code>, <code>Voice_SetVolume</code>, <code>Player_Mute</code>, <code>Player_ToggleMute</code>, <code>Player_Unmute</code>.
</dl>
<h5 class="subsubsection">4.4.2.4 Player_GetModule</h5>
<p><a name="index-Player_005fGetModule-42"></a><code>MODULE* Player_GetModule(void)</code>
<dl>
<dt><i>Description</i><dd>This function returns the module currently being played.
<br><dt><i>Result</i><dd>A pointer to the <code>MODULE</code> being played, or <code>NULL</code> if no module is
playing.
<br><dt><i>See also</i><dd><code>Player_Stop</code>, <code>Player_Start</code>.
</dl>
<h5 class="subsubsection">4.4.2.5 Player_Load</h5>
<p><a name="index-Player_005fLoad-43"></a><code>MODULE* Player_Load(const CHAR* filename, int maxchan, BOOL curious)</code>
<dl>
<dt><i>Description</i><dd>This function loads a music module.
<br><dt><i>Parameters</i><dt><i>filename</i><dd>The name of the module file.
<br><dt><i>maxchan</i><dd>The maximum number of channels the song is allowed to request from the mixer.
<br><dt><i>curious</i><dd>The curiosity level to use.
<br><dt><i>Result</i><dd>A pointer to a <code>MODULE</code> structure, or <code>NULL</code> if an error occurs.
<br><dt><i>Notes</i><dd>If the curiosity level is set to zero, the module will be loaded normally.
However, if it is nonzero, the following things occur:
<ul>
<li>pattern positions occurring after the “end of song” marker in S3M and
IT modules are loaded, and the end of song is set to the last position.
<li>hidden extra patterns are searched in MOD modules, and if found, played
after the last “official” pattern.
<li>MED modules with synthsounds are loaded without causing the
<code>MMERR_MED_SYNTHSAMPLES</code>, and synthsounds are mapped to an empty sample.
</ul>
<br><dt><i>See also</i><dd><code>Player_Free</code>, <code>Player_LoadFP</code>, <code>Player_LoadTitle</code>,
<code>Player_LoadTitleFP</code>, <code>Player_Start</code>.
</dl>
<h5 class="subsubsection">4.4.2.6 Player_LoadFP</h5>
<p><a name="index-Player_005fLoadFP-44"></a><code>MODULE* Player_LoadFP(FILE* file, int maxchan, BOOL curious)</code>
<dl>
<dt><i>Description</i><dd>This function loads a music module.
<br><dt><i>Parameters</i><dt><i>file</i><dd>An open file, at the position where the module starts.
<br><dt><i>maxchan</i><dd>The maximum number of channels the song is allowed to request from the mixer.
<br><dt><i>curious</i><dd>The curiosity level to use.
<br><dt><i>Result</i><dd>A pointer to a <code>MODULE</code> structure, or <code>NULL</code> if an error occurs.
<br><dt><i>Notes</i><dd>The file is left open, at the same position as before the function call.<br>
If the curiosity level is set to zero, the module will be loaded normally.
However, if it is nonzero, the following things occur:
<ul>
<li>pattern positions occurring after the “end of song” marker in S3M and
IT modules are loaded, and the end of song is set to the last position.
<li>hidden extra patterns are searched in MOD modules, and if found, played
after the last “official” pattern.
<li>MED modules with synthsounds are loaded without causing the
<code>MMERR_MED_SYNTHSAMPLES</code>, and synthsounds are mapped to an empty sample.
</ul>
<br><dt><i>See also</i><dd><code>Player_Free</code>, <code>Player_Load</code>, <code>Player_LoadTitle</code>,
<code>Player_LoadTitleFP</code>, <code>Player_Start</code>.
</dl>
<h5 class="subsubsection">4.4.2.7 Player_LoadTitle</h5>
<p><a name="index-Player_005fLoadTitle-45"></a><code>MODULE* Player_LoadTitle(const CHAR* filename)</code>
<dl>
<dt><i>Description</i><dd>This function retrieves the title of a module file.
<br><dt><i>Parameters</i><dt><i>filename</i><dd>The name of the module file.
<br><dt><i>Result</i><dd>A pointer to the song title, or <code>NULL</code> if either the module has no title
or an error has occurred.
<br><dt><i>Notes</i><dd>The title buffer is created with <code>MikMod_malloc</code>; the caller must free it
with <code>MikMod_free</code> when it is no longer necessary.
<br><dt><i>See also</i><dd><code>Player_Load</code>, <code>Player_LoadFP</code>, <code>Player_LoadTitleFP</code>.
</dl>
<h5 class="subsubsection">4.4.2.8 Player_LoadTitleFP</h5>
<p><a name="index-Player_005fLoadTitleFP-46"></a><code>MODULE* Player_LoadTitleFP(FILE* file)</code>
<dl>
<dt><i>Description</i><dd>This function retrieves the title of a module file.
<br><dt><i>Parameters</i><dt><i>file</i><dd>An open file, at the position where the module starts.
<br><dt><i>Result</i><dd>A pointer to the song title, or <code>NULL</code> if either the module has no title
or an error has occurred.
<br><dt><i>Notes</i><dd>The title buffer is created with <code>MikMod_malloc</code>; the caller must free it
with <code>MikMod_free</code> when it is no longer necessary.
<br><dt><i>See also</i><dd><code>Player_Load</code>, <code>Player_LoadFP</code>, <code>Player_LoadTitle</code>.
</dl>
<h5 class="subsubsection">4.4.2.9 Player_Mute</h5>
<p><a name="index-Player_005fMute-47"></a><code>void Player_Mute(SLONG operation, ...)</code>
<dl>
<dt><i>Description</i><dd>This function mutes a single module channel, or a range of module channels.
<br><dt><i>Parameters</i><dt><i>operation</i><dd>Either the number of a module channel to mute (starting from zero), or an
operation code. In the latter case, two extra parameters are needed to
determine the range of channels.
<br><dt><i>Notes</i><dd>If the operation is <code>MUTE_INCLUSIVE</code>, the two channel numbers delimit the
range and are part of the range ; otherwise, if the operation is
<code>MUTE_EXCLUSIVE</code>, they are outside of the range.
<br><dt><i>Example</i><dd>
<pre class="smallexample"> /* mute channel 10 */
Player_Mute(10);
/* mute channels 2 to 5 */
Player_Mute(MUTE_INCLUSIVE, 2, 5);
/* mute channels 7 to 9 */
Player_Mute(MUTE_EXCLUSIVE, 6, 10);
</pre>
<br><dt><i>See also</i><dd><code>Player_Muted</code>, <code>Player_ToggleMute</code>, <code>Player_Unmute</code>.
</dl>
<h5 class="subsubsection">4.4.2.10 Player_Muted</h5>
<p><a name="index-Player_005fMuted-48"></a><code>BOOL Player_Muted(UBYTE channel)</code>
<dl>
<dt><i>Description</i><dd>This function determines whether a module channel is muted or not.
<br><dt><i>Parameters</i><dt><i>channel</i><dd>The module channel to test (starting from zero).
<br><dt><i>Result</i><dt><i>0</i><dd>The channel is not muted.
<br><dt><i>1</i><dd>The channel is muted.
<br><dt><i>See also</i><dd><code>Player_Mute</code>, <code>Player_ToggleMute</code>, <code>Player_Unmute</code>.
</dl>
<h5 class="subsubsection">4.4.2.11 Player_NextPosition</h5>
<p><a name="index-Player_005fNextPosition-49"></a><code>void Player_NextPosition(void)</code>
<dl>
<dt><i>Description</i><dd>This function jumps to the next position in the module.
<br><dt><i>Notes</i><dd>All playing samples and active song voices are cut to avoid hanging notes.
<br><dt><i>See also</i><dd><code>Player_PrevPosition</code>, <code>Player_SetPosition</code>.
</dl>
<h5 class="subsubsection">4.4.2.12 Player_Paused</h5>
<p><a name="index-Player_005fPaused-50"></a><code>BOOL Player_Paused(void)</code>
<dl>
<dt><i>Description</i><dd>This function determines whether the module is paused or not.
<br><dt><i>Result</i><dt><i>0</i><dd>The module is not paused.
<br><dt><i>1</i><dd>The module is paused.
<br><dt><i>See also</i><dd><code>Player_TogglePause</code>.
</dl>
<h5 class="subsubsection">4.4.2.13 Player_PrevPosition</h5>
<p><a name="index-Player_005fPrevPosition-51"></a><code>void Player_PrevPosition(void)</code>
<dl>
<dt><i>Description</i><dd>This function jumps to the previous position in the module.
<br><dt><i>Notes</i><dd>All playing samples and active song voices are cut to avoid hanging notes.
<br><dt><i>See also</i><dd><code>Player_NextPosition</code>, <code>Player_SetPosition</code>.
</dl>
<h5 class="subsubsection">4.4.2.14 Player_SetPosition</h5>
<p><a name="index-Player_005fSetPosition-52"></a><code>void Player_SetPosition(UWORD position)</code>
<dl>
<dt><i>Description</i><dd>This function jumps to the specified position in the module.
<br><dt><i>Parameters</i><dt><i>position</i><dd>The pattern position to jump to.
<br><dt><i>Notes</i><dd>All playing samples and active song voices are cut to avoid hanging notes.
<br><dt><i>See also</i><dd><code>Player_NextPosition</code>, <code>Player_PrevPosition</code>.
</dl>
<h5 class="subsubsection">4.4.2.15 Player_SetSpeed</h5>
<p><a name="index-Player_005fSetSpeed-53"></a><code>void Player_SetSpeed(UWORD speed)</code>
<dl>
<dt><i>Description</i><dd>This function sets the module speed.
<br><dt><i>Parameters</i><dt><i>speed</i><dd>The new module speed, in the range 1-32.
<br><dt><i>See also</i><dd><code>Player_SetTempo</code>.
</dl>
<h5 class="subsubsection">4.4.2.16 Player_SetTempo</h5>
<p><a name="index-Player_005fSetTempo-54"></a><code>void Player_SetTempo(UWORD tempo)</code>
<dl>
<dt><i>Description</i><dd>This function sets the module tempo.
<br><dt><i>Parameters</i><dt><i>tempo</i><dd>The new module tempo, in the range 32-255.
<br><dt><i>See also</i><dd><code>Player_SetSpeed</code>.
</dl>
<h5 class="subsubsection">4.4.2.17 Player_SetVolume</h5>
<p><a name="index-Player_005fSetVolume-55"></a><code>void Player_SetVolume(SWORD volume)</code>
<dl>
<dt><i>Description</i><dd>This function sets the module volume.
<br><dt><i>Parameters</i><dt><i>volume</i><dd>The new overall module playback volume, in the range 0-128.
</dl>
<h5 class="subsubsection">4.4.2.18 Player_Start</h5>
<p><a name="index-Player_005fStart-56"></a><code>void Player_Start(MODULE* module)</code>
<dl>
<dt><i>Description</i><dd>This function starts the specified module playback.
<br><dt><i>Parameters</i><dt><i>module</i><dd>The module to play.
<br><dt><i>Notes</i><dd>If another module is playing, it will be stopped and the new module will play.
<br><dt><i>See also</i><dd><code>Player_Stop</code>.
</dl>
<h5 class="subsubsection">4.4.2.19 Player_Stop</h5>
<p><a name="index-Player_005fStop-57"></a><code>void Player_Stop(void)</code>
<dl>
<dt><i>Description</i><dd>This function stops the currently playing module.
<br><dt><i>See also</i><dd><code>Player_Start</code>.
</dl>
<h5 class="subsubsection">4.4.2.20 Player_ToggleMute</h5>
<p><a name="index-Player_005fToggleMute-58"></a><code>void Player_ToggleMute(SLONG operation, ...)</code>
<dl>
<dt><i>Description</i><dd>This function changes the muted status of a single module channel, or a range
of module channels.
<br><dt><i>Parameters</i><dt><i>operation</i><dd>Either the number of a module channel to work on (starting from zero), or an
operation code. In the latter case, two extra parameters are needed to
determine the range of channels.
<br><dt><i>Notes</i><dd>If the operation is <code>MUTE_INCLUSIVE</code>, the two channel numbers delimit the
range and are part of the range ; otherwise, if the operation is
<code>MUTE_EXCLUSIVE</code>, they are outside of the range.
<br><dt><i>Example</i><dd>
<pre class="smallexample"> /* toggle mute on channel 10 */
Player_ToggleMute(10);
/* toggle mute on channels 2 to 5 */
Player_ToggleMute(MUTE_INCLUSIVE, 2, 5);
/* toggle mute on channels 7 to 9 */
Player_ToggleMute(MUTE_EXCLUSIVE, 6, 10);
</pre>
<br><dt><i>See also</i><dd><code>Player_Mute</code>, <code>Player_Muted</code>, <code>Player_Unmute</code>.
</dl>
<h5 class="subsubsection">4.4.2.21 Player_TogglePause</h5>
<p><a name="index-Player_005fTogglePause-59"></a><code>void Player_TogglePause(void)</code>
<dl>
<dt><i>Description</i><dd>This function toggles the playing/paused status of the module.
<br><dt><i>Notes</i><dd>Calls to <code>Player_xx</code> functions still have effect when the module is paused.
<br><dt><i>See also</i><dd><code>Player_Paused</code>, <code>Player_Start</code>, <code>Player_Stop</code>.
</dl>
<h5 class="subsubsection">4.4.2.22 Player_Unmute</h5>
<p><a name="index-Player_005fUnmute-60"></a><code>void Player_Unmute(SLONG operation, ...)</code>
<dl>
<dt><i>Description</i><dd>This function unmutes a single module channel, or a range of module channels.
<br><dt><i>Parameters</i><dt><i>operation</i><dd>Either the number of a module channel to unmute (starting from zero), or an
operation code. In the latter case, two extra parameters are needed to
determine the range of channels.
<br><dt><i>Notes</i><dd>If the operation is <code>MUTE_INCLUSIVE</code>, the two channel numbers delimit the
range and are part of the range ; otherwise, if the operation is
<code>MUTE_EXCLUSIVE</code>, they are outside of the range.
<br><dt><i>Example</i><dd>
<pre class="smallexample"> /* unmute channel 10 */
Player_Unmute(10);
/* unmute channels 2 to 5 */
Player_Unmute(MUTE_INCLUSIVE, 2, 5);
/* unmute channels 7 to 9 */
Player_Unmute(MUTE_EXCLUSIVE, 6, 10);
</pre>
<br><dt><i>See also</i><dd><code>Player_Mute</code>, <code>Player_Muted</code>, <code>Player_ToggleMute</code>.
</dl>
<!-- ========================================================== Sample_xx -->
<div class="node">
<a name="Sample-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Voice-Functions">Voice Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Module-Player-Functions">Module Player Functions</a>,
Up: <a rel="up" accesskey="u" href="#Function-Reference">Function Reference</a>
</div>
<h4 class="subsection">4.4.3 Sample Functions</h4>
<h5 class="subsubsection">4.4.3.1 Sample_Free</h5>
<p><a name="index-Sample_005fFree-61"></a><code>void Sample_Free(SAMPLE* sample)</code>
<dl>
<dt><i>Description</i><dd>This function unloads a sample from memory.
<br><dt><i>Parameters</i><dt><i>sample</i><dd>The sample to free.
<br><dt><i>See also</i><dd><code>Sample_Load</code>, <code>Sample_LoadFP</code>.
</dl>
<h5 class="subsubsection">4.4.3.2 Sample_Load</h5>
<p><a name="index-Sample_005fLoad-62"></a><code>SAMPLE* Sample_Load(const CHAR* filename)</code>
<dl>
<dt><i>Description</i><dd>This function loads a sample.
<br><dt><i>Parameters</i><dt><i>filename</i><dd>The sample filename.
<br><dt><i>Result</i><dd>A pointer to a <code>SAMPLE</code> structure, or <code>NULL</code> if an error has occurred.
<br><dt><i>See also</i><dd><code>Sample_Free</code>, <code>Sample_LoadFP</code>.
</dl>
<h5 class="subsubsection">4.4.3.3 Sample_LoadFP</h5>
<p><a name="index-Sample_005fLoadFP-63"></a><code>SAMPLE* Sample_LoadFP(FILE* file)</code>
<dl>
<dt><i>Description</i><dd>This function loads a sample.
<br><dt><i>Parameters</i><dt><i>file</i><dd>An open file, at the position where the sample starts.
<br><dt><i>Result</i><dd>A pointer to a <code>SAMPLE</code> structure, or <code>NULL</code> if an error has occurred.
<br><dt><i>Notes</i><dd>The file is left open, at the same position as before the function call.
<br><dt><i>See also</i><dd><code>Sample_Free</code>, <code>Sample_Load</code>.
</dl>
<h5 class="subsubsection">4.4.3.4 Sample_Play</h5>
<p><a name="index-Sample_005fPlay-64"></a><code>SBYTE Sample_Play(SAMPLE* sample, ULONG start, UBYTE flags)</code>
<dl>
<dt><i>Description</i><dd>This function plays a sample as a sound effect.
<br><dt><i>Parameters</i><dt><i>sample</i><dd>The sample to play.
<br><dt><i>start</i><dd>The starting position (in samples).
<br><dt><i>flags</i><dd>Either zero, for normal sound effects, or <code>SFX_CRITICAL</code>, for critical
sound effects which must not be interrupted.
<br><dt><i>Result</i><dd>The voice number corresponding to the voice which will play the sample.
<br><dt><i>Notes</i><dd>Each new sound effect is played on a new voice. When all voices are taken,
the oldest sample which was not marked as critical is cut and its voice is
used for the new sample. Critical samples are not cut unless all the voices
are taken with critical samples and you attempt to play yet another critical
sample. Use <code>Voice_Stop</code> to force the end of a critical sample.
<br><dt><i>See also</i><dd><code>MikMod_SetNumVoices</code>, <code>Voice_Play</code>, <code>Voice_SetFrequency</code>, <code>Voice_SetPanning</code>, <code>Voice_SetVolume</code>, <code>Voice_Stop</code>.
</dl>
<!-- ========================================================== Voice_xx -->
<div class="node">
<a name="Voice-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Loader-Reference">Loader Reference</a>,
Previous: <a rel="previous" accesskey="p" href="#Sample-Functions">Sample Functions</a>,
Up: <a rel="up" accesskey="u" href="#Function-Reference">Function Reference</a>
</div>
<h4 class="subsection">4.4.4 Voice Functions</h4>
<h5 class="subsubsection">4.4.4.1 Voice_GetFrequency</h5>
<p><a name="index-Voice_005fGetFrequency-65"></a><code>ULONG Voice_GetFrequency(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function returns the frequency of the sample currently playing on the
specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to get frequency.
<br><dt><i>Result</i><dd>The current frequency of the sample playing on the specified voice, or zero if
no sample is currently playing on the voice.
<br><dt><i>See also</i><dd><code>Voice_SetFrequency</code>.
</dl>
<h5 class="subsubsection">4.4.4.2 Voice_GetPanning</h5>
<p><a name="index-Voice_005fGetPanning-66"></a><code>ULONG Voice_GetPanning(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function returns the panning position of the sample currently playing on
the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to get panning position.
<br><dt><i>Result</i><dd>The current panning position of the sample playing on the specified voice, or
<code>PAN_CENTER</code> if no sample is currently playing on the voice.
<br><dt><i>See also</i><dd><code>Voice_SetPanning</code>.
</dl>
<h5 class="subsubsection">4.4.4.3 Voice_GetPosition</h5>
<p><a name="index-Voice_005fGetPosition-67"></a><code>SLONG Voice_GetPosition(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function returns the sample position (in samples) of the sample
currently playing on the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to get sample position (starting from zero).
<br><dt><i>Result</i><dd>The current play location of the sample playing on the specified voice, or zero
if the position can not be determined or if no sample is currently playing on
the voice.
<br><dt><i>Notes</i><dd>This function may not work with some drivers (especially for hardware mixed
voices). In this case, it returns always <code>-1</code>.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_Play</code>.
</dl>
<h5 class="subsubsection">4.4.4.4 Voice_GetVolume</h5>
<p><a name="index-Voice_005fGetVolume-68"></a><code>UWORD Voice_GetVolume(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function returns the volume of the sample currently playing on the
specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to get volume.
<br><dt><i>Result</i><dd>The current volume of the sample playing on the specified voice, or zero if no
sample is currently playing on the voice.
<br><dt><i>See also</i><dd><code>Voice_RealVolume</code>, <code>Voice_SetVolume</code>.
</dl>
<h5 class="subsubsection">4.4.4.5 Voice_Play</h5>
<p><a name="index-Voice_005fPlay-69"></a><code>void Voice_Play(SBYTE voice, SAMPLE* sample, ULONG start)</code>
<dl>
<dt><i>Description</i><dd>Start a new sample in the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to be processed (starting from zero).
<br><dt><i>sample</i><dd>The sample to play.
<br><dt><i>start</i><dd>The starting position (in samples).
<br><dt><i>Notes</i><dd>The sample will be played at the volume, panning and frequency settings of the
voice, regardless or the sample characteristics.<br>
The sample played this way gets the same “critical” status as the sample
which was previously played on this voice.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_SetFrequency</code>, <code>Voice_SetPanning</code>, <code>Voice_SetVolume</code>.
</dl>
<h5 class="subsubsection">4.4.4.6 Voice_RealVolume</h5>
<p><a name="index-Voice_005fRealVolume-70"></a><code>ULONG Voice_RealVolume(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function returns the actual playing volume of the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to analyze (starting from zero).
<br><dt><i>Result</i><dd>The real volume of the voice when the function was called, in the range 0-65535,
not related to the volume constraint specified with <code>Voice_SetVolume</code>.
<br><dt><i>Notes</i><dd>This function may not work with some drivers (especially for hardware mixed
voices). In this case, it always returns zero.<br>
Also note that the real volume computation is not a trivial process and takes
some CPU time.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_GetVolume</code>, <code>Voice_Play</code>, <code>Voice_SetVolume</code>.
</dl>
<h5 class="subsubsection">4.4.4.7 Voice_SetFrequency</h5>
<p><a name="index-Voice_005fSetFrequency-71"></a><code>void Voice_SetFrequency(SBYTE voice, ULONG frequency)</code>
<dl>
<dt><i>Description</i><dd>This function sets the frequency (pitch) of the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to be processed (starting from zero).
<br><dt><i>frequency</i><dd>The new frequency of the voice, in hertz.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_GetFrequency</code>, <code>Voice_Play</code>, <code>Voice_SetPanning</code>, <code>Voice_SetVolume</code>, <code>Voice_Stop</code>.
</dl>
<h5 class="subsubsection">4.4.4.8 Voice_SetPanning</h5>
<p><a name="index-Voice_005fSetPanning-72"></a><code>void Voice_SetPanning(SBYTE voice, ULONG panning)</code>
<dl>
<dt><i>Description</i><dd>This function sets the panning position of the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to be processed (starting from zero).
<br><dt><i>panning</i><dd>The new panning position of the voice.
<br><dt><i>Notes</i><dd>Panning can vary between 0 (<code>PAN_LEFT</code>) and 255 (<code>PAN_RIGHT</code>). Center
is 127 (<code>PAN_CENTER</code>. Surround sound can be enabled by specifying the
special value <code>PAN_SURROUND</code>.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_GetPanning</code>, <code>Voice_Play</code>, <code>Voice_SetFrequency</code>, <code>Voice_SetVolume</code>, <code>Voice_Stop</code>.
</dl>
<h5 class="subsubsection">4.4.4.9 Voice_SetVolume</h5>
<p><a name="index-Voice_005fSetVolume-73"></a><code>void Voice_SetVolume(SBYTE voice, UWORD volume)</code>
<dl>
<dt><i>Description</i><dd>This function sets the volume of the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to be processed (starting from zero).
<br><dt><i>volume</i><dd>The new volume of the voice, in the range 0-256.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_GetVolume</code>, <code>Voice_Play</code>, <code>Voice_SetFrequency</code>, <code>Voice_SetPanning</code>, <code>Voice_Stop</code>.
</dl>
<h5 class="subsubsection">4.4.4.10 Voice_Stop</h5>
<p><a name="index-Voice_005fStop-74"></a><code>void Voice_Stop(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function stops the playing sample of the specified voice.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to be processed (starting from zero).
<br><dt><i>Notes</i><dd>After the call to <code>Voice_Stop</code>, the function <code>Voice_Stopped</code> will
return nonzero (true) for the voice. If you want to silence the voice without
stopping the playback, use <code>Voice_SetVolume(voice, 0)</code> instead.
<br><dt><i>See also</i><dd><code>Sample_Play</code>, <code>Voice_Play</code>, <code>Voice_SetFrequency</code>, <code>Voice_SetPanning</code>, <code>Voice_SetVolume</code>.
</dl>
<h5 class="subsubsection">4.4.4.11 Voice_Stopped</h5>
<p><a name="index-Voice_005fStopped-75"></a><code>BOOL Voice_Stopped(SBYTE voice)</code>
<dl>
<dt><i>Description</i><dd>This function returns whether the voice is active or not.
<br><dt><i>Parameters</i><dt><i>voice</i><dd>The number of the voice to be checked (starting from zero).
<br><dt><i>Result</i><dt><i>0</i><dd>The voice is stopped or has no sample assigned.
<br><dt><i>nonzero</i><dd>The voice is playing a sample.
<br><dt><i>Notes</i><dd>This function may not work with some drivers (especially for hardware mixed
voices). In this case, its return value is undefined.
<br><dt><i>See also</i><dd><code>Voice_Stop</code>.
</dl>
<!-- ========================================================== Loader reference -->
<div class="node">
<a name="Loader-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Module-Loaders">Module Loaders</a>,
Previous: <a rel="previous" accesskey="p" href="#Voice-Functions">Voice Functions</a>,
Up: <a rel="up" accesskey="u" href="#Library-Reference">Library Reference</a>
</div>
<h3 class="section">4.5 Loader Reference</h3>
<ul class="menu">
<li><a accesskey="1" href="#Module-Loaders">Module Loaders</a>
<li><a accesskey="2" href="#Sample-Loaders">Sample Loaders</a>
</ul>
<div class="node">
<a name="Module-Loaders"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Sample-Loaders">Sample Loaders</a>,
Previous: <a rel="previous" accesskey="p" href="#Loader-Reference">Loader Reference</a>,
Up: <a rel="up" accesskey="u" href="#Loader-Reference">Loader Reference</a>
</div>
<h4 class="subsection">4.5.1 Module Loaders</h4>
<p>MikMod presents a large choice of module loaders, for the most common formats
as well as for some less-known exotic formats.
<dl>
<dt><code>load_669</code><dd>This loader recognizes “Composer 669” and “Unis 669” modules. The 669
and “Extended 669” formats were among the first PC module formats. They
do not have a wide range of effects, but support up to 32 channels.<br>
“Composer 669” was written by Tran of Renaissance, a.k.a. Tomasz Pytel and
released in 1992. “Unis 669 Composer” was written by Jason Nunn and released
in 1994.
<br><dt><code>load_amf</code><dd>This loader recognizes the “Advanced Module Format”, which is the internal
module format of the “DOS Sound and Music Interface” (DSMI) library. This
format has the same limitations as the S3M format. The most famous DSMI
application was DMP, the Dual Module Player.<br>
DMP and the DSMI library were written by Otto Chrons. DSMI was first released
in 1993.
<br><dt><code>load_asy</code><dd>This loader recognize the “ASYLUM Music Format”, which was used in Crusader
series of games by Origin. This format uses the .amf extension, but is very
similar to a 8 Channel Mod file.
<br><dt><code>load_dsm</code><dd>This loader recognizes the internal DSIK format, which is the internal module
format of the “Digital Sound Interface Kit” (DSIK) library, the ancester of
the SEAL library. This format has the same limitations as the S3M format.<br>
The DSIK library was written by Carlos Hasan and released in 1994.
<br><dt><code>load_far</code><dd>This loader recognizes “Farandole” modules. These modules can be up to 16
channels and have Protracker comparable effects.<br>
The Farandole composer was written by Daniel Potter and released in 1994.
<br><dt><code>load_gdm</code><dd>This loader recognizes the “General DigiMusic” format, which is the internal
format of the “Bells, Whistles and Sound Boards” library. This format has the
same limitations as the S3M format.<br>
The BWSB library was written by Edward Schlunder and first released in 1993.
<br><dt><code>load_imf</code><dd>This loader recognizes “Imago Orpheus” modules. This format is roughly
equivalent to the XM format, but with two effects columns instead of a volume
column and an effect column.<br>
Imago Orpheus was written by Lutz Roeder and released in 1994.
<br><dt><code>load_it</code><dd>This loader recognizes “Impulse Tracker” modules, currently the most powerful
format. These modules support up to 64 real channels, and up to 256 virtual
channels with the “New Note Action” feature. Besides, it has the widest range
of effects, and supports 16 bit samples as well as surround sound.<br>
“Impulse Tracker” was written by Jeffrey Lim and released in 1996.
<br><dt><code>load_med</code><dd>This loader recognizes “OctaMED” modules. These modules are comparable to
Protracker modules, but can embed “synthsounds”, which are midi-like
instruments.<br>
“MED” and later “OctaMED” were written by Teijo Kinnunen. “MED” was
released in 1989, and “OctaMED” was released in 1992.
<br><dt><code>load_m15</code><dd>This loader recognizes the old 15 instrument modules, created by “Ultimate
Soundtracker”, “Soundtracker” and the first versions of “Protracker”.<br>
Since this format was one of the first module formats, developed in 1987, it
does not have any signature field, which makes it hard to detect reliably,
because of its similarities with later module formats.
<br><dt><code>load_mod</code><dd>This loader recognizes the standard 31 instrument modules, created by
“Protracker” or Protracker-compatible programs. The original Protracker
format was limited to 4 channels, but other trackers like “TakeTracker”,
“StarTracker” or “Oktalyzer” afforded more channels.<br>
Although it is now technically obsolete, this format is still widely used, due
to its playback simplicity (on the adequate hardware, the Amiga).
<br><dt><code>load_mtm</code><dd>This loader recognizes the “MultiTracker Module Editor” modules. The MTM
format has up to 32 channels, and protracker comparable effects. It was
intended to replace “Composer 669”.
The “MultiTracker Module Editor” was written by Starscream of Renaissance,
a.k.a. Daniel Goldstein and released in late 1993.
<br><dt><code>load_okt</code><dd>This loader recognizes the “Amiga Oktalyzer” modules. The OKT format has up
to 8 channels, and a few protracker compatible effects, as well as other
OKT-specific effects, of which only a few are currently supported by libmikmod.
“Oktalyzer” was written by Armin Sander and released in 1990.
<br><dt><code>load_stm</code><dd>This loader recognizes “ScreamTracker” modules. “ScreamTracker” was the
first PC tracker, as well as the first PC module format. Loosely inspired by
the “SoundTracker” format, it does not have as many effects as Protracker,
although it supports 31 instruments and 4 channels.<br>
“ScreamTracker” was written by PSI of Future Crew, a.k.a. Sami Tammilehto.
<br><dt><code>load_stx</code><dd>This loader recognizes “STMIK 0.2” modules. “STMIK” (the Scream Tracker
Music Interface Kit) was a module playing library distributed by Future Crew
to play Scream Tracker module in games and demos. It uses an intermediate format
between STM and S3M and comes with a tool converting STM modules to STX.<br>
“STMIK” was written by PSI of Future Crew, a.k.a. Sami Tammilehto.
<br><dt><code>load_s3m</code><dd>This loader recognizes “ScreamTracker 3” modules. This version was a huge
improvement over the original “ScreamTracker”. It supported 32 channels, up
to 99 instruments, and a large choice of effects.<br>
“ScreamTracker 3” was written by PSI of Future Crew, a.k.a. Sami
Tammilehto, and released in 1994.
<br><dt><code>load_ult</code><dd>This loader recognizes “UltraTracker” modules. They are mostly similar to
Protracker modules, but support two effects per channel.<br>
“UltraTracker” was written by MAS of Prophecy, a.k.a. Marc Andre Schallehn,
and released in 1993.
<br><dt><code>load_umx</code><dd>This loader recognizes the modules in “umx” files from games like “Unreal”,
“DeusEx”, etc. To libmikmod, UMX is just a container and the real music
format may be one of “ScreamTracker 3”, “Impulse Tracker”, “FastTracker 2”,
or possibly a “Protracker” compatible one.
<br><dt><code>load_uni</code><dd>This loader recognizes “UNIMOD” modules. This is the internal format used by
MikMod and APlayer. Use of this format is discouraged, this loader being
provided for completeness.
<br><dt><code>load_xm</code><dd>This loader recognizes “FastTracker 2” modules. This format was designed from
scratch, instead of creating yet another Protracker variation. It was the first
format using instruments as well as samples, and envelopes for finer effects.<br>
FastTracker 2 was written by Fredrik Huss and Magnus Hogdahl, and released in
1994.
</dl>
<div class="node">
<a name="Sample-Loaders"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Driver-Reference">Driver Reference</a>,
Previous: <a rel="previous" accesskey="p" href="#Module-Loaders">Module Loaders</a>,
Up: <a rel="up" accesskey="u" href="#Loader-Reference">Loader Reference</a>
</div>
<h4 class="subsection">4.5.2 Sample Loaders</h4>
<p>Currently, the only file type than can be loaded as a sample is the RIFF
WAVE file. Stereo or compressed WAVE files are not supported yet.
<!-- ========================================================== Driver reference -->
<div class="node">
<a name="Driver-Reference"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Network-Drivers">Network Drivers</a>,
Previous: <a rel="previous" accesskey="p" href="#Sample-Loaders">Sample Loaders</a>,
Up: <a rel="up" accesskey="u" href="#Library-Reference">Library Reference</a>
</div>
<h3 class="section">4.6 Driver Reference</h3>
<ul class="menu">
<li><a accesskey="1" href="#Network-Drivers">Network Drivers</a>
<li><a accesskey="2" href="#Hardware-Drivers">Hardware Drivers</a>
<li><a accesskey="3" href="#Disk-Writer-Drivers">Disk Writer Drivers</a>
<li><a accesskey="4" href="#Other-Drivers">Other Drivers</a>
</ul>
<div class="node">
<a name="Network-Drivers"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Hardware-Drivers">Hardware Drivers</a>,
Previous: <a rel="previous" accesskey="p" href="#Driver-Reference">Driver Reference</a>,
Up: <a rel="up" accesskey="u" href="#Driver-Reference">Driver Reference</a>
</div>
<h4 class="subsection">4.6.1 Network Drivers</h4>
<p>These drivers send the generated sound over the network to a server program,
which sends the sound to the real sound hardware. The server program can be
on the same machine than your program, but MikMod does not have access to the
hardware. Network drivers only support software mixing.
<dl>
<dt><code>drv_AF</code><dd>This driver works with the “Digital AudioFile” library.<br>
Start the server on the machine you want, set its hostname in the
‘<samp><span class="samp">AUDIOFILE</span></samp>’ environment variable, and MikMod is ready to send it sound.
<br><dt><code>drv_esd</code><dd>This driver works with the “Enlightened Sound Daemon”.<br>
Start the esd daemon on the machine you want, set its hostname in the
‘<samp><span class="samp">ESPEAKER</span></samp>’ environment variable, and MikMod is ready to send it sound.
<br><dt><code>drv_nas</code><dd>This driver works with the “Network Audio System”.<br>
Start the nas server on the machine you want, and set its hostname with
the ‘<samp><span class="samp">server</span></samp>’ driver command line argument.
<br><dt><code>drv_pulseaudio</code><dd>This driver works with the “PulseAudio” server.<br>
Start the pulseaudio server on the machine you want, set the server name
with ‘<samp><span class="samp">server</span></samp>’ and the device name with ‘<samp><span class="samp">sink</span></samp>’ driver command line
arguments. Without the optional ‘<samp><span class="samp">server</span></samp>’ and ‘<samp><span class="samp">sink</span></samp>’ arguments, the
driver leaves the server:device decision to the pulseaudio library defaults.
</dl>
<div class="node">
<a name="Hardware-Drivers"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Disk-Writer-Drivers">Disk Writer Drivers</a>,
Previous: <a rel="previous" accesskey="p" href="#Network-Drivers">Network Drivers</a>,
Up: <a rel="up" accesskey="u" href="#Driver-Reference">Driver Reference</a>
</div>
<h4 class="subsection">4.6.2 Hardware Drivers</h4>
<p>These drivers access to the sound hardware of the machine they run on.
Depending on your Unix flavor, you'll end with one or more drivers from this
list:
<dl>
<dt><code>drv_ahi</code><dd>This driver is only available under AmigaOS and its variants like MorphOS
and AROS, and it outputs to native Amiga AHI device.<br>
This driver only supports software mixing.
<br><dt><code>drv_aix</code><dd>This driver is only available under AIX, and access its audio device.<br>
This driver only supports software mixing.
<br><dt><code>drv_alsa</code><dd>This driver is only available under Linux, and requires the ALSA driver to be
compiled for your current kernel.<br>
This driver only supports software mixing, but a future version of the driver
might be able to use the hardware capabilities of some sound cards.
<br><dt><code>drv_dart</code><dd>This driver is only available under OS/2 version 3 and higher (Warp), and uses
the “Direct Audio Real-Time” interface.<br>
This driver only supports software mixing.
<br><dt><code>drv_dc</code><dd>This driver is only for the Dreamcast platform, and outputs a stream to the
AICA SPU of a Dreamcast.<br>
This driver only supports software mixing. This driver is not tested yet.
<br><dt><code>drv_ds</code><dd>This driver is only available under WIN32, and uses the “DirectSound” api.<br>
This driver only supports software mixing.
<br><dt><code>drv_gp32</code><dd>This driver is only for the GP32 platform, and uses the “GP32” api.<br>
This driver only supports software mixing. This driver is not tested yet.
<br><dt><code>drv_hp</code><dd>This driver is only available under HP-UX, and access its audio device.<br>
This driver only supports software mixing.
<br><dt><code>drv_mac</code><dd>This driver is only available under MacOS, and uses the “Sound Manager”.<br>
This driver supports the Classic and Carbon environments, and does only software mixing.
<br><dt><code>drv_openal</code><dd>This driver is available for all platforms where “OpenAL” is supported,
and uses the “OpenAL” api.<br>
This driver only supports software mixing.
<br><dt><code>drv_os2</code><dd>This driver is only available under OS/2 version 3 and higher (Warp), and OS/2
2.x with MMPM/2.<br>
This driver only supports software mixing.
<br><dt><code>drv_osles</code><dd>This driver is only available under Android and uses OpenSL ES.<br>
This driver only supports software mixing.
<br><dt><code>drv_oss</code><dd>This driver is available under any Unix with the Open Sound System drivers
installed. Linux and FreeBSD also come with the OSS/Lite driver (the
non-commercial version of OSS) and can make use of this driver.<br>
This driver only supports software mixing.
<br><dt><code>drv_osx</code><dd>This driver is available under MacOS X and Darwin, and uses the “CoreAudio” interface.<br>
This driver only supports software mixing.
<br><dt><code>drv_psp</code><dd>This driver is only for the Playstation Portable platform, and is not tested yet.<br>
This driver only supports software mixing.
<br><dt><code>drv_sam9407</code><dd>This driver is only available under Linux, and requires the Linux sam9407
driver to be compiled for your current kernel.<br>
This driver only supports hardware mixing.
<br><dt><code>drv_sb</code><dd>This driver is only available under DOS, and supports the SoundBlaster/Pro/16/AWE32.<br>
This driver only supports hardware mixing. This driver needs to be tested.
<br><dt><code>drv_sdl</code><dd>This driver is available for all platforms where “SDL” is supported, and
uses the “Simple DirectMedia Layer” apis.<br>
This driver only supports software mixing.
<br><dt><code>drv_sgi</code><dd>This driver is only available under IRIX, and uses the SGI audio library.<br>
This driver only supports software mixing.
<br><dt><code>drv_sndio</code><dd>This driver is only available under OpenBSD and uses the “sndio” interface.<br>
This driver only supports software mixing.
<br><dt><code>drv_sun</code><dd>This driver is only available under Unices which implement SunOS-like audio
device interfaces, that is, SunOS, Solaris, NetBSD and OpenBSD.<br>
This driver only supports software mixing.
<br><dt><code>drv_ultra</code><dd>This driver is available under Linux, and requires the Linux Ultrasound
driver (the ancestor of ALSA) to be compiled for your current kernel. This
driver is also available under DOS/DJGPP and OS/2.<br>
This driver only supports hardware mixing. The DOS/DJGPP and OS/2 parts
needs to be tested.
<br><dt><code>drv_win</code><dd>This driver is only available under WIN32, and uses the “multimedia API”.<br>
This driver only supports software mixing.
<br><dt><code>drv_wss</code><dd>This driver is only available under DOS, and supports Windows Sound System
compatible sound cards.<br>
This driver only supports software mixing. This driver needs to be tested.
<br><dt><code>drv_xaudio2</code><dd>This driver is only available under Windows XP and newer Windows versions
and uses the “XAudio2” 2.7 or 2.8 apis.<br>
This driver only supports software mixing.
</dl>
<div class="node">
<a name="Disk-Writer-Drivers"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Other-Drivers">Other Drivers</a>,
Previous: <a rel="previous" accesskey="p" href="#Hardware-Drivers">Hardware Drivers</a>,
Up: <a rel="up" accesskey="u" href="#Driver-Reference">Driver Reference</a>
</div>
<h4 class="subsection">4.6.3 Disk Writer Drivers</h4>
<p>These drivers work on any machine, since the generated sound is not sent to
hardware, but written in a file. Disk writer drivers only support software
mixing.
<dl>
<dt><code>drv_aiff</code><dd>This driver outputs the sound data in a AIFF (Audio Interchange File Format)
file by default named <samp><span class="file">music.aiff</span></samp> or <samp><span class="file">music.aif</span></samp> on win32/dos in
the current directory.
<br><dt><code>drv_raw</code><dd>This driver outputs the sound data in a file by default named <samp><span class="file">music.raw</span></samp>
in the current directory. The file has no header and only contains the sound
output.
<br><dt><code>drv_wav</code><dd>This driver outputs the sound data in a RIFF WAVE file by default named
<samp><span class="file">music.wav</span></samp> in the current directory.
</dl>
<div class="node">
<a name="Other-Drivers"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Disk-Writer-Drivers">Disk Writer Drivers</a>,
Up: <a rel="up" accesskey="u" href="#Driver-Reference">Driver Reference</a>
</div>
<h4 class="subsection">4.6.4 Other Drivers</h4>
<p>These drivers are of little interest, but are handy sometimes.
<dl>
<dt><code>drv_stdout</code><dd>This driver outputs the sound data to the program's standard output. To avoid
inconvenience, the data will not be output if the standard output is a terminal,
thus you have to pipe it through another command or to redirect it to a file.
Using this driver and redirecting to a file is equivalent to using the
<code>drv_raw</code> disk writer.<br>
This driver only supports software mixing.
<br><dt><code>drv_pipe</code><dd>This driver pipes the sound data to a command (which must be given in the
driver commandline, via <code>MikMod_Init</code>).<br>
This driver only supports software mixing.
<br><dt><code>drv_nos</code><dd>This driver doesn't produce sound at all, and will work on any machine.<br>
Since it does not have to produce sound, it supports both hardware and software
mixing, with as many hardware voices as you like.
</dl>
<!-- ========================================================== Index -->
<div class="node">
<a name="Index"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Function-Index">Function Index</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Reference">Library Reference</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">5 Index</h2>
<ul class="menu">
<li><a accesskey="1" href="#Function-Index">Function Index</a>
<li><a accesskey="2" href="#Type-and-Variable-Index">Type and Variable Index</a>
</ul>
<div class="node">
<a name="Function-Index"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Type-and-Variable-Index">Type and Variable Index</a>,
Previous: <a rel="previous" accesskey="p" href="#Index">Index</a>,
Up: <a rel="up" accesskey="u" href="#Index">Index</a>
</div>
<h2 class="unnumbered">Function Index</h2>
<ul class="index-fn" compact>
<li><a href="#index-MikMod_005fActive-18"><code>MikMod_Active</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fDisableOutput-19"><code>MikMod_DisableOutput</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fEnableOutput-20"><code>MikMod_EnableOutput</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fExit-21"><code>MikMod_Exit</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fGetVersion-22"><code>MikMod_GetVersion</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fInfoDriver-23"><code>MikMod_InfoDriver</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fInfoLoader-24"><code>MikMod_InfoLoader</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fInit-25"><code>MikMod_Init</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fInitThreads-26"><code>MikMod_InitThreads</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fLock-27"><code>MikMod_Lock</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fRegisterAllDrivers-28"><code>MikMod_RegisterAllDrivers</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fRegisterAllLoaders-29"><code>MikMod_RegisterAllLoaders</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fRegisterDriver-30"><code>MikMod_RegisterDriver</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fRegisterErrorHandler-31"><code>MikMod_RegisterErrorHandler</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fRegisterLoader-32"><code>MikMod_RegisterLoader</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fRegisterPlayer-33"><code>MikMod_RegisterPlayer</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fReset-34"><code>MikMod_Reset</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fSetNumVoices-35"><code>MikMod_SetNumVoices</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fstrerror-38"><code>MikMod_strerror</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fUnlock-36"><code>MikMod_Unlock</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-MikMod_005fUpdate-37"><code>MikMod_Update</code></a>: <a href="#Library-Core-Functions">Library Core Functions</a></li>
<li><a href="#index-Player_005fActive-39"><code>Player_Active</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fFree-40"><code>Player_Free</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fGetChannelVoice-41"><code>Player_GetChannelVoice</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fGetModule-42"><code>Player_GetModule</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fLoad-43"><code>Player_Load</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fLoadFP-44"><code>Player_LoadFP</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fLoadTitle-45"><code>Player_LoadTitle</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fLoadTitleFP-46"><code>Player_LoadTitleFP</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fMute-47"><code>Player_Mute</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fMuted-48"><code>Player_Muted</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fNextPosition-49"><code>Player_NextPosition</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fPaused-50"><code>Player_Paused</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fPrevPosition-51"><code>Player_PrevPosition</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fSetPosition-52"><code>Player_SetPosition</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fSetSpeed-53"><code>Player_SetSpeed</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fSetTempo-54"><code>Player_SetTempo</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fSetVolume-55"><code>Player_SetVolume</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fStart-56"><code>Player_Start</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fStop-57"><code>Player_Stop</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fToggleMute-58"><code>Player_ToggleMute</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fTogglePause-59"><code>Player_TogglePause</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Player_005fUnmute-60"><code>Player_Unmute</code></a>: <a href="#Module-Player-Functions">Module Player Functions</a></li>
<li><a href="#index-Sample_005fFree-61"><code>Sample_Free</code></a>: <a href="#Sample-Functions">Sample Functions</a></li>
<li><a href="#index-Sample_005fLoad-62"><code>Sample_Load</code></a>: <a href="#Sample-Functions">Sample Functions</a></li>
<li><a href="#index-Sample_005fLoadFP-63"><code>Sample_LoadFP</code></a>: <a href="#Sample-Functions">Sample Functions</a></li>
<li><a href="#index-Sample_005fPlay-64"><code>Sample_Play</code></a>: <a href="#Sample-Functions">Sample Functions</a></li>
<li><a href="#index-Voice_005fGetFrequency-65"><code>Voice_GetFrequency</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fGetPanning-66"><code>Voice_GetPanning</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fGetPosition-67"><code>Voice_GetPosition</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fGetVolume-68"><code>Voice_GetVolume</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fPlay-69"><code>Voice_Play</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fRealVolume-70"><code>Voice_RealVolume</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fSetFrequency-71"><code>Voice_SetFrequency</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fSetPanning-72"><code>Voice_SetPanning</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fSetVolume-73"><code>Voice_SetVolume</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fStop-74"><code>Voice_Stop</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
<li><a href="#index-Voice_005fStopped-75"><code>Voice_Stopped</code></a>: <a href="#Voice-Functions">Voice Functions</a></li>
</ul><div class="node">
<a name="Type-and-Variable-Index"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Function-Index">Function Index</a>,
Up: <a rel="up" accesskey="u" href="#Index">Index</a>
</div>
<h2 class="unnumbered">Type and Variable Index</h2>
<ul class="index-vr" compact>
<li><a href="#index-INSTRUMENT-14"><code>INSTRUMENT</code></a>: <a href="#Structure-Reference">Structure Reference</a></li>
<li><a href="#index-md_005fdevice-8"><code>md_device</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fdriver-9"><code>md_driver</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fmixfreq-10"><code>md_mixfreq</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fmode-11"><code>md_mode</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fmusicvolume-3"><code>md_musicvolume</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fpansep-4"><code>md_pansep</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005freverb-5"><code>md_reverb</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fsndfxvolume-6"><code>md_sndfxvolume</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-md_005fvolume-7"><code>md_volume</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-MDRIVER-12"><code>MDRIVER</code></a>: <a href="#Structure-Reference">Structure Reference</a></li>
<li><a href="#index-MikMod_005fcritical-2"><code>MikMod_critical</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-MikMod_005ferrno-1"><code>MikMod_errno</code></a>: <a href="#Variable-Reference">Variable Reference</a></li>
<li><a href="#index-MODULE-13"><code>MODULE</code></a>: <a href="#Structure-Reference">Structure Reference</a></li>
<li><a href="#index-MREADER-16"><code>MREADER</code></a>: <a href="#Structure-Reference">Structure Reference</a></li>
<li><a href="#index-MWRITER-17"><code>MWRITER</code></a>: <a href="#Structure-Reference">Structure Reference</a></li>
<li><a href="#index-SAMPLE-15"><code>SAMPLE</code></a>: <a href="#Structure-Reference">Structure Reference</a></li>
</ul><!-- ========================================================== Table Of Contents -->
<div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Top" href="#Top">MikMod Sound Library</a>
<li><a name="toc_Introduction" href="#Introduction">1 Introduction</a>
<li><a name="toc_Tutorial" href="#Tutorial">2 Tutorial</a>
<ul>
<li><a href="#MikMod-Concepts">2.1 MikMod Concepts</a>
<li><a href="#A-Skeleton-Program">2.2 A Skeleton Program</a>
<li><a href="#Playing-Modules">2.3 Playing Modules</a>
<li><a href="#Playing-Sound-Effects">2.4 Playing Sound Effects</a>
<li><a href="#More-Sound-Effects">2.5 More Sound Effects</a>
</li></ul>
<li><a name="toc_Using-the-Library" href="#Using-the-Library">3 Using the Library</a>
<ul>
<li><a href="#Library-Version">3.1 Library Version</a>
<li><a href="#Type-Definitions">3.2 Type Definitions</a>
<li><a href="#Error-Handling">3.3 Error Handling</a>
<li><a href="#Library-Initialization">3.4 Library Initialization and Core Functions</a>
<li><a href="#Samples-and-Voice-Control">3.5 Samples and Voice Control</a>
<li><a href="#Modules-and-Player-Control">3.6 Modules and Player Control</a>
<li><a href="#Loading-Data-from-Memory">3.7 Loading Data from Memory</a>
</li></ul>
<li><a name="toc_Library-Reference" href="#Library-Reference">4 Library Reference</a>
<ul>
<li><a href="#Variable-Reference">4.1 Variable Reference</a>
<ul>
<li><a href="#Variable-Reference">4.1.1 Error Variables</a>
<li><a href="#Variable-Reference">4.1.2 Sound Settings</a>
<li><a href="#Variable-Reference">4.1.3 Driver Settings</a>
</li></ul>
<li><a href="#Structure-Reference">4.2 Structure Reference</a>
<ul>
<li><a href="#Structure-Reference">4.2.1 Drivers</a>
<li><a href="#Structure-Reference">4.2.2 Modules</a>
<ul>
<li><a href="#Structure-Reference">4.2.2.1 General Module Information</a>
<li><a href="#Structure-Reference">4.2.2.2 Playback Settings</a>
</li></ul>
<li><a href="#Structure-Reference">4.2.3 Module Instruments</a>
<li><a href="#Structure-Reference">4.2.4 Samples</a>
<li><a href="#Structure-Reference">4.2.5 MREADER</a>
<li><a href="#Structure-Reference">4.2.6 MWRITER</a>
</li></ul>
<li><a href="#Error-Reference">4.3 Error Reference</a>
<ul>
<li><a href="#Error-Reference">4.3.1 General Errors</a>
<li><a href="#Error-Reference">4.3.2 Sample Errors</a>
<li><a href="#Error-Reference">4.3.3 Module Errors</a>
<li><a href="#Error-Reference">4.3.4 Driver Errors</a>
<ul>
<li><a href="#Error-Reference">4.3.4.1 Generic Driver Errors</a>
<li><a href="#Error-Reference">4.3.4.2 AudioFile Driver Specific Error</a>
<li><a href="#Error-Reference">4.3.4.3 AIX Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.4 Ultra Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.5 HP-UX Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.6 ALSA Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.7 Open Sound System Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.8 SGI Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.9 Sun Driver Specific Error</a>
<li><a href="#Error-Reference">4.3.4.10 OS/2 Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.11 DirectX Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.12 Windows Multimedia API Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.4.13 MacOS Driver Specific Errors</a>
</li></ul>
<li><a href="#Error-Reference">4.3.5 MaxOS X Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.6 Dos “Windows Sound System” Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.7 Dos “SoundBlaster” Driver Specific Errors</a>
<li><a href="#Error-Reference">4.3.8 OpenAL Driver Specific Errors</a>
</li></ul>
<li><a href="#Function-Reference">4.4 Function Reference</a>
<ul>
<li><a href="#Library-Core-Functions">4.4.1 Library Core Functions</a>
<ul>
<li><a href="#Library-Core-Functions">4.4.1.1 MikMod_Active</a>
<li><a href="#Library-Core-Functions">4.4.1.2 MikMod_DisableOutput</a>
<li><a href="#Library-Core-Functions">4.4.1.3 MikMod_EnableOutput</a>
<li><a href="#Library-Core-Functions">4.4.1.4 MikMod_Exit</a>
<li><a href="#Library-Core-Functions">4.4.1.5 MikMod_GetVersion</a>
<li><a href="#Library-Core-Functions">4.4.1.6 MikMod_InfoDriver</a>
<li><a href="#Library-Core-Functions">4.4.1.7 MikMod_InfoLoader</a>
<li><a href="#Library-Core-Functions">4.4.1.8 MikMod_Init</a>
<li><a href="#Library-Core-Functions">4.4.1.9 MikMod_InitThreads</a>
<li><a href="#Library-Core-Functions">4.4.1.10 MikMod_Lock</a>
<li><a href="#Library-Core-Functions">4.4.1.11 MikMod_RegisterAllDrivers</a>
<li><a href="#Library-Core-Functions">4.4.1.12 MikMod_RegisterAllLoaders</a>
<li><a href="#Library-Core-Functions">4.4.1.13 MikMod_RegisterDriver</a>
<li><a href="#Library-Core-Functions">4.4.1.14 MikMod_RegisterErrorHandler</a>
<li><a href="#Library-Core-Functions">4.4.1.15 MikMod_RegisterLoader</a>
<li><a href="#Library-Core-Functions">4.4.1.16 MikMod_RegisterPlayer</a>
<li><a href="#Library-Core-Functions">4.4.1.17 MikMod_Reset</a>
<li><a href="#Library-Core-Functions">4.4.1.18 MikMod_SetNumVoices</a>
<li><a href="#Library-Core-Functions">4.4.1.19 MikMod_Unlock</a>
<li><a href="#Library-Core-Functions">4.4.1.20 MikMod_Update</a>
<li><a href="#Library-Core-Functions">4.4.1.21 MikMod_strerror</a>
</li></ul>
<li><a href="#Module-Player-Functions">4.4.2 Module Player Functions</a>
<ul>
<li><a href="#Module-Player-Functions">4.4.2.1 Player_Active</a>
<li><a href="#Module-Player-Functions">4.4.2.2 Player_Free</a>
<li><a href="#Module-Player-Functions">4.4.2.3 Player_GetChannelVoice</a>
<li><a href="#Module-Player-Functions">4.4.2.4 Player_GetModule</a>
<li><a href="#Module-Player-Functions">4.4.2.5 Player_Load</a>
<li><a href="#Module-Player-Functions">4.4.2.6 Player_LoadFP</a>
<li><a href="#Module-Player-Functions">4.4.2.7 Player_LoadTitle</a>
<li><a href="#Module-Player-Functions">4.4.2.8 Player_LoadTitleFP</a>
<li><a href="#Module-Player-Functions">4.4.2.9 Player_Mute</a>
<li><a href="#Module-Player-Functions">4.4.2.10 Player_Muted</a>
<li><a href="#Module-Player-Functions">4.4.2.11 Player_NextPosition</a>
<li><a href="#Module-Player-Functions">4.4.2.12 Player_Paused</a>
<li><a href="#Module-Player-Functions">4.4.2.13 Player_PrevPosition</a>
<li><a href="#Module-Player-Functions">4.4.2.14 Player_SetPosition</a>
<li><a href="#Module-Player-Functions">4.4.2.15 Player_SetSpeed</a>
<li><a href="#Module-Player-Functions">4.4.2.16 Player_SetTempo</a>
<li><a href="#Module-Player-Functions">4.4.2.17 Player_SetVolume</a>
<li><a href="#Module-Player-Functions">4.4.2.18 Player_Start</a>
<li><a href="#Module-Player-Functions">4.4.2.19 Player_Stop</a>
<li><a href="#Module-Player-Functions">4.4.2.20 Player_ToggleMute</a>
<li><a href="#Module-Player-Functions">4.4.2.21 Player_TogglePause</a>
<li><a href="#Module-Player-Functions">4.4.2.22 Player_Unmute</a>
</li></ul>
<li><a href="#Sample-Functions">4.4.3 Sample Functions</a>
<ul>
<li><a href="#Sample-Functions">4.4.3.1 Sample_Free</a>
<li><a href="#Sample-Functions">4.4.3.2 Sample_Load</a>
<li><a href="#Sample-Functions">4.4.3.3 Sample_LoadFP</a>
<li><a href="#Sample-Functions">4.4.3.4 Sample_Play</a>
</li></ul>
<li><a href="#Voice-Functions">4.4.4 Voice Functions</a>
<ul>
<li><a href="#Voice-Functions">4.4.4.1 Voice_GetFrequency</a>
<li><a href="#Voice-Functions">4.4.4.2 Voice_GetPanning</a>
<li><a href="#Voice-Functions">4.4.4.3 Voice_GetPosition</a>
<li><a href="#Voice-Functions">4.4.4.4 Voice_GetVolume</a>
<li><a href="#Voice-Functions">4.4.4.5 Voice_Play</a>
<li><a href="#Voice-Functions">4.4.4.6 Voice_RealVolume</a>
<li><a href="#Voice-Functions">4.4.4.7 Voice_SetFrequency</a>
<li><a href="#Voice-Functions">4.4.4.8 Voice_SetPanning</a>
<li><a href="#Voice-Functions">4.4.4.9 Voice_SetVolume</a>
<li><a href="#Voice-Functions">4.4.4.10 Voice_Stop</a>
<li><a href="#Voice-Functions">4.4.4.11 Voice_Stopped</a>
</li></ul>
</li></ul>
<li><a href="#Loader-Reference">4.5 Loader Reference</a>
<ul>
<li><a href="#Module-Loaders">4.5.1 Module Loaders</a>
<li><a href="#Sample-Loaders">4.5.2 Sample Loaders</a>
</li></ul>
<li><a href="#Driver-Reference">4.6 Driver Reference</a>
<ul>
<li><a href="#Network-Drivers">4.6.1 Network Drivers</a>
<li><a href="#Hardware-Drivers">4.6.2 Hardware Drivers</a>
<li><a href="#Disk-Writer-Drivers">4.6.3 Disk Writer Drivers</a>
<li><a href="#Other-Drivers">4.6.4 Other Drivers</a>
</li></ul>
</li></ul>
<li><a name="toc_Index" href="#Index">5 Index</a>
<li><a name="toc_Function-Index" href="#Function-Index">Function Index</a>
<li><a name="toc_Type-and-Variable-Index" href="#Type-and-Variable-Index">Type and Variable Index</a>
</li></ul>
</div>
<div class="footnote">
<hr>
<a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> <code>PAN_SURROUND</code> will be
mapped to <code>PAN_CENTER</code> if the library is initialized without surround
sound, that is, if the variable <code>md_mode</code> doesn't have the bit
<code>DMODE_SURROUND</code> set.</p>
<p class="footnote"><small>[<a name="fn-2" href="#fnd-2">2</a>]</small> Unless you
explicitely choose to create a non thread-safe version of libmikmod at
compile-time.</p>
<p class="footnote"><small>[<a name="fn-3" href="#fnd-3">3</a>]</small> You can force libmikmod to
load the module (without the synthsounds, of course) by setting the
<code>curious</code> parameter to <code>1</code> when invoking <code>Player_Loadxx</code>.</p>
<hr></div>
</body></html>
|