aboutsummaryrefslogblamecommitdiffstats
path: root/Game/Code/lib/DSPack/DirectX9/DirectSound.pas
blob: f89aaafc3f164f89cd55425cfc1f585b514bfd0b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                      
{******************************************************************************}
{*                                                                            *}
{*  Copyright (C) Microsoft Corporation.  All Rights Reserved.                *}
{*                                                                            *}
{*  Files:      dsound.h                                                      *}
{*  Content:    DirectSound include file                                      *}
{*                                                                            *}
{*  DirectX 9.0 Delphi adaptation by Alexey Barkovoy                          *}
{*  E-Mail: clootie@reactor.ru                                                *}
{*                                                                            *}
{*  Modified: 27-Apr-2003                                                     *}
{*                                                                            *}
{*  Compatible with :                                                         *}
{*    DirectX 7.0 Object Pascal adaptation by                                 *}
{*      Erik Unger, e-Mail: DelphiDirectX@next-reality.com                    *}
{*                                                                            *}
{*  Latest version can be downloaded from:                                    *}
{*     http://clootie.narod.ru/delphi                                         *}
{*                                                                            *}
{******************************************************************************}
{                                                                              }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{                                                                              }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{                                                                              }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{                                                                              }
{******************************************************************************}

unit DirectSound;

interface

uses
  Windows, MMSystem, DXTypes;

(*==========================================================================;
 *
 *  Copyright (c) Microsoft Corporation.  All rights reserved.
 *
 *  File:       dsound.h
 *  Content:    DirectSound include file
 *
 **************************************************************************)

{$I DirectX.inc}

////////////////////////////////////////////////////////////////////////
// Global level dynamic loading support
{$IFDEF DYNAMIC_LINK_ALL}
  {$DEFINE DIRECTSOUND_DYNAMIC_LINK}
{$ENDIF}
{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL}
  {$DEFINE DIRECTSOUND_DYNAMIC_LINK_EXPLICIT}
{$ENDIF}

// Remove "dots" below to force some kind of dynamic linking
{.$DEFINE DIRECTSOUND_DYNAMIC_LINK}
{.$DEFINE DIRECTSOUND_DYNAMIC_LINK_EXPLICIT}

////////////////////////////////////////////////////////////////////////
// Assume for what DirectSound version we will compile headers
{$IFDEF DIRECTX7}
  {$DEFINE DIRECTSOUND_VERSION_7}
{$ENDIF}
{$IFDEF DIRECTX8}
  {$DEFINE DIRECTSOUND_VERSION_8}
{$ENDIF}
{$IFDEF DIRECTX9}
  {$DEFINE DIRECTSOUND_VERSION_9}
{$ENDIF}

{$IFNDEF DIRECTSOUND_VERSION_9}
  {$IFNDEF DIRECTSOUND_VERSION_8}
    {$IFNDEF DIRECTSOUND_VERSION_7}
// Compiling for DirectSound9 by default
       {$DEFINE DIRECTSOUND_VERSION_9}
    {$ENDIF}
  {$ENDIF}
{$ENDIF}

////////////////////////////////////////////////////////////////////////
// Emit conditionals to C++Builder compiler
{$IFDEF DIRECTSOUND_VERSION_7}
  {$HPPEMIT '#define DIRECTSOUND_VERSION         0x0700'}
{$ENDIF}
{$IFDEF DIRECTSOUND_VERSION_8}
  {$HPPEMIT '#define DIRECTSOUND_VERSION         0x0800'}
{$ENDIF}
{$IFDEF DIRECTSOUND_VERSION_9}
  {$HPPEMIT '#define DIRECTSOUND_VERSION         0x0900'}
{$ENDIF}

{$NOINCLUDE DXTypes}
(*$HPPEMIT '#include "dsound.h"' *)


////////////////////////////////////////////////////////////////////////
// Define symbols for '<=' comparision
{$IFDEF DIRECTSOUND_VERSION_9}
  {$DEFINE DIRECTSOUND_VERSION_8}
{$ENDIF}
{$IFDEF DIRECTSOUND_VERSION_8}
  {$DEFINE DIRECTSOUND_VERSION_7}
{$ENDIF}

{ Type definitions shared with Direct3D }

type
  D3DVALUE = DXTypes.D3DVALUE;
  {$EXTERNALSYM D3DVALUE}
  TD3DValue = DXTypes.TD3DValue;
  {$NODEFINE TD3DValue}
  PD3DValue = DXTypes.PD3DValue;
  {$NODEFINE PD3DValue}

  D3DCOLOR = DXTypes.D3DCOLOR;
  {$EXTERNALSYM D3DCOLOR}
  TD3DColor = DXTypes.TD3DColor;
  {$NODEFINE TD3DColor}

  _D3DVECTOR = DXTypes._D3DVECTOR;
  {$EXTERNALSYM _D3DVECTOR}
  D3DVECTOR = DXTypes.D3DVECTOR;
  {$EXTERNALSYM D3DVECTOR}
  TD3DVector = DXTypes.TD3DVector;
  {$NODEFINE TD3DVector}
  PD3DVector = DXTypes.PD3DVector;
  {$NODEFINE PD3DVector}

{$HPPEMIT ''}
{$HPPEMIT '#ifndef DX_SHARED_DEFINES_BCB'}
{$HPPEMIT ''}
{$HPPEMIT 'typedef D3DVALUE TD3DValue;'}
{$HPPEMIT 'typedef D3DVALUE *PD3DValue;'}
{$HPPEMIT ''}
{$HPPEMIT '#ifndef D3DCOLOR_DEFINED_BCB'}
{$HPPEMIT 'typedef D3DCOLOR TD3DColor;'}
{$HPPEMIT '#define D3DCOLOR_DEFINED_BCB'}
{$HPPEMIT '#endif'}
{$HPPEMIT ''}
{$HPPEMIT '#ifndef D3DVECTOR_DEFINED_BCB'}
{$HPPEMIT 'typedef _D3DVECTOR TD3DVector;'}
{$HPPEMIT 'typedef _D3DVECTOR *PD3DVector;'}
{$HPPEMIT '#define D3DVECTOR_DEFINED_BCB'}
{$HPPEMIT '#endif'}
{$HPPEMIT ''}
{$HPPEMIT '#define DX_SHARED_DEFINES_BCB'}
{$HPPEMIT '#endif // DX_SHARED_DEFINES_BCB'}
{$HPPEMIT ''}

const
  _FACDS = $878;                { DirectSound's facility code }
  {$EXTERNALSYM _FACDS}

// #define MAKE_DSHRESULT(code)  MAKE_HRESULT(1, _FACDS, code)
function MAKE_DSHRESULT(Code: DWord): DWord;
{$EXTERNALSYM MAKE_DSHRESULT}

const
  MAKE_DSHRESULT_R     = (1 shl 31) or (_FACDS shl 16);

const
  // DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000}
  CLSID_DirectSound: TGUID = '{47d4d946-62e8-11cf-93bc-444553540000}';
  {$EXTERNALSYM CLSID_DirectSound}

  // DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B}
  CLSID_DirectSound8: TGUID = '{3901cc3f-84b5-4fa4-ba35-aa8172b8a09b}';
  {$EXTERNALSYM CLSID_DirectSound8}

  // DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16}
  CLSID_DirectSoundCapture: TGUID = '{b0210780-89cd-11d0-af08-00a0c925cd16}';
  {$EXTERNALSYM CLSID_DirectSoundCapture}

  // DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1}
  CLSID_DirectSoundCapture8: TGUID = '{e4bcac13-7f99-4908-9a8e-74e3bf24b6e1}';
  {$EXTERNALSYM CLSID_DirectSoundCapture8}

  // DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D}
  CLSID_DirectSoundFullDuplex: TGUID = '{fea4300c-7959-4147-b26a-2377b9e7a91d}';
  {$EXTERNALSYM CLSID_DirectSoundFullDuplex}


  // DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03}
  DSDEVID_DefaultPlayback: TGUID = '{def00000-9c6d-47ed-aaf1-4dda8f2b5c03}';
  {$EXTERNALSYM DSDEVID_DefaultPlayback}

  // DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03}
  DSDEVID_DefaultCapture: TGUID = '{def00001-9c6d-47ed-aaf1-4dda8f2b5c03}';
  {$EXTERNALSYM DSDEVID_DefaultCapture}

  // DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03}
  DSDEVID_DefaultVoicePlayback: TGUID = '{def00002-9c6d-47ed-aaf1-4dda8f2b5c03}';
  {$EXTERNALSYM DSDEVID_DefaultVoicePlayback}

  // DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03}
  DSDEVID_DefaultVoiceCapture: TGUID = '{def00003-9c6d-47ed-aaf1-4dda8f2b5c03}';
  {$EXTERNALSYM DSDEVID_DefaultVoiceCapture}


//
// Structures
//

type
  PDSCaps = ^TDSCaps;
  _DSCAPS = packed record
    dwSize                         : DWORD;
    dwFlags                        : DWORD;
    dwMinSecondarySampleRate       : DWORD;
    dwMaxSecondarySampleRate       : DWORD;
    dwPrimaryBuffers               : DWORD;
    dwMaxHwMixingAllBuffers        : DWORD;
    dwMaxHwMixingStaticBuffers     : DWORD;
    dwMaxHwMixingStreamingBuffers  : DWORD;
    dwFreeHwMixingAllBuffers       : DWORD;
    dwFreeHwMixingStaticBuffers    : DWORD;
    dwFreeHwMixingStreamingBuffers : DWORD;
    dwMaxHw3DAllBuffers            : DWORD;
    dwMaxHw3DStaticBuffers         : DWORD;
    dwMaxHw3DStreamingBuffers      : DWORD;
    dwFreeHw3DAllBuffers           : DWORD;
    dwFreeHw3DStaticBuffers        : DWORD;
    dwFreeHw3DStreamingBuffers     : DWORD;
    dwTotalHwMemBytes              : DWORD;
    dwFreeHwMemBytes               : DWORD;
    dwMaxContigFreeHwMemBytes      : DWORD;
    dwUnlockTransferRateHwBuffers  : DWORD;
    dwPlayCpuOverheadSwBuffers     : DWORD;
    dwReserved1                    : DWORD;
    dwReserved2                    : DWORD;
  end;
  {$EXTERNALSYM _DSCAPS}
  DSCAPS = _DSCAPS;
  {$EXTERNALSYM DSCAPS}
  TDSCaps = _DSCAPS;

  PDSBcaps = ^TDSBcaps;
  _DSBCAPS = packed record
    dwSize                : DWORD;
    dwFlags               : DWORD;
    dwBufferBytes         : DWORD;
    dwUnlockTransferRate  : DWORD;
    dwPlayCpuOverhead     : DWORD;
  end;
  {$EXTERNALSYM _DSBCAPS}
  DSBCAPS = _DSBCAPS;
  {$EXTERNALSYM DSBCAPS}
  TDSBcaps = _DSBCAPS;

{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800
  {$IFDEF WIN64}
  DWORD_PTR = Int64;
  {$ELSE}
  DWORD_PTR = DWORD;
  {$ENDIF}
  {$NODEFINE DWORD_PTR}

  PDSEffectDesc = ^TDSEffectDesc;
  _DSEFFECTDESC = packed record
      dwSize        : DWORD;
      dwFlags       : DWORD;
      guidDSFXClass : TGUID;
      dwReserved1   : DWORD_PTR;
      dwReserved2   : DWORD_PTR;
  end;
  {$EXTERNALSYM _DSEFFECTDESC}
  DSEFFECTDESC = _DSEFFECTDESC;
  {$EXTERNALSYM DSEFFECTDESC}
  TDSEffectDesc = _DSEFFECTDESC;

const
  DSFX_LOCHARDWARE    = $00000001;
  {$EXTERNALSYM DSFX_LOCHARDWARE}
  DSFX_LOCSOFTWARE    = $00000002;
  {$EXTERNALSYM DSFX_LOCSOFTWARE}

  DSFXR_PRESENT          = 0;
  {$EXTERNALSYM DSFXR_PRESENT}
  DSFXR_LOCHARDWARE      = 1;
  {$EXTERNALSYM DSFXR_LOCHARDWARE}
  DSFXR_LOCSOFTWARE      = 2;
  {$EXTERNALSYM DSFXR_LOCSOFTWARE}
  DSFXR_UNALLOCATED      = 3;
  {$EXTERNALSYM DSFXR_UNALLOCATED}
  DSFXR_FAILED           = 4;
  {$EXTERNALSYM DSFXR_FAILED}
  DSFXR_UNKNOWN          = 5;
  {$EXTERNALSYM DSFXR_UNKNOWN}
  DSFXR_SENDLOOP         = 6;
  {$EXTERNALSYM DSFXR_SENDLOOP}

type
  PDSCEffectDesc = ^TDSCEffectDesc;
  _DSCEFFECTDESC = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    guidDSCFXClass: TGUID;
    guidDSCFXInstance: TGUID;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
  end;
  {$EXTERNALSYM _DSCEFFECTDESC}
  DSCEFFECTDESC = _DSCEFFECTDESC;
  {$EXTERNALSYM DSCEFFECTDESC}
  TDSCEffectDesc = _DSCEFFECTDESC;

const
  DSCFX_LOCHARDWARE   = $00000001;
  {$EXTERNALSYM DSCFX_LOCHARDWARE}
  DSCFX_LOCSOFTWARE   = $00000002;
  {$EXTERNALSYM DSCFX_LOCSOFTWARE}

  DSCFXR_LOCHARDWARE  = $00000010;
  {$EXTERNALSYM DSCFXR_LOCHARDWARE}
  DSCFXR_LOCSOFTWARE  = $00000020;
  {$EXTERNALSYM DSCFXR_LOCSOFTWARE}

{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800

type
  PDSBufferDesc = ^TDSBufferDesc;
  _DSBUFFERDESC = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwBufferBytes: DWORD;
    dwReserved: DWORD;
    lpwfxFormat: PWaveFormatEx;
{$IFDEF DIRECTSOUND_VERSION_7} // #if DIRECTSOUND_VERSION >= 0x0700
    guid3DAlgorithm: TGUID;
{$ENDIF} // DIRECTSOUND_VERSION >= 0x0700
  end;
  {$EXTERNALSYM _DSBUFFERDESC}
  DSBUFFERDESC = _DSBUFFERDESC;
  {$EXTERNALSYM DSBUFFERDESC}
  TDSBufferDesc = _DSBUFFERDESC;

// Older version of this structure:

  PDSBufferDesc1 = ^TDSBufferDesc1;
  _DSBUFFERDESC1 = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwBufferBytes: DWORD;
    dwReserved: DWORD;
    lpwfxFormat: PWaveFormatEx;
  end;
  {$EXTERNALSYM _DSBUFFERDESC1}
  DSBUFFERDESC1 = _DSBUFFERDESC1;
  {$EXTERNALSYM DSBUFFERDESC1}
  TDSBufferDesc1 = _DSBUFFERDESC1;

  PDS3DBuffer = ^TDS3DBuffer;
  _DS3DBUFFER = packed record
    dwSize: DWORD;
    vPosition: TD3DVector;
    vVelocity: TD3DVector;
    dwInsideConeAngle: DWORD;
    dwOutsideConeAngle: DWORD;
    vConeOrientation: TD3DVector;
    lConeOutsideVolume: Longint;
    flMinDistance: TD3DValue;
    flMaxDistance: TD3DValue;
    dwMode: DWORD;
  end;
  {$EXTERNALSYM _DS3DBUFFER}
  DS3DBUFFER = _DS3DBUFFER;
  {$EXTERNALSYM DS3DBUFFER}
  TDS3DBuffer = _DS3DBUFFER;

  PDS3DListener = ^TDS3DListener;
  _DS3DLISTENER = packed record
    dwSize: DWORD;
    vPosition: TD3DVector;
    vVelocity: TD3DVector;
    vOrientFront: TD3DVector;
    vOrientTop: TD3DVector;
    flDistanceFactor: TD3DValue;
    flRolloffFactor: TD3DValue;
    flDopplerFactor: TD3DValue;
  end;
  {$EXTERNALSYM _DS3DLISTENER}
  DS3DLISTENER = _DS3DLISTENER;
  {$EXTERNALSYM DS3DLISTENER}
  TDS3DListener = _DS3DLISTENER;

  PDSCcaps = ^TDSCcaps;
  _DSCCAPS = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwFormats: DWORD;
    dwChannels: DWORD;
  end;
  {$EXTERNALSYM _DSCCAPS}
  DSCCAPS = _DSCCAPS;
  {$EXTERNALSYM DSCCAPS}
  TDSCcaps = _DSCCAPS;

  PDSCBufferDesc1 = ^TDSCBufferDesc1;
  _DSCBUFFERDESC1 = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwBufferBytes: DWORD;
    dwReserved: DWORD;
    lpwfxFormat: PWaveFormatEx;
  end;
  {$EXTERNALSYM _DSCBUFFERDESC1}
  DSCBUFFERDESC1 = _DSCBUFFERDESC1;
  {$EXTERNALSYM DSCBUFFERDESC1}
  TDSCBufferDesc1 = _DSCBUFFERDESC1;

  PDSCBufferDesc = ^TDSCBufferDesc;
  _DSCBUFFERDESC = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwBufferBytes: DWORD;
    dwReserved: DWORD;
    lpwfxFormat: PWaveFormatEx;
{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800
    dwFXCount: DWORD;
    lpDSCFXDesc: PDSCEffectDesc;
{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800
  end;
  {$EXTERNALSYM _DSCBUFFERDESC}
  DSCBUFFERDESC = _DSCBUFFERDESC;
  {$EXTERNALSYM DSCBUFFERDESC}
  TDSCBufferDesc = _DSCBUFFERDESC;

  PDSCBCaps = ^TDSCBCaps;
  _DSCBCAPS = packed record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwBufferBytes: DWORD;
    dwReserved: DWORD;
  end;
  {$EXTERNALSYM _DSCBCAPS}
  DSCBCAPS = _DSCBCAPS;
  {$EXTERNALSYM DSCBCAPS}
  TDSCBCaps = _DSCBCAPS;

  PDSBPositionNotify = ^TDSBPositionNotify;
  _DSBPOSITIONNOTIFY = packed record
    dwOffset: DWORD;
    hEventNotify: THandle;
  end;
  {$EXTERNALSYM _DSBPOSITIONNOTIFY}
  DSBPOSITIONNOTIFY = _DSBPOSITIONNOTIFY;
  {$EXTERNALSYM DSBPOSITIONNOTIFY}
  TDSBPositionNotify = _DSBPOSITIONNOTIFY;


type
  PReferenceTime = ^TReferenceTime;
  REFERENCE_TIME = LONGLONG;
  {$EXTERNALSYM REFERENCE_TIME}
  TReferenceTime = REFERENCE_TIME;

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IReferenceClock);'}
  {$EXTERNALSYM IReferenceClock}
  IReferenceClock = interface(IUnknown)
    ['{56a86897-0ad4-11ce-b03a-0020af0ba770}']
    // IReferenceClock methods
    function GetTime(out pTime: TReferenceTime): HResult; stdcall;
    function AdviseTime(rtBaseTime, rtStreamTime: TReferenceTime; hEvent: THandle; out pdwAdviseCookie: DWORD): HResult; stdcall;
    function AdvisePeriodic(const rtStartTime, rtPeriodTime: TReferenceTime; hSemaphore: THandle; out pdwAdviseCookie: DWORD): HResult; stdcall;
    function Unadvise(dwAdviseCookie: DWORD): HResult; stdcall;
  end;

  IID_IReferenceClock = IReferenceClock;
  {$EXTERNALSYM IID_IReferenceClock}


  IDirectSoundBuffer = interface;

  //
  // IDirectSound
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound);'}
  {$EXTERNALSYM IDirectSound}
  IDirectSound = interface(IUnknown)
    ['{279AFA83-4981-11CE-A521-0020AF0BE560}']
    // IDirectSound methods
    function CreateSoundBuffer(const pcDSBufferDesc: TDSBufferDesc; out ppDSBuffer: IDirectSoundBuffer; pUnkOuter: IUnknown): HResult; stdcall;
    function GetCaps(out pDSCaps: TDSCaps): HResult; stdcall;
    function DuplicateSoundBuffer(pDSBufferOriginal: IDirectSoundBuffer; out ppDSBufferDuplicate: IDirectSoundBuffer): HResult; stdcall;
    function SetCooperativeLevel(hwnd: HWND; dwLevel: DWORD): HResult; stdcall;
    function Compact: HResult; stdcall;
    function GetSpeakerConfig(out pdwSpeakerConfig: DWORD): HResult; stdcall;
    function SetSpeakerConfig(dwSpeakerConfig: DWORD): HResult; stdcall;
    function Initialize(pcGuidDevice: PGUID): HResult; stdcall;
  end;

  IID_IDirectSound = IDirectSound;
  {$EXTERNALSYM IID_IDirectSound}


{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSound8
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound8);'}
  {$EXTERNALSYM IDirectSound8}
  IDirectSound8 = interface(IDirectSound)
    ['{C50A7E93-F395-4834-9EF6-7FA99DE50966}']
    // IDirectSound8 methods
    function VerifyCertification(pdwCertified: PDWORD): HResult; stdcall;
  end;

  IID_IDirectSound8 = IDirectSound8;
  {$EXTERNALSYM IID_IDirectSound8}


{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSoundBuffer
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundBuffer);'}
  {$EXTERNALSYM IDirectSoundBuffer}
  IDirectSoundBuffer = interface(IUnknown)
    ['{279AFA85-4981-11CE-A521-0020AF0BE560}']
    // IDirectSoundBuffer methods
    function GetCaps(var pDSBufferCaps: TDSBcaps): HResult; stdcall;
    function GetCurrentPosition(pdwCurrentPlayCursor, pdwCurrentWriteCursor: PDWORD): HResult; stdcall;
    function GetFormat(pwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD; pdwSizeWritten: PDWORD): HResult; stdcall;
    function GetVolume(out plVolume: Longint): HResult; stdcall;
    function GetPan(out plPan: Longint): HResult; stdcall;
    function GetFrequency(out pdwFrequency: DWORD): HResult; stdcall;
    function GetStatus(out pdwStatus: DWORD): HResult; stdcall;
    function Initialize(pDirectSound: IDirectSound; const pcDSBufferDesc: TDSBufferDesc): HResult; stdcall;
    function Lock(dwOffset, dwBytes: DWORD; out ppvAudioPtr1: Pointer; out pdwAudioBytes1: DWORD;
      out ppvAudioPtr2: Pointer; out pdwAudioBytes2: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Play(dwReserved1, dwPriority, dwFlags: DWORD): HResult; stdcall;
    function SetCurrentPosition(dwNewPosition: DWORD): HResult; stdcall;
    function SetFormat(pcfxFormat: PWaveFormatEx): HResult; stdcall;
    function SetVolume(lVolume: Longint): HResult; stdcall;
    function SetPan(lPan: Longint): HResult; stdcall;
    function SetFrequency(dwFrequency: DWORD): HResult; stdcall;
    function Stop: HResult; stdcall;
    function Unlock(pvAudioPtr1: Pointer; dwAudioBytes1: DWORD; pvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HResult; stdcall;
    function Restore: HResult; stdcall;
  end;

  IID_IDirectSoundBuffer = IDirectSoundBuffer;
  {$EXTERNALSYM IID_IDirectSoundBuffer}


{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSoundBuffer8
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundBuffer8);'}
  {$EXTERNALSYM IDirectSoundBuffer8}
  IDirectSoundBuffer8 = interface(IDirectSoundBuffer)
    ['{6825a449-7524-4d82-920f-50e36ab3ab1e}']
    // IDirectSoundBuffer8 methods
    function SetFX(dwEffectsCount: DWORD; pDSFXDesc: PDSEffectDesc; pdwResultCodes: PDWORD): HResult; stdcall;
    function AcquireResources(dwFlags, dwEffectsCount, pdwResultCodes: PDWORD): HResult; stdcall;
    function GetObjectInPath(const rguidObject: TGUID; dwIndex: DWORD; const rguidInterface: TGUID; out ppObject{IUnknown}): HResult; stdcall;
  end;

  IID_IDirectSoundBuffer8 = IDirectSoundBuffer8;
  {$EXTERNALSYM IID_IDirectSoundBuffer8}

const
  // Special GUID meaning "select all objects" for use in GetObjectInPath()
  GUID_All_Objects: TGUID = '{aa114de5-c262-4169-a1c8-23d698cc73b5}';
  {$EXTERNALSYM GUID_All_Objects}


type
{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSound3DListener
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound3DListener);'}
  {$EXTERNALSYM IDirectSound3DListener}
  IDirectSound3DListener = interface(IUnknown)
    ['{279AFA84-4981-11CE-A521-0020AF0BE560}']
    // IDirectSound3DListener methods
    function GetAllParameters(var pListener: TDS3DListener): HResult; stdcall;
    function GetDistanceFactor(out pflDistanceFactor: TD3DValue): HResult; stdcall;
    function GetDopplerFactor(out pflDopplerFactor: TD3DValue): HResult; stdcall;
    function GetOrientation(out pvOrientFront, pvOrientTop: TD3DVector): HResult; stdcall;
    function GetPosition(out pvPosition: TD3DVector): HResult; stdcall;
    function GetRolloffFactor(out pflRolloffFactor: TD3DValue): HResult; stdcall;
    function GetVelocity(out pvVelocity: TD3DVector): HResult; stdcall;
    function SetAllParameters(const pcListener: TDS3DListener; dwApply: DWORD): HResult; stdcall;
    function SetDistanceFactor(flDistanceFactor: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetDopplerFactor(flDopplerFactor: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetOrientation(xFront, yFront, zFront: TD3DValue; xTop, yTop, zTop: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetPosition(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetRolloffFactor(flRolloffFactor: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function CommitDeferredSettings: HResult; stdcall;
  end;

  IID_IDirectSound3DListener = IDirectSound3DListener;
  {$EXTERNALSYM IID_IDirectSound3DListener}


  //
  // IDirectSound3DBuffer
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound3DBuffer);'}
  {$EXTERNALSYM IDirectSound3DBuffer}
  IDirectSound3DBuffer = interface(IUnknown)
    ['{279AFA86-4981-11CE-A521-0020AF0BE560}']
    // IDirectSound3DBuffer methods
    function GetAllParameters(var pDs3dBuffer: TDS3DBuffer): HResult; stdcall;
    function GetConeAngles(var pdwInsideConeAngle, pdwOutsideConeAngle: DWORD): HResult; stdcall;
    function GetConeOrientation(out pvOrientation: TD3DVector): HResult; stdcall;
    function GetConeOutsideVolume(out plConeOutsideVolume: Longint): HResult; stdcall;
    function GetMaxDistance(out pflMaxDistance: TD3DValue): HResult; stdcall;
    function GetMinDistance(out pflMinDistance: TD3DValue): HResult; stdcall;
    function GetMode(out pdwMode: DWORD): HResult; stdcall;
    function GetPosition(out pvPosition: TD3DVector): HResult; stdcall;
    function GetVelocity(out pvVelocity: TD3DVector): HResult; stdcall;
    function SetAllParameters(const pcDs3dBuffer: TDS3DBuffer; dwApply: DWORD): HResult; stdcall;
    function SetConeAngles(dwInsideConeAngle, dwOutsideConeAngle: DWORD; dwApply: DWORD): HResult; stdcall;
    function SetConeOrientation(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetConeOutsideVolume(lConeOutsideVolume: Longint; dwApply: DWORD): HResult; stdcall;
    function SetMaxDistance(flMaxDistance: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetMinDistance(flMinDistance: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetMode(dwMode: DWORD; dwApply: DWORD): HResult; stdcall;
    function SetPosition(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
    function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall;
  end;

  IID_IDirectSound3DBuffer = IDirectSound3DBuffer;
  {$EXTERNALSYM IID_IDirectSound3DBuffer}


  IDirectSoundCaptureBuffer = interface;

  //
  // IDirectSoundCapture
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCapture);'}
  {$EXTERNALSYM IDirectSoundCapture}
  IDirectSoundCapture = interface(IUnknown)
    ['{b0210781-89cd-11d0-af08-00a0c925cd16}']
    // IDirectSoundCapture methods
    function CreateCaptureBuffer(const pcDSCBufferDesc: TDSCBufferDesc; out ppDSCBuffer: IDirectSoundCaptureBuffer; pUnkOuter: IUnknown): HResult; stdcall;
    function GetCaps(var pDSCCaps: TDSCcaps): HResult; stdcall;
    function Initialize(pcGuidDevice: PGUID): HResult; stdcall;
  end;

  IID_IDirectSoundCapture = IDirectSoundCapture;
  {$EXTERNALSYM IID_IDirectSoundCapture}


  //
  // IDirectSoundCaptureBuffer
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureBuffer);'}
  {$EXTERNALSYM IDirectSoundCaptureBuffer}
  IDirectSoundCaptureBuffer = interface(IUnknown)
    ['{b0210782-89cd-11d0-af08-00a0c925cd16}']
    // IDirectSoundCaptureBuffer methods
    function GetCaps(var pDSCBCaps: TDSCBCaps): HResult; stdcall;
    function GetCurrentPosition(pdwCapturePosition, pdwReadPosition: PDWORD): HResult; stdcall;
    function GetFormat(pwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD; pdwSizeWritten: PDWORD): HResult; stdcall;
    function GetStatus(pdwStatus: PDWORD): HResult; stdcall;
    function Initialize(pDirectSoundCapture: IDirectSoundCapture; const pcDSCBufferDesc: TDSCBufferDesc): HResult; stdcall;
    function Lock(dwOffset, dwBytes: DWORD; out ppvAudioPtr1: Pointer; out pdwAudioBytes1: DWORD; out ppvAudioPtr2: Pointer; out pdwAudioBytes2: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Start(dwFlags: DWORD): HResult; stdcall;
    function Stop: HResult; stdcall;
    function Unlock(pvAudioPtr1: Pointer; dwAudioBytes1: DWORD; pvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HResult; stdcall;
  end;

  IID_IDirectSoundCaptureBuffer = IDirectSoundCaptureBuffer;
  {$EXTERNALSYM IID_IDirectSoundCaptureBuffer}


{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSoundCaptureBuffer8
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureBuffer8);'}
  {$EXTERNALSYM IDirectSoundCaptureBuffer8}
  IDirectSoundCaptureBuffer8 = interface(IDirectSoundCaptureBuffer)
    ['{00990df4-0dbb-4872-833e-6d303e80aeb6}']
    // IDirectSoundCaptureBuffer8 methods
    function GetObjectInPath(const rguidObject: TGUID; dwIndex: DWORD; const rguidInterface: TGUID; out ppObject{IUnknown}): HResult; stdcall;
    function GetFXStatus(dwFXCount: DWORD; pdwFXStatus: PDWORD): HResult; stdcall;
  end;

  IID_IDirectSoundCaptureBuffer8 = IDirectSoundCaptureBuffer8;
  {$EXTERNALSYM IID_IDirectSoundCaptureBuffer8}

{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSoundNotify
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundNotify);'}
  {$EXTERNALSYM IDirectSoundNotify}
  IDirectSoundNotify = interface(IUnknown)
    ['{b0210783-89cd-11d0-af08-00a0c925cd16}']
    // IDirectSoundNotify methods
    function SetNotificationPositions(dwPositionNotifies: DWORD; pcPositionNotifies: PDSBPositionNotify): HResult; stdcall;
  end;

  IID_IDirectSoundNotify = IDirectSoundNotify;
  {$EXTERNALSYM IID_IDirectSoundNotify}


  //
  // IKsPropertySet
  //

const
  KSPROPERTY_SUPPORT_GET  = $00000001;
  {$EXTERNALSYM KSPROPERTY_SUPPORT_GET}
  KSPROPERTY_SUPPORT_SET  = $00000002;
  {$EXTERNALSYM KSPROPERTY_SUPPORT_SET}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IKsPropertySet);'}
  {$EXTERNALSYM IKsPropertySet}
  IKsPropertySet = interface(IUnknown)
    ['{31efac30-515c-11d0-a9aa-00aa0061be93}']
    // IKsPropertySet methods
    function Get(const rguidPropSet: TGUID; ulId: ULONG; pInstanceData: Pointer; ulInstanceLength: ULONG; pPropertyData: Pointer; ulDataLength: ULONG; out pulBytesReturned: ULONG): HResult; stdcall;
    function _Set(const rguidPropSet: TGUID; ulId: ULONG; pInstanceData: Pointer; ulInstanceLength: ULONG; pPropertyData: Pointer; ulDataLength: ULONG): HResult; stdcall;
    function QuerySupport(rguidPropSet: TGUID; ulId: ULONG; out pulTypeSupport: ULONG): HResult; stdcall;
  end;

  IID_IKsPropertySet = IKsPropertySet;
  {$EXTERNALSYM IID_IKsPropertySet}

{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800

  //
  // IDirectSoundFXGargle
  //

  PDSFXGargle = ^TDSFXGargle;
  _DSFXGargle = packed record
    dwRateHz: DWORD;               // Rate of modulation in hz
    dwWaveShape: DWORD;            // DSFXGARGLE_WAVE_xxx
  end;
  {$EXTERNALSYM _DSFXGargle}
  DSFXGargle = _DSFXGargle;
  {$EXTERNALSYM DSFXGargle}
  TDSFXGargle = _DSFXGargle;

const
  DSFXGARGLE_WAVE_TRIANGLE        = 0;
  {$EXTERNALSYM DSFXGARGLE_WAVE_TRIANGLE}
  DSFXGARGLE_WAVE_SQUARE          = 1;
  {$EXTERNALSYM DSFXGARGLE_WAVE_SQUARE}

  DSFXGARGLE_RATEHZ_MIN           = 1;
  {$EXTERNALSYM DSFXGARGLE_RATEHZ_MIN}
  DSFXGARGLE_RATEHZ_MAX           = 1000;
  {$EXTERNALSYM DSFXGARGLE_RATEHZ_MAX}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXGargle);'}
  {$EXTERNALSYM IDirectSoundFXGargle}
  IDirectSoundFXGargle = interface(IUnknown)
    ['{d616f352-d622-11ce-aac5-0020af0b99a3}']
    // IDirectSoundFXGargle methods
    function SetAllParameters(const pcDsFxGargle: TDSFXGargle): HResult; stdcall;
    function GetAllParameters(out pDsFxGargle: TDSFXGargle): HResult; stdcall;
  end;

  IID_IDirectSoundFXGargle = IDirectSoundFXGargle;
  {$EXTERNALSYM IID_IDirectSoundFXGargle}


  //
  // IDirectSoundFXChorus
  //

  PDSFXChorus = ^TDSFXChorus;
  _DSFXChorus = packed record
    fWetDryMix: Single;
    fDepth: Single;
    fFeedback: Single;
    fFrequency: Single;
    lWaveform: Longint;          // LFO shape; DSFXCHORUS_WAVE_xxx
    fDelay: Single;
    lPhase: Longint;
  end;
  {$EXTERNALSYM _DSFXChorus}
  DSFXChorus = _DSFXChorus;
  {$EXTERNALSYM DSFXChorus}
  TDSFXChorus = _DSFXChorus;

const
  DSFXCHORUS_WAVE_TRIANGLE        = 0;
  {$EXTERNALSYM DSFXCHORUS_WAVE_TRIANGLE}
  DSFXCHORUS_WAVE_SIN             = 1;
  {$EXTERNALSYM DSFXCHORUS_WAVE_SIN}

  DSFXCHORUS_WETDRYMIX_MIN        = 0.0;
  {$EXTERNALSYM DSFXCHORUS_WETDRYMIX_MIN}
  DSFXCHORUS_WETDRYMIX_MAX        = 100.0;
  {$EXTERNALSYM DSFXCHORUS_WETDRYMIX_MAX}
  DSFXCHORUS_DEPTH_MIN            = 0.0;
  {$EXTERNALSYM DSFXCHORUS_DEPTH_MIN}
  DSFXCHORUS_DEPTH_MAX            = 100.0;
  {$EXTERNALSYM DSFXCHORUS_DEPTH_MAX}
  DSFXCHORUS_FEEDBACK_MIN         = -99.0;
  {$EXTERNALSYM DSFXCHORUS_FEEDBACK_MIN}
  DSFXCHORUS_FEEDBACK_MAX         = 99.0;
  {$EXTERNALSYM DSFXCHORUS_FEEDBACK_MAX}
  DSFXCHORUS_FREQUENCY_MIN        = 0.0;
  {$EXTERNALSYM DSFXCHORUS_FREQUENCY_MIN}
  DSFXCHORUS_FREQUENCY_MAX        = 10.0;
  {$EXTERNALSYM DSFXCHORUS_FREQUENCY_MAX}
  DSFXCHORUS_DELAY_MIN            = 0.0;
  {$EXTERNALSYM DSFXCHORUS_DELAY_MIN}
  DSFXCHORUS_DELAY_MAX            = 20.0;
  {$EXTERNALSYM DSFXCHORUS_DELAY_MAX}
  DSFXCHORUS_PHASE_MIN            = 0;
  {$EXTERNALSYM DSFXCHORUS_PHASE_MIN}
  DSFXCHORUS_PHASE_MAX            = 4;
  {$EXTERNALSYM DSFXCHORUS_PHASE_MAX}

  DSFXCHORUS_PHASE_NEG_180        = 0;
  {$EXTERNALSYM DSFXCHORUS_PHASE_NEG_180}
  DSFXCHORUS_PHASE_NEG_90         = 1;
  {$EXTERNALSYM DSFXCHORUS_PHASE_NEG_90}
  DSFXCHORUS_PHASE_ZERO           = 2;
  {$EXTERNALSYM DSFXCHORUS_PHASE_ZERO}
  DSFXCHORUS_PHASE_90             = 3;
  {$EXTERNALSYM DSFXCHORUS_PHASE_90}
  DSFXCHORUS_PHASE_180            = 4;
  {$EXTERNALSYM DSFXCHORUS_PHASE_180}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXChorus);'}
  {$EXTERNALSYM IDirectSoundFXChorus}
  IDirectSoundFXChorus = interface(IUnknown)
    ['{880842e3-145f-43e6-a934-a71806e50547}']
    // IDirectSoundFXChorus methods
    function SetAllParameters(const pcDsFxChorus: TDSFXChorus): HResult; stdcall;
    function GetAllParameters(out pDsFxChorus: TDSFXChorus): HResult; stdcall;
  end;

  IID_IDirectSoundFXChorus = IDirectSoundFXChorus;
  {$EXTERNALSYM IID_IDirectSoundFXChorus}


  //
  // IDirectSoundFXFlanger
  //

  PDSFXFlanger = ^TDSFXFlanger;
  _DSFXFlanger = packed record
    fWetDryMix: Single;
    fDepth: Single;
    fFeedback: Single;
    fFrequency: Single;
    lWaveform: Longint;
    fDelay: Single;
    lPhase: Longint;
  end;
  {$EXTERNALSYM _DSFXFlanger}
  DSFXFlanger = _DSFXFlanger;
  {$EXTERNALSYM DSFXFlanger}
  TDSFXFlanger = _DSFXFlanger;

const
  DSFXFLANGER_WAVE_TRIANGLE       = 0;
  {$EXTERNALSYM DSFXFLANGER_WAVE_TRIANGLE}
  DSFXFLANGER_WAVE_SIN            = 1;
  {$EXTERNALSYM DSFXFLANGER_WAVE_SIN}

  DSFXFLANGER_WETDRYMIX_MIN       = 0.0;
  {$EXTERNALSYM DSFXFLANGER_WETDRYMIX_MIN}
  DSFXFLANGER_WETDRYMIX_MAX       = 100.0;
  {$EXTERNALSYM DSFXFLANGER_WETDRYMIX_MAX}
  DSFXFLANGER_FREQUENCY_MIN       = 0.0;
  {$EXTERNALSYM DSFXFLANGER_FREQUENCY_MIN}
  DSFXFLANGER_FREQUENCY_MAX       = 10.0;
  {$EXTERNALSYM DSFXFLANGER_FREQUENCY_MAX}
  DSFXFLANGER_DEPTH_MIN           = 0.0;
  {$EXTERNALSYM DSFXFLANGER_DEPTH_MIN}
  DSFXFLANGER_DEPTH_MAX           = 100.0;
  {$EXTERNALSYM DSFXFLANGER_DEPTH_MAX}
  DSFXFLANGER_PHASE_MIN           = 0;
  {$EXTERNALSYM DSFXFLANGER_PHASE_MIN}
  DSFXFLANGER_PHASE_MAX           = 4;
  {$EXTERNALSYM DSFXFLANGER_PHASE_MAX}
  DSFXFLANGER_FEEDBACK_MIN        = -99.0;
  {$EXTERNALSYM DSFXFLANGER_FEEDBACK_MIN}
  DSFXFLANGER_FEEDBACK_MAX        = 99.0;
  {$EXTERNALSYM DSFXFLANGER_FEEDBACK_MAX}
  DSFXFLANGER_DELAY_MIN           = 0.0;
  {$EXTERNALSYM DSFXFLANGER_DELAY_MIN}
  DSFXFLANGER_DELAY_MAX           = 4.0;
  {$EXTERNALSYM DSFXFLANGER_DELAY_MAX}

  DSFXFLANGER_PHASE_NEG_180       = 0;
  {$EXTERNALSYM DSFXFLANGER_PHASE_NEG_180}
  DSFXFLANGER_PHASE_NEG_90        = 1;
  {$EXTERNALSYM DSFXFLANGER_PHASE_NEG_90}
  DSFXFLANGER_PHASE_ZERO          = 2;
  {$EXTERNALSYM DSFXFLANGER_PHASE_ZERO}
  DSFXFLANGER_PHASE_90            = 3;
  {$EXTERNALSYM DSFXFLANGER_PHASE_90}
  DSFXFLANGER_PHASE_180           = 4;
  {$EXTERNALSYM DSFXFLANGER_PHASE_180}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXFlanger);'}
  {$EXTERNALSYM IDirectSoundFXFlanger}
  IDirectSoundFXFlanger = interface(IUnknown)
    ['{903e9878-2c92-4072-9b2c-ea68f5396783}']
    // IDirectSoundFXFlanger methods
    function SetAllParameters(const pcDsFxFlanger: TDSFXFlanger): HResult; stdcall;
    function GetAllParameters(out pDsFxFlanger: TDSFXFlanger): HResult; stdcall;
  end;

  IID_IDirectSoundFXFlanger = IDirectSoundFXFlanger;
  {$EXTERNALSYM IID_IDirectSoundFXFlanger}


  //
  // IDirectSoundFXEcho
  //

  PDSFXEcho = ^TDSFXEcho;
  _DSFXEcho = packed record
    fWetDryMix: Single;
    fFeedback: Single;
    fLeftDelay: Single;
    fRightDelay: Single;
    lPanDelay: Longint;
  end;
  {$EXTERNALSYM _DSFXEcho}
  DSFXEcho = _DSFXEcho;
  {$EXTERNALSYM DSFXEcho}
  TDSFXEcho = _DSFXEcho;

const
  DSFXECHO_WETDRYMIX_MIN      = 0.0;
  {$EXTERNALSYM DSFXECHO_WETDRYMIX_MIN}
  DSFXECHO_WETDRYMIX_MAX      = 100.0;
  {$EXTERNALSYM DSFXECHO_WETDRYMIX_MAX}
  DSFXECHO_FEEDBACK_MIN       = 0.0;
  {$EXTERNALSYM DSFXECHO_FEEDBACK_MIN}
  DSFXECHO_FEEDBACK_MAX       = 100.0;
  {$EXTERNALSYM DSFXECHO_FEEDBACK_MAX}
  DSFXECHO_LEFTDELAY_MIN      = 1.0;
  {$EXTERNALSYM DSFXECHO_LEFTDELAY_MIN}
  DSFXECHO_LEFTDELAY_MAX      = 2000.0;
  {$EXTERNALSYM DSFXECHO_LEFTDELAY_MAX}
  DSFXECHO_RIGHTDELAY_MIN     = 1.0;
  {$EXTERNALSYM DSFXECHO_RIGHTDELAY_MIN}
  DSFXECHO_RIGHTDELAY_MAX     = 2000.0;
  {$EXTERNALSYM DSFXECHO_RIGHTDELAY_MAX}
  DSFXECHO_PANDELAY_MIN       = 0;
  {$EXTERNALSYM DSFXECHO_PANDELAY_MIN}
  DSFXECHO_PANDELAY_MAX       = 1;
  {$EXTERNALSYM DSFXECHO_PANDELAY_MAX}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXEcho);'}
  {$EXTERNALSYM IDirectSoundFXEcho}
  IDirectSoundFXEcho = interface(IUnknown)
    ['{8bd28edf-50db-4e92-a2bd-445488d1ed42}']
    // IDirectSoundFXEcho methods
    function SetAllParameters(const pcDsFxEcho: TDSFXEcho): HResult; stdcall;
    function GetAllParameters(out pDsFxEcho: TDSFXEcho): HResult; stdcall;
  end;

  IID_IDirectSoundFXEcho = IDirectSoundFXEcho;
  {$EXTERNALSYM IID_IDirectSoundFXEcho}


  //
  // IDirectSoundFXDistortion
  //

  PDSFXDistortion = ^TDSFXDistortion;
  _DSFXDistortion = packed record
    fGain: Single;
    fEdge: Single;
    fPostEQCenterFrequency: Single;
    fPostEQBandwidth: Single;
    fPreLowpassCutoff: Single;
  end;
  {$EXTERNALSYM _DSFXDistortion}
  DSFXDistortion = _DSFXDistortion;
  {$EXTERNALSYM DSFXDistortion}
  TDSFXDistortion = _DSFXDistortion;

const
  DSFXDISTORTION_GAIN_MIN                     = -60.0;
  {$EXTERNALSYM DSFXDISTORTION_GAIN_MIN}
  DSFXDISTORTION_GAIN_MAX                     = 0.0;
  {$EXTERNALSYM DSFXDISTORTION_GAIN_MAX}
  DSFXDISTORTION_EDGE_MIN                     = 0.0;
  {$EXTERNALSYM DSFXDISTORTION_EDGE_MIN}
  DSFXDISTORTION_EDGE_MAX                     = 100.0;
  {$EXTERNALSYM DSFXDISTORTION_EDGE_MAX}
  DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN    = 100.0;
  {$EXTERNALSYM DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN}
  DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX    = 8000.0;
  {$EXTERNALSYM DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX}
  DSFXDISTORTION_POSTEQBANDWIDTH_MIN          = 100.0;
  {$EXTERNALSYM DSFXDISTORTION_POSTEQBANDWIDTH_MIN}
  DSFXDISTORTION_POSTEQBANDWIDTH_MAX          = 8000.0;
  {$EXTERNALSYM DSFXDISTORTION_POSTEQBANDWIDTH_MAX}
  DSFXDISTORTION_PRELOWPASSCUTOFF_MIN         = 100.0;
  {$EXTERNALSYM DSFXDISTORTION_PRELOWPASSCUTOFF_MIN}
  DSFXDISTORTION_PRELOWPASSCUTOFF_MAX         = 8000.0;
  {$EXTERNALSYM DSFXDISTORTION_PRELOWPASSCUTOFF_MAX}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXDistortion);'}
  {$EXTERNALSYM IDirectSoundFXDistortion}
  IDirectSoundFXDistortion = interface(IUnknown)
    ['{8ecf4326-455f-4d8b-bda9-8d5d3e9e3e0b}']
    // IDirectSoundFXDistortion methods
    function SetAllParameters(const pcDsFxDistortion: TDSFXDistortion): HResult; stdcall;
    function GetAllParameters(out pDsFxDistortion: TDSFXDistortion): HResult; stdcall;
  end;

  IID_IDirectSoundFXDistortion = IDirectSoundFXDistortion;
  {$EXTERNALSYM IID_IDirectSoundFXDistortion}


  //
  // IDirectSoundFXCompressor
  //

  PDSFXCompressor = ^TDSFXCompressor;
  _DSFXCompressor = packed record
    fGain: Single;
    fAttack: Single;
    fRelease: Single;
    fThreshold: Single;
    fRatio: Single;
    fPredelay: Single;
  end;
  {$EXTERNALSYM _DSFXCompressor}
  DSFXCompressor = _DSFXCompressor;
  {$EXTERNALSYM DSFXCompressor}
  TDSFXCompressor = _DSFXCompressor;

const
  DSFXCOMPRESSOR_GAIN_MIN             = -60.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_GAIN_MIN}
  DSFXCOMPRESSOR_GAIN_MAX             = 60.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_GAIN_MAX}
  DSFXCOMPRESSOR_ATTACK_MIN           = 0.01;
  {$EXTERNALSYM DSFXCOMPRESSOR_ATTACK_MIN}
  DSFXCOMPRESSOR_ATTACK_MAX           = 500.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_ATTACK_MAX}
  DSFXCOMPRESSOR_RELEASE_MIN          = 50.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_RELEASE_MIN}
  DSFXCOMPRESSOR_RELEASE_MAX          = 3000.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_RELEASE_MAX}
  DSFXCOMPRESSOR_THRESHOLD_MIN        = -60.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_THRESHOLD_MIN}
  DSFXCOMPRESSOR_THRESHOLD_MAX        = 0.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_THRESHOLD_MAX}
  DSFXCOMPRESSOR_RATIO_MIN            = 1.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_RATIO_MIN}
  DSFXCOMPRESSOR_RATIO_MAX            = 100.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_RATIO_MAX}
  DSFXCOMPRESSOR_PREDELAY_MIN         = 0.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_PREDELAY_MIN}
  DSFXCOMPRESSOR_PREDELAY_MAX         = 4.0;
  {$EXTERNALSYM DSFXCOMPRESSOR_PREDELAY_MAX}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXCompressor);'}
  {$EXTERNALSYM IDirectSoundFXCompressor}
  IDirectSoundFXCompressor = interface(IUnknown)
    ['{4bbd1154-62f6-4e2c-a15c-d3b6c417f7a0}']
    // IDirectSoundFXCompressor methods
    function SetAllParameters(const pcDsFxCompressor: TDSFXCompressor): HResult; stdcall;
    function GetAllParameters(out pDsFxCompressor: TDSFXCompressor): HResult; stdcall;
  end;

  IID_IDirectSoundFXCompressor = IDirectSoundFXCompressor;
  {$EXTERNALSYM IID_IDirectSoundFXCompressor}


  //
  // IDirectSoundFXParamEq
  //

  PDSFXParamEq = ^TDSFXParamEq;
  _DSFXParamEq = packed record
    fCenter: Single;
    fBandwidth: Single;
    fGain: Single;
  end;
  {$EXTERNALSYM _DSFXParamEq}
  DSFXParamEq = _DSFXParamEq;
  {$EXTERNALSYM DSFXParamEq}
  TDSFXParamEq = _DSFXParamEq;

