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
|
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//
// Module Name:mmsystem.h -- Include file for Multimedia API's
//
// * If defined, the following flags inhibit inclusion
// * of the indicated items:
// *
// * MMNOSOUND Sound support
// * MMNOWAVE Waveform support
// * MMNOMCI MCI API
// * MMNOMMIO file I/O
// *
// *
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit mmsystem;
{$CALLING cdecl}
interface
uses Windows, mmreg;
{$PACKRECORDS 1} // #include "pshpack1.h" // Assume byte packing throughout
{$DEFINE MMNOMIDI} // No midi audio support.
{$IFDEF WIN32}
{$DEFINE _WIN32}
{$ENDIF WIN32}
{****************************************************************************
General constants and data types
****************************************************************************}
//* general constants */
const
MAXPNAMELEN = 32; // max product name length (including NULL)
MAXERRORLENGTH = 128; // max error text length (including final NULL)
{*
* Microsoft Manufacturer and Product ID's
*
Used with wMid and wPid fields in WAVEOUTCAPS, WAVEINCAPS,
MIDIOUTCAPS, MIDIINCAPS, AUXCAPS, JOYCAPS structures.
*}
{*
* (these have been moved to
* MMREG.H for Windows 4.00 and above).
*}
//* manufacturer IDs *
const
MM_MICROSOFT = 1; // Microsoft Corporation
//* general data types */
type
MMVERSION = UINT; // major (high byte), minor (low byte)
MMRESULT = UINT; // error return code, 0 means no error
// call as if(err=xxxx(...)) Error(err); else
LPUINT = ^UINT;
//* MMTIME data structure */
type
mmtime_tag = record
wType:UINT; //* indicates the contents of the union */
case UINT of
0: (ms:DWORD); //* milliseconds */
1: (sample:DWORD); //* samples */
2: (cb:DWORD); //* byte count */
3: (ticks:DWORD); //* ticks in MIDI stream */
4: (smpte:record
hour:byte; //* hours */
min:byte; //* minutes */
sec:byte; //* seconds */
frame:byte; //* frames */
fps:byte; //* frames per second */
dummy:byte; //* pad */
{$IFDEF _WIN32}
pad:array[0..1] of byte;
{$ENDIF _WIN32}
end);
5: (midi:record
songptrpos:DWORD; //* song pointer position */
end);
end;
MMTIME = mmtime_tag;
PMMTIME = ^mmtime_tag;
NPMMTIME = ^mmtime_tag;
LPMMTIME = ^mmtime_tag;
//* types for wType field in MMTIME struct */
const
TIME_MS = $0001; //* time in milliseconds */
TIME_SAMPLES = $0002; //* number of wave samples */
TIME_BYTES = $0004; //* current byte offset */
TIME_SMPTE = $0008; //* SMPTE time */
TIME_MIDI = $0010; //* MIDI time */
TIME_TICKS = $0020; //* Ticks within MIDI stream */
{ Was declared as
MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3)
}
function MAKEFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC;
function mmioFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC;
{****************************************************************************
Multimedia Extensions Window Messages
****************************************************************************}
const
MM_MCINOTIFY = $3B9; //* MCI */
MM_WOM_OPEN = $3BB; //* waveform output */
MM_WOM_CLOSE = $3BC;
MM_WOM_DONE = $3BD;
MM_WOM_ATTENUATED = $3D8; //* gain class support - stream attenuated */
MM_WIM_OPEN = $3BE; //* waveform input */
MM_WIM_CLOSE = $3BF;
MM_WIM_DATA = $3C0;
MM_MIM_OPEN = $3C1; //* MIDI input */
MM_MIM_CLOSE = $3C2;
MM_MIM_DATA = $3C3;
MM_MIM_LONGDATA = $3C4;
MM_MIM_ERROR = $3C5;
MM_MIM_LONGERROR = $3C6;
MM_MOM_OPEN = $3C7; //* MIDI output */
MM_MOM_CLOSE = $3C8;
MM_MOM_DONE = $3C9;
//* these are also in msvideo.h */
MM_DRVM_OPEN = $3D0; //* installable drivers */
MM_DRVM_CLOSE = $3D1;
MM_DRVM_DATA = $3D2;
MM_DRVM_ERROR = $3D3;
MM_MCISYSTEM_STRING = $3CA; //* internal */
//* these are used by msacm.h */
MM_STREAM_OPEN = $3D4;
MM_STREAM_CLOSE = $3D5;
MM_STREAM_DONE = $3D6;
MM_STREAM_ERROR = $3D7;
MM_MOM_POSITIONCB = $3CA; //* Callback for MEVT_POSITIONCB */
MM_MCISIGNAL = $3CB;
MM_MIM_MOREDATA = $3CC; //* MIM_DONE w/ pending events */
MM_MIXM_LINE_CHANGE = $3D0; //* mixer line change notify */
MM_MIXM_CONTROL_CHANGE = $3D1; //* mixer control change notify */
{****************************************************************************
String resource number bases (internal use)
****************************************************************************}
const
MMSYSERR_BASE = 0;
WAVERR_BASE = 32;
MIDIERR_BASE = 64;
TIMERR_BASE = 96;
MCIERR_BASE = 256;
MIXERR_BASE = 1024;
MCI_STRING_OFFSET = 512;
MCI_VD_OFFSET = 1024;
MCI_CD_OFFSET = 1088;
MCI_WAVE_OFFSET = 1152;
MCI_SEQ_OFFSET = 1216;
{****************************************************************************
General error return values
****************************************************************************}
const
//* general error return values */
MMSYSERR_NOERROR = 0; //* no error */
MMSYSERR_ERROR = MMSYSERR_BASE + 1; //* unspecified error */
MMSYSERR_BADDEVICEID = MMSYSERR_BASE + 2; //* device ID out of range */
MMSYSERR_NOTENABLED = MMSYSERR_BASE + 3; //* driver failed enable */
MMSYSERR_ALLOCATED = MMSYSERR_BASE + 4; //* device already allocated */
MMSYSERR_INVALHANDLE = MMSYSERR_BASE + 5; //* device handle is invalid */
MMSYSERR_NODRIVER = MMSYSERR_BASE + 6; //* no device driver present */
MMSYSERR_NOMEM = MMSYSERR_BASE + 7; //* memory allocation error */
MMSYSERR_NOTSUPPORTED = MMSYSERR_BASE + 8; //* function isn't supported */
MMSYSERR_BADERRNUM = MMSYSERR_BASE + 9; //* error value out of range */
MMSYSERR_INVALFLAG = MMSYSERR_BASE + 10; //* invalid flag passed */
MMSYSERR_INVALPARAM = MMSYSERR_BASE + 11; //* invalid parameter passed */
MMSYSERR_HANDLEBUSY = MMSYSERR_BASE + 12; //* handle being used */
//* simultaneously on another */
//* thread (eg callback) */
MMSYSERR_INVALIDALIAS = MMSYSERR_BASE + 13; //* specified alias not found */
MMSYSERR_BADDB = MMSYSERR_BASE + 14; //* bad registry database */
MMSYSERR_KEYNOTFOUND = MMSYSERR_BASE + 15; //* registry key not found */
MMSYSERR_READERROR = MMSYSERR_BASE + 16; //* registry read error */
MMSYSERR_WRITEERROR = MMSYSERR_BASE + 17; //* registry write error */
MMSYSERR_DELETEERROR = MMSYSERR_BASE + 18; //* registry delete error */
MMSYSERR_VALNOTFOUND = MMSYSERR_BASE + 19; //* registry value not found */
MMSYSERR_NODRIVERCB = MMSYSERR_BASE + 20; //* driver does not call DriverCallback */
MMSYSERR_LASTERROR = MMSYSERR_BASE + 20; //* last error in range */
type
HDRVR = HANDLE;
{$IFNDEF MMNODRV}
//
// Installable driver support was left out.
//
{$ENDIF MMNODRV}
{****************************************************************************
Driver callback support
****************************************************************************}
//* flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and */
//* midiOutOpen() to specify the type of the dwCallback parameter. */
const
CALLBACK_TYPEMASK = $00070000; //* callback type mask */
CALLBACK_NULL = $00000000; //* no callback */
CALLBACK_WINDOW = $00010000; //* dwCallback is a HWND */
CALLBACK_TASK = $00020000; //* dwCallback is a HTASK */
CALLBACK_FUNCTION = $00030000; //* dwCallback is a FARPROC */
CALLBACK_THREAD = CALLBACK_TASK;//* thread ID replaces 16 bit task */
CALLBACK_EVENT = $00050000; //* dwCallback is an EVENT Handle */
CALLBACK_MSGQUEUE = $00060000; //* dwCallback is HANDLE returned by CreateMsgQueue or OpenMsgQueue (new in Windows CE 5.0) */
type
DRVCALLBACK = procedure(_hdrvr:HANDLE; uMsg:UINT; dwUser:DWORD; dw1:DWORD; dw2:DWORD); cdecl;
LPDRVCALLBACK = DRVCALLBACK;
PDRVCALLBACK = DRVCALLBACK;
{* CALLBACK_MSGQUEUE - client process sets up a MsgQueuue that receives WAVEMSG structures.
* Note that structure fields are identical to arguments to a callback function
* but we put the message field first to allow for multi-functional message queues.
*}
type
_tag_WAVEMSG = record
uMsg:UINT; // WOM_OPEN, WIM_OPEN, WOM_DONE, WIM_DATA, etc.
hWav:HANDLE; // stream handle returned by waveInOpen or waveOutOpen
dwInstance:DWORD; // value of dwInstance argument passed into waveInOpen or waveOutOpen
dwParam1:DWORD; // completed WAVEHDR for WIM_DATA, WOM_DONE, reserved elsewhere
dwParam2:DWORD; // reserved
end;
WAVEMSG = _tag_WAVEMSG;
PWAVEMSG = ^_tag_WAVEMSG;
{$IFNDEF MMNOSOUND}
function sndPlaySoundW(lpszSoundName:LPCWSTR; fuSound:UINT):BOOL; external KernelDLL name 'sndPlaySoundW'; // index 266
{$IFDEF UNICODE}
function sndPlaySound(lpszSoundName:LPCWSTR; fuSound:UINT):BOOL; external KernelDLL name 'sndPlaySoundW'; // index 266
{$ELSE} // UNICODE
//#define sndPlaySound sndPlaySoundA
{$ENDIF} // UNICODE
function PlaySoundW(pszSound:LPCWSTR; hmod:HMODULE; fdwSound:DWORD):BOOL; external KernelDLL name 'PlaySoundW'; // index 267
{$IFDEF UNICODE}
function PlaySound(pszSound:LPCWSTR; hmod:HMODULE; fdwSound:DWORD):BOOL; external KernelDLL name 'PlaySoundW'; // index 267
{$ELSE} // UNICODE
//#define PlaySound PlaySoundA
{$ENDIF} // UNICODE
{*
* flag values for fuSound arguments on [snd]PlaySound
* or dwFlags for PlaySound
*}
//* sndAlias creates the alias identifier */
const
SND_ALIAS_START = 0; // ??? must be > 4096 to keep strings in same section of resource file
function sndAlias(ch0:AnsiChar; ch1:AnsiChar):DWORD;
const
SND_ALIAS_SYSTEMASTERISK = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('*')));
SND_ALIAS_SYSTEMQUESTION = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('?')));
SND_ALIAS_SYSTEMHAND = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('H')));
SND_ALIAS_SYSTEMEXIT = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('E')));
SND_ALIAS_SYSTEMSTART = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('S')));
SND_ALIAS_SYSTEMWELCOME = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('W')));
SND_ALIAS_SYSTEMEXCLAMATION = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('!')));
SND_ALIAS_SYSTEMDEFAULT = SND_ALIAS_START+
(DWORD(AnsiChar('S')) or
DWORD(AnsiChar('D')));
SND_ALIAS = $00010000; // name is a WIN.INI [sounds] entry
SND_FILENAME = $00020000; // name is a file name
SND_RESOURCE = $00040004; // name is a resource name or atom
SND_SYNC = $00000000; // play synchronously (default)
SND_ASYNC = $00000001; // play asynchronously
SND_NODEFAULT = $00000002; // silence not default, if sound not found
SND_MEMORY = $00000004; // lpszSoundName points to a memory file
SND_LOOP = $00000008; // loop the sound until next sndPlaySound
SND_NOSTOP = $00000010; // don't stop any currently playing sound
SND_NOWAIT = $00002000; // don't wait if the driver is busy
SND_VALIDFLAGS = $0017201F; // Set of valid flag bits. Anything outside
// this range will raise an error
SND_RESERVED = $FF000000; // In particular these flags are reserved
SND_TYPE_MASK = $00170007;
SND_ALIAS_ID = $00110000; // name is a WIN.INI [sounds] entry identifier
{$ENDIF} // MMNOSOUND
{$IFNDEF MMNOWAVE}
{****************************************************************************
Waveform audio support
****************************************************************************}
const
//* waveform audio error return values */
WAVERR_BADFORMAT = WAVERR_BASE + 0; // unsupported wave format
WAVERR_STILLPLAYING = WAVERR_BASE + 1; // still something playing
WAVERR_UNPREPARED = WAVERR_BASE + 2; // header not prepared
WAVERR_SYNC = WAVERR_BASE + 3; // device is synchronous
WAVERR_LASTERROR = WAVERR_BASE + 3; // last error in range
//* waveform audio data types */
type
HWAVE = HANDLE;
HWAVEIN = HANDLE;
LPHWAVEIN = ^HWAVEIN;
HWAVEOUT = HANDLE;
LPHWAVEOUT = ^HWAVEOUT;
WAVECALLBACK = DRVCALLBACK;
LPWAVECALLBACK = WAVECALLBACK;
const
//* wave callback messages */
WOM_OPEN = MM_WOM_OPEN;
WOM_CLOSE = MM_WOM_CLOSE;
WOM_DONE = MM_WOM_DONE;
WIM_OPEN = MM_WIM_OPEN;
WIM_CLOSE = MM_WIM_CLOSE;
WIM_DATA = MM_WIM_DATA;
//* device ID for wave device mapper */
const
WAVE_MAPPER = DWORD(-1);
//* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */
const
WAVE_FORMAT_QUERY = $00000001;
WAVE_ALLOWSYNC = $00000002;
WAVE_MAPPED = $00000004;
WAVE_FORMAT_DIRECT = $00000008;
WAVE_FORMAT_DIRECT_QUERY = WAVE_FORMAT_QUERY or WAVE_FORMAT_DIRECT;
WAVE_NOMIXER = $00000080; //* Windows CE only - bypass software mixer */
// Switch to DWORD packing for WAVEHDR
// Warning: This assumes that the start of headers is DWORD aligned, which is a change from previous implementations.
{$PACKRECORDS 4}// #include "pshpack4.h"
//* wave data block header */
type
LPWAVEHDR = ^wavehdr_tag;
wavehdr_tag = record
lpData:LPSTR; //* pointer to locked data buffer */
dwBufferLength:DWORD; //* length of data buffer */
dwBytesRecorded:DWORD; //* used for input only */
dwUser:DWORD; //* for client's use */
dwFlags:DWORD; //* assorted flags (see defines) */
dwLoops:DWORD; //* loop control counter */
lpNext:LPWAVEHDR; //* reserved for driver */
reserved:DWORD; //* reserved for driver */
end;
WAVEHDR = wavehdr_tag;
PWAVEHDR = ^wavehdr_tag;
NPWAVEHDR = ^wavehdr_tag;
// Switch back to previous packing
{$PACKRECORDS 1}// #include "poppack.h"
//* flags for dwFlags field of WAVEHDR */
const
WHDR_DONE = $00000001; //* done bit */
WHDR_PREPARED = $00000002; //* set if this header has been prepared */
WHDR_BEGINLOOP = $00000004; //* loop start block */
WHDR_ENDLOOP = $00000008; //* loop end block */
WHDR_INQUEUE = $00000010; //* reserved for driver */
//* waveform output device capabilities structure */
type
tagWAVEOUTCAPS = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of TCHAR; //* product name (NULL terminated string) */
dwFormats:DWORD; //* formats supported */
wChannels:word; //* number of sources supported */
wReserved1:word; //* packing */
dwSupport:DWORD; //* functionality supported by driver */
end;
WAVEOUTCAPS = tagWAVEOUTCAPS;
PWAVEOUTCAPS = ^tagWAVEOUTCAPS;
NPWAVEOUTCAPS = ^tagWAVEOUTCAPS;
LPWAVEOUTCAPS = ^tagWAVEOUTCAPS;
//* flags for dwSupport field of WAVEOUTCAPS */
const
WAVECAPS_PITCH = $0001; //* supports pitch control */
WAVECAPS_PLAYBACKRATE = $0002; //* supports playback rate control */
WAVECAPS_VOLUME = $0004; //* supports volume control */
WAVECAPS_LRVOLUME = $0008; //* separate left-right volume control */
// WAVECAPS_SYNC = $0010; //* Windows CE only supports asynchronous audio devices */
WAVECAPS_SAMPLEACCURATE = $0020;
WAVECAPS_DIRECTSOUND = $0040;
//* waveform input device capabilities structure */
type
tagWAVEINCAPS = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of TCHAR; //* product name (NULL terminated string) */
dwFormats:DWORD; //* formats supported */
wChannels:word; //* number of channels supported */
wReserved1:word; //* structure packing */
end;
WAVEINCAPS = tagWAVEINCAPS;
PWAVEINCAPS = ^tagWAVEINCAPS;
NPWAVEINCAPS = ^tagWAVEINCAPS;
LPWAVEINCAPS = ^tagWAVEINCAPS;
//* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS */
const
WAVE_INVALIDFORMAT = $00000000; //* invalid format */
WAVE_FORMAT_1M08 = $00000001; //* 11.025 kHz, Mono, 8-bit */
WAVE_FORMAT_1S08 = $00000002; //* 11.025 kHz, Stereo, 8-bit */
WAVE_FORMAT_1M16 = $00000004; //* 11.025 kHz, Mono, 16-bit */
WAVE_FORMAT_1S16 = $00000008; //* 11.025 kHz, Stereo, 16-bit */
WAVE_FORMAT_2M08 = $00000010; //* 22.05 kHz, Mono, 8-bit */
WAVE_FORMAT_2S08 = $00000020; //* 22.05 kHz, Stereo, 8-bit */
WAVE_FORMAT_2M16 = $00000040; //* 22.05 kHz, Mono, 16-bit */
WAVE_FORMAT_2S16 = $00000080; //* 22.05 kHz, Stereo, 16-bit */
WAVE_FORMAT_4M08 = $00000100; //* 44.1 kHz, Mono, 8-bit */
WAVE_FORMAT_4S08 = $00000200; //* 44.1 kHz, Stereo, 8-bit */
WAVE_FORMAT_4M16 = $00000400; //* 44.1 kHz, Mono, 16-bit */
WAVE_FORMAT_4S16 = $00000800; //* 44.1 kHz, Stereo, 16-bit */
//* property information for audio gain classes */
//* audio gain class property sets */
const
MM_PROPSET_GAINCLASS_CLASS:GUID = '{E7E569A5-8498-43FE-8075-33D1FDAB15EF}';
MM_PROPSET_GAINCLASS_STREAM:GUID = '{40E953AE-EE3E-493A-93EE-DA3E30764390}';
(*
#define MM_PROPSET_GAINCLASS_CLASS \
{ 0xe7e569a5, 0x8498, 0x43fe, { 0x80, 0x75, 0x33, 0xd1, 0xfd, 0xab, 0x15, 0xef } }
#define MM_PROPSET_GAINCLASS_STREAM \
{ 0x40e953ae, 0xee3e, 0x493a, { 0x93, 0xee, 0xda, 0x3e, 0x30, 0x76, 0x43, 0x90 } }
*)
const
//* MM_PROPSET_GAINCLASS_CLASS property IDs */
MM_PROP_GAINCLASS_CLASS = 1;
//* MM_PROPSET_GAINCLASS_STREAM property IDs */
MM_PROP_GAINCLASS_STREAM = 1;
//* structure to describe audio gain classes */
type
tagAUDIOGAINCLASS = record
dwPriority:DWORD;
dwRelativeGain:DWORD;
end;
AUDIOGAINCLASS = tagAUDIOGAINCLASS;
PAUDIOGAINCLASS = ^tagAUDIOGAINCLASS;
CPAUDIOGAINCLASS = ^AUDIOGAINCLASS;
//* values for AUDIOGAINCLASS.dwPriority */
const
WAGC_PRIORITY_CRITICAL = 6;
WAGC_PRIORITY_HIGH = 4;
WAGC_PRIORITY_NORMAL = 2;
//* wave stream properties structure */
type
tagSTREAMPROPS = record
dwClassID:DWORD;
dwFlags:DWORD;
end;
STREAMPROPS = tagSTREAMPROPS;
PSTREAMPROPS = ^tagSTREAMPROPS;
CPSTREAMPROPS = ^STREAMPROPS;
//* flag definitions for STREAMPROPS.dwFlags */
const
SPSFL_NOTIFY_GAIN_CHANGE = $00000001; //* callback gets MM_WOM_ATTENUATED messages */
SPSFL_EXCLUDE = $00000002; //* stream does not participate in gain-class operations */
//* values for STREAMPROPS.dwClassid */
const
WAGC_CLASS_DEFAULT = 0;
WAGC_CLASS_NORMAL = 1;
WAGC_CLASS_AUDIO_ALERT = 2;
WAGC_CLASS_SPEECH_ALERT = 3;
WAGC_CLASS_SPEECH_NOTIFICATION = 4;
WAGC_CLASS_AUDIO_NOTIFICATION = 5;
WAGC_CLASS_FORCE_MUTE = 6;
//* classes 7-15 are reserved for future use */
WAGC_CLASS_MAX = 15; //* class ID's larger than this are illegal */
//* Discontinuity detection property set */
MM_PROPSET_DISCONTINUITY:GUID = '{B4389733-868E-4D06-B008-9A6FC8CE852E}';
{
#define MM_PROPSET_DISCONTINUITY \
{ 0xb4389733, 0x868e, 0x4d06, { 0xb0, 0x8, 0x9a, 0x6f, 0xc8, 0xce, 0x85, 0x2e } }
}
//* MM_PROPSET_DISCONTINUITY property IDs */
MM_PROP_DISCONTINUITY = 1;
//* bit values for MM_PROP_DISCONTINUITY parameter */
WDSC_APP = 1;
WDSC_SWMIXER = 2;
WDSC_DRIVER = 4;
//* structure to receive discontinuity information */
type
tagAUDIODISCONTINUITY = record
dwMask:DWORD; // bitmask shows which values were set (see WDSC_* values above)
dwApp:DWORD; // # discontinuities detected at the application level
dwSwMixer:DWORD; // # discontinuities detected at the software mixer level
dwDriver:DWORD; // # discontinuities detected at the driver level
end;
AUDIODISCONTINUITY = tagAUDIODISCONTINUITY;
PAUDIODISCONTINUITY = ^tagAUDIODISCONTINUITY;
//* waveform audio function prototypes */
function waveOutGetNumDevs:UINT; external KernelDLL name 'waveOutGetNumDevs'; // index 268
function waveOutGetDevCaps(uDeviceID:UINT; pwoc:LPWAVEOUTCAPS; cbwoc:UINT):MMRESULT; external KernelDLL name 'waveOutGetDevCaps'; // index 269
function waveOutGetVolume(hwo:HWAVEOUT; pdwVolume:LPDWORD):MMRESULT; external KernelDLL name 'waveOutGetVolume'; // index 26A
function waveOutSetVolume(hwo:HWAVEOUT; dwVolume:DWORD):MMRESULT; external KernelDLL name 'waveOutSetVolume'; // index 26B
function waveOutGetErrorText(mmrError:MMRESULT; pszText:PTSTR; cchText:UINT):MMRESULT; external KernelDLL name 'waveOutGetErrorText'; // index 26C
function waveOutClose(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutClose'; // index 26D
function waveOutPrepareHeader(hwo:HWAVEOUT; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveOutPrepareHeader'; // index 26E
function waveOutUnprepareHeader(hwo:HWAVEOUT; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveOutUnprepareHeader'; // index 26F
function waveOutWrite(hwo:HWAVEOUT; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveOutWrite'; // index 270
function waveOutPause(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutPause'; // index 271
function waveOutRestart(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutRestart'; // index 272
function waveOutReset(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutReset'; // index 273
function waveOutBreakLoop(hwo:HWAVEOUT):MMRESULT; external KernelDLL name 'waveOutBreakLoop'; // index 274
function waveOutGetPosition(hwo:HWAVEOUT; pmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external KernelDLL name 'waveOutGetPosition'; // index 275
function waveOutGetPitch(hwo:HWAVEOUT; pdwPitch:LPDWORD):MMRESULT; external KernelDLL name 'waveOutGetPitch'; // index 276
function waveOutSetPitch(hwo:HWAVEOUT; dwPitch:DWORD):MMRESULT; external KernelDLL name 'waveOutSetPitch'; // index 277
function waveOutGetPlaybackRate(hwo:HWAVEOUT; pdwRate:LPDWORD):MMRESULT; external KernelDLL name 'waveOutGetPlaybackRate'; // index 278
function waveOutSetPlaybackRate(hwo:HWAVEOUT; dwRate:DWORD):MMRESULT; external KernelDLL name 'waveOutSetPlaybackRate'; // index 279
function waveOutGetID(hwo:HWAVEOUT; puDeviceID:LPUINT):MMRESULT; external KernelDLL name 'waveOutGetID'; // index 27A
function waveOutMessage(hwo:HWAVEOUT; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external KernelDLL name 'waveOutMessage'; // index 27B
function waveOutOpen(Phwo:LPHWAVEOUT;
uDeviceID:UINT;
pwfx:LPCWAVEFORMATEX;
dwCallback:DWORD;
dwInstance:DWORD;
fdwOpen:DWORD):MMRESULT; external KernelDLL name 'waveOutOpen'; // index 27C
function waveOutGetProperty(uDeviceID:UINT;
pPropSetId:PGUID;
ulPropId:ULONG;
pvPropParams:LPVOID;
cbPropParams:ULONG;
pvPropData:LPVOID;
cbPropData:ULONG;
pcbReturn:PULONG):MMRESULT; external KernelDLL name 'waveOutGetProperty'; // index ?
function waveOutSetProperty(uDeviceID:UINT;
pPropSetId:PGUID;
ulPropId:ULONG;
pvPropParams:LPVOID;
cbPropParams:ULONG;
pvPropData:LPVOID;
cbPropData:ULONG):MMRESULT; external KernelDLL name 'waveOutSetProperty'; // index ?
function waveInGetNumDevs:UINT; external KernelDLL name 'waveInGetNumDevs'; // index 27D
function waveInGetDevCaps(uDeviceID:UINT; pwic:LPWAVEINCAPS; cbwic:UINT):MMRESULT; external KernelDLL name 'waveInGetDevCaps'; // index 27E
function waveInGetErrorText(mmrError:MMRESULT; pszText:LPTSTR; cchText:UINT):MMRESULT; external KernelDLL name 'waveInGetErrorText'; // index 27F
function waveInClose(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInClose'; // index 280
function waveInPrepareHeader(hwi:HWAVEIN; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveInPrepareHeader'; // index 281
function waveInUnprepareHeader(hwi:HWAVEIN; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveInUnprepareHeader'; // index 282
function waveInAddBuffer(hwi:HWAVEIN; pwh:LPWAVEHDR; cbwh:UINT):MMRESULT; external KernelDLL name 'waveInAddBuffer'; // index 283
function waveInStart(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInStart'; // index 284
function waveInStop(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInStop'; // index 285
function waveInReset(hwi:HWAVEIN):MMRESULT; external KernelDLL name 'waveInReset'; // index 286
function waveInGetPosition(hwi:HWAVEIN; pmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external KernelDLL name 'waveInGetPosition'; // index 287
function waveInGetID(hwi:HWAVEIN; puDeviceID:LPUINT):MMRESULT; external KernelDLL name 'waveInGetID'; // index 288
function waveInMessage(hwi:HWAVEIN; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external KernelDLL name 'waveInMessage'; // index 289
function waveInOpen(phwi:LPHWAVEIN;
uDeviceID:UINT;
pwfx:LPCWAVEFORMATEX;
dwCallback:DWORD;
dwInstance:DWORD;
fdwOpen:DWORD):MMRESULT; external KernelDLL name 'waveInOpen'; // index 28A
function waveInGetProperty(uDeviceID:UINT;
pPropSetId:PGUID;
ulPropId:ULONG;
pvPropParams:LPVOID;
cbPropParams:ULONG;
pvPropData:LPVOID;
cbPropData:ULONG;
pcbReturn:PULONG):MMRESULT; external KernelDLL name 'waveInGetProperty'; // index ?
function waveInSetProperty(uDeviceID:UINT;
pPropSetId:PGUID;
ulPropId:ULONG;
pvPropParams:LPVOID;
cbPropParams:ULONG;
pvPropData:LPVOID;
cbPropData:ULONG):MMRESULT; external KernelDLL name 'waveInSetProperty'; // index ?
{$ENDIF} // MMNOWAVE
{$IFNDEF MMNOMIDI}
{****************************************************************************
MIDI audio support
****************************************************************************}
const
//* MIDI error return values */
MIDIERR_UNPREPARED = MIDIERR_BASE + 0; //* header not prepared */
MIDIERR_STILLPLAYING = MIDIERR_BASE + 1; //* still something playing */
MIDIERR_NOMAP = MIDIERR_BASE + 2; //* no configured instruments */
MIDIERR_NOTREADY = MIDIERR_BASE + 3; //* hardware is still busy */
MIDIERR_NODEVICE = MIDIERR_BASE + 4; //* port no longer connected */
MIDIERR_INVALIDSETUP = MIDIERR_BASE + 5; //* invalid MIF */
MIDIERR_BADOPENMODE = MIDIERR_BASE + 6; //* operation unsupported w/ open mode */
MIDIERR_DONT_CONTINUE = MIDIERR_BASE + 7; //* thru device 'eating' a message */
MIDIERR_LASTERROR = MIDIERR_BASE + 7; //* last error in range */
//* MIDI audio data types */
type
HMIDI = HANDLE;
HMIDIIN = HANDLE;
HMIDIOUT = HANDLE;
HMIDISTRM = HANDLE;
LPHMIDI = ^HMIDI;
LPHMIDIIN = ^HMIDIIN;
LPHMIDIOUT = ^HMIDIOUT;
LPHMIDISTRM = ^HMIDISTRM;
MIDICALLBACK = DRVCALLBACK;
LPMIDICALLBACK = MIDICALLBACK;
const
MIDIPATCHSIZE = 128;
type
PATCHARRAY = array[0..MIDIPATCHSIZE-1] of word;
LPPATCHARRAY = ^PATCHARRAY;
KEYARRAY = array[0..MIDIPATCHSIZE-1] of word;
LPKEYARRAY = ^KEYARRAY;
//* MIDI callback messages */
const
MIM_OPEN = MM_MIM_OPEN;
MIM_CLOSE = MM_MIM_CLOSE;
MIM_DATA = MM_MIM_DATA;
MIM_LONGDATA = MM_MIM_LONGDATA;
MIM_ERROR = MM_MIM_ERROR;
MIM_LONGERROR = MM_MIM_LONGERROR;
MOM_OPEN = MM_MOM_OPEN;
MOM_CLOSE = MM_MOM_CLOSE;
MOM_DONE = MM_MOM_DONE;
MIM_MOREDATA = MM_MIM_MOREDATA;
MOM_POSITIONCB = MM_MOM_POSITIONCB;
//* device ID for MIDI mapper */
const
MIDIMAPPER = UINT(-1);
MIDI_MAPPER = UINT(-1);
//* flags for dwFlags parm of midiInOpen() */
const
MIDI_IO_STATUS = $00000020;
MIDI_IO_CONTROL = $00000008; //* Internal */
MIDI_IO_INPUT = $00000010; //*future*/ /* Internal */
MIDI_IO_OWNED = $00004000; //* Internal */
MIDI_IO_SHARED = $00008000; //* Internal */
MIDI_I_VALID = $C027; //* Internal */
MIDI_O_VALID = $C00E; //* Internal */
//* flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() */
MIDI_CACHE_ALL = 1;
MIDI_CACHE_BESTFIT = 2;
MIDI_CACHE_QUERY = 3;
MIDI_UNCACHE = 4;
MIDI_CACHE_VALID = MIDI_CACHE_ALL or MIDI_CACHE_BESTFIT or MIDI_CACHE_QUERY or MIDI_UNCACHE; //* Internal */
//* MIDI output device capabilities structure */
{$IFDEF _WIN32}
type
tagMIDIOUTCAPSA = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of AnsiChar; //* product name (NULL terminated string) */
wTechnology:word; //* type of device */
wVoices:word; //* # of voices (internal synth only) */
wNotes:word; //* max # of notes (internal synth only) */
wChannelMask:word; //* channels used (internal synth only) */
dwSupport:DWORD; //* functionality supported by driver */
end;
MIDIOUTCAPSA = tagMIDIOUTCAPSA;
PMIDIOUTCAPSA = ^tagMIDIOUTCAPSA;
NPMIDIOUTCAPSA = ^tagMIDIOUTCAPSA;
LPMIDIOUTCAPSA = ^tagMIDIOUTCAPSA;
type
tagMIDIOUTCAPSW = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of WCHAR; //* product name (NULL terminated string) */
wTechnology:word; //* type of device */
wVoices:word; //* # of voices (internal synth only) */
wNotes:word; //* max # of notes (internal synth only) */
wChannelMask:word; //* channels used (internal synth only) */
dwSupport:DWORD; //* functionality supported by driver */
end;
MIDIOUTCAPSW = tagMIDIOUTCAPSW;
PMIDIOUTCAPSW = ^tagMIDIOUTCAPSW;
NPMIDIOUTCAPSW = ^tagMIDIOUTCAPSW;
LPMIDIOUTCAPSW = ^tagMIDIOUTCAPSW;
{$IFDEF UNICODE}
MIDIOUTCAPS = MIDIOUTCAPSW;
PMIDIOUTCAPS = PMIDIOUTCAPSW;
NPMIDIOUTCAPS = NPMIDIOUTCAPSW;
LPMIDIOUTCAPS = LPMIDIOUTCAPSW;
{$ELSE} // UNICODE
MIDIOUTCAPS = MIDIOUTCAPSA;
PMIDIOUTCAPS = PMIDIOUTCAPSA;
NPMIDIOUTCAPS = NPMIDIOUTCAPSA;
LPMIDIOUTCAPS = LPMIDIOUTCAPSA;
{$ENDIF} // UNICODE
{$ELSE} // _WIN32
type
midioutcaps_tag = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of char; //* product name (NULL terminated string) */
wTechnology:word; //* type of device */
wVoices:word; //* # of voices (internal synth only) */
wNotes:word; //* max # of notes (internal synth only) */
wChannelMask:word; //* channels used (internal synth only) */
dwSupport:DWORD; //* functionality supported by driver */
end;
MIDIOUTCAPS = midioutcaps_tag;
PMIDIOUTCAPS = ^midioutcaps_tag;
NPMIDIOUTCAPS = ^midioutcaps_tag;
LPMIDIOUTCAPS = ^midioutcaps_tag;
{$ENDIF} // _WIN32
const
//* flags for wTechnology field of MIDIOUTCAPS structure */
MOD_MIDIPORT = 1; //* output port */
MOD_SYNTH = 2; //* generic internal synth */
MOD_SQSYNTH = 3; //* square wave internal synth */
MOD_FMSYNTH = 4; //* FM internal synth */
MOD_MAPPER = 5; //* MIDI mapper */
//* flags for dwSupport field of MIDIOUTCAPS structure */
MIDICAPS_VOLUME = $0001; //* supports volume control */
MIDICAPS_LRVOLUME = $0002; //* separate left-right volume control */
MIDICAPS_CACHE = $0004;
MIDICAPS_STREAM = $0008; //* driver supports midiStreamOut directly */
//* MIDI input device capabilities structure */
{$IFDEF _WIN32}
type
tagMIDIINCAPSA = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of AnsiChar; //* product name (NULL terminated string) */
//#if (WINVER >= 0x0400)
dwSupport:DWORD; //* functionality supported by driver */
//#endif
end;
MIDIINCAPSA = tagMIDIINCAPSA;
PMIDIINCAPSA = ^tagMIDIINCAPSA;
NPMIDIINCAPSA = ^tagMIDIINCAPSA;
LPMIDIINCAPSA = ^tagMIDIINCAPSA;
type
tagMIDIINCAPSW = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of WCHAR; //* product name (NULL terminated string) */
//#if (WINVER >= 0x0400)
dwSupport:DWORD; //* functionality supported by driver */
//#endif
end;
MIDIINCAPSW = tagMIDIINCAPSW;
PMIDIINCAPSW = ^tagMIDIINCAPSW;
NPMIDIINCAPSW = ^tagMIDIINCAPSW;
LPMIDIINCAPSW = ^tagMIDIINCAPSW;
{$IFDEF UNICODE}
MIDIINCAPS = MIDIINCAPSW;
PMIDIINCAPS = PMIDIINCAPSW;
NPMIDIINCAPS = NPMIDIINCAPSW;
LPMIDIINCAPS = LPMIDIINCAPSW;
{$ELSE} // UNICODE
MIDIINCAPS = MIDIINCAPSA;
PMIDIINCAPS = PMIDIINCAPSA;
NPMIDIINCAPS = NPMIDIINCAPSA;
LPMIDIINCAPS = LPMIDIINCAPSA;
{$ENDIF} // UNICODE
{$ELSE} // _WIN32
type
midiincaps_tag = record
wMid:word; //* manufacturer ID */
wPid:word; //* product ID */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of char; //* product name (NULL terminated string) */
//#if (WINVER >= 0x0400)
dwSupport:DWORD; //* functionality supported by driver */
//#endif
end;
MIDIINCAPS = midiincaps_tag;
PMIDIINCAPS = ^midiincaps_tag;
NPMIDIINCAPS = ^midiincaps_tag;
LPMIDIINCAPS = ^midiincaps_tag;
{$ENDIF} // _WIN32
//* MIDI data block header */
type
LPMIDIHDR = ^midihdr_tag;
midihdr_tag = record
lpData:LPSTR; //* pointer to locked data block */
dwBufferLength:DWORD; //* length of data in data block */
dwBytesRecorded:DWORD; //* used for input only */
dwUser:DWORD; //* for client's use */
dwFlags:DWORD; //* assorted flags (see defines) */
lpNext:LPMIDIHDR; //* reserved for driver */
reserved:DWORD; //* reserved for driver */
//#if (WINVER >= 0x0400)
dwOffset:DWORD; //* Callback offset into buffer */
dwReserved:array[0..7] of DWORD; //* Reserved for MMSYSTEM */
//#endif
end;
MIDIHDR = midihdr_tag;
PMIDIHDR = ^midihdr_tag;
NPMIDIHDR = ^midihdr_tag;
type
midievent_tag = record
dwDeltaTime:DWORD; //* Ticks since last event */
dwStreamID:DWORD; //* Reserved; must be zero */
dwEvent:DWORD; //* Event type and parameters */
dwParms:array[0..0] of DWORD; //* Parameters if this is a long event */
end;
MIDIEVENT = midievent_tag;
type
midistrmbuffver_tag = record
dwVersion:DWORD; //* Stream buffer format version */
dwMid:DWORD; //* Manufacturer ID as defined in MMREG.H */
dwOEMVersion:DWORD; //* Manufacturer version for custom ext */
end;
MIDISTRMBUFFVER = midistrmbuffver_tag;
const
//* flags for dwFlags field of MIDIHDR structure */
MHDR_DONE = $00000001; //* done bit */
MHDR_PREPARED = $00000002; //* set if header prepared */
MHDR_INQUEUE = $00000004; //* reserved for driver */
MHDR_ISSTRM = $00000008; //* Buffer is stream buffer */
MHDR_SENDING = $00000020; //* Internal */
MHDR_MAPPED = $00001000; //* thunked header */ /* Internal */
MHDR_SHADOWHDR = $00002000; //* MIDIHDR is 16-bit shadow */ /* Internal */
MHDR_VALID = $e000302F; //* valid flags */ /* Internal */
MHDR_SAVE = $e0003000; //* Save these flags */ /* Internal */
//* past driver calls */ /* Internal */
//* Dreamcast-only flags for tonebank support */
MHDR_WRITEABLE = $e0000000;
MHDR_GENERALMIDI = $80000000; //* Indicates a tonebank that is to be used */
//* by General MIDI stream ports */
MHDR_GMDRUM = $40000000; //* In combination with GENERALMIDI, indicates */
//* a GM drum tonebank. By itself, indicates an */
//* "alternate" GM drum tonebank */
MHDR_MAPPINGTABLE = $20000000; //* Indicates that this MIDIHDR is for a */
//* program mapping table rather than an actual */
//* tonebank */
//* */
//* Type codes which go in the high byte of the event DWORD of a stream buffer */
//* */
//* Type codes 00-7F contain parameters within the low 24 bits */
//* Type codes 80-FF contain a length of their parameter in the low 24 */
//* bits, followed by their parameter data in the buffer. The event */
//* DWORD contains the exact byte length; the parm data itself must be */
//* padded to be an even multiple of 4 bytes long. */
//* */
const
MEVT_F_SHORT = $00000000;
MEVT_F_LONG = $80000000;
MEVT_F_CALLBACK = $40000000;
MEVT_SHORTMSG = byte($00); //* parm = shortmsg for midiOutShortMsg */
MEVT_TEMPO = byte($01); //* parm = new tempo in microsec/qn */
MEVT_NOP = byte($02); //* parm = unused; does nothing */
function MEVT_EVENTTYPE(x:DWORD):byte;
function MEVT_EVENTPARM(x:DWORD):DWORD;
//* 0x04-0x7F reserved */
const
MEVT_LONGMSG = byte($80); //* parm = bytes to send verbatim */
MEVT_COMMENT = byte($82); //* parm = comment data */
MEVT_VERSION = byte($84); //* parm = MIDISTRMBUFFVER struct */
//* 0x81-0xFF reserved */
MIDISTRM_ERROR = -2;
//* */
//* Structures and defines for midiStreamProperty */
//* */
MIDIPROP_SET = $80000000;
MIDIPROP_GET = $40000000;
//* These are intentionally both non-zero so the app cannot accidentally */
//* leave the operation off and happen to appear to work due to default */
//* action. */
function MIDIPROP_PROPERTY(mp:DWORD):DWORD;
const
MIDIPROP_TIMEDIV = 00000001;
MIDIPROP_TEMPO = 00000002;
MIDIPROP_SMF = 00000003;
MIDIPROP_BUFFERED = 00000004;
MIDIPROP_LOOPING = 00000005;
MIDIPROP_GENERALMIDI = 00000006;
//* Some useful defines to help with Standard MIDI File Format stuff */
SMF_TIMEDIV_QUARTERNOTE = 0;
SMF_TIMEDIV_SECONDS = 1;
function SMF_TIMEDIV(format:DWORD; division:DWORD):DWORD;
function SMF_TIMEDIV_SMPTE(smpte:DWORD; division:DWORD):DWORD;
function SMF_TIMEDIV_ISSMPTE(dw:DWORD):DWORD;
function SMF_TIMEDIV_GETSMPTE(dw:DWORD):byte;
function SMF_TIMEDIV_GETTPF(dw:DWORD):DWORD;
function SMF_TIMEDIV_GETTPQN(dw:DWORD):DWORD;
type
midiproptimediv_tag = record
cbStruct:DWORD;
dwTimeDiv:DWORD;
end;
MIDIPROPTIMEDIV = midiproptimediv_tag;
LPMIDIPROPTIMEDIV = ^midiproptimediv_tag;
type
midiproptempo_tag = record
cbStruct:DWORD;
dwTempo:DWORD;
end;
MIDIPROPTEMPO = midiproptempo_tag;
LPMIDIPROPTEMPO = ^midiproptempo_tag;
const
MIDIPROP_PROPVAL = $3FFFFFFF; //* Internal */
// The library exports midi-functions.
{$IFDEF _WIN32}
const
MIDIDLL = 'winmm.dll';
{$ELSE _WIN32}
const
MIDIDLL = KernelDLL;
{$ENDIF _WIN32}
//* MIDI function prototypes */
function midiOutGetNumDevs:UINT; external MIDIDLL name 'midiOutGetNumDevs';
function midiStreamOpen(phms:LPHMIDISTRM; puDeviceID:LPUINT; cMidi:DWORD; dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external MIDIDLL name 'midiStreamOpen'; // index
function midiStreamClose(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamClose'; // index
function midiStreamProperty(hms:HMIDISTRM; lppropdata:LPBYTE; dwProperty:DWORD):MMRESULT; external MIDIDLL name 'midiStreamProperty'; // index
function midiStreamPosition(hms:HMIDISTRM; lpmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external MIDIDLL name 'midiStreamPosition'; // index
function midiStreamOut(hms:HMIDISTRM; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiStreamOut'; // index
function midiStreamPause(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamPause'; // index
function midiStreamRestart(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamRestart'; // index
function midiStreamStop(hms:HMIDISTRM):MMRESULT; external MIDIDLL name 'midiStreamStop'; // index
{$IFDEF _WIN32}
function midiConnect(hmi:HMIDI; hmo:HMIDIOUT; pReserved:LPVOID):MMRESULT; external MIDIDLL name 'midiConnect'; // index
function midiDisconnect(hmi:HMIDI; hmo:HMIDIOUT; pReserved:LPVOID):MMRESULT; external MIDIDLL name 'midiDisconnect'; // index
{$ENDIF} // _WIN32
{$IFDEF _WIN32}
function midiOutGetDevCapsA(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSA; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsA'; // index
function midiOutGetDevCapsW(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSW; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsW'; // index
{$IFDEF UNICODE}
function midiOutGetDevCaps(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSW; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsW'; // index
{$ELSE} // UNICODE
function midiOutGetDevCaps(uDeviceID:UINT; pmoc:LPMIDIOUTCAPSA; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCapsA'; // index
{$ENDIF} // UNICODE
{$ELSE} // _WIN32
function midiOutGetDevCaps(uDeviceID:UINT; pmoc:LPMIDIOUTCAPS; cbmoc:UINT):MMRESULT; external MIDIDLL name 'midiOutGetDevCaps'; // index
{$ENDIF} // _WIN32
function midiOutGetVolume(hmo:HMIDIOUT; pdwVolume:LPDWORD):MMRESULT; external MIDIDLL name 'midiOutGetVolume'; // index
function midiOutSetVolume(hmo:HMIDIOUT; dwVolume:DWORD):MMRESULT; external MIDIDLL name 'midiOutSetVolume'; // index
{$IFDEF _WIN32}
function midiOutGetErrorTextA(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextA'; // index
function midiOutGetErrorTextW(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextW'; // index
{$IFDEF UNICODE}
function midiOutGetErrorText(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextW'; // index
{$ELSE} // UNICODE
function midiOutGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorTextA'; // index
{$ENDIF} // UNICODE
{$ELSE} // _WIN32
function midiOutGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiOutGetErrorText'; // index
{$ENDIF} // _WIN32
function midiOutOpen(phmo:LPHMIDIOUT; uDeviceID:UINT;
dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external MIDIDLL name 'midiOutOpen'; // index
function midiOutClose(hmo:HMIDIOUT):MMRESULT; external MIDIDLL name 'midiOutClose'; // index
function midiOutPrepareHeader(hmo:HMIDIOUT; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiOutPrepareHeader'; // index
function midiOutUnprepareHeader(hmo:HMIDIOUT; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiOutUnprepareHeader'; // index
function midiOutShortMsg(hmo:HMIDIOUT; dwMsg:DWORD):MMRESULT; external MIDIDLL name 'midiOutShortMsg'; // index
function midiOutLongMsg(hmo:HMIDIOUT; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiOutLongMsg'; // index
function midiOutReset(hmo:HMIDIOUT):MMRESULT; external MIDIDLL name 'midiOutReset'; // index
function midiOutCachePatches(hmo:HMIDIOUT; uBank:UINT; pwpa:LPWORD; fuCache:UINT):MMRESULT; external MIDIDLL name 'midiOutCachePatches'; // index
function midiOutCacheDrumPatches(hmo:HMIDIOUT; uPatch:UINT; pwkya:LPWORD; fuCache:UINT):MMRESULT; external MIDIDLL name 'midiOutCacheDrumPatches'; // index
function midiOutGetID(hmo:HMIDIOUT; puDeviceID:LPUINT):MMRESULT; external MIDIDLL name 'midiOutGetID'; // index
{$IFDEF _WIN32}
function midiOutMessage(hmo:HMIDIOUT; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external MIDIDLL name 'midiOutMessage'; // index
{$ELSE} // _WIN32
function midiOutMessage(hmo:HMIDIOUT; uMsg:UINT; dw1:DWORD; dw2:DWORD):DWORD; external MIDIDLL name 'midiOutMessage'; // index
{$ENDIF} // _WIN32
function midiInGetNumDevs:UINT; external MIDIDLL name 'midiInGetNumDevs'; // index
{$IFDEF _WIN32}
function midiInGetDevCapsA(uDeviceID:UINT; pmic:LPMIDIINCAPSA; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsA'; // index
function midiInGetDevCapsW(uDeviceID:UINT; pmic:LPMIDIINCAPSW; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsW'; // index
{$IFDEF UNICODE}
function midiInGetDevCaps(uDeviceID:UINT; pmic:LPMIDIINCAPSW; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsW'; // index
{$ELSE} // UNICODE
function midiInGetDevCaps(uDeviceID:UINT; pmic:LPMIDIINCAPSA; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCapsA'; // index
{$ENDIF} // UNICODE
function midiInGetErrorTextA(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextA'; // index
function midiInGetErrorTextW(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextW'; // index
{$IFDEF UNICODE}
function midiInGetErrorText(mmrError:MMRESULT; pszText:LPWSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextW'; // index
{$ELSE} // UNICODE
function midiInGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorTextA'; // index
{$ENDIF} // UNICODE
{$ELSE} // _WIN32
function midiInGetDevCaps(uDeviceID:UINT; pmic:LPMIDIINCAPS; cbmic:UINT):MMRESULT; external MIDIDLL name 'midiInGetDevCaps'; // index
function midiInGetErrorText(mmrError:MMRESULT; pszText:LPSTR; cchText:UINT):MMRESULT; external MIDIDLL name 'midiInGetErrorText'; // index
{$ENDIF} // _WIN32
function midiInOpen(phmi:LPHMIDIIN; uDeviceID:UINT;
dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external MIDIDLL name 'midiInOpen'; // index
function midiInClose(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInClose'; // index
function midiInPrepareHeader(hmi:HMIDIIN; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiInPrepareHeader'; // index
function midiInUnprepareHeader(hmi:HMIDIIN; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiInUnprepareHeader'; // index
function midiInAddBuffer(hmi:HMIDIIN; pmh:LPMIDIHDR; cbmh:UINT):MMRESULT; external MIDIDLL name 'midiInAddBuffer'; // index
function midiInStart(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInStart'; // index
function midiInStop(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInStop'; // index
function midiInReset(hmi:HMIDIIN):MMRESULT; external MIDIDLL name 'midiInReset'; // index
function midiInGetID(hmi:HMIDIIN; puDeviceID:LPUINT):MMRESULT; external MIDIDLL name 'midiInGetID'; // index
{$IFDEF _WIN32}
function midiInMessage(hmi:HMIDIIN; uMsg:UINT; dw1:DWORD; dw2:DWORD):MMRESULT; external MIDIDLL name 'midiInMessage'; // index
{$ELSE} // _WIN32
function midiInMessage(hmi:HMIDIIN; uMsg:UINT; dw1:DWORD; dw2:DWORD):DWORD; external MIDIDLL name 'midiInMessage'; // index
{$ENDIF} // _WIN32
{$ENDIF} // MMNOMIDI
{$IFNDEF MMNOMIXER}
{****************************************************************************
Mixer Support
****************************************************************************}
type
HMIXEROBJ = HANDLE;
LPHMIXEROBJ = ^HMIXEROBJ;
HMIXER = HANDLE;
LPHMIXER = ^HMIXER;
const
MIXER_SHORT_NAME_CHARS = 16;
MIXER_LONG_NAME_CHARS = 64;
//* */
//* MMRESULT error return values specific to the mixer API */
//* */
//* */
const
MIXERR_INVALLINE = MIXERR_BASE + 0;
MIXERR_INVALCONTROL = MIXERR_BASE + 1;
MIXERR_INVALVALUE = MIXERR_BASE + 2;
MIXERR_LASTERROR = MIXERR_BASE + 2;
MIXER_OBJECTF_HANDLE = $80000000;
MIXER_OBJECTF_MIXER = $00000000;
MIXER_OBJECTF_HMIXER = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIXER;
MIXER_OBJECTF_WAVEOUT = $10000000;
MIXER_OBJECTF_HWAVEOUT = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEOUT;
MIXER_OBJECTF_WAVEIN = $20000000;
MIXER_OBJECTF_HWAVEIN = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEIN;
MIXER_OBJECTF_MIDIOUT = $30000000;
MIXER_OBJECTF_HMIDIOUT = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIOUT;
MIXER_OBJECTF_MIDIIN = $40000000;
MIXER_OBJECTF_HMIDIIN = MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIIN;
MIXER_OBJECTF_AUX = $50000000;
function mixerGetNumDevs:UINT; external KernelDLL name 'mixerGetNumDevs'; // index 2AE
type
tagMIXERCAPS = record
wMid:word; //* manufacturer id */
wPid:word; //* product id */
vDriverVersion:MMVERSION; //* version of the driver */
szPname:array[0..MAXPNAMELEN-1] of TCHAR; //* product name */
fdwSupport:DWORD; //* misc. support bits */
cDestinations:DWORD; //* count of destinations */
end;
MIXERCAPS = tagMIXERCAPS;
PMIXERCAPS = ^tagMIXERCAPS;
LPMIXERCAPS = ^tagMIXERCAPS;
function mixerGetDevCaps(uMxId:UINT; pmxcaps:LPMIXERCAPS; cbmxcaps:UINT):MMRESULT; external KernelDLL name 'mixerGetDevCaps'; // index 2AA
function mixerOpen(phmx:LPHMIXER; uMxId:UINT; dwCallback:DWORD; dwInstance:DWORD; fdwOpen:DWORD):MMRESULT; external KernelDLL name 'mixerOpen'; // index 2B0
function mixerClose(hmx:HMIXER):MMRESULT; external KernelDLL name 'mixerClose'; // index 2B2
function mixerMessage(hmx:HMIXER; uMsg:UINT; dwParam1:DWORD; dwParam2:DWORD):DWORD; external KernelDLL name 'mixerMessage'; // index 2AF
type
tMIXERLINE = record
cbStruct:DWORD; //* size of MIXERLINE structure */
dwDestination:DWORD; //* zero based destination index */
dwSource:DWORD; //* zero based source index (if source) */
dwLineID:DWORD; //* unique line id for mixer device */
fdwLine:DWORD; //* state/information about line */
dwUser:DWORD; //* driver specific information */
dwComponentType:DWORD; //* component type line connects to */
cChannels:DWORD; //* number of channels line supports */
cConnections:DWORD; //* number of connections [possible] */
cControls:DWORD; //* number of controls at this line */
szShortName:array[0..MIXER_SHORT_NAME_CHARS-1] of TCHAR;
szName:array[0..MIXER_LONG_NAME_CHARS-1] of TCHAR;
Target:record
dwType:DWORD; //* MIXERLINE_TARGETTYPE_xxxx */
dwDeviceID:DWORD; //* target device ID of device type */
wMid:word; //* of target device */
wPid:word; //* " */
vDriverVersion:MMVERSION; //* " */
szPname:array[0..MAXPNAMELEN-1] of TCHAR; //* " */
end;
end;
MIXERLINE = tMIXERLINE;
PMIXERLINE = ^tMIXERLINE;
LPMIXERLINE = ^tMIXERLINE;
//* */
//* MIXERLINE.fdwLine */
//* */
//* */
const
MIXERLINE_LINEF_ACTIVE = $00000001;
MIXERLINE_LINEF_DISCONNECTED = $00008000;
MIXERLINE_LINEF_SOURCE = $80000000;
//* */
//* MIXERLINE.dwComponentType */
//* */
//* component types for destinations and sources */
//* */
//* */
MIXERLINE_COMPONENTTYPE_DST_FIRST = $00000000;
MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = MIXERLINE_COMPONENTTYPE_DST_FIRST + 0;
MIXERLINE_COMPONENTTYPE_DST_DIGITAL = MIXERLINE_COMPONENTTYPE_DST_FIRST + 1;
MIXERLINE_COMPONENTTYPE_DST_LINE = MIXERLINE_COMPONENTTYPE_DST_FIRST + 2;
MIXERLINE_COMPONENTTYPE_DST_MONITOR = MIXERLINE_COMPONENTTYPE_DST_FIRST + 3;
MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = MIXERLINE_COMPONENTTYPE_DST_FIRST + 4;
MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = MIXERLINE_COMPONENTTYPE_DST_FIRST + 5;
MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = MIXERLINE_COMPONENTTYPE_DST_FIRST + 6;
MIXERLINE_COMPONENTTYPE_DST_WAVEIN = MIXERLINE_COMPONENTTYPE_DST_FIRST + 7;
MIXERLINE_COMPONENTTYPE_DST_VOICEIN = MIXERLINE_COMPONENTTYPE_DST_FIRST + 8;
MIXERLINE_COMPONENTTYPE_DST_LAST = MIXERLINE_COMPONENTTYPE_DST_FIRST + 8;
MIXERLINE_COMPONENTTYPE_SRC_FIRST = $00001000;
MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0;
MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1;
MIXERLINE_COMPONENTTYPE_SRC_LINE = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2;
MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3;
MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4;
MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5;
MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6;
MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7;
MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8;
MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9;
MIXERLINE_COMPONENTTYPE_SRC_ANALOG = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10;
MIXERLINE_COMPONENTTYPE_SRC_LAST = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10;
//* */
//* MIXERLINE.Target.dwType */
//* */
//* */
MIXERLINE_TARGETTYPE_UNDEFINED = 0;
MIXERLINE_TARGETTYPE_WAVEOUT = 1;
MIXERLINE_TARGETTYPE_WAVEIN = 2;
MIXERLINE_TARGETTYPE_MIDIOUT = 3;
MIXERLINE_TARGETTYPE_MIDIIN = 4;
MIXERLINE_TARGETTYPE_AUX = 5;
function mixerGetLineInfo(hmxobj:HMIXEROBJ; pmxl:LPMIXERLINE; fdwInfo:DWORD):MMRESULT; external KernelDLL name 'mixerGetLineInfo'; // index 2AD
const
MIXER_GETLINEINFOF_DESTINATION = $00000000;
MIXER_GETLINEINFOF_SOURCE = $00000001;
MIXER_GETLINEINFOF_LINEID = $00000002;
MIXER_GETLINEINFOF_COMPONENTTYPE = $00000003;
MIXER_GETLINEINFOF_TARGETTYPE = $00000004;
MIXER_GETLINEINFOF_QUERYMASK = $0000000F;
function mixerGetID(hmxobj:HMIXEROBJ; puMxId:LPUINT; fdwId:DWORD):MMRESULT; external KernelDLL name 'mixerGetID'; // index 2AB
//* */
//* MIXERCONTROL */
//* */
//* */
type
tMIXERCONTROL = record
cbStruct:DWORD; //* size in bytes of MIXERCONTROL */
dwControlID:DWORD; //* unique control id for mixer device */
dwControlType:DWORD; //* MIXERCONTROL_CONTROLTYPE_xxx */
fdwControl:DWORD; //* MIXERCONTROL_CONTROLF_xxx */
cMultipleItems:DWORD; //* if MIXERCONTROL_CONTROLF_MULTIPLE set */
szShortName:array[0..MIXER_SHORT_NAME_CHARS-1] of TCHAR;
szName:array[0..MIXER_LONG_NAME_CHARS-1] of TCHAR;
Bounds:record
case DWORD of
0: (lMinimum:LONG; //* signed minimum for this control */
lMaximum:LONG); //* signed maximum for this control */
1: (dwMinimum:DWORD; //* unsigned minimum for this control */
dwMaximum:DWORD); //* unsigned maximum for this control */
2: (dwReserved:array[0..5] of DWORD);
end;
Metrics:record
case DWORD of
0: (cSteps:DWORD); //* # of steps between min & max */
1: (cbCustomData:DWORD); //* size in bytes of custom data */
2: (dwReserved:array[0..5] of DWORD);
end;
end;
MIXERCONTROL = tMIXERCONTROL;
PMIXERCONTROL = ^tMIXERCONTROL;
LPMIXERCONTROL = ^tMIXERCONTROL;
const
//* */
//* MIXERCONTROL.fdwControl */
//* */
//* */
MIXERCONTROL_CONTROLF_UNIFORM = $00000001;
MIXERCONTROL_CONTROLF_MULTIPLE = $00000002;
MIXERCONTROL_CONTROLF_DISABLED = $80000000;
//* */
//* MIXERCONTROL_CONTROLTYPE_xxx building block defines */
//* */
//* */
MIXERCONTROL_CT_CLASS_MASK = $F0000000;
MIXERCONTROL_CT_CLASS_CUSTOM = $00000000;
MIXERCONTROL_CT_CLASS_METER = $10000000;
MIXERCONTROL_CT_CLASS_SWITCH = $20000000;
MIXERCONTROL_CT_CLASS_NUMBER = $30000000;
MIXERCONTROL_CT_CLASS_SLIDER = $40000000;
MIXERCONTROL_CT_CLASS_FADER = $50000000;
MIXERCONTROL_CT_CLASS_TIME = $60000000;
MIXERCONTROL_CT_CLASS_LIST = $70000000;
MIXERCONTROL_CT_SUBCLASS_MASK = $0F000000;
MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = $00000000;
MIXERCONTROL_CT_SC_SWITCH_BUTTON = $01000000;
MIXERCONTROL_CT_SC_METER_POLLED = $00000000;
MIXERCONTROL_CT_SC_TIME_MICROSECS = $00000000;
MIXERCONTROL_CT_SC_TIME_MILLISECS = $01000000;
MIXERCONTROL_CT_SC_LIST_SINGLE = $00000000;
MIXERCONTROL_CT_SC_LIST_MULTIPLE = $01000000;
MIXERCONTROL_CT_UNITS_MASK = $00FF0000;
MIXERCONTROL_CT_UNITS_CUSTOM = $00000000;
MIXERCONTROL_CT_UNITS_BOOLEAN = $00010000;
MIXERCONTROL_CT_UNITS_SIGNED = $00020000;
MIXERCONTROL_CT_UNITS_UNSIGNED = $00030000;
MIXERCONTROL_CT_UNITS_DECIBELS = $00040000; //* in 10ths */
MIXERCONTROL_CT_UNITS_PERCENT = $00050000; //* in 10ths */
//* */
//* Commonly used control types for specifying MIXERCONTROL.dwControlType */
//* */
MIXERCONTROL_CONTROLTYPE_CUSTOM = MIXERCONTROL_CT_CLASS_CUSTOM or MIXERCONTROL_CT_UNITS_CUSTOM;
MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_BOOLEAN;
MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_SIGNED;
MIXERCONTROL_CONTROLTYPE_PEAKMETER = MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1;
MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_UNSIGNED;
MIXERCONTROL_CONTROLTYPE_BOOLEAN = MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN or MIXERCONTROL_CT_UNITS_BOOLEAN;
MIXERCONTROL_CONTROLTYPE_ONOFF = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1;
MIXERCONTROL_CONTROLTYPE_MUTE = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2;
MIXERCONTROL_CONTROLTYPE_MONO = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3;
MIXERCONTROL_CONTROLTYPE_LOUDNESS = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4;
MIXERCONTROL_CONTROLTYPE_STEREOENH = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5;
// - mmreg.h
MIXERCONTROL_CONTROLTYPE_SRS_MTS = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 6;
MIXERCONTROL_CONTROLTYPE_SRS_ONOFF = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 7;
MIXERCONTROL_CONTROLTYPE_SRS_SYNTHSELECT = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 8;
// - end of mmreg.h
MIXERCONTROL_CONTROLTYPE_BUTTON = MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BUTTON or MIXERCONTROL_CT_UNITS_BOOLEAN;
MIXERCONTROL_CONTROLTYPE_DECIBELS = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_DECIBELS;
MIXERCONTROL_CONTROLTYPE_SIGNED = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_SIGNED;
MIXERCONTROL_CONTROLTYPE_UNSIGNED = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_UNSIGNED;
MIXERCONTROL_CONTROLTYPE_PERCENT = MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_PERCENT;
MIXERCONTROL_CONTROLTYPE_SLIDER = MIXERCONTROL_CT_CLASS_SLIDER or MIXERCONTROL_CT_UNITS_SIGNED;
MIXERCONTROL_CONTROLTYPE_PAN = MIXERCONTROL_CONTROLTYPE_SLIDER + 1;
MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = MIXERCONTROL_CONTROLTYPE_SLIDER + 2;
MIXERCONTROL_CONTROLTYPE_FADER = MIXERCONTROL_CT_CLASS_FADER or MIXERCONTROL_CT_UNITS_UNSIGNED;
MIXERCONTROL_CONTROLTYPE_VOLUME = MIXERCONTROL_CONTROLTYPE_FADER + 1;
MIXERCONTROL_CONTROLTYPE_BASS = MIXERCONTROL_CONTROLTYPE_FADER + 2;
MIXERCONTROL_CONTROLTYPE_TREBLE = MIXERCONTROL_CONTROLTYPE_FADER + 3;
MIXERCONTROL_CONTROLTYPE_EQUALIZER = MIXERCONTROL_CONTROLTYPE_FADER + 4;
MIXERCONTROL_CONTROLTYPE_SINGLESELECT = MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_SINGLE or MIXERCONTROL_CT_UNITS_BOOLEAN;
MIXERCONTROL_CONTROLTYPE_MUX = MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1;
MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_MULTIPLE or MIXERCONTROL_CT_UNITS_BOOLEAN;
MIXERCONTROL_CONTROLTYPE_MIXER = MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1;
MIXERCONTROL_CONTROLTYPE_MICROTIME = MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MICROSECS or MIXERCONTROL_CT_UNITS_UNSIGNED;
MIXERCONTROL_CONTROLTYPE_MILLITIME = MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MILLISECS or MIXERCONTROL_CT_UNITS_UNSIGNED;
//* */
//* MIXERLINECONTROLS */
//* */
type
tMIXERLINECONTROLS = record
cbStruct:DWORD; //* size in bytes of MIXERLINECONTROLS */
dwLineID:DWORD; //* line id (from MIXERLINE.dwLineID) */
case DWORD of
0: (dwControlID:DWORD); //* MIXER_GETLINECONTROLSF_ONEBYID */
1: (dwControlType:DWORD; //* MIXER_GETLINECONTROLSF_ONEBYTYPE */
cControls:DWORD; //* count of controls pmxctrl points to */
cbmxctrl:DWORD; //* size in bytes of _one_ MIXERCONTROL */
pamxctrl:LPMIXERCONTROL); //* pointer to first MIXERCONTROL array */
end;
MIXERLINECONTROLS = tMIXERLINECONTROLS;
PMIXERLINECONTROLS = ^tMIXERLINECONTROLS;
LPMIXERLINECONTROLS = ^tMIXERLINECONTROLS;
function mixerGetLineControls(hmxobj:HMIXEROBJ; pmxlc:LPMIXERLINECONTROLS; fdwControls:DWORD):MMRESULT; external KernelDLL name 'mixerGetLineControls'; // index 2AC
const
MIXER_GETLINECONTROLSF_ALL = $00000000;
MIXER_GETLINECONTROLSF_ONEBYID = $00000001;
MIXER_GETLINECONTROLSF_ONEBYTYPE = $00000002;
MIXER_GETLINECONTROLSF_QUERYMASK = $0000000F;
type
tMIXERCONTROLDETAILS = record
cbStruct:DWORD; //* size in bytes of MIXERCONTROLDETAILS */
dwControlID:DWORD; //* control id to get/set details on */
cChannels:DWORD; //* number of channels in paDetails array */
case DWORD of
0: (hwndOwner:HWND); //* for MIXER_SETCONTROLDETAILSF_CUSTOM */
1: (cMultipleItems:DWORD; //* if _MULTIPLE, the number of items per channel */
cbDetails:DWORD; //* size of _one_ details_XX struct */
paDetails:LPVOID); //* pointer to array of details_XX structs */
end;
MIXERCONTROLDETAILS = tMIXERCONTROLDETAILS;
PMIXERCONTROLDETAILS = ^tMIXERCONTROLDETAILS;
LPMIXERCONTROLDETAILS = ^tMIXERCONTROLDETAILS;
//* */
//* MIXER_GETCONTROLDETAILSF_LISTTEXT */
//* */
//* */
type
tMIXERCONTROLDETAILS_LISTTEXT = record
dwParam1:DWORD;
dwParam2:DWORD;
szName:array[0..MIXER_LONG_NAME_CHARS-1] of TCHAR;
end;
MIXERCONTROLDETAILS_LISTTEXT = tMIXERCONTROLDETAILS_LISTTEXT;
PMIXERCONTROLDETAILS_LISTTEXT = ^tMIXERCONTROLDETAILS_LISTTEXT;
LPMIXERCONTROLDETAILS_LISTTEXT = ^tMIXERCONTROLDETAILS_LISTTEXT;
//* */
//* MIXER_GETCONTROLDETAILSF_VALUE */
//* */
//* */
type
tMIXERCONTROLDETAILS_BOOLEAN = record
fValue:LONG;
end;
MIXERCONTROLDETAILS_BOOLEAN = tMIXERCONTROLDETAILS_BOOLEAN;
PMIXERCONTROLDETAILS_BOOLEAN = ^tMIXERCONTROLDETAILS_BOOLEAN;
LPMIXERCONTROLDETAILS_BOOLEAN = ^tMIXERCONTROLDETAILS_BOOLEAN;
type
tMIXERCONTROLDETAILS_SIGNED = record
lValue:LONG;
end;
MIXERCONTROLDETAILS_SIGNED = tMIXERCONTROLDETAILS_SIGNED;
PMIXERCONTROLDETAILS_SIGNED = ^tMIXERCONTROLDETAILS_SIGNED;
LPMIXERCONTROLDETAILS_SIGNED = ^tMIXERCONTROLDETAILS_SIGNED;
type
tMIXERCONTROLDETAILS_UNSIGNED = record
dwValue:DWORD;
end;
MIXERCONTROLDETAILS_UNSIGNED = tMIXERCONTROLDETAILS_UNSIGNED;
PMIXERCONTROLDETAILS_UNSIGNED = ^tMIXERCONTROLDETAILS_UNSIGNED;
LPMIXERCONTROLDETAILS_UNSIGNED = ^tMIXERCONTROLDETAILS_UNSIGNED;
function mixerGetControlDetails(hmxobj:HMIXEROBJ; pmxcd:LPMIXERCONTROLDETAILS; fdwDetails:DWORD):MMRESULT; external KernelDLL name 'mixerGetControlDetails'; // index 2A9
const
MIXER_GETCONTROLDETAILSF_VALUE = $00000000;
MIXER_GETCONTROLDETAILSF_LISTTEXT = $00000001;
MIXER_GETCONTROLDETAILSF_QUERYMASK = $0000000F;
function mixerSetControlDetails(hmxobj:HMIXEROBJ; pmxcd:LPMIXERCONTROLDETAILS; fdwDetails:DWORD):MMRESULT; external KernelDLL name 'mixerSetControlDetails'; // index 2B1
const
MIXER_SETCONTROLDETAILSF_VALUE = $00000000;
MIXER_SETCONTROLDETAILSF_CUSTOM = $00000001;
MIXER_SETCONTROLDETAILSF_QUERYMASK = $0000000F;
{$ENDIF} // MMNOMIXER
{$IFNDEF MMNOTIMER}
{****************************************************************************
Timer support
****************************************************************************}
//* timer error return values */
const
TIMERR_NOERROR = 0; //* no error */
TIMERR_NOCANDO = TIMERR_BASE+1; //* request not completed */
TIMERR_STRUCT = TIMERR_BASE+33; //* time struct size */
//* timer data types */
type
TIMECALLBACK = procedure(uTimerID:UINT; uMsg:UINT; dwUser:DWORD; dw1:DWORD; dw2:DWORD); cdecl;
LPTIMECALLBACK = TIMECALLBACK;
//* flags for fuEvent parameter of timeSetEvent() function */
const
TIME_ONESHOT = $0000; //* program timer for single event */
TIME_PERIODIC = $0001; //* program for continuous periodic event */
{.$IFDEF _WIN32}
TIME_CALLBACK_FUNCTION = $0000; //* callback is function */
TIME_CALLBACK_EVENT_SET = $0010; //* callback is event - use SetEvent */
TIME_CALLBACK_EVENT_PULSE = $0020; //* callback is event - use PulseEvent */
TIME_CALLBACK_TYPEMASK = $00F0; //* Internal */
{.$ENDIF} // _WIN32
//* timer device capabilities data structure */
type
timecaps_tag = record
wPeriodMin:UINT; //* minimum period supported */
wPeriodMax:UINT; //* maximum period supported */
end;
TIMECAPS = timecaps_tag;
PTIMECAPS = ^timecaps_tag;
NPTIMECAPS = ^timecaps_tag;
LPTIMECAPS = ^timecaps_tag;
{$IFDEF _WIN32}
const
MMTimerDLL = 'winmm.dll';
{$ELSE _WIN32}
const
MMTimerDLL = 'mmtimer.dll';
{$ENDIF _WIN32}
//* timer function prototypes */
function timeGetSystemTime(pmmt:LPMMTIME; cbmmt:UINT):MMRESULT; external MMTimerDLL name 'timeGetSystemTime'; // index
function timeGetTime:DWORD; external MMTimerDLL name 'timeGetTime'; // index
function timeSetEvent(uDelay:UINT;
uResolution:UINT;
fptc:LPTIMECALLBACK;
dwUser:DWORD;
fuEvent:UINT):MMRESULT; external MMTimerDLL name 'timeSetEvent'; // index
function timeKillEvent(uTimerID:UINT):MMRESULT; external MMTimerDLL name 'timeKillEvent'; // index
function timeGetDevCaps(ptc:LPTIMECAPS; cbtc:UINT):MMRESULT; external MMTimerDLL name 'timeGetDevCaps'; // index
function timeBeginPeriod(uPeriod:UINT):MMRESULT; external MMTimerDLL name 'timeBeginPeriod'; // index
function timeEndPeriod(uPeriod:UINT):MMRESULT; external MMTimerDLL name 'timeEndPeriod'; // index
function timeGetTimeSinceInterrupt:DWORD; external MMTimerDLL name 'timeGetTimeSinceInterrupt'; // index
function timeGetHardwareFrequency:DWORD; external MMTimerDLL name 'timeGetHardwareFrequency'; // index
{$ENDIF} // MMNOTIMER
{$IFNDEF MMNOMMIO}
{****************************************************************************
Multimedia File I/O support
****************************************************************************}
const
//* MMIO error return values */
MMIOERR_BASE = 256;
MMIOERR_FILENOTFOUND = MMIOERR_BASE + 1; //* file not found */
MMIOERR_OUTOFMEMORY = MMIOERR_BASE + 2; //* out of memory */
MMIOERR_CANNOTOPEN = MMIOERR_BASE + 3; //* cannot open */
MMIOERR_CANNOTCLOSE = MMIOERR_BASE + 4; //* cannot close */
MMIOERR_CANNOTREAD = MMIOERR_BASE + 5; //* cannot read */
MMIOERR_CANNOTWRITE = MMIOERR_BASE + 6; //* cannot write */
MMIOERR_CANNOTSEEK = MMIOERR_BASE + 7; //* cannot seek */
MMIOERR_CANNOTEXPAND = MMIOERR_BASE + 8; //* cannot expand file */
MMIOERR_CHUNKNOTFOUND = MMIOERR_BASE + 9; //* chunk not found */
MMIOERR_UNBUFFERED = MMIOERR_BASE + 10; //* */
MMIOERR_PATHNOTFOUND = MMIOERR_BASE + 11; //* path incorrect */
MMIOERR_ACCESSDENIED = MMIOERR_BASE + 12; //* file was protected */
MMIOERR_SHARINGVIOLATION = MMIOERR_BASE + 13; //* file in use */
MMIOERR_NETWORKERROR = MMIOERR_BASE + 14; //* network not responding */
MMIOERR_TOOMANYOPENFILES = MMIOERR_BASE + 15; //* no more file handles */
MMIOERR_INVALIDFILE = MMIOERR_BASE + 16; //* default error file error */
//* MMIO constants */
CFSEPCHAR = '+'; //* compound file name separator char. */
//* MMIO data types */
type
HPSTR = ^char; //* a huge version of LPSTR */
HMMIO = HANDLE; //* a handle to an open file */
type
MMIOPROC = function(lpmmioinfo:LPSTR; uMsg:UINT; lParam1:LPARAM; lParam2:LPARAM):LRESULT; cdecl;
LPMMIOPROC = MMIOPROC;
//* general MMIO information data structure */
type
_MMIOINFO = record
//* general fields */
dwFlags:DWORD; //* general status flags */
fccIOProc:FOURCC; //* pointer to I/O procedure */
pIOProc:LPMMIOPROC; //* pointer to I/O procedure */
wErrorRet:UINT; //* place for error to be returned */
htask:HTASK; //* alternate local task */
//* fields maintained by MMIO functions during buffered I/O */
cchBuffer:LONG; //* size of I/O buffer (or 0L) */
pchBuffer:HPSTR; //* start of I/O buffer (or NULL) */
pchNext:HPSTR; //* pointer to next byte to read/write */
pchEndRead:HPSTR; //* pointer to last valid byte to read */
pchEndWrite:HPSTR; //* pointer to last byte to write */
lBufOffset:LONG; //* disk offset of start of buffer */
//* fields maintained by I/O procedure */
lDiskOffset:LONG; //* disk offset of next read or write */
adwInfo:array[0..2] of DWORD; //* data specific to type of MMIOPROC */
//* other fields maintained by MMIO */
dwReserved1:DWORD; //* reserved for MMIO use */
dwReserved2:DWORD; //* reserved for MMIO use */
hmmio:HMMIO; //* handle to open file */
end;
MMIOINFO = _MMIOINFO;
PMMIOINFO = ^_MMIOINFO;
NPMMIOINFO = ^_MMIOINFO;
LPMMIOINFO = ^_MMIOINFO;
LPCMMIOINFO = ^MMIOINFO;
//* RIFF chunk information data structure */
type
_MMCKINFO = record
ckid:FOURCC; //* chunk ID */
cksize:DWORD; //* chunk size */
fccType:FOURCC; //* form type or list type */
dwDataOffset:DWORD; //* offset of data portion of chunk */
dwFlags:DWORD; //* flags used by MMIO functions */
end;
MMCKINFO = _MMCKINFO;
PMMCKINFO = ^_MMCKINFO;
NPMMCKINFO = ^_MMCKINFO;
LPMMCKINFO = ^_MMCKINFO;
LPCMMCKINFO = ^MMCKINFO;
const
//* bit field masks */
MMIO_RWMODE = $00000003; //* open file for reading/writing/both */
MMIO_SHAREMODE = $00000070; //* file sharing mode number */
//* read/write mode numbers (bit field MMIO_RWMODE) */
MMIO_READ = $00000000; //* open file for reading only */
MMIO_WRITE = $00000001; //* open file for writing only */
MMIO_READWRITE = $00000002; //* open file for reading and writing */
//* various MMIO flags */
MMIO_FHOPEN = $0010; //* mmioClose: keep file handle open */
MMIO_EMPTYBUF = $0010; //* mmioFlush: empty the I/O buffer */
MMIO_TOUPPER = $0010; //* mmioStringToFOURCC: to u-case */
MMIO_INSTALLPROC = $00010000; //* mmioInstallIOProc: install MMIOProc */
MMIO_GLOBALPROC = $10000000; //* mmioInstallIOProc: install globally */
MMIO_REMOVEPROC = $00020000; //* mmioInstallIOProc: remove MMIOProc */
MMIO_UNICODEPROC = $01000000; //* mmioInstallIOProc: Unicode MMIOProc */
MMIO_FINDPROC = $00040000; //* mmioInstallIOProc: find an MMIOProc */
MMIO_FINDCHUNK = $0010; //* mmioDescend: find a chunk by ID */
MMIO_FINDRIFF = $0020; //* mmioDescend: find a LIST chunk */
MMIO_FINDLIST = $0040; //* mmioDescend: find a RIFF chunk */
MMIO_CREATERIFF = $0020; //* mmioCreateChunk: make a LIST chunk */
MMIO_CREATELIST = $0040; //* mmioCreateChunk: make a RIFF chunk */
MMIO_VALIDPROC = $10070000; //* valid for mmioInstallIOProc */ /* Internal */
//* constants for dwFlags field of MMIOINFO */
MMIO_CREATE = $00001000; //* create new file (or truncate file) */
MMIO_PARSE = $00000100; //* parse new file returning path */
MMIO_DELETE = $00000200; //* create new file (or truncate file) */
MMIO_EXIST = $00004000; //* checks for existence of file */
MMIO_ALLOCBUF = $00010000; //* mmioOpen() should allocate a buffer */
MMIO_GETTEMP = $00020000; //* mmioOpen() should retrieve temp name */
MMIO_DIRTY = $10000000; //* I/O buffer is dirty */
MMIO_OPEN_VALID = $0003FFFF; //* valid flags for mmioOpen */ /* Internal */
MMIO_FLUSH_VALID = MMIO_EMPTYBUF; //* valid flags for mmioFlush */ /* Internal */
MMIO_ADVANCE_VALID = MMIO_WRITE or MMIO_READ; //* valid flags for mmioAdvance */ /* Internal */
MMIO_FOURCC_VALID = MMIO_TOUPPER; //* valid flags for mmioStringToFOURCC */ /* Internal */
MMIO_DESCEND_VALID = MMIO_FINDCHUNK or MMIO_FINDRIFF or MMIO_FINDLIST; //* Internal */
MMIO_CREATE_VALID = MMIO_CREATERIFF or MMIO_CREATELIST; //* Internal */
//* share mode numbers (bit field MMIO_SHAREMODE) */
MMIO_COMPAT = $00000000; //* compatibility mode */
MMIO_EXCLUSIVE = $00000010; //* exclusive-access mode */
MMIO_DENYWRITE = $00000020; //* deny writing to other processes */
MMIO_DENYREAD = $00000030; //* deny reading to other processes */
MMIO_DENYNONE = $00000040; //* deny nothing to other processes */
//* message numbers for MMIOPROC I/O procedure functions */
MMIOM_READ = MMIO_READ; //* read */
MMIOM_WRITE = MMIO_WRITE; //* write */
MMIOM_SEEK = 2; //* seek to a new position in file */
MMIOM_OPEN = 3; //* open file */
MMIOM_CLOSE = 4; //* close file */
MMIOM_WRITEFLUSH = 5; //* write and flush */
MMIOM_RENAME = 6; //* rename specified file */
MMIOM_USER = $8000; //* beginning of user-defined messages */
//* standard four character codes */
const
FOURCC_RIFF = FOURCC(byte(AnsiChar('R')) or
(byte(AnsiChar('I')) shl 8) or
(byte(AnsiChar('F')) shl 16) or
(byte(AnsiChar('F')) shl 24)
);
FOURCC_LIST = FOURCC(byte(AnsiChar('L')) or
(byte(AnsiChar('I')) shl 8) or
(byte(AnsiChar('S')) shl 16) or
(byte(AnsiChar('T')) shl 24)
);
//* four character codes used to identify standard built-in I/O procedures */
FOURCC_DOS = FOURCC(byte(AnsiChar('D')) or
(byte(AnsiChar('O')) shl 8) or
(byte(AnsiChar('S')) shl 16) or
(byte(AnsiChar(' ')) shl 24)
);
FOURCC_MEM = FOURCC(byte(AnsiChar('M')) or
(byte(AnsiChar('E')) shl 8) or
(byte(AnsiChar('M')) shl 16) or
(byte(AnsiChar(' ')) shl 24)
);
//* flags for mmioSeek() */
const
SEEK_SET = 0; //* seek to an absolute position */
SEEK_CUR = 1; //* seek relative to current position */
SEEK_END = 2; //* seek relative to end of file */
//* other constants */
const
MMIO_DEFAULTBUFFER = 8192; //* default buffer size */
{$ENDIF} // MMNOMMIO
{$PACKRECORDS DEFAULT} // #include "poppack.h" /* Revert to default packing */
implementation
{ Was declared as
MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3)
}
function MAKEFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC; inline;
begin
MAKEFOURCC:=DWORD(ch0) or
(DWORD(ch1) shl 8) or
(DWORD(ch2) shl 16) or
(DWORD(ch3) shl 24);
end;
function mmioFOURCC(ch0:AnsiChar; ch1:AnsiChar; ch2:AnsiChar; ch3:AnsiChar):FOURCC;
begin
mmioFOURCC:=MAKEFOURCC(ch0,ch1,ch2,ch3);
end;
{ Was declared as
#define sndAlias( ch0, ch1 ) \
( SND_ALIAS_START + (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ))
}
function sndAlias(ch0:AnsiChar; ch1:AnsiChar):DWORD; inline;
begin
sndAlias:=SND_ALIAS_START+(DWORD(ch0) or (DWORD(ch1) shl 8));
end;
function MEVT_EVENTTYPE(x:DWORD):byte; inline;
begin
MEVT_EVENTTYPE:=byte(((x shr 24) and $FF));
end;
function MEVT_EVENTPARM(x:DWORD):DWORD; inline;
begin
MEVT_EVENTPARM:=DWORD(x and $00FFFFFF);
end;
{$IFNDEF MMNOMIDI}
function MIDIPROP_PROPERTY(mp:DWORD):DWORD; inline;
begin
MIDIPROP_PROPERTY:=mp and (not (MIDIPROP_SET or MIDIPROP_GET));
end;
function SMF_TIMEDIV(format:DWORD; division:DWORD):DWORD; inline;
begin
SMF_TIMEDIV:=(format shr 15) or division;
end;
function SMF_TIMEDIV_SMPTE(smpte:DWORD; division:DWORD):DWORD; inline;
begin
SMF_TIMEDIV_SMPTE:=(smpte shl 8) or division;
end;
function SMF_TIMEDIV_ISSMPTE(dw:DWORD):DWORD; inline;
begin
SMF_TIMEDIV_ISSMPTE:=dw shr 15;
end;
function SMF_TIMEDIV_GETSMPTE(dw:DWORD):byte; inline;
begin
SMF_TIMEDIV_GETSMPTE:=byte((dw shr 8) and $ff);
end;
function SMF_TIMEDIV_GETTPF(dw:DWORD):DWORD; inline;
begin
SMF_TIMEDIV_GETTPF:=dw and $ff;
end;
function SMF_TIMEDIV_GETTPQN(dw:DWORD):DWORD; inline;
begin
SMF_TIMEDIV_GETTPQN:=dw and $7fff;
end;
{$ENDIF MMNOMIDI}
end.
|