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
|
/*
* Copyright (c) 2004 by Hannu Savolainen < hannu@opensound.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include "local.h"
static int nports = 0;
typedef struct _snd_seq_port_subscribe
{
int dummy;
} snd_seq_port_subscribe_t;
typedef struct _snd_seq_queue_tempo
{
int dummy;
} snd_seq_queue_tempo_t;
typedef struct _snd_seq_system_info
{
int dummy;
} snd_seq_system_info_t;
struct _snd_seq_remove_events
{
int dummy;
};
struct _snd_seq_query_subscribe
{
int dummy;
};
/**
* \brief Open the ALSA sequencer
*
* \param seqp Pointer to a snd_seq_t pointer. This pointer must be
* kept and passed to most of the other sequencer functions.
* \param name The sequencer's "name". This is \em not a name you make
* up for your own purposes; it has special significance to the ALSA
* library. Usually you need to pass \c "default" here.
* \param streams The read/write mode of the sequencer. Can be one of
* three values:
* - #SND_SEQ_OPEN_OUTPUT - open the sequencer for output only
* - #SND_SEQ_OPEN_INPUT - open the sequencer for input only
* - #SND_SEQ_OPEN_DUPLEX - open the sequencer for output and input
* \note Internally, these are translated to \c O_WRONLY, \c O_RDONLY and
* \c O_RDWR respectively and used as the second argument to the C library
* open() call.
* \param mode Optional modifier. Can be either 0, or
* #SND_SEQ_NONBLOCK, which will make read/write operations
* non-blocking. This can also be set later using #snd_seq_nonblock().
* \return 0 on success otherwise a negative error code
*
* Creates a new handle and opens a connection to the kernel
* sequencer interface.
* After a client is created successfully, an event
* with #SND_SEQ_EVENT_CLIENT_START is broadcast to announce port.
*
* \sa snd_seq_open_lconf(), snd_seq_close(), snd_seq_type(), snd_seq_name(),
* snd_seq_nonblock(), snd_seq_client_id()
*/
int
snd_seq_open (snd_seq_t ** seqp, const char *name, int streams, int mode)
{
snd_seq_t *seq;
int err, oss_mode;
static int instance = 0;
char *fname = "/dev/midi", *envname = NULL, tmp[128];
ALIB_INIT ();
dbg_printf ("snd_seq_open(name='%s', streams=%d, mode=%x)\n", name, streams,
mode);
if (!alib_appcheck ())
return -ENODEV;
instance++;
sprintf (tmp, "%s_mididev%d", alib_appname, instance);
if ((envname = getenv (tmp)) != NULL)
{
fname = envname;
}
#if 0
if (streams != 1)
{
fprintf (stderr, "salsa: snd_seq_open doesn't support streams=%d\n",
streams);
return -EIO;
}
#endif
if ((seq = malloc (sizeof (*seq))) == NULL)
return -ENOMEM;
dbg_printf ("Created sequencer seq=%p\n", seq);
memset (seq, 0, sizeof (*seq));
switch (streams)
{
case SND_SEQ_OPEN_INPUT:
oss_mode = O_RDONLY;
dbg_printf ("Open SND_SEQ_OPEN_INPUT\n");
break;
case SND_SEQ_OPEN_OUTPUT:
oss_mode = O_WRONLY;
dbg_printf ("Open SND_SEQ_OPEN_OUTPUT\n");
break;
case SND_SEQ_OPEN_DUPLEX:
dbg_printf ("SND_SEQ_OPEN_DUPLEX\n");
oss_mode = O_RDWR;
break;
default:
fprintf (stderr, "snd_seq_open: Unknown stream %x\n", streams);
return -ENODEV;
}
if ((seq->fd = open (fname, oss_mode, 0)) == -1)
{
err = errno;
perror (fname);
if (envname == NULL)
{
fprintf (stderr,
"You can select another filename using environment variable %s_mididev%d\n",
alib_appname, instance);
}
return -err;
}
seq->streams = streams;
seq->oss_mode = oss_mode;
if (streams == SND_SEQ_OPEN_INPUT || streams == SND_SEQ_OPEN_DUPLEX)
{
seq->parser = midiparser_create (midiparser_callback, seq);
if (seq->parser == NULL)
{
fprintf (stderr, "libsalsa: Can't create MIDI parser\n");
return -ENODEV;
}
}
*seqp = seq;
return 0;
}
/**
* \brief Close the sequencer
* \param handle Handle returned from #snd_seq_open()
* \return 0 on success otherwise a negative error code
*
* Closes the sequencer client and releases its resources.
* After a client is closed, an event with
* #SND_SEQ_EVENT_CLIENT_EXIT is broadcast to announce port.
* The connection between other clients are disconnected.
* Call this just before exiting your program.
*
* \sa snd_seq_close()
*/
int
snd_seq_close (snd_seq_t * seq)
{
dbg_printf ("snd_seq_close(seq=%x)\n", seq);
close (seq->fd);
free (seq);
}
/**
* \brief Set nonblock mode
* \param seq sequencer handle
* \param nonblock 0 = block, 1 = nonblock mode
* \return 0 on success otherwise a negative error code
*
* Change the blocking mode of the given client.
* In block mode, the client falls into sleep when it fills the
* output memory pool with full events. The client will be woken up
* after a certain amount of free space becomes available.
*
* \sa snd_seq_open()
*/
int
snd_seq_nonblock (snd_seq_t * seq, int nonblock)
{
dbg_printf ("snd_seq_nonblock(seq=%x, nonblock=%d)\n", seq, nonblock);
seq->nonblock = nonblock;
return 0;
}
/**
* \brief create a sequencer port on the current client
* \param seq sequencer handle
* \param port port information for the new port
* \return 0 on success otherwise a negative error code
*
* Creates a sequencer port on the current client.
* The attributes of created port is specified in \a info argument.
*
* The client field in \a info argument is overwritten with the current client id.
* The port id to be created can be specified via #snd_seq_port_info_set_port_specified.
* You can get the created port id by reading the port pointer via #snd_seq_port_info_get_port.
*
* Each port has the capability bit-masks to specify the access capability
* of the port from other clients.
* The capability bit flags are defined as follows:
* - #SND_SEQ_PORT_CAP_READ Readable from this port
* - #SND_SEQ_PORT_CAP_WRITE Writable to this port.
* - #SND_SEQ_PORT_CAP_SYNC_READ For synchronization (not implemented)
* - #SND_SEQ_PORT_CAP_SYNC_WRITE For synchronization (not implemented)
* - #SND_SEQ_PORT_CAP_DUPLEX Read/write duplex access is supported
* - #SND_SEQ_PORT_CAP_SUBS_READ Read subscription is allowed
* - #SND_SEQ_PORT_CAP_SUBS_WRITE Write subscription is allowed
* - #SND_SEQ_PORT_CAP_SUBS_NO_EXPORT Subscription management from 3rd client is disallowed
*
* Each port has also the type bitmasks defined as follows:
* - #SND_SEQ_PORT_TYPE_SPECIFIC Hardware specific port
* - #SND_SEQ_PORT_TYPE_MIDI_GENERIC Generic MIDI device
* - #SND_SEQ_PORT_TYPE_MIDI_GM General MIDI compatible device
* - #SND_SEQ_PORT_TYPE_MIDI_GS GS compatible device
* - #SND_SEQ_PORT_TYPE_MIDI_XG XG compatible device
* - #SND_SEQ_PORT_TYPE_MIDI_MT32 MT-32 compatible device
* - #SND_SEQ_PORT_TYPE_SYNTH Synth device
* - #SND_SEQ_PORT_TYPE_DIRECT_SAMPLE Sampling device (supporting download)
* - #SND_SEQ_PORT_TYPE_SAMPLE Sampling device (sample can be downloaded at any time)
* - #SND_SEQ_PORT_TYPE_APPLICATION Application (sequencer/editor)
*
* A port may contain specific midi channels, midi voices and synth voices.
* These values could be zero as default.
*
* \sa snd_seq_delete_port(), snd_seq_get_port_info(),
* snd_seq_create_simple_port()
*/
int
snd_seq_create_port (snd_seq_t * seq, snd_seq_port_info_t * port)
{
dbg_printf ("snd_seq_create_port(seq=%x, port=%x)\n", seq, port);
port->port = nports++;
return 0;
}
/**
* \brief Get the client id
* \param seq sequencer handle
* \return the client id
*
* Returns the id of the specified client.
* If an error occurs, function returns the negative error code.
* A client id is necessary to inquiry or to set the client information.
* A user client is assigned from 128 to 191.
*
* \sa snd_seq_open()
*/
int
snd_seq_client_id (snd_seq_t * seq)
{
static int client_id = 128;
dbg_printf ("snd_seq_client_id(seq=%x)=%d\n", seq, client_id);
return client_id++;
}
/**
* \brief Get client id of a client_info container
* \param info client_info container
* \return client id
*
* \sa snd_seq_get_client_info(), snd_seq_client_info_set_client(), snd_seq_client_id()
*/
int
snd_seq_client_info_get_client (const snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_client_info_get_client()\n");
return 0;
}
/**
* \brief Get client type of a client_info container
* \param info client_info container
* \return client type
*
* The client type is either #SEQ_CLIENT_TYPE_KERNEL or #SEQ_CLIENT_TYPE_USER
* for kernel or user client respectively.
*
* \sa snd_seq_get_client_info()
*/
snd_seq_client_type_t
snd_seq_client_info_get_type (const snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_client_info_get_type(infp=%x)\n", info);
return SND_SEQ_KERNEL_CLIENT; // TODO
}
/**
* \brief Set the client id of a client_info container
* \param info client_info container
* \param client client id
*
* \sa snd_seq_get_client_info(), snd_seq_client_info_get_client()
*/
void
snd_seq_client_info_set_client (snd_seq_client_info_t * info, int client)
{
dbg_printf ("snd_seq_client_info_set_client(%x, %d)\n", info, client);
info->client = client;
}
/**
* \brief get size of #snd_seq_client_info_t
* \return size in bytes
*/
size_t
snd_seq_client_info_sizeof ()
{
dbg_printf ("snd_seq_client_info_sizeof()\n");
return sizeof (snd_seq_client_info_t);
}
/**
* \brief retrieve an event from sequencer
* \param seq sequencer handle
* \param ev event pointer to be stored
* \return
*
* Obtains an input event from sequencer.
* The event is created via snd_seq_create_event(), and its pointer is stored on * ev argument.
*
* This function firstly receives the event byte-stream data from sequencer
* as much as possible at once. Then it retrieves the first event record
* and store the pointer on ev.
* By calling this function sequentially, events are extracted from the input buffer.
*
* If there is no input from sequencer, function falls into sleep
* in blocking mode until an event is received,
* or returns \c -EAGAIN error in non-blocking mode.
* Occasionally, this function may return \c -ENOSPC error.
* This means that the input FIFO of sequencer overran, and some events are
* lost.
* Once this error is returned, the input FIFO is cleared automatically.
*
* Function returns the byte size of remaining events on the input buffer
* if an event is successfully received.
* Application can determine from the returned value whether to call
* input once more or not.
*
* \sa snd_seq_event_input_pending(), snd_seq_drop_input()
*/
int
snd_seq_event_input (snd_seq_t * seq, snd_seq_event_t ** evp)
{
static snd_seq_event_t *ev;
unsigned char buf[256];
int i, l;
dbg_printf2 ("snd_seq_event_input(seq=%x)\n", seq);
while (1)
{
if (seq->nextevent < seq->nevents)
{
*evp = &seq->events[seq->nextevent++];
return (seq->nevents - seq->nextevent) * sizeof (snd_seq_event_t);
}
seq->nextevent = seq->nevents = 0;
memset (seq->events, 0, sizeof (seq->events));
// TODO Handling of nonblocking mode
if ((l = read (seq->fd, buf, sizeof (buf))) == -1)
return -errno;
midiparser_input_buf (seq->parser, buf, l);
}
}
/**
* \brief output an event directly to the sequencer NOT through output buffer
* \param seq sequencer handle
* \param ev event to be output
* \return the byte size sent to sequencer or a negative error code
*
* This function sends an event to the sequencer directly not through the
* output buffer. When the event is a variable length event, a temporary
* buffer is allocated inside alsa-lib and the data is copied there before
* actually sent.
*
* \sa snd_seq_event_output()
*/
int
snd_seq_event_output_direct (snd_seq_t * seq, snd_seq_event_t * ev)
{
int err;
dbg_printf3 ("snd_seq_event_output_direct()\n");
if ((err = convert_event (seq, ev)) < 0)
return err;
if ((err = snd_seq_drain_output (seq)) < 0)
return err;
return 0;
}
/**
* \brief (DEPRECATED) free an event
*
* In the former version, this function was used to
* release the event pointer which was allocated by snd_seq_event_input().
* In the current version, the event record is not allocated, so
* you don't have to call this function any more.
*/
int
snd_seq_free_event (snd_seq_event_t * ev)
{
return 0;
}
/**
* \brief obtain the current client information
* \param seq sequencer handle
* \param info the pointer to be stored
* \return 0 on success otherwise a negative error code
*
* Obtains the information of the current client stored on info.
* client and type fields are ignored.
*
* \sa snd_seq_get_any_client_info(), snd_seq_set_client_info(),
* snd_seq_query_next_client()
*/
int
snd_seq_get_client_info (snd_seq_t * seq, snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_get_client_info(seq=%x, info=%x)\n", seq, info);
return 0;
}
/**
* \brief query the next matching port
* \param seq sequencer handle
* \param info query pattern and result
* Queries the next matching port on the client specified in
* \a info argument.
* The search begins at the next port specified in
* port field of \a info argument.
* For finding the first port at a certain client, give -1.
*
* If a matching port is found, its attributes are stored on
* \a info and function returns zero.
* Otherwise, a negative error code is returned.
*
* \sa snd_seq_get_port_info()
*/
int
snd_seq_query_next_port (snd_seq_t * seq, snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_query_next_port()\n");
return -EINVAL;
}
/**
* \brief Set the name of a client_info container
* \param info client_info container
* \param name name string
*
* \sa snd_seq_get_client_info(), snd_seq_client_info_get_name(),
* snd_seq_set_client_name()
*/
void
snd_seq_client_info_set_name (snd_seq_client_info_t * info, const char *name)
{
dbg_printf ("snd_seq_client_info_set_name(%s)\n", name);
strncpy (info->name, name, sizeof (info->name) - 1);
info->name[sizeof (info->name) - 1] = 0;
}
/**
* \brief subscribe a port connection
* \param seq sequencer handle
* \param sub subscription information
* \return 0 on success otherwise a negative error code
*
* Subscribes a connection between two ports.
* The subscription information is stored in sub argument.
*
* \sa snd_seq_get_port_subscription(), snd_seq_unsubscribe_port(),
* snd_seq_connect_from(), snd_seq_connect_to()
*/
int
snd_seq_subscribe_port (snd_seq_t * seq, snd_seq_port_subscribe_t * sub)
{
dbg_printf ("snd_seq_subscribe_port()\n");
return -EINVAL;
}
/**
* \brief get size of #snd_seq_port_subscribe_t
* \return size in bytes
*/
size_t
snd_seq_port_subscribe_sizeof ()
{
return sizeof (snd_seq_port_subscribe_t);
}
/**
* \brief Set sender address of a port_subscribe container
* \param info port_subscribe container
* \param addr sender address
*
* \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_sender()
*/
void
snd_seq_port_subscribe_set_sender (snd_seq_port_subscribe_t * info,
const snd_seq_addr_t * addr)
{
dbg_printf ("snd_seq_port_subscribe_set_sender()\n");
}
/**
* \brief Set destination address of a port_subscribe container
* \param info port_subscribe container
* \param addr destination address
*
* \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_dest()
*/
void
snd_seq_port_subscribe_set_dest (snd_seq_port_subscribe_t * info,
const snd_seq_addr_t * addr)
{
dbg_printf ("snd_seq_port_subscribe_set_dest()\n");
}
/**
* \brief Set the queue id of a port_subscribe container
* \param info port_subscribe container
* \param q queue id
*
* \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_queue()
*/
void
snd_seq_port_subscribe_set_queue (snd_seq_port_subscribe_t * info, int q)
{
dbg_printf ("snd_seq_port_subscribe_set_queue()\n");
}
/**
* \brief Set the real-time mode of a port_subscribe container
* \param info port_subscribe container
* \param val non-zero to enable
*
* \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_time_real()
*/
void
snd_seq_port_subscribe_set_time_real (snd_seq_port_subscribe_t * info,
int val)
{
dbg_printf ("snd_seq_port_subscribe_set_time_real()\n");
}
/**
* \brief Set the time-update mode of a port_subscribe container
* \param info port_subscribe container
* \param val non-zero to enable
*
* \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_time_update()
*/
void
snd_seq_port_subscribe_set_time_update (snd_seq_port_subscribe_t * info, int
val)
{
dbg_printf ("snd_seq_port_subscribe_set_time_update()\n");
}
/*
* Port
*/
/**
* \brief get size of #snd_seq_port_info_t
* \return size in bytes
*/
size_t
snd_seq_port_info_sizeof ()
{
return sizeof (snd_seq_port_info_t);
}
/**
* \brief Get the capability bits of a port_info container
* \param info port_info container
* \return capability bits
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_capability()
*/
unsigned int
snd_seq_port_info_get_capability (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_capability()\n");
return info->capability;
}
/**
* \brief Get client/port address of a port_info container
* \param info port_info container
* \return client/port address pointer
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_addr()
*/
const snd_seq_addr_t *
snd_seq_port_info_get_addr (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_addr(info=%x)\n", info);
return NULL; // TODO
}
/**
* \brief set the capability bits of a port_info container
* \param info port_info container
* \param capability capability bits
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_capability()
*/
void
snd_seq_port_info_set_capability (snd_seq_port_info_t * info,
unsigned int capability)
{
dbg_printf ("snd_seq_port_info_set_capability()\n");
}
/**
* \brief Set the port-specified mode of a port_info container
* \param info port_info container
* \param val non-zero if specifying the port id at creation
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_port_specified()
*/
void
snd_seq_port_info_set_port_specified (snd_seq_port_info_t * info, int val)
{
dbg_printf ("snd_seq_port_info_set_port_specified()\n");
}
/**
* \brief Get the midi channels of a port_info container
* \param info port_info container
* \return number of midi channels (default 0)
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_midi_channels()
*/
int
snd_seq_port_info_get_midi_channels (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_midi_channels(info=%x)=%d\n",
info, info->midi_channels);
return info->midi_channels;
}
/**
* \brief set the midi channels of a port_info container
* \param info port_info container
* \param channels midi channels (default 0)
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_midi_channels()
*/
void
snd_seq_port_info_set_midi_channels (snd_seq_port_info_t * info, int channels)
{
dbg_printf ("snd_seq_port_info_set_midi_channels(info=%x, channels=%d)\n",
info, channels);
info->midi_channels = channels;
}
/**
* \brief Get the queue id to update timestamps
* \param info port_info container
* \return the queue id to get the timestamps
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_timestamp_queue()
*/
int
snd_seq_port_info_get_timestamp_queue (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_timestamp_queue(info=%x)\n", info);
return 0; // TODO
}
/**
* \brief Set the queue id for timestamping
* \param info port_info container
* \param queue the queue id to get timestamps
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_timestamp_queue()
*/
void
snd_seq_port_info_set_timestamp_queue (snd_seq_port_info_t * info, int queue)
{
dbg_printf ("snd_seq_port_info_set_timestamp_queue(info=%x, queue=%d)\n",
info, queue);
// TODO
}
/**
* \brief Get whether the time-stamping of the given port is real-time mode
* \param info port_info container
* \return 1 if the time-stamping is in the real-time mode
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_timestamp_real()
*/
int
snd_seq_port_info_get_timestamp_real (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_timestamp_real(info=%x)\n", info);
return 0; // TODO
}
/**
* \brief Set whether the timestime is updated in the real-time mode
* \param info port_info container
* \param enable non-zero if updating the timestamps in real-time mode
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_timestamp_real()
*/
void
snd_seq_port_info_set_timestamp_real (snd_seq_port_info_t * info, int enable)
{
dbg_printf ("snd_seq_port_info_set_timestamp_real(infp=%x, enable=%d)\n",
info, enable);
}
/**
* \brief Get the time-stamping mode of the given port in a port_info container * \param info port_info container
* \return 1 if the port updates timestamps of incoming events
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_timestamping()
*/
int
snd_seq_port_info_get_timestamping (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_timestamping(info=%x)\n", info);
return 0; // TODO
}
/**
* \brief Set the time-stamping mode of the given port
* \param info port_info container
* \param enable non-zero if updating the timestamps of incoming events
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_timestamping()
*/
void
snd_seq_port_info_set_timestamping (snd_seq_port_info_t * info, int enable)
{
dbg_printf ("snd_seq_port_info_set_timestamping(info=%x, enable=%d)\n",
info, enable);
// TODO
}
/**
* \brief Set the name of a port_info container
* \param info port_info container
* \param name name string
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_name()
*/
void
snd_seq_port_info_set_name (snd_seq_port_info_t * info, const char *name)
{
dbg_printf ("snd_seq_port_info_set_name()\n");
strncpy (info->name, name, sizeof (info->name));
}
/**
* \brief Get the name of a port_info container
* \param info port_info container
* \return name string
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_name()
*/
const char *
snd_seq_port_info_get_name (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_name()\n");
return "Port Name";
}
/**
* \brief Get port id of a port_info container
* \param info port_info container
* \return port id
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_port()
*/
int
snd_seq_port_info_get_port (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_port()\n");
return -EIO;
}
/**
* \brief Get the type bits of a port_info container
* \param info port_info container
* \return port type bits
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_type()
*/
unsigned int
snd_seq_port_info_get_type (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_type()\n");
return info->type;
}
/**
* \brief Set the client id of a port_info container
* \param info port_info container
* \param client client id
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_client()
*/
void
snd_seq_port_info_set_client (snd_seq_port_info_t * info, int client)
{
dbg_printf ("snd_seq_port_info_set_client()\n");
}
/**
* \brief Set the port id of a port_info container
* \param info port_info container
* \param port port id
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_port()
*/
void
snd_seq_port_info_set_port (snd_seq_port_info_t * info, int port)
{
dbg_printf ("snd_seq_port_info_set_port()\n");
}
/**
* \brief query the next matching client
* \param seq sequencer handle
* \param info query pattern and result
*
* Queries the next matching client with the given condition in
* info argument.
* The search begins at the client with an id one greater than
* client field in info.
* If name field in info is not empty, the client name is compared.
* If a matching client is found, its attributes are stored o
* info and returns zero.
* Otherwise returns a negative error code.
*
* \sa snd_seq_get_any_client_info()
*/
int
snd_seq_query_next_client (snd_seq_t * seq, snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_query_next_client()\n");
return -EIO;
}
/**
* \brief set the current client information
* \param seq sequencer handle
* \param info the client info data to set
* \return 0 on success otherwise a negative error code
*
* Obtains the information of the current client stored on info.
* client and type fields are ignored.
*
* \sa snd_seq_get_client_info()
*/
int
snd_seq_set_client_info (snd_seq_t * seq, snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_set_client_info(seq=%x, info=%x)\n", seq, info);
if (*info->name)
{
strcpy (seq->name, info->name);
ioctl (seq->fd, SNDCTL_SETNAME, seq->name);
ioctl (seq->fd, SNDCTL_SETSONG, seq->name);
}
return 0;
}
/**
* \brief check events in input buffer
* \return the byte size of remaining input events on input buffer.
*
* If events remain on the input buffer of user-space, function returns
* the total byte size of events on it.
* If fetch_sequencer argument is non-zero,
* this function checks the presence of events on sequencer FIFO
* When events exist, they are transferred to the input buffer,
* and the number of received events are returned.
* If fetch_sequencer argument is zero and
* no events remain on the input buffer, function simply returns zero.
*
* \sa snd_seq_event_input()
*/
int
snd_seq_event_input_pending (snd_seq_t * seq, int fetch_sequencer)
{
dbg_printf ("snd_seq_event_input_pending()\n");
return 0;
}
/**
* \brief Get poll descriptors
* \param seq sequencer handle
* \param pfds array of poll descriptors
* \param space space in the poll descriptor array
* \param events polling events to be checked (\c POLLIN and \c POLLOUT)
* \return count of filled descriptors
*
* Get poll descriptors assigned to the sequencer handle.
* Since a sequencer handle can duplex streams, you need to set which direction(s)
* is/are polled in \a events argument. When \c POLLIN bit is specified,
* the incoming events to the ports are checked.
*
* To check the returned poll-events, call #snd_seq_poll_descriptors_revents()
* instead of reading the pollfd structs directly.
*
* \sa snd_seq_poll_descriptors_count(), snd_seq_poll_descriptors_revents()
*/
int
snd_seq_poll_descriptors (snd_seq_t * seq, struct pollfd *pfds,
unsigned int space, short events)
{
dbg_printf ("snd_seq_poll_descriptors(seq=%x)\n", seq);
pfds->fd = seq->fd;
pfds->events = 0;
pfds->revents = 0;
if (seq->oss_mode == O_WRONLY || seq->oss_mode == O_RDWR)
pfds->events = POLLOUT;
if (seq->oss_mode == O_RDONLY || seq->oss_mode == O_RDWR)
pfds->events = POLLIN;
return 1;
}
/**
* \brief Returns the number of poll descriptors
* \param seq sequencer handle
* \param events the poll events to be checked (\c POLLIN and \c POLLOUT)
* \return the number of poll descriptors.
*
* Get the number of poll descriptors. The polling events to be checked
* can be specified by the second argument. When both input and output
* are checked, pass \c POLLIN|POLLOUT
*
* \sa snd_seq_poll_descriptors()
*/
int
snd_seq_poll_descriptors_count (snd_seq_t * seq, short events)
{
dbg_printf ("snd_seq_poll_descriptors_count(seq=%x, events=%x)\n",
seq, events);
return 1;
}
/**
* \brief create a queue
* \param seq sequencer handle
* \param info queue information to initialize
* \return the queue id (zero or positive) on success otherwise a negative error code
*
* \sa snd_seq_alloc_queue()
*/
int
snd_seq_create_queue (snd_seq_t * seq, snd_seq_queue_info_t * info)
{
dbg_printf ("snd_seq_create_queue()\n");
return 0;
}
/**
* \brief simple subscription (w/o exclusive & time conversion)
* \param myport the port id as sender
* \param dest_client destination client id
* \param dest_port destination port id
* \return 0 on success or negative error code
*
* Connect from the given receiver port in the current client
* to the given destination client:port.
*
* \sa snd_seq_subscribe_port(), snd_seq_disconnect_to()
*/
int
snd_seq_connect_to (snd_seq_t * seq, int myport, int dest_client,
int dest_port)
{
dbg_printf ("snd_seq_connect_to(%d->%d/%d)\n", myport, dest_client,
dest_port);
return 0;
}
/**
* \brief simple subscription (w/o exclusive & time conversion)
* \param myport the port id as receiver
* \param src_client sender client id
* \param src_port sender port id
* \return 0 on success or negative error code
*
* Connect from the given sender client:port to the given destination port in the
* current client.
*
* \sa snd_seq_subscribe_port(), snd_seq_disconnect_from()
*/
int
snd_seq_connect_from (snd_seq_t * seq, int myport, int src_client,
int src_port)
{
dbg_printf
("snd_seq_connect_from(seq=%x, myport=%d, src_client=%d, src_port=%d)\n",
seq, myport, src_client, src_port);
return 0;
}
/**
* \brief queue controls - start/stop/continue
* \param seq sequencer handle
* \param q queue id to control
* \param type event type
* \param value event value
* \param ev event instance
*
* This function sets up general queue control event and sends it.
* To send at scheduled time, set the schedule in \a ev.
* If \a ev is NULL, the event is composed locally and sent immediately
* to the specified queue. In any cases, you need to call #snd_seq_drain_output()
* appropriately to feed the event.
*
* \sa snd_seq_alloc_queue()
*/
int
snd_seq_control_queue (snd_seq_t * seq, int q, int type, int value,
snd_seq_event_t * ev)
{
dbg_printf ("snd_seq_control_queue()\n");
return 0;
}
/**
* \brief drain output buffer to sequencer
* \param seq sequencer handle
* \return 0 when all events are drained and sent to sequencer.
* When events still remain on the buffer, the byte size of remaining
* events are returned. On error a negative error code is returned.
*
* This function drains all pending events on the output buffer.
* The function returns immediately after the events are sent to the queues
* regardless whether the events are processed or not.
* To get synchronization with the all event processes, use
* #snd_seq_sync_output_queue() after calling this function.
*
* \sa snd_seq_event_output(), snd_seq_sync_output_queue()
*/
int
snd_seq_drain_output (snd_seq_t * seq)
{
dbg_printf3 ("snd_seq_drain_output(seq=%x)\n", seq);
return 0;
}
/**
* \brief remove all events on output buffer
* \param seq sequencer handle
*
* Removes all events on both user-space output buffer and
* output memory pool on kernel.
*
* \sa snd_seq_drain_output(), snd_seq_drop_output_buffer(), snd_seq_remove_events()
*/
int
snd_seq_drop_output (snd_seq_t * seq)
{
dbg_printf ("snd_seq_drop_output()\n");
return 0;
}
/**
* \brief output an event
* \param seq sequencer handle
* \param ev event to be output
* \return the number of remaining events or a negative error code
*
* An event is once expanded on the output buffer.
* The output buffer will be drained automatically if it becomes full.
*
* If events remain unprocessed on output buffer before drained,
* the size of total byte data on output buffer is returned.
* If the output buffer is empty, this returns zero.
*
* \sa snd_seq_event_output_direct(), snd_seq_event_output_buffer(),
* snd_seq_event_output_pending(), snd_seq_drain_output(),
* snd_seq_drop_output(), snd_seq_extract_output(),
* snd_seq_remove_events()
*/
int
snd_seq_event_output (snd_seq_t * seq, snd_seq_event_t * ev)
{
dbg_printf3 ("snd_seq_event_output(seq=%x, ev=%x)\n", seq, ev);
return convert_event (seq, ev);
}
/**
* \brief delete the specified queue
* \param seq sequencer handle
* \param q queue id to delete
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_alloc_queue()
*/
int
snd_seq_free_queue (snd_seq_t * seq, int q)
{
dbg_printf ("snd_seq_free_queue()\n");
return 0;
}
/**
* \brief obtain the information of the given client
* \param seq sequencer handle
* \param client client id
* \param info the pointer to be stored
* \return 0 on success otherwise a negative error code
*
* Obtains the information of the client with a client id specified by
* info argument.
* The obtained information is written on info parameter.
*
* \sa snd_seq_get_client_info()
*/
int
snd_seq_get_any_client_info (snd_seq_t * seq, int client,
snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_get_any_client_info()\n");
strcpy (info->name, seq->name);
return 0;
}
/**
* \brief obtain the information of a port on an arbitrary client
* \param seq sequencer handle
* \param client client id to get
* \param port port id to get
* \param info pointer information returns
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_get_port_info()
*/
int
snd_seq_get_any_port_info (snd_seq_t * seq, int client, int port,
snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_get_any_port_info()\n");
return 0;
}
/**
* \brief allocate an empty #snd_seq_port_info_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_port_info_malloc (snd_seq_port_info_t ** ptr)
{
snd_seq_port_info_t *p;
dbg_printf ("snd_seq_port_info_malloc()\n");
if ((p = malloc (sizeof (*p))) == NULL)
return -ENOMEM;
*ptr = p;
return 0;
}
/**
* \brief frees a previously allocated #snd_seq_port_info_t
* \param pointer to object to free
*/
void
snd_seq_port_info_free (snd_seq_port_info_t * obj)
{
free (obj);
}
/**
* \brief allocate an empty #snd_seq_queue_tempo_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_queue_tempo_malloc (snd_seq_queue_tempo_t ** ptr)
{
assert (ptr);
*ptr = calloc (1, sizeof (snd_seq_queue_tempo_t));
dbg_printf ("snd_seq_queue_tempo_malloc()=%x\n", *ptr);
if (!*ptr)
return -ENOMEM;
return 0;
}
/**
* \brief frees a previously allocated #snd_seq_queue_tempo_t
* \param pointer to object to free
*/
void
snd_seq_queue_tempo_free (snd_seq_queue_tempo_t * obj)
{
dbg_printf ("snd_seq_queue_tempo_free(%x)\n", obj);
free (obj);
}
/**
* \brief Set the ppq of a queue_status container
* \param info queue_status container
* \param ppq ppq value
*
* \sa snd_seq_get_queue_tempo()
*/
void
snd_seq_queue_tempo_set_ppq (snd_seq_queue_tempo_t * info, int ppq)
{
dbg_printf ("snd_seq_queue_tempo_set_ppq(info=%x, %d)\n", info, ppq);
}
/**
* \brief Set the tempo of a queue_status container
* \param info queue_status container
* \param tempo tempo value
*
* \sa snd_seq_get_queue_tempo()
*/
void
snd_seq_queue_tempo_set_tempo (snd_seq_queue_tempo_t * info,
unsigned int tempo)
{
dbg_printf ("snd_seq_queue_tempo_set_tempo(info=%x, %d)\n", info, tempo);
}
/**
* \brief get size of #snd_seq_queue_tempo_t
* \return size in bytes
*/
size_t
snd_seq_queue_tempo_sizeof ()
{
return sizeof (snd_seq_queue_tempo_t);
}
/**
* \brief set the queue timer information
* \param seq sequencer handle
* \param q queue id to change the timer
* \param timer timer information
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_get_queue_timer()
*/
int
snd_seq_set_queue_timer (snd_seq_t * seq, int q,
snd_seq_queue_timer_t * timer)
{
dbg_printf ("snd_seq_get_queue_timer(seq=%x, q=%d, timer=%X)\n", seq, q,
timer);
return -ENXIO; // TODO
}
/**
* \brief Opens a new connection to the timer query interface.
* \param timer Returned handle (NULL if not wanted)
* \param name ASCII identifier of the RawMidi handle
* \param mode Open mode
* \return 0 on success otherwise a negative error code
*
* Opens a new connection to the RawMidi interface specified with
* an ASCII identifier and mode.
*/
int
snd_timer_query_open (snd_timer_query_t ** timer, const char *name, int mode)
{
dbg_printf ("snd_timer_query_open(name=%s, mode=%x)\n", name, mode);
return -ENXIO; // TODO
}
/**
* \brief obtain the current tempo of the queue
* \param seq sequencer handle
* \param q queue id to be queried
* \param tempo pointer to store the current tempo
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_set_queue_tempo()
*/
int
snd_seq_get_queue_tempo (snd_seq_t * seq, int q,
snd_seq_queue_tempo_t * tempo)
{
dbg_printf ("snd_seq_get_queue_tempo(seq=%x, q=%d, tempo=%x)\n", seq, q,
tempo);
return 0;
}
/**
* \brief allocate an empty #snd_seq_client_info_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_client_info_malloc (snd_seq_client_info_t ** ptr)
{
dbg_printf ("snd_seq_client_info_malloc()\n");
*ptr = malloc (sizeof (snd_seq_client_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
/**
* \brief frees a previously allocated #snd_seq_client_info_t
* \param pointer to object to free
*/
void
snd_seq_client_info_free (snd_seq_client_info_t * obj)
{
dbg_printf ("snd_seq_client_info_free()\n");
free (obj);
}
/**
* \brief Get the name of a client_info container
* \param info client_info container
* \return name string
*
* \sa snd_seq_get_client_info(), snd_seq_client_info_set_name()
*/
const char *
snd_seq_client_info_get_name (snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_client_info_get_name()\n");
return "OSS seq client";
}
/**
* \brief Get the number of opened ports of a client_info container
* \param info client_info container
* \return number of opened ports
*
* \sa snd_seq_get_client_info()
*/
int
snd_seq_client_info_get_num_ports (const snd_seq_client_info_t * info)
{
dbg_printf ("snd_seq_client_info_get_num_ports()\n");
return 1;
}
/**
* \brief Get size of #snd_seq_system_info_t
* \return size in bytes
*/
size_t
snd_seq_system_info_sizeof ()
{
return sizeof (snd_seq_system_info_t);
}
/**
* \brief Allocate an empty #snd_seq_system_info_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_system_info_malloc (snd_seq_system_info_t ** ptr)
{
dbg_printf ("snd_seq_system_info_malloc()\n");
*ptr = malloc (sizeof (snd_seq_system_info_t));
if (*ptr == NULL)
return -ENOMEM;
return 0;
}
/**
* \brief Frees a previously allocated #snd_seq_system_info_t
* \param pointer to object to free
*/
void
snd_seq_system_info_free (snd_seq_system_info_t * obj)
{
free (obj);
}
/**
* \brief obtain the sequencer system information
* \param seq sequencer handle
* \param info the pointer to be stored
* \return 0 on success otherwise a negative error code
*
* Stores the global system information of ALSA sequencer system.
* The returned data contains
* the maximum available numbers of queues, clients, ports and channels.
*/
int
snd_seq_system_info (snd_seq_t * seq, snd_seq_system_info_t * info)
{
dbg_printf ("snd_seq_system_info()\n");
return 0;
}
/**
* \brief Get maximum number of clients
* \param info #snd_seq_system_info_t container
* \return maximum number of clients
*
* \sa snd_seq_system_info()
*/
int
snd_seq_system_info_get_clients (const snd_seq_system_info_t * info)
{
dbg_printf ("snd_seq_system_info_get_clients()\n");
return 4;
}
/**
* \brief Get maximum number of queues
* \param info #snd_seq_system_info_t container
* \return maximum number of queues
*
* \sa snd_seq_system_info()
*/
int
snd_seq_system_info_get_queues (const snd_seq_system_info_t * info)
{
dbg_printf ("snd_seq_system_info_get_queues(info=%x)\n", info);
return 1; // TODO
}
/**
* \brief Get maximum number of ports
* \param info #snd_seq_system_info_t container
* \return maximum number of ports
*
* \sa snd_seq_system_info()
*/
int
snd_seq_system_info_get_ports (const snd_seq_system_info_t * info)
{
dbg_printf ("snd_seq_system_info_get_ports()\n");
return 4;
}
/**
* \brief allocate a queue with the specified name
* \param seq sequencer handle
* \param name the name of the new queue
* \return the queue id (zero or positive) on success otherwise a negative error code
*
* \sa snd_seq_alloc_queue()
*/
int
snd_seq_alloc_named_queue (snd_seq_t * seq, const char *name)
{
dbg_printf ("snd_seq_alloc_named_queue(seq=%x, name=%s)\n", seq, name);
return 0;
}
/**
* \brief Get client id of a port_info container
* \param info port_info container
* \return client id
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_client()
*/
int
snd_seq_port_info_get_client (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_client()\n");
return 0;
}
/**
* \brief Get the port-specified mode of a port_info container
* \param info port_info container
* \return 1 if port id is specified at creation
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_set_port_specified()
*/
int
snd_seq_port_info_get_port_specified (const snd_seq_port_info_t * info)
{
dbg_printf ("snd_seq_port_info_get_port_specified()\n");
return 0;
}
/**
* \brief Get the type bits of a port_info container
* \param info port_info container
* \return port type bits
*
* \sa snd_seq_get_port_info(), snd_seq_port_info_get_type()
*/
void
snd_seq_port_info_set_type (snd_seq_port_info_t * info, unsigned int type)
{
dbg_printf ("snd_seq_port_info_set_type(%u)\n", type);
}
/**
* \brief Get the ppq of a queue_status container
* \param info queue_status container
* \return ppq value
*
* \sa snd_seq_get_queue_tempo()
*/
int
snd_seq_queue_tempo_get_ppq (const snd_seq_queue_tempo_t * info)
{
dbg_printf ("snd_seq_queue_tempo_get_ppq()\n");
return 0;
}
/**
* \brief Get the tempo of a queue_status container
* \param info queue_status container
* \return tempo value
*
* \sa snd_seq_get_queue_tempo()
*/
unsigned int
snd_seq_queue_tempo_get_tempo (const snd_seq_queue_tempo_t * info)
{
dbg_printf ("snd_seq_queue_tempo_get_tempo()\n");
return 0;
}
/**
* \brief set the tempo of the queue
* \param seq sequencer handle
* \param q queue id to change the tempo
* \param tempo tempo information
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_get_queue_tempo()
*/
int
snd_seq_set_queue_tempo (snd_seq_t * seq, int q,
snd_seq_queue_tempo_t * tempo)
{
dbg_printf ("snd_seq_set_queue_tempo(seq=%x, q=%d, tempo=%x)\n", seq, q,
tempo);
return 0;
}
/**
* \brief allocate a queue
* \param seq sequencer handle
* \return the queue id (zero or positive) on success otherwise a negative error code
*
* \sa snd_seq_alloc_named_queue(), snd_seq_create_queue(), snd_seq_free_queue(),
* snd_seq_get_queue_info()
*/
int
snd_seq_alloc_queue (snd_seq_t * seq)
{
static int queue_num = 0;
dbg_printf ("snd_seq_alloc_queue(seq=%x)=%d\n", seq, queue_num);
return queue_num++;
}
#define FIXED_EV(x) (_SND_SEQ_TYPE(SND_SEQ_EVFLG_FIXED) | _SND_SEQ_TYPE(x))
/** Event types conversion array */
const unsigned int snd_seq_event_types[256] = {
[SND_SEQ_EVENT_SYSTEM...SND_SEQ_EVENT_RESULT]
= FIXED_EV (SND_SEQ_EVFLG_RESULT),
[SND_SEQ_EVENT_NOTE]
=
FIXED_EV (SND_SEQ_EVFLG_NOTE) |
_SND_SEQ_TYPE_OPT (SND_SEQ_EVFLG_NOTE_TWOARG),
[SND_SEQ_EVENT_NOTEON...SND_SEQ_EVENT_KEYPRESS] =
FIXED_EV (SND_SEQ_EVFLG_NOTE),
[SND_SEQ_EVENT_CONTROLLER...SND_SEQ_EVENT_REGPARAM] =
FIXED_EV (SND_SEQ_EVFLG_CONTROL),
[SND_SEQ_EVENT_START...SND_SEQ_EVENT_STOP] = FIXED_EV (SND_SEQ_EVFLG_QUEUE),
[SND_SEQ_EVENT_SETPOS_TICK]
=
FIXED_EV (SND_SEQ_EVFLG_QUEUE) |
_SND_SEQ_TYPE_OPT (SND_SEQ_EVFLG_QUEUE_TICK),
[SND_SEQ_EVENT_SETPOS_TIME] =
FIXED_EV (SND_SEQ_EVFLG_QUEUE) |
_SND_SEQ_TYPE_OPT (SND_SEQ_EVFLG_QUEUE_TIME),
[SND_SEQ_EVENT_TEMPO...SND_SEQ_EVENT_SYNC_POS] =
FIXED_EV (SND_SEQ_EVFLG_QUEUE) |
_SND_SEQ_TYPE_OPT (SND_SEQ_EVFLG_QUEUE_VALUE),
[SND_SEQ_EVENT_TUNE_REQUEST...SND_SEQ_EVENT_SENSING] =
FIXED_EV (SND_SEQ_EVFLG_NONE),
[SND_SEQ_EVENT_ECHO...SND_SEQ_EVENT_OSS] =
FIXED_EV (SND_SEQ_EVFLG_RAW) | FIXED_EV (SND_SEQ_EVFLG_SYSTEM),
[SND_SEQ_EVENT_CLIENT_START...SND_SEQ_EVENT_PORT_CHANGE] =
FIXED_EV (SND_SEQ_EVFLG_MESSAGE),
[SND_SEQ_EVENT_PORT_SUBSCRIBED...SND_SEQ_EVENT_PORT_UNSUBSCRIBED] =
FIXED_EV (SND_SEQ_EVFLG_CONNECTION),
[SND_SEQ_EVENT_USR0...SND_SEQ_EVENT_USR9] =
FIXED_EV (SND_SEQ_EVFLG_RAW) | FIXED_EV (SND_SEQ_EVFLG_USERS),
[SND_SEQ_EVENT_SYSEX...SND_SEQ_EVENT_BOUNCE] =
_SND_SEQ_TYPE (SND_SEQ_EVFLG_VARIABLE),
[SND_SEQ_EVENT_USR_VAR0...SND_SEQ_EVENT_USR_VAR4] =
_SND_SEQ_TYPE (SND_SEQ_EVFLG_VARIABLE) |
_SND_SEQ_TYPE (SND_SEQ_EVFLG_USERS),
[SND_SEQ_EVENT_NONE] = FIXED_EV (SND_SEQ_EVFLG_NONE),
};
/**
* \brief obtain the running state of the queue
* \param seq sequencer handle
* \param q queue id to query
* \param status pointer to store the current status
* \return 0 on success otherwise a negative error code
*
* Obtains the running state of the specified queue q.
*/
int
snd_seq_get_queue_status (snd_seq_t * seq, int q,
snd_seq_queue_status_t * status)
{
dbg_printf ("snd_seq_get_queue_status(seq=%x. q=%d)\n", seq, q);
return 0;
}
/**
* \brief allocate an empty #snd_seq_queue_status_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_queue_status_malloc (snd_seq_queue_status_t ** ptr)
{
dbg_printf ("snd_seq_queue_status_malloc()\n");
*ptr = calloc (1, sizeof (snd_seq_queue_status_t));
dbg_printf ("snd_seq_queue_status_malloc()=%x\n", *ptr);
if (!*ptr)
return -ENOMEM;
return 0;
}
/**
* \brief frees a previously allocated #snd_seq_queue_status_t
* \param pointer to object to free
*/
void
snd_seq_queue_status_free (snd_seq_queue_status_t * obj)
{
dbg_printf ("snd_seq_queue_status_free(%x)\n", obj);
free (obj);
}
/**
* \brief Get the tick time of a queue_status container
* \param info queue_status container
* \return tick time
*
* \sa snd_seq_get_queue_status()
*/
snd_seq_tick_time_t
snd_seq_queue_status_get_tick_time (const snd_seq_queue_status_t * info)
{
dbg_printf ("snd_seq_queue_status_get_tick_time(info=%x)\n", info);
return 0;
}
/**
* \brief get size of #snd_seq_remove_events_t
* \return size in bytes
*/
size_t
snd_seq_remove_events_sizeof ()
{
return sizeof (snd_seq_remove_events_t);
}
/**
* \brief allocate an empty #snd_seq_remove_events_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_remove_events_malloc (snd_seq_remove_events_t ** ptr)
{
assert (ptr);
*ptr = calloc (1, sizeof (snd_seq_remove_events_t));
dbg_printf ("snd_seq_remove_events_malloc()=%x\n", *ptr);
if (!*ptr)
return -ENOMEM;
return 0;
}
/**
* \brief frees a previously allocated #snd_seq_remove_events_t
* \param pointer to object to free
*/
void
snd_seq_remove_events_free (snd_seq_remove_events_t * obj)
{
free (obj);
}
/**
* \brief Set the removal condition bits
* \param info remove_events container
* \param flags removal condition bits
*
* \sa snd_seq_remove_events()
*/
void
snd_seq_remove_events_set_condition (snd_seq_remove_events_t * info,
unsigned int flags)
{
dbg_printf ("snd_seq_remove_events_set_condition(rmp=%x, flags=%lu)\n",
info, flags);
}
/**
* \brief Set the queue as removal condition
* \param info remove_events container
* \param queue queue id
*
* \sa snd_seq_remove_events()
*/
void
snd_seq_remove_events_set_queue (snd_seq_remove_events_t * info, int queue)
{
dbg_printf ("snd_seq_remove_events_set_queue(rmp=%x, q=%d)\n", info, queue);
}
/**
* \brief remove events on input/output buffers and pools
* \param seq sequencer handle
* \param rmp remove event container
*
* Removes matching events with the given condition from input/output buffers
* and pools.
* The removal condition is specified in \a rmp argument.
*
* \sa snd_seq_event_output(), snd_seq_drop_output(), snd_seq_reset_pool_output()
*/
int
snd_seq_remove_events (snd_seq_t * seq, snd_seq_remove_events_t * rmp)
{
dbg_printf ("snd_seq_remove_events(seq=%x, rmp=%x)\n", seq, rmp);
return 1;
}
/**
* \brief clear input buffer and and remove events in sequencer queue
* \param seq sequencer handle
*
* \sa snd_seq_drop_input_buffer(), snd_seq_remove_events()
*/
int
snd_seq_drop_input (snd_seq_t * seq)
{
dbg_printf ("snd_seq_drop_input(seq=%x)\n", seq);
return 0;
}
/**
* \brief remove all events on user-space output buffer
* \param seq sequencer handle
*
* Removes all events on user-space output buffer.
* Unlike snd_seq_drain_output(), this function doesn't remove
* events on output memory pool of sequencer.
*
* \sa snd_seq_drop_output()
*/
int
snd_seq_drop_output_buffer (snd_seq_t * seq)
{
dbg_printf ("snd_seq_drop_output_buffer(seq=%x)\n", seq);
return 0;
}
/**
* \brief extract the first event in output buffer
* \param seq sequencer handle
* \param ev_res event pointer to be extracted
* \return 0 on success otherwise a negative error code
*
* Extracts the first event in output buffer.
* If ev_res is NULL, just remove the event.
*
* \sa snd_seq_event_output()
*/
int
snd_seq_extract_output (snd_seq_t * seq, snd_seq_event_t ** ev_res)
{
dbg_printf ("snd_seq_extract_output(seq=%x)\n", seq);
return -EIO;
}
/**
* \brief get size of #snd_seq_queue_status_t
* \return size in bytes
*/
size_t
snd_seq_queue_status_sizeof ()
{
return sizeof (snd_seq_queue_status_t);
}
/**
* \brief Return the size of output buffer
* \param seq sequencer handle
* \return the size of output buffer in bytes
*
* Obtains the size of output buffer.
* This buffer is used to store decoded byte-stream of output events
* before transferring to sequencer.
*
* \sa snd_seq_set_output_buffer_size()
*/
size_t
snd_seq_get_output_buffer_size (snd_seq_t * seq)
{
dbg_printf ("snd_seq_get_output_buffer_size(seq=%x)\n", seq);
return 1024;
}
/**
* \brief Change the size of output buffer
* \param seq sequencer handle
* \param size the size of output buffer to be changed in bytes
* \return 0 on success otherwise a negative error code
*
* Changes the size of output buffer.
*
* \sa snd_seq_get_output_buffer_size()
*/
int
snd_seq_set_output_buffer_size (snd_seq_t * seq, size_t size)
{
dbg_printf ("snd_seq_set_output_buffer_size(seq=%x, size=%d)\n", seq, size);
return 0;
}
/**
* \brief unsubscribe a connection between ports
* \param seq sequencer handle
* \param sub subscription information to disconnect
* \return 0 on success otherwise a negative error code
*
* Unsubscribes a connection between two ports,
* described in sender and dest fields in sub argument.
*
* \sa snd_seq_subscribe_port(), snd_seq_disconnect_from(), snd_seq_disconnect_to()
*/
int
snd_seq_unsubscribe_port (snd_seq_t * seq, snd_seq_port_subscribe_t * sub)
{
dbg_printf ("snd_seq_unsubscribe_port(seq=%x, sub=%x)\n", seq, sub);
return 0;
}
/**
* \brief Get the queue id of a queue_timer container
* \param info queue_timer container
* \return queue id
*
* \sa snd_seq_get_queue_timer()
*/
int
snd_seq_queue_timer_get_queue (const snd_seq_queue_timer_t * info)
{
dbg_printf ("snd_seq_queue_timer_get_queue(timer=%x)\n", info);
return 0;
}
/**
* \brief obtain the queue timer information
* \param seq sequencer handle
* \param q queue id to query
* \param timer pointer to store the timer information
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_set_queue_timer()
*/
int
snd_seq_get_queue_timer (snd_seq_t * seq, int q,
snd_seq_queue_timer_t * timer)
{
dbg_printf ("snd_seq_get_queue_timer(seq=%x, q=%d, timer=%x)\n",
seq, 1, timer);
return 0;
}
/**
* \brief Set the timer id of a queue_timer container
* \param info queue_timer container
* \param id timer id pointer
*
* \sa snd_seq_get_queue_timer()
*/
void
snd_seq_queue_timer_set_id (snd_seq_queue_timer_t * info,
const snd_timer_id_t * id)
{
dbg_printf ("snd_seq_queue_timer_set_id(timer=%x, id=%x)\n", info, id);
}
/**
* \brief get size of #snd_seq_queue_timer_t
* \return size in bytes
*/
size_t
snd_seq_queue_timer_sizeof ()
{
return sizeof (snd_seq_queue_timer_t);
}
/**
* \brief get size of #snd_seq_query_subscribe_t
* \return size in bytes
*/
size_t
snd_seq_query_subscribe_sizeof ()
{
return sizeof (snd_seq_query_subscribe_t);
}
/**
* \brief allocate an empty #snd_seq_query_subscribe_t using standard malloc
* \param ptr returned pointer
* \return 0 on success otherwise negative error code
*/
int
snd_seq_query_subscribe_malloc (snd_seq_query_subscribe_t ** ptr)
{
*ptr = calloc (1, sizeof (snd_seq_query_subscribe_t));
dbg_printf ("snd_seq_query_subscribe_malloc()=%x\n", *ptr);
if (!*ptr)
return -ENOMEM;
return 0;
}
/**
* \brief frees a previously allocated #snd_seq_query_subscribe_t
* \param pointer to object to free
*/
void
snd_seq_query_subscribe_free (snd_seq_query_subscribe_t * obj)
{
dbg_printf ("snd_seq_query_subscribe_free(obj=%x)\n", obj);
free (obj);
}
/**
* \brief Get the address of subscriber of a query_subscribe container
* \param info query_subscribe container
* \return subscriber's address pointer
*
* \sa snd_seq_query_port_subscribers()
*/
const snd_seq_addr_t *
snd_seq_query_subscribe_get_addr (const snd_seq_query_subscribe_t * info)
{
dbg_printf ("snd_seq_query_subscribe_get_addr(info=%x)\n", info);
return NULL; // TODO
}
/**
* \brief Get the index of subscriber of a query_subscribe container
* \param info query_subscribe container
* \return subscriber's index
*
* \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_index()
*/
int
snd_seq_query_subscribe_get_index (const snd_seq_query_subscribe_t * info)
{
dbg_printf ("snd_seq_query_subscribe_get_index(info=%x)\n", info);
return 0; // TODO
}
/**
* \brief Set the subscriber's index to be queried
* \param info query_subscribe container
* \param index index to be queried
*
* \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_index()
*/
void
snd_seq_query_subscribe_set_index (snd_seq_query_subscribe_t * info,
int index)
{
dbg_printf ("snd_seq_query_subscribe_t(info=%x, index=%d)\n", info, index);
// TODO
}
/**
* \brief Get the client/port address of a query_subscribe container
* \param info query_subscribe container
* \return client/port address pointer
*
* \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_root()
*/
const snd_seq_addr_t *
snd_seq_query_subscribe_get_root (const snd_seq_query_subscribe_t * info)
{
dbg_printf ("snd_seq_query_subscribe_get_root(info=%x)\n", info);
return NULL; // TODO
}
/**
* \brief Set the client/port address of a query_subscribe container
* \param info query_subscribe container
* \param addr client/port address pointer
*
* \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_root()
*/
void
snd_seq_query_subscribe_set_root (snd_seq_query_subscribe_t * info,
const snd_seq_addr_t * addr)
{
dbg_printf ("snd_seq_query_subscribe_set_root(info=%d, addr=%x)\n",
info, addr);
}
/**
* \brief Get the query type of a query_subscribe container
* \param info query_subscribe container
* \return query type
*
* \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_type()
*/
snd_seq_query_subs_type_t
snd_seq_query_subscribe_get_type (const snd_seq_query_subscribe_t * info)
{
dbg_printf ("snd_seq_query_subscribe_get_type(info=%x)\n", info);
return 0; // TODO
}
/**
* \brief Set the query type of a query_subscribe container
* \param info query_subscribe container
* \param type query type
*
* \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_type()
*/
void
snd_seq_query_subscribe_set_type (snd_seq_query_subscribe_t * info,
snd_seq_query_subs_type_t type)
{
dbg_printf ("snd_seq_query_subscribe_set_type(info=%x, type=%x)\n",
info, type);
// TODO
}
/**
* \brief obtain subscription information
* \param seq sequencer handle
* \param sub pointer to return the subscription information
* \return 0 on success otherwise a negative error code
*
* \sa snd_seq_subscribe_port(), snd_seq_query_port_subscribers()
*/
int
snd_seq_get_port_subscription (snd_seq_t * seq,
snd_seq_port_subscribe_t * sub)
{
dbg_printf ("snd_seq_get_port_subscription(seq=%x, sub=%x)\n", seq, sub);
return 0; // TODO
}
/**
* \brief query port subscriber list
* \param seq sequencer handle
* \param subs subscription to query
* \return 0 on success otherwise a negative error code
*
* Queries the subscribers accessing to a port.
* The query information is specified in subs argument.
*
* At least, the client id, the port id, the index number and
* the query type must be set to perform a proper query.
* As the query type, #SND_SEQ_QUERY_SUBS_READ or #SND_SEQ_QUERY_SUBS_WRITE
* can be specified to check whether the readers or the writers to the port.
* To query the first subscription, set 0 to the index number. To list up
* all the subscriptions, call this function with the index numbers from 0
* until this returns a negative value.
*
* \sa snd_seq_get_port_subscription()
*/
int
snd_seq_query_port_subscribers (snd_seq_t * seq, snd_seq_query_subscribe_t *
subs)
{
dbg_printf ("snd_seq_query_port_subscribers(seq=%x, subs=%x)\n", seq, subs);
return 0; // TODO
}
/**
* \brief Get the real time of a queue_status container
* \param info queue_status container
* \param time real time
*
* \sa snd_seq_get_queue_status()
*/
const snd_seq_real_time_t *
snd_seq_queue_status_get_real_time (const snd_seq_queue_status_t * info)
{
dbg_printf ("snd_seq_queue_status_get_real_time(info=%x)\n", info);
return NULL; // TODO
}
|