const
  DSFXPARAMEQ_CENTER_MIN      = 80.0;
  {$EXTERNALSYM DSFXPARAMEQ_CENTER_MIN}
  DSFXPARAMEQ_CENTER_MAX      = 16000.0;
  {$EXTERNALSYM DSFXPARAMEQ_CENTER_MAX}
  DSFXPARAMEQ_BANDWIDTH_MIN   = 1.0;
  {$EXTERNALSYM DSFXPARAMEQ_BANDWIDTH_MIN}
  DSFXPARAMEQ_BANDWIDTH_MAX   = 36.0;
  {$EXTERNALSYM DSFXPARAMEQ_BANDWIDTH_MAX}
  DSFXPARAMEQ_GAIN_MIN        = -15.0;
  {$EXTERNALSYM DSFXPARAMEQ_GAIN_MIN}
  DSFXPARAMEQ_GAIN_MAX        = 15.0;
  {$EXTERNALSYM DSFXPARAMEQ_GAIN_MAX}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXParamEq);'}
  {$EXTERNALSYM IDirectSoundFXParamEq}
  IDirectSoundFXParamEq = interface(IUnknown)
    ['{c03ca9fe-fe90-4204-8078-82334cd177da}']
    // IDirectSoundFXParamEq methods
    function SetAllParameters(const pcDsFxParamEq: TDSFXParamEq): HResult; stdcall;
    function GetAllParameters(out pDsFxParamEq: TDSFXParamEq): HResult; stdcall;
  end;

  IID_IDirectSoundFXParamEq = IDirectSoundFXParamEq;
  {$EXTERNALSYM IID_IDirectSoundFXParamEq}


  //
  // IDirectSoundFXI3DL2Reverb
  //

  PDSFXI3DL2Reverb = ^TDSFXI3DL2Reverb;
  _DSFXI3DL2Reverb = packed record
    lRoom: Longint;                  // [-10000, 0]      default: -1000 mB
    lRoomHF: Longint;                // [-10000, 0]      default: 0 mB
    flRoomRolloffFactor: Single;     // [0.0, 10.0]      default: 0.0
    flDecayTime: Single;             // [0.1, 20.0]      default: 1.49s
    flDecayHFRatio: Single;          // [0.1, 2.0]       default: 0.83
    lReflections: Longint;           // [-10000, 1000]   default: -2602 mB
    flReflectionsDelay: Single;      // [0.0, 0.3]       default: 0.007 s
    lReverb: Longint;                // [-10000, 2000]   default: 200 mB
    flReverbDelay: Single;           // [0.0, 0.1]       default: 0.011 s
    flDiffusion: Single;             // [0.0, 100.0]     default: 100.0 %
    flDensity: Single;               // [0.0, 100.0]     default: 100.0 %
    flHFReference: Single;           // [20.0, 20000.0]  default: 5000.0 Hz
  end;
  {$EXTERNALSYM _DSFXI3DL2Reverb}
  DSFXI3DL2Reverb = _DSFXI3DL2Reverb;
  {$EXTERNALSYM DSFXI3DL2Reverb}
  TDSFXI3DL2Reverb = _DSFXI3DL2Reverb;

const
  DSFX_I3DL2REVERB_ROOM_MIN                   = (-10000);
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOM_MIN}
  DSFX_I3DL2REVERB_ROOM_MAX                   = 0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOM_MAX}
  DSFX_I3DL2REVERB_ROOM_DEFAULT               = (-1000);
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOM_DEFAULT}

  DSFX_I3DL2REVERB_ROOMHF_MIN                 = (-10000);
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMHF_MIN}
  DSFX_I3DL2REVERB_ROOMHF_MAX                 = 0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMHF_MAX}
  DSFX_I3DL2REVERB_ROOMHF_DEFAULT             = (-100);
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMHF_DEFAULT}

  DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN      = 0.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN}
  DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX      = 10.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX}
  DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT  = 0.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT}

  DSFX_I3DL2REVERB_DECAYTIME_MIN              = 0.1;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYTIME_MIN}
  DSFX_I3DL2REVERB_DECAYTIME_MAX              = 20.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYTIME_MAX}
  DSFX_I3DL2REVERB_DECAYTIME_DEFAULT          = 1.49;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYTIME_DEFAULT}

  DSFX_I3DL2REVERB_DECAYHFRATIO_MIN           = 0.1;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYHFRATIO_MIN}
  DSFX_I3DL2REVERB_DECAYHFRATIO_MAX           = 2.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYHFRATIO_MAX}
  DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT       = 0.83;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT}

  DSFX_I3DL2REVERB_REFLECTIONS_MIN            = (-10000);
  {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONS_MIN}
  DSFX_I3DL2REVERB_REFLECTIONS_MAX            = 1000;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONS_MAX}
  DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT        = (-2602);
  {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT}

  DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN       = 0.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN}
  DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX       = 0.3;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX}
  DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT   = 0.007;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT}

  DSFX_I3DL2REVERB_REVERB_MIN                 = (-10000);
  {$EXTERNALSYM DSFX_I3DL2REVERB_REVERB_MIN}
  DSFX_I3DL2REVERB_REVERB_MAX                 = 2000;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REVERB_MAX}
  DSFX_I3DL2REVERB_REVERB_DEFAULT             = (200);
  {$EXTERNALSYM DSFX_I3DL2REVERB_REVERB_DEFAULT}

  DSFX_I3DL2REVERB_REVERBDELAY_MIN            = 0.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REVERBDELAY_MIN}
  DSFX_I3DL2REVERB_REVERBDELAY_MAX            = 0.1;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REVERBDELAY_MAX}
  DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT        = 0.011;
  {$EXTERNALSYM DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT}

  DSFX_I3DL2REVERB_DIFFUSION_MIN              = 0.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DIFFUSION_MIN}
  DSFX_I3DL2REVERB_DIFFUSION_MAX              = 100.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DIFFUSION_MAX}
  DSFX_I3DL2REVERB_DIFFUSION_DEFAULT          = 100.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DIFFUSION_DEFAULT}

  DSFX_I3DL2REVERB_DENSITY_MIN                = 0.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DENSITY_MIN}
  DSFX_I3DL2REVERB_DENSITY_MAX                = 100.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DENSITY_MAX}
  DSFX_I3DL2REVERB_DENSITY_DEFAULT            = 100.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_DENSITY_DEFAULT}

  DSFX_I3DL2REVERB_HFREFERENCE_MIN            = 20.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_HFREFERENCE_MIN}
  DSFX_I3DL2REVERB_HFREFERENCE_MAX            = 20000.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_HFREFERENCE_MAX}
  DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT        = 5000.0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT}

  DSFX_I3DL2REVERB_QUALITY_MIN                = 0;
  {$EXTERNALSYM DSFX_I3DL2REVERB_QUALITY_MIN}
  DSFX_I3DL2REVERB_QUALITY_MAX                = 3;
  {$EXTERNALSYM DSFX_I3DL2REVERB_QUALITY_MAX}
  DSFX_I3DL2REVERB_QUALITY_DEFAULT            = 2;
  {$EXTERNALSYM DSFX_I3DL2REVERB_QUALITY_DEFAULT}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXI3DL2Reverb);'}
  {$EXTERNALSYM IDirectSoundFXI3DL2Reverb}
  IDirectSoundFXI3DL2Reverb = interface(IUnknown)
    ['{4b166a6a-0d66-43f3-80e3-ee6280dee1a4}']
    // IDirectSoundFXI3DL2Reverb methods
    function SetAllParameters(const pcDsFxI3DL2Reverb: TDSFXI3DL2Reverb): HResult; stdcall;
    function GetAllParameters(out pDsFxI3DL2Reverb: TDSFXI3DL2Reverb): HResult; stdcall;
    function SetPreset(dwPreset: DWORD): HResult; stdcall;
    function GetPreset(out pdwPreset: DWORD): HResult; stdcall;
    function SetQuality(lQuality: Longint): HResult; stdcall;
    function GetQuality(out plQuality: Longint): HResult; stdcall;
  end;

  IID_IDirectSoundFXI3DL2Reverb = IDirectSoundFXI3DL2Reverb;
  {$EXTERNALSYM IID_IDirectSoundFXI3DL2Reverb}


  //
  // IDirectSoundFXWavesReverb
  //

  PDSFXWavesReverb = ^TDSFXWavesReverb;
  _DSFXWavesReverb = packed record
    fInGain: Single;                // [-96.0,0.0]            default: 0.0 dB
    fReverbMix: Single;             // [-96.0,0.0]            default: 0.0 db
    fReverbTime: Single;            // [0.001,3000.0]         default: 1000.0 ms
    fHighFreqRTRatio: Single;       // [0.001,0.999]          default: 0.001
  end;
  {$EXTERNALSYM _DSFXWavesReverb}
  DSFXWavesReverb = _DSFXWavesReverb;
  {$EXTERNALSYM DSFXWavesReverb}
  TDSFXWavesReverb = _DSFXWavesReverb;

const
  DSFX_WAVESREVERB_INGAIN_MIN                 = -96.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_INGAIN_MIN}
  DSFX_WAVESREVERB_INGAIN_MAX                 = 0.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_INGAIN_MAX}
  DSFX_WAVESREVERB_INGAIN_DEFAULT             = 0.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_INGAIN_DEFAULT}
  DSFX_WAVESREVERB_REVERBMIX_MIN              = -96.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_REVERBMIX_MIN}
  DSFX_WAVESREVERB_REVERBMIX_MAX              = 0.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_REVERBMIX_MAX}
  DSFX_WAVESREVERB_REVERBMIX_DEFAULT          = 0.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_REVERBMIX_DEFAULT}
  DSFX_WAVESREVERB_REVERBTIME_MIN             = 0.001;
  {$EXTERNALSYM DSFX_WAVESREVERB_REVERBTIME_MIN}
  DSFX_WAVESREVERB_REVERBTIME_MAX             = 3000.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_REVERBTIME_MAX}
  DSFX_WAVESREVERB_REVERBTIME_DEFAULT         = 1000.0;
  {$EXTERNALSYM DSFX_WAVESREVERB_REVERBTIME_DEFAULT}
  DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN        = 0.001;
  {$EXTERNALSYM DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN}
  DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX        = 0.999;
  {$EXTERNALSYM DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX}
  DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT    = 0.001;
  {$EXTERNALSYM DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXWavesReverb);'}
  {$EXTERNALSYM IDirectSoundFXWavesReverb}
  IDirectSoundFXWavesReverb = interface(IUnknown)
    ['{46858c3a-0dc6-45e3-b760-d4eef16cb325}']
    // IDirectSoundFXWavesReverb methods
    function SetAllParameters(const pcDsFxWavesReverb: TDSFXWavesReverb): HResult; stdcall;
    function GetAllParameters(out pDsFxWavesReverb: TDSFXWavesReverb): HResult; stdcall;
  end;

  IID_IDirectSoundFXWavesReverb = IDirectSoundFXWavesReverb;
  {$EXTERNALSYM IID_IDirectSoundFXWavesReverb}

  
  //
  // IDirectSoundCaptureFXAec
  //

  PDSCFXAec = ^TDSCFXAec;
  _DSCFXAec = packed record
    fEnable: BOOL;
    fNoiseFill: BOOL;
    dwMode: DWORD;
  end;
  {$EXTERNALSYM _DSCFXAec}
  DSCFXAec = _DSCFXAec;
  {$EXTERNALSYM DSCFXAec}
  TDSCFXAec = _DSCFXAec;

const
  // These match the AEC_MODE_* constants in the DDK's ksmedia.h file
  DSCFX_AEC_MODE_PASS_THROUGH                     = $0;
  {$EXTERNALSYM DSCFX_AEC_MODE_PASS_THROUGH}
  DSCFX_AEC_MODE_HALF_DUPLEX                      = $1;
  {$EXTERNALSYM DSCFX_AEC_MODE_HALF_DUPLEX}
  DSCFX_AEC_MODE_FULL_DUPLEX                      = $2;
  {$EXTERNALSYM DSCFX_AEC_MODE_FULL_DUPLEX}

  // These match the AEC_STATUS_* constants in ksmedia.h
  DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED          = $0;
  {$EXTERNALSYM DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED}
  DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED = $1;
  {$EXTERNALSYM DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED}
  DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED    = $2;
  {$EXTERNALSYM DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED}
  DSCFX_AEC_STATUS_CURRENTLY_CONVERGED            = $8;
  {$EXTERNALSYM DSCFX_AEC_STATUS_CURRENTLY_CONVERGED}

type
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureFXAec);'}
  {$EXTERNALSYM IDirectSoundCaptureFXAec}
  IDirectSoundCaptureFXAec = interface(IUnknown)
    ['{ad74143d-903d-4ab7-8066-28d363036d65}']
    // IDirectSoundCaptureFXAec methods
    function SetAllParameters(const pDscFxAec: TDSCFXAec): HResult; stdcall;
    function GetAllParameters(out pDscFxAec: TDSCFXAec): HResult; stdcall;
    function GetStatus(out pdwStatus: DWORD): HResult; stdcall;
    function Reset: HResult; stdcall;
  end;

  IID_IDirectSoundCaptureFXAec = IDirectSoundCaptureFXAec;
  {$EXTERNALSYM IID_IDirectSoundCaptureFXAec}


  //
  // IDirectSoundCaptureFXNoiseSuppress
  //

  PDSCFXNoiseSuppress = ^TDSCFXNoiseSuppress;
  _DSCFXNoiseSuppress = packed record
    fEnable:    BOOL;
  end;
  {$EXTERNALSYM _DSCFXNoiseSuppress}
  DSCFXNoiseSuppress = _DSCFXNoiseSuppress;
  {$EXTERNALSYM DSCFXNoiseSuppress}
  TDSCFXNoiseSuppress = _DSCFXNoiseSuppress;

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureFXNoiseSuppress);'}
  {$EXTERNALSYM IDirectSoundCaptureFXNoiseSuppress}
  IDirectSoundCaptureFXNoiseSuppress = interface(IUnknown)
    ['{ed311e41-fbae-4175-9625-cd0854f693ca}']
    // IDirectSoundCaptureFXNoiseSuppress methods
    function SetAllParameters(const pcDscFxNoiseSuppress: TDSCFXNoiseSuppress): HResult; stdcall;
    function GetAllParameters(out pDscFxNoiseSuppress: TDSCFXNoiseSuppress): HResult; stdcall;
    function Reset: HResult; stdcall;
  end;

  IID_IDirectSoundCaptureFXNoiseSuppress = IDirectSoundCaptureFXNoiseSuppress;
  {$EXTERNALSYM IID_IDirectSoundCaptureFXNoiseSuppress}


  //
  // IDirectSoundFullDuplex
  //

  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFullDuplex);'}
  {$EXTERNALSYM IDirectSoundFullDuplex}
  IDirectSoundFullDuplex = interface(IUnknown)
    ['{edcb4c7a-daab-4216-a42e-6c50596ddc1d}']
    // IDirectSoundFullDuplex methods
    function Initialize(pCaptureGuid, pRenderGuid: PGUID;
      const lpDscBufferDesc: TDSCBufferDesc; const lpDsBufferDesc: TDSBufferDesc;
      hWnd: HWND; dwLevel: DWORD;
      out lplpDirectSoundCaptureBuffer8: IDirectSoundCaptureBuffer8;
      out lplpDirectSoundBuffer8: IDirectSoundBuffer8): HResult; stdcall;
  end;

  IID_IDirectSoundFullDuplex = IDirectSoundFullDuplex;
  {$EXTERNALSYM IID_IDirectSoundFullDuplex}


{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800

//
// DirectSound 8.0 interfaces.
//

{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800
// IDirectSound8, IDirectSoundBuffer8 and IDirectSoundCaptureBuffer8 are the
// only DirectSound 7.0 interfaces with changed functionality in version 8.0.
// The other level 8 interfaces as equivalent to their level 7 counterparts:
type
  IDirectSoundCapture8            = IDirectSoundCapture;
  {$EXTERNALSYM IDirectSoundCapture8}
  IDirectSound3DListener8         = IDirectSound3DListener;
  {$EXTERNALSYM IDirectSound3DListener8}
  IDirectSound3DBuffer8           = IDirectSound3DBuffer;
  {$EXTERNALSYM IDirectSound3DBuffer8}
  IDirectSoundNotify8             = IDirectSoundNotify;
  {$EXTERNALSYM IDirectSoundNotify8}
  IDirectSoundFXGargle8           = IDirectSoundFXGargle;
  {$EXTERNALSYM IDirectSoundFXGargle8}
  IDirectSoundFXChorus8           = IDirectSoundFXChorus;
  {$EXTERNALSYM IDirectSoundFXChorus8}
  IDirectSoundFXFlanger8          = IDirectSoundFXFlanger;
  {$EXTERNALSYM IDirectSoundFXFlanger8}
  IDirectSoundFXEcho8             = IDirectSoundFXEcho;
  {$EXTERNALSYM IDirectSoundFXEcho8}
  IDirectSoundFXDistortion8       = IDirectSoundFXDistortion;
  {$EXTERNALSYM IDirectSoundFXDistortion8}
  IDirectSoundFXCompressor8       = IDirectSoundFXCompressor;
  {$EXTERNALSYM IDirectSoundFXCompressor8}
  IDirectSoundFXParamEq8          = IDirectSoundFXParamEq;
  {$EXTERNALSYM IDirectSoundFXParamEq8}
  IDirectSoundFXWavesReverb8      = IDirectSoundFXWavesReverb;
  {$EXTERNALSYM IDirectSoundFXWavesReverb8}
  IDirectSoundFXI3DL2Reverb8      = IDirectSoundFXI3DL2Reverb;
  {$EXTERNALSYM IDirectSoundFXI3DL2Reverb8}
  IDirectSoundCaptureFXAec8       = IDirectSoundCaptureFXAec;
  {$EXTERNALSYM IDirectSoundCaptureFXAec8}
  IDirectSoundCaptureFXNoiseSuppress8 = IDirectSoundCaptureFXNoiseSuppress;
  {$EXTERNALSYM IDirectSoundCaptureFXNoiseSuppress8}
  IDirectSoundFullDuplex8         = IDirectSoundFullDuplex;
  {$EXTERNALSYM IDirectSoundFullDuplex8}

  //
  // IID definitions for the unchanged DirectSound 8.0 interfaces
  //

  IID_IDirectSoundCapture8            = IID_IDirectSoundCapture;
  {$EXTERNALSYM IID_IDirectSoundCapture8}
  IID_IDirectSound3DListener8         = IID_IDirectSound3DListener;
  {$EXTERNALSYM IID_IDirectSound3DListener8}
  IID_IDirectSound3DBuffer8           = IID_IDirectSound3DBuffer;
  {$EXTERNALSYM IID_IDirectSound3DBuffer8}
  IID_IDirectSoundNotify8             = IID_IDirectSoundNotify;
  {$EXTERNALSYM IID_IDirectSoundNotify8}
  IID_IDirectSoundFXGargle8           = IID_IDirectSoundFXGargle;
  {$EXTERNALSYM IID_IDirectSoundFXGargle8}
  IID_IDirectSoundFXChorus8           = IID_IDirectSoundFXChorus;
  {$EXTERNALSYM IID_IDirectSoundFXChorus8}
  IID_IDirectSoundFXFlanger8          = IID_IDirectSoundFXFlanger;
  {$EXTERNALSYM IID_IDirectSoundFXFlanger8}
  IID_IDirectSoundFXEcho8             = IID_IDirectSoundFXEcho;
  {$EXTERNALSYM IID_IDirectSoundFXEcho8}
  IID_IDirectSoundFXDistortion8       = IID_IDirectSoundFXDistortion;
  {$EXTERNALSYM IID_IDirectSoundFXDistortion8}
  IID_IDirectSoundFXCompressor8       = IID_IDirectSoundFXCompressor;
  {$EXTERNALSYM IID_IDirectSoundFXCompressor8}
  IID_IDirectSoundFXParamEq8          = IID_IDirectSoundFXParamEq;
  {$EXTERNALSYM IID_IDirectSoundFXParamEq8}
  IID_IDirectSoundFXWavesReverb8      = IID_IDirectSoundFXWavesReverb;
  {$EXTERNALSYM IID_IDirectSoundFXWavesReverb8}
  IID_IDirectSoundFXI3DL2Reverb8      = IID_IDirectSoundFXI3DL2Reverb;
  {$EXTERNALSYM IID_IDirectSoundFXI3DL2Reverb8}
  IID_IDirectSoundCaptureFXAec8       = IID_IDirectSoundCaptureFXAec;
  {$EXTERNALSYM IID_IDirectSoundCaptureFXAec8}
  IID_IDirectSoundCaptureFXNoiseSuppress8 = IID_IDirectSoundCaptureFXNoiseSuppress;
  {$EXTERNALSYM IID_IDirectSoundCaptureFXNoiseSuppress8}
  IID_IDirectSoundFullDuplex8         = IID_IDirectSoundFullDuplex;
  {$EXTERNALSYM IID_IDirectSoundFullDuplex8}
{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800

const
  //
  // Return Codes
  //

  // The function completed successfully
  DS_OK                           = S_OK;
  {$EXTERNALSYM DS_OK}

  // The call succeeded, but we had to substitute the 3D algorithm
  DS_NO_VIRTUALIZATION            = (0 shl 31) or (_FACDS shl 16) or 10; // MAKE_HRESULT(0, _FACDS, 10)
  {$EXTERNALSYM DS_NO_VIRTUALIZATION}

  // The call failed because resources (such as a priority level)
  // were already being used by another caller
  DSERR_ALLOCATED                 = MAKE_DSHRESULT_R or 10; // MAKE_DSHRESULT(10)
  {$EXTERNALSYM DSERR_ALLOCATED}

  // The control (vol, pan, etc.) requested by the caller is not available
  DSERR_CONTROLUNAVAIL            = MAKE_DSHRESULT_R or 30; // MAKE_DSHRESULT(30)
  {$EXTERNALSYM DSERR_CONTROLUNAVAIL}

  // An invalid parameter was passed to the returning function
  DSERR_INVALIDPARAM              = E_INVALIDARG;
  {$EXTERNALSYM DSERR_INVALIDPARAM}

  // This call is not valid for the current state of this object
  DSERR_INVALIDCALL               = MAKE_DSHRESULT_R or 50; // MAKE_DSHRESULT(50)
  {$EXTERNALSYM DSERR_INVALIDCALL}

  // An undetermined error occurred inside the DirectSound subsystem
  DSERR_GENERIC                   = E_FAIL;
  {$EXTERNALSYM DSERR_GENERIC}

  // The caller does not have the priority level required for the function to
  // succeed
  DSERR_PRIOLEVELNEEDED           = MAKE_DSHRESULT_R or 70; // MAKE_DSHRESULT(70)
  {$EXTERNALSYM DSERR_PRIOLEVELNEEDED}

  // Not enough free memory is available to complete the operation
  DSERR_OUTOFMEMORY               = E_OUTOFMEMORY;
  {$EXTERNALSYM DSERR_OUTOFMEMORY}

  // The specified WAVE format is not supported
  DSERR_BADFORMAT                 = MAKE_DSHRESULT_R or 100; // MAKE_DSHRESULT(100)
  {$EXTERNALSYM DSERR_BADFORMAT}

  // The function called is not supported at this time
  DSERR_UNSUPPORTED               = E_NOTIMPL;
  {$EXTERNALSYM DSERR_UNSUPPORTED}

  // No sound driver is available for use
  DSERR_NODRIVER                  = MAKE_DSHRESULT_R or 120; // MAKE_DSHRESULT(120)
  {$EXTERNALSYM DSERR_NODRIVER}

  // This object is already initialized
  DSERR_ALREADYINITIALIZED        = MAKE_DSHRESULT_R or 130; // MAKE_DSHRESULT(130)
  {$EXTERNALSYM DSERR_ALREADYINITIALIZED}

  // This object does not support aggregation
  DSERR_NOAGGREGATION             = CLASS_E_NOAGGREGATION;
  {$EXTERNALSYM DSERR_NOAGGREGATION}

  // The buffer memory has been lost, and must be restored
  DSERR_BUFFERLOST                = MAKE_DSHRESULT_R or 150; // MAKE_DSHRESULT(150)
  {$EXTERNALSYM DSERR_BUFFERLOST}

  // Another app has a higher priority level, preventing this call from
  // succeeding
  DSERR_OTHERAPPHASPRIO           = MAKE_DSHRESULT_R or 160; // MAKE_DSHRESULT(160)
  {$EXTERNALSYM DSERR_OTHERAPPHASPRIO}

  // This object has not been initialized
  DSERR_UNINITIALIZED             = MAKE_DSHRESULT_R or 170; // MAKE_DSHRESULT(170)
  {$EXTERNALSYM DSERR_UNINITIALIZED}

  // The requested COM interface is not available
  DSERR_NOINTERFACE               = E_NOINTERFACE;
  {$EXTERNALSYM DSERR_NOINTERFACE}

  // Access is denied
  DSERR_ACCESSDENIED              = E_ACCESSDENIED;
  {$EXTERNALSYM DSERR_ACCESSDENIED}

  // Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds
  DSERR_BUFFERTOOSMALL            = MAKE_DSHRESULT_R or 180; // MAKE_DSHRESULT(180)
  {$EXTERNALSYM DSERR_BUFFERTOOSMALL}

  // Attempt to use DirectSound 8 functionality on an older DirectSound object
  DSERR_DS8_REQUIRED              = MAKE_DSHRESULT_R or 190; // MAKE_DSHRESULT(190)
  {$EXTERNALSYM DSERR_DS8_REQUIRED}

  // A circular loop of send effects was detected
  DSERR_SENDLOOP                  = MAKE_DSHRESULT_R or 200; // MAKE_DSHRESULT(200)
  {$EXTERNALSYM DSERR_SENDLOOP}

  // The GUID specified in an audiopath file does not match a valid MIXIN buffer
  DSERR_BADSENDBUFFERGUID         = MAKE_DSHRESULT_R or 210; // MAKE_DSHRESULT(210)
  {$EXTERNALSYM DSERR_BADSENDBUFFERGUID}

  // The object requested was not found (numerically equal to DMUS_E_NOT_FOUND)
  DSERR_OBJECTNOTFOUND            = MAKE_DSHRESULT_R or 4449; // MAKE_DSHRESULT(4449)
  {$EXTERNALSYM DSERR_OBJECTNOTFOUND}

  // The effects requested could not be found on the system, or they were found
  // but in the wrong order, or in the wrong hardware/software locations.
  DSERR_FXUNAVAILABLE             = MAKE_DSHRESULT_R or 220; // MAKE_DSHRESULT(220)
  {$EXTERNALSYM DSERR_FXUNAVAILABLE}

  //
  // Flags
  //

  DSCAPS_PRIMARYMONO          = $00000001;
  {$EXTERNALSYM DSCAPS_PRIMARYMONO}
  DSCAPS_PRIMARYSTEREO        = $00000002;
  {$EXTERNALSYM DSCAPS_PRIMARYSTEREO}
  DSCAPS_PRIMARY8BIT          = $00000004;
  {$EXTERNALSYM DSCAPS_PRIMARY8BIT}
  DSCAPS_PRIMARY16BIT         = $00000008;
  {$EXTERNALSYM DSCAPS_PRIMARY16BIT}
  DSCAPS_CONTINUOUSRATE       = $00000010;
  {$EXTERNALSYM DSCAPS_CONTINUOUSRATE}
  DSCAPS_EMULDRIVER           = $00000020;
  {$EXTERNALSYM DSCAPS_EMULDRIVER}
  DSCAPS_CERTIFIED            = $00000040;
  {$EXTERNALSYM DSCAPS_CERTIFIED}
  DSCAPS_SECONDARYMONO        = $00000100;
  {$EXTERNALSYM DSCAPS_SECONDARYMONO}
  DSCAPS_SECONDARYSTEREO      = $00000200;
  {$EXTERNALSYM DSCAPS_SECONDARYSTEREO}
  DSCAPS_SECONDARY8BIT        = $00000400;
  {$EXTERNALSYM DSCAPS_SECONDARY8BIT}
  DSCAPS_SECONDARY16BIT       = $00000800;
  {$EXTERNALSYM DSCAPS_SECONDARY16BIT}

  DSSCL_NORMAL                = $00000001;
  {$EXTERNALSYM DSSCL_NORMAL}
  DSSCL_PRIORITY              = $00000002;
  {$EXTERNALSYM DSSCL_PRIORITY}
  DSSCL_EXCLUSIVE             = $00000003;
  {$EXTERNALSYM DSSCL_EXCLUSIVE}
  DSSCL_WRITEPRIMARY          = $00000004;
  {$EXTERNALSYM DSSCL_WRITEPRIMARY}

  DSSPEAKER_DIRECTOUT         = $00000000;
  {$EXTERNALSYM DSSPEAKER_DIRECTOUT}
  DSSPEAKER_HEADPHONE         = $00000001;
  {$EXTERNALSYM DSSPEAKER_HEADPHONE}
  DSSPEAKER_MONO              = $00000002;
  {$EXTERNALSYM DSSPEAKER_MONO}
  DSSPEAKER_QUAD              = $00000003;
  {$EXTERNALSYM DSSPEAKER_QUAD}
  DSSPEAKER_STEREO            = $00000004;
  {$EXTERNALSYM DSSPEAKER_STEREO}
  DSSPEAKER_SURROUND          = $00000005;
  {$EXTERNALSYM DSSPEAKER_SURROUND}
  DSSPEAKER_5POINT1           = $00000006;
  {$EXTERNALSYM DSSPEAKER_5POINT1}
  DSSPEAKER_7POINT1           = $00000007;
  {$EXTERNALSYM DSSPEAKER_7POINT1}

  DSSPEAKER_GEOMETRY_MIN      = $00000005;  //   5 degrees
  {$EXTERNALSYM DSSPEAKER_GEOMETRY_MIN}
  DSSPEAKER_GEOMETRY_NARROW   = $0000000A;  //  10 degrees
  {$EXTERNALSYM DSSPEAKER_GEOMETRY_NARROW}
  DSSPEAKER_GEOMETRY_WIDE     = $00000014;  //  20 degrees
  {$EXTERNALSYM DSSPEAKER_GEOMETRY_WIDE}
  DSSPEAKER_GEOMETRY_MAX      = $000000B4;  // 180 degrees
  {$EXTERNALSYM DSSPEAKER_GEOMETRY_MAX}

// #define DSSPEAKER_COMBINED(c, g)    ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16))
function DSSPEAKER_COMBINED(c, g: DWORD): DWORD;
{$EXTERNALSYM DSSPEAKER_COMBINED}
// #define DSSPEAKER_CONFIG(a)         ((BYTE)(a))
function DSSPEAKER_CONFIG(a: Cardinal): Byte;
{$EXTERNALSYM DSSPEAKER_CONFIG}
// #define DSSPEAKER_GEOMETRY(a)       ((BYTE)(((DWORD)(a) >> 16) & 0x00FF))
function DSSPEAKER_GEOMETRY(a: Cardinal): Byte;
{$EXTERNALSYM DSSPEAKER_GEOMETRY}

const
  DSBCAPS_PRIMARYBUFFER       = $00000001;
  {$EXTERNALSYM DSBCAPS_PRIMARYBUFFER}
  DSBCAPS_STATIC              = $00000002;
  {$EXTERNALSYM DSBCAPS_STATIC}
  DSBCAPS_LOCHARDWARE         = $00000004;
  {$EXTERNALSYM DSBCAPS_LOCHARDWARE}
  DSBCAPS_LOCSOFTWARE         = $00000008;
  {$EXTERNALSYM DSBCAPS_LOCSOFTWARE}
  DSBCAPS_CTRL3D              = $00000010;
  {$EXTERNALSYM DSBCAPS_CTRL3D}
  DSBCAPS_CTRLFREQUENCY       = $00000020;
  {$EXTERNALSYM DSBCAPS_CTRLFREQUENCY}
  DSBCAPS_CTRLPAN             = $00000040;
  {$EXTERNALSYM DSBCAPS_CTRLPAN}
  DSBCAPS_CTRLVOLUME          = $00000080;
  {$EXTERNALSYM DSBCAPS_CTRLVOLUME}
  DSBCAPS_CTRLPOSITIONNOTIFY  = $00000100;
  {$EXTERNALSYM DSBCAPS_CTRLPOSITIONNOTIFY}
  DSBCAPS_CTRLFX              = $00000200;
  {$EXTERNALSYM DSBCAPS_CTRLFX}
  DSBCAPS_STICKYFOCUS         = $00004000;
  {$EXTERNALSYM DSBCAPS_STICKYFOCUS}
  DSBCAPS_GLOBALFOCUS         = $00008000;
  {$EXTERNALSYM DSBCAPS_GLOBALFOCUS}
  DSBCAPS_GETCURRENTPOSITION2 = $00010000;
  {$EXTERNALSYM DSBCAPS_GETCURRENTPOSITION2}
  DSBCAPS_MUTE3DATMAXDISTANCE = $00020000;
  {$EXTERNALSYM DSBCAPS_MUTE3DATMAXDISTANCE}
  DSBCAPS_LOCDEFER            = $00040000;
  {$EXTERNALSYM DSBCAPS_LOCDEFER}

  DSBPLAY_LOOPING             = $00000001;
  {$EXTERNALSYM DSBPLAY_LOOPING}
  DSBPLAY_LOCHARDWARE         = $00000002;
  {$EXTERNALSYM DSBPLAY_LOCHARDWARE}
  DSBPLAY_LOCSOFTWARE         = $00000004;
  {$EXTERNALSYM DSBPLAY_LOCSOFTWARE}
  DSBPLAY_TERMINATEBY_TIME    = $00000008;
  {$EXTERNALSYM DSBPLAY_TERMINATEBY_TIME}
  DSBPLAY_TERMINATEBY_DISTANCE    = $000000010;
  {$EXTERNALSYM DSBPLAY_TERMINATEBY_DISTANCE}
  DSBPLAY_TERMINATEBY_PRIORITY    = $000000020;
  {$EXTERNALSYM DSBPLAY_TERMINATEBY_PRIORITY}

  DSBSTATUS_PLAYING           = $00000001;
  {$EXTERNALSYM DSBSTATUS_PLAYING}
  DSBSTATUS_BUFFERLOST        = $00000002;
  {$EXTERNALSYM DSBSTATUS_BUFFERLOST}
  DSBSTATUS_LOOPING           = $00000004;
  {$EXTERNALSYM DSBSTATUS_LOOPING}
  DSBSTATUS_LOCHARDWARE       = $00000008;
  {$EXTERNALSYM DSBSTATUS_LOCHARDWARE}
  DSBSTATUS_LOCSOFTWARE       = $00000010;
  {$EXTERNALSYM DSBSTATUS_LOCSOFTWARE}
  DSBSTATUS_TERMINATED        = $00000020;
  {$EXTERNALSYM DSBSTATUS_TERMINATED}

  DSBLOCK_FROMWRITECURSOR     = $00000001;
  {$EXTERNALSYM DSBLOCK_FROMWRITECURSOR}
  DSBLOCK_ENTIREBUFFER        = $00000002;
  {$EXTERNALSYM DSBLOCK_ENTIREBUFFER}

  DSBFREQUENCY_ORIGINAL       = 0;
  {$EXTERNALSYM DSBFREQUENCY_ORIGINAL}
  DSBFREQUENCY_MIN            = 100;
  {$EXTERNALSYM DSBFREQUENCY_MIN}
{$IFDEF DIRECTSOUND_VERSION_9} // #if DIRECTSOUND_VERSION >= 0x0900
  DSBFREQUENCY_MAX            = 200000;
  {$EXTERNALSYM DSBFREQUENCY_MAX}
{$ELSE}
  DSBFREQUENCY_MAX            = 100000;
  {$EXTERNALSYM DSBFREQUENCY_MAX}
{$ENDIF}

  DSBPAN_LEFT                 = -10000;
  {$EXTERNALSYM DSBPAN_LEFT}
  DSBPAN_CENTER               = 0;
  {$EXTERNALSYM DSBPAN_CENTER}
  DSBPAN_RIGHT                = 10000;
  {$EXTERNALSYM DSBPAN_RIGHT}

  DSBVOLUME_MIN               = -10000;
  {$EXTERNALSYM DSBVOLUME_MIN}
  DSBVOLUME_MAX               = 0;
  {$EXTERNALSYM DSBVOLUME_MAX}

  DSBSIZE_MIN                 = 4;
  {$EXTERNALSYM DSBSIZE_MIN}
  DSBSIZE_MAX                 = $0FFFFFFF;
  {$EXTERNALSYM DSBSIZE_MAX}
  DSBSIZE_FX_MIN              = 150;  // NOTE: Milliseconds, not bytes
  {$EXTERNALSYM DSBSIZE_FX_MIN}

  DS3DMODE_NORMAL             = $00000000;
  {$EXTERNALSYM DS3DMODE_NORMAL}
  DS3DMODE_HEADRELATIVE       = $00000001;
  {$EXTERNALSYM DS3DMODE_HEADRELATIVE}
  DS3DMODE_DISABLE            = $00000002;
  {$EXTERNALSYM DS3DMODE_DISABLE}

  DS3D_IMMEDIATE              = $00000000;
  {$EXTERNALSYM DS3D_IMMEDIATE}
  DS3D_DEFERRED               = $00000001;
  {$EXTERNALSYM DS3D_DEFERRED}
var
  // Forced to define as 'var' cos pascal compiler treats all consts as Double
  DS3D_MINDISTANCEFACTOR: Single = 1.175494351e-38; // FLT_MIN;
  {$EXTERNALSYM DS3D_MINDISTANCEFACTOR}
  DS3D_MAXDISTANCEFACTOR: Single = 3.402823466e+38; // FLT_MAX;
  {$EXTERNALSYM DS3D_MAXDISTANCEFACTOR}
const
  DS3D_DEFAULTDISTANCEFACTOR  = 1.0;
  {$EXTERNALSYM DS3D_DEFAULTDISTANCEFACTOR}

  DS3D_MINROLLOFFFACTOR       = 0.0;
  {$EXTERNALSYM DS3D_MINROLLOFFFACTOR}
  DS3D_MAXROLLOFFFACTOR       = 10.0;
  {$EXTERNALSYM DS3D_MAXROLLOFFFACTOR}
  DS3D_DEFAULTROLLOFFFACTOR   = 1.0;
  {$EXTERNALSYM DS3D_DEFAULTROLLOFFFACTOR}

  DS3D_MINDOPPLERFACTOR       = 0.0;
  {$EXTERNALSYM DS3D_MINDOPPLERFACTOR}
  DS3D_MAXDOPPLERFACTOR       = 10.0;
  {$EXTERNALSYM DS3D_MAXDOPPLERFACTOR}
  DS3D_DEFAULTDOPPLERFACTOR   = 1.0;
  {$EXTERNALSYM DS3D_DEFAULTDOPPLERFACTOR}

  DS3D_DEFAULTMINDISTANCE     = 1.0;
  {$EXTERNALSYM DS3D_DEFAULTMINDISTANCE}
  DS3D_DEFAULTMAXDISTANCE     = 1000000000.0;
  {$EXTERNALSYM DS3D_DEFAULTMAXDISTANCE}

  DS3D_MINCONEANGLE           = 0;
  {$EXTERNALSYM DS3D_MINCONEANGLE}
  DS3D_MAXCONEANGLE           = 360;
  {$EXTERNALSYM DS3D_MAXCONEANGLE}
  DS3D_DEFAULTCONEANGLE       = 360;
  {$EXTERNALSYM DS3D_DEFAULTCONEANGLE}

  DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX;
  {$EXTERNALSYM DS3D_DEFAULTCONEOUTSIDEVOLUME}

  // IDirectSoundCapture attributes

  DSCCAPS_EMULDRIVER          = DSCAPS_EMULDRIVER;
  {$EXTERNALSYM DSCCAPS_EMULDRIVER}
  DSCCAPS_CERTIFIED           = DSCAPS_CERTIFIED;
  {$EXTERNALSYM DSCCAPS_CERTIFIED}
  DSCCAPS_MULTIPLECAPTURE     = $00000001;
  {$EXTERNALSYM DSCCAPS_MULTIPLECAPTURE}

  // IDirectSoundCaptureBuffer attributes

  DSCBCAPS_WAVEMAPPED         = $80000000;
  {$EXTERNALSYM DSCBCAPS_WAVEMAPPED}

{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800
  DSCBCAPS_CTRLFX             = $00000200;
  {$EXTERNALSYM DSCBCAPS_CTRLFX}
{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800


  DSCBLOCK_ENTIREBUFFER       = $00000001;
  {$EXTERNALSYM DSCBLOCK_ENTIREBUFFER}

  DSCBSTATUS_CAPTURING        = $00000001;
  {$EXTERNALSYM DSCBSTATUS_CAPTURING}
  DSCBSTATUS_LOOPING          = $00000002;
  {$EXTERNALSYM DSCBSTATUS_LOOPING}

  DSCBSTART_LOOPING           = $00000001;
  {$EXTERNALSYM DSCBSTART_LOOPING}

  DSBPN_OFFSETSTOP            = $FFFFFFFF;
  {$EXTERNALSYM DSBPN_OFFSETSTOP}

  DS_CERTIFIED                = $00000000;
  {$EXTERNALSYM DS_CERTIFIED}
  DS_UNCERTIFIED              = $00000001;
  {$EXTERNALSYM DS_UNCERTIFIED}


  //
  // Flags for the I3DL2 effects
  //

  //
  // I3DL2 Material Presets
  //

  DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW = 0;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW}
  DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW = 1;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW}
  DSFX_I3DL2_MATERIAL_PRESET_THINDOOR     = 2;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_THINDOOR}
  DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR    = 3;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR}
  DSFX_I3DL2_MATERIAL_PRESET_WOODWALL     = 4;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_WOODWALL}
  DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL    = 5;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL}
  DSFX_I3DL2_MATERIAL_PRESET_STONEWALL    = 6;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_STONEWALL}
  DSFX_I3DL2_MATERIAL_PRESET_CURTAIN      = 7;
  {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_CURTAIN}

//Translator: have not found where these defines are used
{
#define I3DL2_MATERIAL_PRESET_SINGLEWINDOW    -2800,0.71f
#define I3DL2_MATERIAL_PRESET_DOUBLEWINDOW    -5000,0.40f
#define I3DL2_MATERIAL_PRESET_THINDOOR        -1800,0.66f
#define I3DL2_MATERIAL_PRESET_THICKDOOR       -4400,0.64f
#define I3DL2_MATERIAL_PRESET_WOODWALL        -4000,0.50f
#define I3DL2_MATERIAL_PRESET_BRICKWALL       -5000,0.60f
#define I3DL2_MATERIAL_PRESET_STONEWALL       -6000,0.68f
#define I3DL2_MATERIAL_PRESET_CURTAIN         -1200,0.15f
}

  DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT         = 0;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT}
  DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC         = 1;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC}
  DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL      = 2;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL}
  DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM            = 3;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM        = 4;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM      = 5;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM       = 6;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM      = 7;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL     = 8;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL}
  DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE            = 9;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE}
  DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA           = 10;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA}
  DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR          = 11;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR}
  DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY = 12;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY}
  DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY         = 13;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY}
  DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR   = 14;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR}
  DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY           = 15;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY}
  DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST          = 16;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST}
  DSFX_I3DL2_ENVIRONMENT_PRESET_CITY            = 17;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CITY}
  DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS       = 18;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS}
  DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY          = 19;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY}
  DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN           = 20;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN}
  DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT      = 21;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT}
  DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE       = 22;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE}
  DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER      = 23;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER}
  DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM       = 24;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM      = 25;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM       = 26;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM}
  DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL      = 27;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL}
  DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL       = 28;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL}
  DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE           = 29;
  {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE}

  //
  // I3DL2 Reverberation Presets Values
  //

  I3DL2_ENVIRONMENT_PRESET_DEFAULT         : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -100; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.83; lReflections: -2602; flReflectionsDelay: 0.007; lReverb:   200; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_DEFAULT}
  I3DL2_ENVIRONMENT_PRESET_GENERIC         : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -100; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.83; lReflections: -2602; flReflectionsDelay: 0.007; lReverb:   200; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_GENERIC}
  I3DL2_ENVIRONMENT_PRESET_PADDEDCELL      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -6000; flRoomRolloffFactor: 0.0; flDecayTime: 0.17; flDecayHFRatio: 0.10; lReflections: -1204; flReflectionsDelay: 0.001; lReverb:   207; flReverbDelay: 0.002; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PADDEDCELL}
  I3DL2_ENVIRONMENT_PRESET_ROOM            : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -454; flRoomRolloffFactor: 0.0; flDecayTime: 0.40; flDecayHFRatio: 0.83; lReflections: -1646; flReflectionsDelay: 0.002; lReverb:    53; flReverbDelay: 0.003; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_ROOM}
  I3DL2_ENVIRONMENT_PRESET_BATHROOM        : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1200; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.54; lReflections:  -370; flReflectionsDelay: 0.007; lReverb:  1030; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity:  60.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_BATHROOM}
  I3DL2_ENVIRONMENT_PRESET_LIVINGROOM      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -6000; flRoomRolloffFactor: 0.0; flDecayTime: 0.50; flDecayHFRatio: 0.10; lReflections: -1376; flReflectionsDelay: 0.003; lReverb: -1104; flReverbDelay: 0.004; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_LIVINGROOM}
  I3DL2_ENVIRONMENT_PRESET_STONEROOM       : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -300; flRoomRolloffFactor: 0.0; flDecayTime: 2.31; flDecayHFRatio: 0.64; lReflections:  -711; flReflectionsDelay: 0.012; lReverb:    83; flReverbDelay: 0.017; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_STONEROOM}
  I3DL2_ENVIRONMENT_PRESET_AUDITORIUM      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -476; flRoomRolloffFactor: 0.0; flDecayTime: 4.32; flDecayHFRatio: 0.59; lReflections:  -789; flReflectionsDelay: 0.020; lReverb:  -289; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_AUDITORIUM}
  I3DL2_ENVIRONMENT_PRESET_CONCERTHALL     : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -500; flRoomRolloffFactor: 0.0; flDecayTime: 3.92; flDecayHFRatio: 0.70; lReflections: -1230; flReflectionsDelay: 0.020; lReverb:    -2; flReverbDelay: 0.029; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CONCERTHALL}
  I3DL2_ENVIRONMENT_PRESET_CAVE            : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:     0; flRoomRolloffFactor: 0.0; flDecayTime: 2.91; flDecayHFRatio: 1.30; lReflections:  -602; flReflectionsDelay: 0.015; lReverb:  -302; flReverbDelay: 0.022; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CAVE}
  I3DL2_ENVIRONMENT_PRESET_ARENA           : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -698; flRoomRolloffFactor: 0.0; flDecayTime: 7.24; flDecayHFRatio: 0.33; lReflections: -1166; flReflectionsDelay: 0.020; lReverb:    16; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_ARENA}
  I3DL2_ENVIRONMENT_PRESET_HANGAR          : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1000; flRoomRolloffFactor: 0.0; flDecayTime:10.05; flDecayHFRatio: 0.23; lReflections:  -602; flReflectionsDelay: 0.020; lReverb:   198; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_HANGAR}
  I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -4000; flRoomRolloffFactor: 0.0; flDecayTime: 0.30; flDecayHFRatio: 0.10; lReflections: -1831; flReflectionsDelay: 0.002; lReverb: -1630; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY}
  I3DL2_ENVIRONMENT_PRESET_HALLWAY         : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -300; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.59; lReflections: -1219; flReflectionsDelay: 0.007; lReverb:   441; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_HALLWAY}
  I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR   : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -237; flRoomRolloffFactor: 0.0; flDecayTime: 2.70; flDecayHFRatio: 0.79; lReflections: -1214; flReflectionsDelay: 0.013; lReverb:   395; flReverbDelay: 0.020; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR}
  I3DL2_ENVIRONMENT_PRESET_ALLEY           : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -270; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.86; lReflections: -1204; flReflectionsDelay: 0.007; lReverb:    -4; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_ALLEY}
  I3DL2_ENVIRONMENT_PRESET_FOREST          : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -3300; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.54; lReflections: -2560; flReflectionsDelay: 0.162; lReverb:  -613; flReverbDelay: 0.088; flDiffusion:  79.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_FOREST}
  I3DL2_ENVIRONMENT_PRESET_CITY            : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -800; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.67; lReflections: -2273; flReflectionsDelay: 0.007; lReverb: -2217; flReverbDelay: 0.011; flDiffusion:  50.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CITY}
  I3DL2_ENVIRONMENT_PRESET_MOUNTAINS       : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -2500; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.21; lReflections: -2780; flReflectionsDelay: 0.300; lReverb: -2014; flReverbDelay: 0.100; flDiffusion:  27.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_MOUNTAINS}
  I3DL2_ENVIRONMENT_PRESET_QUARRY          : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1000; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.83; lReflections:-10000; flReflectionsDelay: 0.061; lReverb:   500; flReverbDelay: 0.025; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_QUARRY}
  I3DL2_ENVIRONMENT_PRESET_PLAIN           : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -2000; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.50; lReflections: -2466; flReflectionsDelay: 0.179; lReverb: -2514; flReverbDelay: 0.100; flDiffusion:  21.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PLAIN}
  I3DL2_ENVIRONMENT_PRESET_PARKINGLOT      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:     0; flRoomRolloffFactor: 0.0; flDecayTime: 1.65; flDecayHFRatio: 1.50; lReflections: -1363; flReflectionsDelay: 0.008; lReverb: -1153; flReverbDelay: 0.012; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PARKINGLOT}
  I3DL2_ENVIRONMENT_PRESET_SEWERPIPE       : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1000; flRoomRolloffFactor: 0.0; flDecayTime: 2.81; flDecayHFRatio: 0.14; lReflections:   429; flReflectionsDelay: 0.014; lReverb:   648; flReverbDelay: 0.021; flDiffusion:  80.0; flDensity:  60.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_SEWERPIPE}
  I3DL2_ENVIRONMENT_PRESET_UNDERWATER      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -4000; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.10; lReflections:  -449; flReflectionsDelay: 0.007; lReverb:  1700; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_UNDERWATER}

  //
  // Examples simulating 'musical' reverb presets
  //
  // Name       Decay time   Description
  // Small Room    1.1s      A small size room with a length of 5m or so.
  // Medium Room   1.3s      A medium size room with a length of 10m or so.
  // Large Room    1.5s      A large size room suitable for live performances.
  // Medium Hall   1.8s      A medium size concert hall.
  // Large Hall    1.8s      A large size concert hall suitable for a full orchestra.
  // Plate         1.3s      A plate reverb simulation.
  //

  I3DL2_ENVIRONMENT_PRESET_SMALLROOM       : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.10; flDecayHFRatio: 0.83; lReflections:  -400; flReflectionsDelay: 0.005; lReverb:   500; flReverbDelay: 0.010; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_SMALLROOM}
  I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.30; flDecayHFRatio: 0.83; lReflections: -1000; flReflectionsDelay: 0.010; lReverb:  -200; flReverbDelay: 0.020; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM}
  I3DL2_ENVIRONMENT_PRESET_LARGEROOM       : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.50; flDecayHFRatio: 0.83; lReflections: -1600; flReflectionsDelay: 0.020; lReverb: -1000; flReverbDelay: 0.040; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_LARGEROOM}
  I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL      : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.80; flDecayHFRatio: 0.70; lReflections: -1300; flReflectionsDelay: 0.015; lReverb:  -800; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL}
  I3DL2_ENVIRONMENT_PRESET_LARGEHALL       : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.80; flDecayHFRatio: 0.70; lReflections: -2000; flReflectionsDelay: 0.030; lReverb: -1400; flReverbDelay: 0.060; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_LARGEHALL}
  I3DL2_ENVIRONMENT_PRESET_PLATE           : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF:  -200; flRoomRolloffFactor: 0.0; flDecayTime: 1.30; flDecayHFRatio: 0.90; lReflections:     0; flReflectionsDelay: 0.002; lReverb:     0; flReverbDelay: 0.010; flDiffusion: 100.0; flDensity:  75.0; flHFReference: 5000.0);
  {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PLATE}

  //
  // DirectSound3D Algorithms
  //

  // Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000}
  DS3DALG_DEFAULT : TGUID = '{00000000-0000-0000-0000-000000000000}'; // GUID_NULL;
  {$EXTERNALSYM DS3DALG_DEFAULT}

  // No virtualization (Pan3D) {C241333F-1C1B-11d2-94F5-00C04FC28ACA}
  DS3DALG_NO_VIRTUALIZATION: TGUID = '{c241333f-1c1b-11d2-94f5-00c04fc28aca}';
  {$EXTERNALSYM DS3DALG_NO_VIRTUALIZATION}

  // High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA}
  DS3DALG_HRTF_FULL: TGUID = '{c2413340-1c1b-11d2-94f5-00c04fc28aca}';
  {$EXTERNALSYM DS3DALG_HRTF_FULL}

  // Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA}
  DS3DALG_HRTF_LIGHT: TGUID = '{c2413342-1c1b-11d2-94f5-00c04fc28aca}';
  {$EXTERNALSYM DS3DALG_HRTF_LIGHT}


{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800

  //
  // DirectSound Internal Effect Algorithms
  //


  // Gargle {DAFD8210-5711-4B91-9FE3-F75B7AE279BF}
  GUID_DSFX_STANDARD_GARGLE: TGUID = '{dafd8210-5711-4b91-9fe3-f75b7ae279bf}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_GARGLE}

  // Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6}
  GUID_DSFX_STANDARD_CHORUS: TGUID = '{efe6629c-81f7-4281-bd91-c9d604a95af6}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_CHORUS}

  // Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98}
  GUID_DSFX_STANDARD_FLANGER: TGUID = '{efca3d92-dfd8-4672-a603-7420894bad98}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_FLANGER}

  // Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D}
  GUID_DSFX_STANDARD_ECHO: TGUID = '{ef3e932c-d40b-4f51-8ccf-3f98f1b29d5d}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_ECHO}

  // Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21}
  GUID_DSFX_STANDARD_DISTORTION: TGUID = '{ef114c90-cd1d-484e-96e5-09cfaf912a21}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_DISTORTION}

  // Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57}
  GUID_DSFX_STANDARD_COMPRESSOR: TGUID = '{ef011f79-4000-406d-87af-bffb3fc39d57}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_COMPRESSOR}

  // Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231}
  GUID_DSFX_STANDARD_PARAMEQ: TGUID = '{120ced89-3bf4-4173-a132-3cb406cf3231}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_PARAMEQ}

  // I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4}
  GUID_DSFX_STANDARD_I3DL2REVERB: TGUID = '{ef985e71-d5c7-42d4-ba4d-2d073e2e96f4}';
  {$EXTERNALSYM GUID_DSFX_STANDARD_I3DL2REVERB}

  // Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C}
  GUID_DSFX_WAVES_REVERB: TGUID = '{87fc0268-9a55-4360-95aa-004a1d9de26c}';
  {$EXTERNALSYM GUID_DSFX_WAVES_REVERB}

  //
  // DirectSound Capture Effect Algorithms
  //


  // Acoustic Echo Canceller {BF963D80-C559-11D0-8A2B-00A0C9255AC1}
  // Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL in ksmedia.h
  GUID_DSCFX_CLASS_AEC: TGUID = '{BF963D80-C559-11D0-8A2B-00A0C9255AC1}';
  {$EXTERNALSYM GUID_DSCFX_CLASS_AEC}

  // Microsoft AEC {CDEBB919-379A-488a-8765-F53CFD36DE40}
  GUID_DSCFX_MS_AEC: TGUID = '{cdebb919-379a-488a-8765-f53cfd36de40}';
  {$EXTERNALSYM GUID_DSCFX_MS_AEC}

  // System AEC {1C22C56D-9879-4f5b-A389-27996DDC2810}
  GUID_DSCFX_SYSTEM_AEC: TGUID = '{1c22c56d-9879-4f5b-a389-27996ddc2810}';
  {$EXTERNALSYM GUID_DSCFX_SYSTEM_AEC}

  // Noise Supression {E07F903F-62FD-4e60-8CDD-DEA7236665B5}
  // Matches KSNODETYPE_NOISE_SUPPRESS in post Windows ME DDK's ksmedia.h
  GUID_DSCFX_CLASS_NS: TGUID = '{e07f903f-62fd-4e60-8cdd-dea7236665b5}';
  {$EXTERNALSYM GUID_DSCFX_CLASS_NS}

  // Microsoft Noise Suppresion {11C5C73B-66E9-4ba1-A0BA-E814C6EED92D}
  GUID_DSCFX_MS_NS: TGUID = '{11c5c73b-66e9-4ba1-a0ba-e814c6eed92d}';
  {$EXTERNALSYM GUID_DSCFX_MS_NS}

  // System Noise Suppresion {5AB0882E-7274-4516-877D-4EEE99BA4FD0}
  GUID_DSCFX_SYSTEM_NS: TGUID = '{5ab0882e-7274-4516-877d-4eee99ba4fd0}';
  {$EXTERNALSYM GUID_DSCFX_SYSTEM_NS}

{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800



//
// DirectSound API
//

type
  TDSEnumCallbackA = function(lpGuid: PGUID; lpcstrDescription, lpcstrModule: PAnsiChar;
    lpContext: Pointer): BOOL; stdcall;
  {$NODEFINE TDSEnumCallbackA}
  TDSEnumCallbackW = function(lpGuid: PGUID; lpcstrDescription, lpcstrModule: PWideChar;
    lpContext: Pointer): BOOL; stdcall;
  {$NODEFINE TDSEnumCallbackW}
{$IFDEF UNICODE}
  TDSEnumCallback = TDSEnumCallbackW;
{$ELSE}
  TDSEnumCallback = TDSEnumCallbackA;
{$ENDIF}
  {$NODEFINE TDSEnumCallback}
  {$HPPEMIT 'typedef LPDSENUMCALLBACKA TDSEnumCallbackA;'}
  {$HPPEMIT 'typedef LPDSENUMCALLBACKW TDSEnumCallbackW;'}
  {$HPPEMIT 'typedef LPDSENUMCALLBACK TDSEnumCallback;'}

const
  DirectSoundDll = 'dsound.dll';

function DirectSoundLoaded: Boolean;
function UnLoadDirectSound: Boolean;
function LoadDirectSound: Boolean;

{$IFDEF DIRECTSOUND_DYNAMIC_LINK}
var
  DirectSoundCreate: function(lpGuid: PGUID; out ppDS: IDirectSound; pUnkOuter: IUnknown): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCreate}
  DirectSoundEnumerateW: function(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall;
  {$EXTERNALSYM DirectSoundEnumerateW}
  DirectSoundEnumerateA: function(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  {$EXTERNALSYM DirectSoundEnumerateA}
  DirectSoundEnumerate: function(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall;
  {$EXTERNALSYM DirectSoundEnumerate}

  DirectSoundCaptureCreate: function(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCaptureCreate}
  DirectSoundCaptureEnumerateW: function(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCaptureEnumerateW}
  DirectSoundCaptureEnumerateA: function(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCaptureEnumerateA}
  DirectSoundCaptureEnumerate: function(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCaptureEnumerate}

//#if DIRECTSOUND_VERSION >= 0x0800
type
  TDirectSoundFullDuplexCreateFunc = function(pcGuidCaptureDevice, pcGuidRenderDevice: PGUID;
    const pcDSCBufferDesc: TDSCBufferDesc; const pcDSBufferDesc: TDSBufferDesc;
    hWnd: hWnd; dwLevel: DWORD; out ppDSFD: IDirectSoundFullDuplex8;
    out ppDSCBuffer8: IDirectSoundCaptureBuffer8; out ppDSBuffer8: IDirectSoundBuffer8;
    pUnkOuter: IUnknown): HResult; stdcall;

var
  DirectSoundCreate8: function(pcGuidDevice: PGUID; out ppDS8: IDirectSound8; pUnkOuter: IUnknown): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCreate8}
  DirectSoundCaptureCreate8: function(pcGuidDevice: PGUID; out ppDSC8: IDirectSoundCapture8; pUnkOuter: IUnknown): HResult; stdcall;
  {$EXTERNALSYM DirectSoundCaptureCreate8}
  DirectSoundFullDuplexCreate: TDirectSoundFullDuplexCreateFunc;
  {$EXTERNALSYM DirectSoundFullDuplexCreate}
  DirectSoundFullDuplexCreate8: TDirectSoundFullDuplexCreateFunc;
  {$EXTERNALSYM DirectSoundFullDuplexCreate8}

  GetDeviceID: function(pGuidSrc, pGuidDest: PGUID): HResult; stdcall;
  {$EXTERNALSYM GetDeviceID}
//#endif // DIRECTSOUND_VERSION >= 0x0800

{$ELSE}
function DirectSoundCreate(lpGuid: PGUID; out ppDS: IDirectSound; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM DirectSoundCreate}
function DirectSoundEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateW';
{$EXTERNALSYM DirectSoundEnumerateW}
function DirectSoundEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateA';
{$EXTERNALSYM DirectSoundEnumerateA}
{$IFDEF UNICODE}
function DirectSoundEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateW';
{$ELSE}
function DirectSoundEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateA';
{$ENDIF}
{$EXTERNALSYM DirectSoundEnumerate}

function DirectSoundCaptureCreate(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM DirectSoundCaptureCreate}
function DirectSoundCaptureEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateW';
{$EXTERNALSYM DirectSoundCaptureEnumerateW}
function DirectSoundCaptureEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateA';
{$EXTERNALSYM DirectSoundCaptureEnumerateA}
{$IFDEF UNICODE}
function DirectSoundCaptureEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateW';
{$ELSE}
function DirectSoundCaptureEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateA';
{$ENDIF}
{$EXTERNALSYM DirectSoundCaptureEnumerate}

//#if DIRECTSOUND_VERSION >= 0x0800
function DirectSoundCreate8(pcGuidDevice: PGUID; out ppDS8: IDirectSound8; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM DirectSoundCreate8}
function DirectSoundCaptureCreate8(pcGuidDevice: PGUID; out ppDSC8: IDirectSoundCapture8; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM DirectSoundCaptureCreate8}
function DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice: PGUID;
  const pcDSCBufferDesc: TDSCBufferDesc; const pcDSBufferDesc: TDSBufferDesc;
  hWnd: hWnd; dwLevel: DWORD; out ppDSFD: IDirectSoundFullDuplex8;
  out ppDSCBuffer8: IDirectSoundCaptureBuffer8; out ppDSBuffer8: IDirectSoundBuffer8;
  pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM DirectSoundFullDuplexCreate}
function DirectSoundFullDuplexCreate8(pcGuidCaptureDevice, pcGuidRenderDevice: PGUID;
  const pcDSCBufferDesc: TDSCBufferDesc; const pcDSBufferDesc: TDSBufferDesc;
  hWnd: hWnd; dwLevel: DWORD; out ppDSFD: IDirectSoundFullDuplex8;
  out ppDSCBuffer8: IDirectSoundCaptureBuffer8; out ppDSBuffer8: IDirectSoundBuffer8;
  pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM DirectSoundFullDuplexCreate8}

function GetDeviceID(pGuidSrc, pGuidDest: PGUID): HResult; stdcall; external DirectSoundDLL;
{$EXTERNALSYM GetDeviceID}
//#endif // DIRECTSOUND_VERSION >= 0x0800

{$ENDIF}


implementation

// #define MAKE_DSHRESULT(code)  MAKE_HRESULT(1, _FACDS, code)
function MAKE_DSHRESULT(Code: DWord): DWord;
begin
  Result:= DWord((1 shl 31) or (_FACDS shl 16)) or Code;
end;

// #define DSSPEAKER_COMBINED(c, g)    ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16))
function DSSPEAKER_COMBINED(c, g: DWORD): DWORD;
begin
  Result:= Byte(c) or (DWORD(Byte(g)) shl 16);
end;

// #define DSSPEAKER_CONFIG(a)         ((BYTE)(a))
function DSSPEAKER_CONFIG(a: Cardinal): Byte;
begin
  Result:= Byte(a);
end;

// #define DSSPEAKER_GEOMETRY(a)       ((BYTE)(((DWORD)(a) >> 16) & 0x00FF))
function DSSPEAKER_GEOMETRY(a: Cardinal): Byte;
begin
  Result:= Byte((DWORD(a) shr 16) and $00FF);
end;


{$IFDEF DIRECTSOUND_DYNAMIC_LINK}
var
  DirectSoundLib: THandle = 0;

function DirectSoundLoaded: Boolean;
begin
  Result:= (DirectSoundLib <> 0);
end;

function UnLoadDirectSound: Boolean;
begin
  Result:= True;
  if (DirectSoundLib <> 0) then
  begin
    Result:= Result and FreeLibrary(DirectSoundLib);

    DirectSoundCreate:= nil;
    DirectSoundEnumerateW:= nil;
    DirectSoundEnumerateA:= nil;
    DirectSoundEnumerate:= nil;

    DirectSoundCaptureCreate:= nil;
    DirectSoundCaptureEnumerateW:= nil;
    DirectSoundCaptureEnumerateA:= nil;
    DirectSoundCaptureEnumerate:= nil;

    //#if DIRECTSOUND_VERSION >= 0x0800
    DirectSoundCreate8:= nil;
    DirectSoundCaptureCreate8:= nil;
    DirectSoundFullDuplexCreate:= nil;
    DirectSoundFullDuplexCreate8:= nil;

    GetDeviceID:= nil;

    DirectSoundLib:= 0;
  end;
end;

function LoadDirectSound: Boolean;
begin
  Result:= DirectSoundLoaded;
  if (not Result) then
  begin
    DirectSoundLib:= LoadLibrary(DirectSoundDll);
    if (DirectSoundLib<>0) then
    begin
      DirectSoundCreate:= GetProcAddress(DirectSoundLib, 'DirectSoundCreate');
      DirectSoundEnumerateW:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateW');
      DirectSoundEnumerateA:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateA');
      {$IFDEF UNICODE}
      DirectSoundEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateW');
      {$ELSE}
      DirectSoundEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateA');
      {$ENDIF}

      DirectSoundCaptureCreate:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureCreate');
      DirectSoundCaptureEnumerateW:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateW');
      DirectSoundCaptureEnumerateA:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateA');
      {$IFDEF UNICODE}
      DirectSoundCaptureEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateW');
      {$ELSE}
      DirectSoundCaptureEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateA');
      {$ENDIF}

      //#if DIRECTSOUND_VERSION >= 0x0800
      DirectSoundCreate8:= GetProcAddress(DirectSoundLib, 'DirectSoundCreate8');
      DirectSoundCaptureCreate8:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureCreate8');
      DirectSoundFullDuplexCreate:= GetProcAddress(DirectSoundLib, 'DirectSoundFullDuplexCreate');
      DirectSoundFullDuplexCreate8:= GetProcAddress(DirectSoundLib, 'DirectSoundFullDuplexCreate');

      GetDeviceID:= GetProcAddress(DirectSoundLib, 'GetDeviceID');
      //#endif // DIRECTSOUND_VERSION >= 0x0800
    end;
    
    Result:= Assigned(DirectSoundCreate);
    if not Result then UnLoadDirectSound;
  end;
end;
{$ELSE}
function DirectSoundLoaded: Boolean;
begin // Stub function for static linking
  Result:= True;
end;

function UnLoadDirectSound: Boolean;
begin // Stub function for static linking
  Result:= True; // should emulate "normal" behaviour
end;

function LoadDirectSound: Boolean;
begin // Stub function for static linking
  Result:= True;
end;

{$ENDIF}

{$IFDEF DIRECTSOUND_DYNAMIC_LINK}
initialization
{$IFNDEF DIRECTSOUND_DYNAMIC_LINK_EXPLICIT}
  LoadDirectSound;
{$ENDIF}
finalization
  UnLoadDirectSound;
{$ENDIF}
end.