/Common/MilesWin/include/mss.h

https://bitbucket.org/Ryfon/mux · C Header · 6379 lines · 4279 code · 1550 blank · 550 comment · 123 complexity · beeb601d135f81abfdc395e0aa95d25e MD5 · raw file

  1. //############################################################################
  2. //## ##
  3. //## Miles Sound System ##
  4. //## ##
  5. //## MSS.H: Miles Sound System main header file ##
  6. //## ##
  7. //## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ##
  8. //## 1.01 of 19-Jun-95: Added various functions for V3.03 release ##
  9. //## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ##
  10. //## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ##
  11. //## 16 bit DLL loads (JKR) ##
  12. //## 1.04 of 2-Nov-97: Changes made to handle DLS in future ##
  13. //## versions ##
  14. //## 1.05 of 1-Jan-98: Massive changes for version 4.0 ##
  15. //## 1.06 of 17-Sep-98: Massive changes for version 5.0 ##
  16. //## 1.07 of 2-Feb-99: Changes for new input API ##
  17. //## 1.08 of 8-Feb-99: Changes for new filter helper functions ##
  18. //## 1.09 of 8-Feb-03: Changes for xbox and linux ##
  19. //## 1.10 of 15-May-05: Massive changes for version 7.0 ##
  20. //## ##
  21. //## Author: John Miles ##
  22. //## ##
  23. //############################################################################
  24. //## ##
  25. //## Contact RAD Game Tools at 425-893-4300 for technical support. ##
  26. //## ##
  27. //############################################################################
  28. #ifndef MSS_VERSION
  29. #define MSS_VERSION "7.1a" // Version string needs to be 4 characters long for benefit of MIDIECHW and SETSOUND
  30. #define MSS_MAJOR_VERSION 7
  31. #define MSS_MINOR_VERSION 1
  32. #define MSS_SUB_VERSION 0
  33. #define MSS_VERSION_DATE "25-Jun-07"
  34. #define MSS_COPYRIGHT "Copyright (C) 1991-2007, RAD Game Tools, Inc."
  35. #endif
  36. #ifndef MSS_H
  37. #define MSS_H
  38. // IS_DOS for DOS
  39. // IS_WINDOWS for Windows or Win32
  40. // IS_WIN64 for Win64
  41. // IS_WIN32 for Win32
  42. // IS_WIN16 for Windows
  43. // IS_WIN32API for Windows, Xbox and Xenon
  44. // IS_64REG when CPU registers are 64-bit - Xenon, PS3, Win64 and PS2
  45. // IS_32 for 32-bit DOS or Win32
  46. // IS_16 for 16-bit Windows
  47. // IS_LE for little endian (PCs)
  48. // IS_BE for big endian (Macs, x360, ps3)
  49. // IS_X86 for Intel
  50. // IS_MAC for Mac
  51. // IS_MACHO for Macho Mac
  52. // IS_PPC for PPC Mac
  53. // IS_68K for 68K Mac
  54. // IS_LINUX for Linux
  55. // IS_XBOX for Xbox
  56. // IS_XENON for Xbox 360
  57. // IS_PS2 for PS/2
  58. // IS_PS3 for PS/3
  59. // IS_WII for Wii
  60. // IS_STATIC for static versions (DOS, Xbox, Xbox 360, GameCube, PS2, PS3, Wii)
  61. #ifdef IS_DOS
  62. #undef IS_DOS
  63. #endif
  64. #ifdef IS_WINDOWS
  65. #undef IS_WINDOWS
  66. #endif
  67. #ifdef IS_WIN32
  68. #undef IS_WIN32
  69. #endif
  70. #ifdef IS_WIN64
  71. #undef IS_WIN64
  72. #endif
  73. #ifdef IS_WIN16
  74. #undef IS_WIN16
  75. #endif
  76. #ifdef IS_32
  77. #undef IS_32
  78. #endif
  79. #ifdef IS_16
  80. #undef IS_16
  81. #endif
  82. #ifdef IS_LE
  83. #undef IS_LE
  84. #endif
  85. #ifdef IS_BE
  86. #undef IS_BE
  87. #endif
  88. #ifdef IS_X86
  89. #undef IS_X86
  90. #endif
  91. #ifdef IS_MAC
  92. #undef IS_MAC
  93. #endif
  94. #ifdef IS_PPC
  95. #undef IS_PPC
  96. #endif
  97. #ifdef IS_68K
  98. #undef IS_68K
  99. #endif
  100. #ifdef IS_LINUX
  101. #undef IS_LINUX
  102. #endif
  103. #ifdef IS_STATIC
  104. #undef IS_STATIC
  105. #endif
  106. #ifdef IS_XBOX
  107. #undef IS_XBOX
  108. #endif
  109. #ifdef IS_XENON
  110. #undef IS_XENON
  111. #endif
  112. #undef MSSRESTRICT
  113. #define MSSRESTRICT
  114. #if defined(R5900)
  115. #define IS_PS2
  116. #define IS_32
  117. #define IS_64REGS
  118. #define IS_STATIC
  119. #define IS_LE
  120. #undef MSSRESTRICT
  121. #define MSSRESTRICT __restrict
  122. #elif defined(__CELLOS_LV2__)
  123. #define IS_PS3
  124. #define IS_32
  125. #define IS_64REGS
  126. #define IS_STATIC
  127. #define IS_BE
  128. #define IS_PPC
  129. #ifndef __LP32__
  130. #error "PS3 32bit ABI support only"
  131. #endif
  132. #undef MSSRESTRICT
  133. #define MSSRESTRICT __restrict__
  134. #elif defined(HOLLYWOOD_REV) || defined(REVOLUTION)
  135. #define IS_WII
  136. #define IS_32
  137. #define IS_STATIC
  138. #define IS_BE
  139. #define IS_PPC
  140. #undef MSSRESTRICT
  141. #define MSSRESTRICT
  142. #elif defined( __DOS__ )
  143. #define IS_DOS
  144. #define IS_32
  145. #define IS_LE
  146. #define IS_X86
  147. #define IS_STATIC
  148. #else
  149. #if defined(_XENON) || (_XBOX_VER == 200)
  150. #undef MSSRESTRICT
  151. #define MSSRESTRICT __restrict
  152. // Remember that Xenon also defines _XBOX
  153. #define IS_WIN32API
  154. #define IS_32
  155. #define IS_64REGS
  156. #define IS_BE
  157. #define IS_XENON
  158. #define IS_STATIC
  159. #define IS_PPC
  160. #else
  161. #ifdef _XBOX
  162. #define IS_WIN32API
  163. #define IS_32
  164. #define IS_LE
  165. #define IS_X86
  166. #define IS_XBOX
  167. #define IS_STATIC
  168. #else
  169. #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(__NT__) || defined(__WIN32__)
  170. #define IS_WIN32API
  171. #define IS_WINDOWS
  172. #define IS_WIN32
  173. #define IS_32
  174. #define IS_LE
  175. #define IS_X86
  176. #if defined(_WIN64) // We consider Win64 to be a superset of Win32!
  177. #define IS_WIN64
  178. #define IS_64REGS
  179. #endif
  180. #if _MSC_VER >= 1400
  181. #undef MSSRESTRICT
  182. #define MSSRESTRICT __restrict
  183. #endif
  184. #else
  185. #ifdef _WINDOWS
  186. #define IS_WINDOWS
  187. #define IS_WIN16
  188. #define IS_16
  189. #define IS_LE
  190. #define IS_X86
  191. #else
  192. #if defined(_WINDLL) || defined(WINDOWS) || defined(__WINDOWS__) || defined(_Windows)
  193. #define IS_WINDOWS
  194. #define IS_WIN16
  195. #define IS_16
  196. #define IS_LE
  197. #define IS_X86
  198. #else
  199. #if (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__)
  200. #define IS_MAC
  201. #if TARGET_API_MAC_CARBON
  202. #define IS_CARBON
  203. #endif
  204. #define IS_32
  205. #if defined(__MACHO__) || defined(__MACH__)
  206. #define IS_MACHO
  207. #elif defined(__GNUC__) || defined(__GNUG__)
  208. #define IS_MACHO
  209. #endif
  210. #if defined(__powerc) || defined(powerc) || defined(__POWERPC__)
  211. #define IS_PPC
  212. #define IS_BE
  213. #elif defined(__i386__)
  214. #define IS_X86
  215. #define IS_LE
  216. #else
  217. #if defined(__MC68K__)
  218. #define IS_68K
  219. #define IS_BE
  220. #endif
  221. #endif
  222. #ifndef IS_MACHO
  223. #define ON_MAC_USE_FSS
  224. #endif
  225. #else
  226. #ifdef linux
  227. #define IS_LINUX
  228. #define IS_32
  229. #define IS_LE
  230. #ifdef i386
  231. #define IS_X86
  232. #endif
  233. #endif
  234. #endif
  235. #endif
  236. #endif
  237. #endif
  238. #endif
  239. #endif
  240. #endif
  241. #if (!defined(IS_LE) && !defined(IS_BE))
  242. #error MSS.H did not detect your platform. Define __DOS__, _WINDOWS, WIN32, WIN64, or macintosh.
  243. #endif
  244. #ifndef IS_PS2
  245. #if defined(_PUSHPOP_SUPPORTED) || PRAGMA_STRUCT_PACKPUSH
  246. #pragma pack(push,1)
  247. #else
  248. #pragma pack(1)
  249. #endif
  250. #endif
  251. //
  252. // Pipeline filters supported on following platforms
  253. //
  254. #if defined(IS_WIN32API) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_DOS) || defined(IS_PS2) || defined(IS_XENON) || defined(IS_PS3) || defined(IS_WII)
  255. #define MSS_FLT_SUPPORTED 1
  256. #define EXTRA_BUILD_BUFFERS 1
  257. #define FLT_A (MAX_SPEAKERS)
  258. #if defined(IS_WIN32API)
  259. #define MSS_VFLT_SUPPORTED 1
  260. #endif
  261. #else
  262. #define EXTRA_BUILD_BUFFERS 0
  263. #endif
  264. #if defined(IS_WIN32) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_PS2) || defined(IS_XENON) || defined(IS_PS3) || defined(IS_WII)
  265. #define MSS_REVERB_SUPPORTED 1
  266. #endif
  267. #ifdef __cplusplus
  268. extern "C" {
  269. #define RADDEFSTART extern "C" {
  270. #define RADDEFEND }
  271. #else
  272. #define RADDEFSTART
  273. #define RADDEFEND
  274. #endif
  275. #undef MSS_STRUCT
  276. #define MSS_STRUCT struct
  277. #ifdef IS_PS2
  278. #if !defined(__MWERKS__)
  279. #undef MSS_STRUCT
  280. #define MSS_STRUCT struct __attribute__((__packed__))
  281. #endif
  282. #define AILCALLBACK //$ __attribute__((cdecl))
  283. #define AILEXPORT //$ __attribute__((cdecl))
  284. #define DXDEC extern
  285. #define DXDEF
  286. #define AILCALL //$__attribute__((cdecl))
  287. #define FAR
  288. #define HIWORD(ptr) (((U32)ptr)>>16)
  289. #define LOWORD(ptr) ((U16)((U32)ptr))
  290. #define WINAPI
  291. #define FOURCC U32
  292. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  293. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  294. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  295. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  296. #define AILLIBCALLBACK //__attribute__((cdecl))
  297. #define MSS_MAIN_DEF
  298. #define MSS_REDIST_DIR_NAME "redist"
  299. #define MSS_DIR_SEP "\\"
  300. #define MSS_DIR_UP ".." MSS_DIR_SEP
  301. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  302. #elif defined( IS_DOS )
  303. #define AILCALLBACK __pascal
  304. #define AILEXPORT cdecl
  305. #define DXDEC extern
  306. #define DXDEF
  307. #define AILCALL cdecl
  308. #define FAR
  309. #define HIWORD(ptr) (((U32)ptr)>>16)
  310. #define LOWORD(ptr) ((U16)((U32)ptr))
  311. #define FOURCC U32
  312. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  313. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  314. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  315. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  316. #define AILLIBCALLBACK __pascal
  317. #define MSS_MAIN_DEF
  318. #define MSS_REDIST_DIR_NAME "redist"
  319. #define MSS_DIR_SEP "\\"
  320. #define MSS_DIR_UP ".." MSS_DIR_SEP
  321. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  322. #else
  323. #ifdef IS_WINDOWS
  324. #ifndef WIN32_LEAN_AND_MEAN
  325. #define WIN32_LEAN_AND_MEAN
  326. #endif
  327. #ifndef WIN32_EXTRA_LEAN
  328. #define WIN32_EXTRA_LEAN
  329. #endif
  330. #ifndef STRICT
  331. #define STRICT
  332. #endif
  333. typedef char CHAR;
  334. typedef short SHORT;
  335. typedef int BOOL;
  336. typedef long LONG;
  337. typedef CHAR *LPSTR, *PSTR;
  338. #ifdef IS_WIN64
  339. typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
  340. #else
  341. #ifdef _Wp64
  342. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  343. typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
  344. #else
  345. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  346. #endif
  347. #else
  348. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  349. #endif
  350. #endif
  351. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  352. typedef unsigned long DWORD;
  353. typedef unsigned short WORD;
  354. typedef unsigned int UINT;
  355. typedef struct HWAVE__ *HWAVE;
  356. typedef struct HWAVEIN__ *HWAVEIN;
  357. typedef struct HWAVEOUT__ *HWAVEOUT;
  358. typedef HWAVEIN *LPHWAVEIN;
  359. typedef HWAVEOUT *LPHWAVEOUT;
  360. typedef struct Mwavehdr_tag {
  361. LPSTR lpData;
  362. DWORD dwBufferLength;
  363. DWORD dwBytesRecorded;
  364. DWORD_PTR dwUser;
  365. DWORD dwFlags;
  366. DWORD dwLoops;
  367. struct Mwavehdr_tag *lpNext;
  368. DWORD_PTR reserved;
  369. } MWAVEHDR;
  370. typedef struct Mwaveformat_tag {
  371. WORD wFormatTag;
  372. WORD nChannels;
  373. DWORD nSamplesPerSec;
  374. DWORD nAvgBytesPerSec;
  375. WORD nBlockAlign;
  376. } MWAVEFORMAT;
  377. typedef struct Mpcmwaveformat_tag {
  378. MWAVEFORMAT wf;
  379. WORD wBitsPerSample;
  380. } MPCMWAVEFORMAT;
  381. #ifndef WAVE_MAPPER
  382. #define WAVE_MAPPER ((UINT)-1)
  383. #endif
  384. typedef struct waveformat_tag *LPWAVEFORMAT;
  385. typedef struct HMIDIOUT__ *HMIDIOUT;
  386. typedef HMIDIOUT *LPHMIDIOUT;
  387. typedef struct HWND__ *HWND;
  388. typedef struct HINSTANCE__ *HINSTANCE;
  389. typedef HINSTANCE HMODULE;
  390. typedef struct wavehdr_tag *LPWAVEHDR;
  391. typedef DWORD FOURCC; /* a four character code */
  392. #ifndef MAKEFOURCC
  393. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  394. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  395. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  396. #endif
  397. #ifndef mmioFOURCC
  398. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  399. #endif
  400. #define MSS_MAIN_DEF __cdecl
  401. //
  402. // If compiling MSS DLL, use __declspec(dllexport) for both
  403. // declarations and definitions
  404. //
  405. // If compiling MSS16 library or application, use "extern" in declarations
  406. // and nothing in definitions
  407. //
  408. #ifdef IS_WIN32
  409. #undef FAR
  410. #define FAR
  411. #ifndef FORNONWIN
  412. #define AILLIBCALLBACK __stdcall
  413. #define AILCALL __stdcall
  414. #define AILCALLBACK __stdcall
  415. #define AILEXPORT __stdcall
  416. #else
  417. #define AILLIBCALLBACK __cdecl
  418. #define AILCALL __cdecl
  419. #define AILCALLBACK __cdecl
  420. #define AILEXPORT __cdecl
  421. #endif
  422. #ifdef __RADINDLL__
  423. #define DXDEC __declspec(dllexport)
  424. #define DXDEF __declspec(dllexport)
  425. #else
  426. #ifdef __BORLANDC__
  427. #define DXDEC extern
  428. #else
  429. #define DXDEC __declspec(dllimport)
  430. #endif
  431. #endif
  432. #ifdef IS_WIN64
  433. #define MSSDLLNAME "MSS64.DLL"
  434. #define MSS_REDIST_DIR_NAME "redist64"
  435. #else
  436. #define MSSDLLNAME "MSS32.DLL"
  437. #define MSS_REDIST_DIR_NAME "redist"
  438. #endif
  439. #define MSS_DIR_SEP "\\"
  440. #define MSS_DIR_UP ".." MSS_DIR_SEP
  441. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  442. #else
  443. #define AILCALL WINAPI
  444. #define AILEXPORT __export WINAPI
  445. #define AILCALLBACK AILEXPORT
  446. #define AILLIBCALLBACK WINAPI
  447. #define DXDEC extern
  448. #define DXDEF
  449. #define MSSDLLNAME "MSS16.DLL"
  450. #define MSS_REDIST_DIR_NAME "redist"
  451. #define MSS_DIR_SEP "\\"
  452. #define MSS_DIR_UP ".." MSS_DIR_SEP
  453. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  454. #endif
  455. typedef void * LPVOID;
  456. typedef LPVOID AILLPDIRECTSOUND;
  457. typedef LPVOID AILLPDIRECTSOUNDBUFFER;
  458. #else
  459. #ifdef IS_MAC
  460. #if !defined(__FILES__) && defined( ON_MAC_USE_FSS )
  461. #define FSSpec void
  462. #endif
  463. #define FAR
  464. #ifdef IS_X86
  465. #define AILLIBCALLBACK __attribute__((cdecl))
  466. #define AILCALL __attribute__((cdecl))
  467. #define AILCALLBACK __attribute__((cdecl))
  468. #define AILEXPORT __attribute__((cdecl)) __attribute__((visibility("default")))
  469. #ifdef __RADINDLL__
  470. #define DXDEC __attribute__((visibility("default")))
  471. #define DXDEF
  472. #else
  473. #define DXDEC extern
  474. #define DXDEF
  475. #endif
  476. #else
  477. #define AILLIBCALLBACK
  478. #define AILCALL
  479. #define AILEXPORT
  480. #define AILCALLBACK
  481. #ifdef __RADINDLL__
  482. #define DXDEC __declspec(export)
  483. #define DXDEF
  484. #else
  485. #define DXDEC extern
  486. #define DXDEF
  487. #endif
  488. #endif
  489. #ifdef IS_MACHO
  490. #ifdef IS_X86
  491. #define MSS_REDIST_DIR_NAME "redist/macx86"
  492. #else
  493. #define MSS_REDIST_DIR_NAME "redist/macho"
  494. #endif
  495. #define MSS_DIR_SEP "/"
  496. #define MSS_DIR_UP ".." MSS_DIR_SEP
  497. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  498. #else
  499. #ifdef IS_CARBON
  500. #define MSS_REDIST_DIR_NAME "redist:carbon"
  501. #define MSSDLLNAME "Miles Carbon Library"
  502. #else
  503. #define MSS_REDIST_DIR_NAME "redist:classic"
  504. #define MSSDLLNAME "Miles Shared Library"
  505. #endif
  506. #define MSS_DIR_SEP ":"
  507. #define MSS_DIR_UP ":" MSS_DIR_SEP
  508. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_SEP
  509. #endif
  510. #define HIWORD(ptr) (((U32)ptr)>>16)
  511. #define LOWORD(ptr) ((U16)((U32)ptr))
  512. #define FOURCC U32
  513. #ifndef MAKEFOURCC
  514. #ifdef IS_X86
  515. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  516. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  517. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  518. #else
  519. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  520. (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \
  521. ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) ))
  522. #endif
  523. #endif
  524. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  525. #define MSS_MAIN_DEF
  526. #else
  527. #ifdef IS_LINUX
  528. #define FAR
  529. #ifdef IS_X86
  530. #define AILLIBCALLBACK __attribute__((cdecl))
  531. #define AILCALL __attribute__((cdecl))
  532. #define AILCALLBACK __attribute__((cdecl))
  533. #define AILEXPORT __attribute__((cdecl))
  534. #else
  535. #define AILLIBCALLBACK
  536. #define AILCALL
  537. #define AILEXPORT
  538. #define AILCALLBACK
  539. #endif
  540. #define DXDEC extern
  541. #define DXDEF
  542. #define MSS_REDIST_DIR_NAME "redist"
  543. #define MSSDLLNAME "Miles Shared Library"
  544. #define MSS_DIR_SEP "/"
  545. #define MSS_DIR_UP "../"
  546. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  547. #define HIWORD(ptr) (((U32)ptr)>>16)
  548. #define LOWORD(ptr) ((U16)((U32)ptr))
  549. #define FOURCC U32
  550. #ifndef MAKEFOURCC
  551. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  552. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  553. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  554. #endif
  555. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  556. #define MSS_MAIN_DEF
  557. #else
  558. #ifdef IS_XBOX
  559. #define FOURCC U32
  560. #ifndef MAKEFOURCC
  561. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  562. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  563. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  564. #endif
  565. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  566. #undef FAR
  567. #define FAR
  568. #define AILLIBCALLBACK __stdcall
  569. #define AILCALL __stdcall
  570. #define AILEXPORT __stdcall
  571. #define AILCALLBACK __stdcall
  572. #define DXDEC extern
  573. #define DXDEF
  574. #define MSS_REDIST_DIR_NAME "redist"
  575. #define MSS_DIR_SEP "\\"
  576. #define MSS_DIR_UP ".." MSS_DIR_SEP
  577. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  578. typedef void * LPVOID;
  579. typedef LPVOID AILLPDIRECTSOUND;
  580. typedef LPVOID AILLPDIRECTSOUNDBUFFER;
  581. #else
  582. #ifdef IS_XENON
  583. #define FOURCC U32
  584. #undef MAKEFOURCC // refine it - the xtl makes a bad one
  585. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  586. (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \
  587. ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) ))
  588. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  589. #undef FAR
  590. #define FAR
  591. #define AILLIBCALLBACK __stdcall
  592. #define AILCALL __stdcall
  593. #define AILEXPORT __stdcall
  594. #define AILCALLBACK __stdcall
  595. #define DXDEC extern
  596. #define DXDEF
  597. #define MSS_REDIST_DIR_NAME "redist"
  598. #define MSS_DIR_SEP "\\"
  599. #define MSS_DIR_UP ".." MSS_DIR_SEP
  600. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  601. typedef void * AILLPDIRECTSOUND;
  602. typedef void * AILLPDIRECTSOUNDBUFFER;
  603. #else
  604. #ifdef IS_PS3
  605. #define FOURCC U32
  606. #undef MAKEFOURCC // refine it - the xtl makes a bad one
  607. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  608. (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \
  609. ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) ))
  610. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  611. #undef FAR
  612. #define FAR
  613. #define AILLIBCALLBACK
  614. #define AILCALL
  615. #define AILEXPORT
  616. #define AILCALLBACK
  617. #define DXDEC extern
  618. #define DXDEF
  619. #define MSS_REDIST_DIR_NAME "redist"
  620. #define MSS_DIR_SEP "/"
  621. #define MSS_DIR_UP ".." MSS_DIR_SEP
  622. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  623. #elif defined( IS_WII)
  624. #define FOURCC U32
  625. #undef MAKEFOURCC // refine it - the xtl makes a bad one
  626. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  627. (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \
  628. ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) ))
  629. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  630. #undef FAR
  631. #define FAR
  632. #define AILLIBCALLBACK
  633. #define AILCALL
  634. #define AILEXPORT
  635. #define AILCALLBACK
  636. #define DXDEC extern
  637. #define DXDEF
  638. #define MSS_REDIST_DIR_NAME "redist"
  639. #define MSS_DIR_SEP "/"
  640. #define MSS_DIR_UP ".." MSS_DIR_SEP
  641. #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
  642. #endif
  643. #endif
  644. #endif
  645. #endif
  646. #endif
  647. #endif
  648. #endif
  649. #ifndef NULL
  650. #define NULL 0
  651. #endif
  652. //
  653. // Misc. constant definitions
  654. //
  655. #define MAX_DRVRS 16 // Max. # of simultaneous drivers
  656. #define MAX_TIMERS 16 // Max. # of simultaneous timers
  657. #define MAX_NOTES 32 // Max # of notes "on"
  658. #define FOR_NEST 4 // # of nested XMIDI FOR loops
  659. #define NUM_CHANS 16 // # of possible MIDI channels
  660. #define MAX_W_VOICES 16 // Max virtual wave synth voice cnt
  661. #define MAX_W_ENTRIES 512 // 512 wave library entries max.
  662. #ifdef IS_WIN32
  663. #define MAX_SPEAKERS 18 // Up to 18 hardware output channels supported
  664. #elif defined(IS_PS3) || defined(IS_PS2) || defined(IS_WII)
  665. #define MAX_SPEAKERS 8 // Up to 8 hardware output channels on PS3, PS2, Wii
  666. #else
  667. #define MAX_SPEAKERS 6 // Up to 6 hardware output channels supported on other platforms
  668. #endif
  669. #define MAX_RECEIVER_SPECS 32 // Up to 32 receiver point specifications
  670. #define MAX_SAVED_FILTER_PROPERTIES 48 // Up to 48 filter attributes can be stored in an HSATTRIBS structure
  671. #define MIN_CHAN ( 1-1) // Min channel recognized (0-based)
  672. #define MAX_CHAN (16-1) // Max channel recognized
  673. #define MIN_LOCK_CHAN ( 1-1) // Min channel available for locking
  674. #define MAX_LOCK_CHAN (16-1) // Max channel available for locking
  675. #define PERCUSS_CHAN (10-1) // Percussion channel (no locking)
  676. #define AIL_MAX_FILE_HEADER_SIZE 8192 // AIL_set_named_sample_file() requires at least 8K
  677. // of data or the entire file image, whichever is less,
  678. // to determine sample format
  679. #define DIG_F_16BITS_MASK 1
  680. #define DIG_F_STEREO_MASK 2
  681. #define DIG_F_ADPCM_MASK 4
  682. #define DIG_F_XBOX_ADPCM_MASK 8
  683. #define DIG_F_MULTICHANNEL_MASK 16
  684. #define DIG_F_OUTPUT_FILTER_IN_USE 32
  685. #define DIG_F_MONO_8 0 // PCM data formats
  686. #define DIG_F_MONO_16 (DIG_F_16BITS_MASK)
  687. #define DIG_F_STEREO_8 (DIG_F_STEREO_MASK)
  688. #define DIG_F_MULTICHANNEL_8 (DIG_F_MULTICHANNEL_MASK)
  689. #define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK)
  690. #define DIG_F_MULTICHANNEL_16 (DIG_F_MULTICHANNEL_MASK|DIG_F_16BITS_MASK)
  691. #define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK)
  692. #define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
  693. #define DIG_F_ADPCM_MULTICHANNEL_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
  694. #define DIG_F_XBOX_ADPCM_MONO_16 (DIG_F_XBOX_ADPCM_MASK |DIG_F_16BITS_MASK)
  695. #define DIG_F_XBOX_ADPCM_STEREO_16 (DIG_F_XBOX_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
  696. #define DIG_F_XBOX_ADPCM_MULTICHANNEL_16 (DIG_F_XBOX_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_MULTICHANNEL_MASK)
  697. #define DIG_F_NOT_8_BITS (DIG_F_16BITS_MASK | DIG_F_ADPCM_MASK | DIG_F_XBOX_ADPCM_MASK | DIG_F_MULTICHANNEL_MASK)
  698. #define DIG_F_USING_ASI 16
  699. #define DIG_PCM_SIGN 0x0001 // (obsolete)
  700. #define DIG_PCM_ORDER 0x0002
  701. #define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware
  702. #define DIG_PCM_SPLIT 0x0008
  703. #define DIG_BUFFER_SERVICE 0x0010
  704. #define DIG_DUAL_DMA 0x0020
  705. #define DIG_RECORDING_SUPPORTED 0x8000
  706. #define WAVE_FORMAT_PCM 1
  707. #define WAVE_FORMAT_IMA_ADPCM 0x0011
  708. #define WAVE_FORMAT_XBOX_ADPCM 0x0069
  709. #define MSS_SPEAKER_INDEX_FRONT_LEFT 0 // Speaker order indexes correspond to
  710. #define MSS_SPEAKER_INDEX_FRONT_RIGHT 1 // bitmasks in PSDK's ksmedia.h
  711. #define MSS_SPEAKER_INDEX_FRONT_CENTER 2 // Also see microsoft.com/whdc/device/audio/multichaud.mspx
  712. #define MSS_SPEAKER_INDEX_LOW_FREQUENCY 3
  713. #define MSS_SPEAKER_INDEX_BACK_LEFT 4
  714. #define MSS_SPEAKER_INDEX_BACK_RIGHT 5
  715. #define MSS_SPEAKER_INDEX_FRONT_LEFT_OF_CENTER 6
  716. #define MSS_SPEAKER_INDEX_FRONT_RIGHT_OF_CENTER 7
  717. #define MSS_SPEAKER_INDEX_BACK_CENTER 8
  718. #define MSS_SPEAKER_INDEX_SIDE_LEFT 9
  719. #define MSS_SPEAKER_INDEX_SIDE_RIGHT 10
  720. #define MSS_SPEAKER_INDEX_TOP_CENTER 11
  721. #define MSS_SPEAKER_INDEX_TOP_FRONT_LEFT 12
  722. #define MSS_SPEAKER_INDEX_TOP_FRONT_CENTER 13
  723. #define MSS_SPEAKER_INDEX_TOP_FRONT_RIGHT 14
  724. #define MSS_SPEAKER_INDEX_TOP_BACK_LEFT 15
  725. #define MSS_SPEAKER_INDEX_TOP_BACK_CENTER 16
  726. #define MSS_SPEAKER_INDEX_TOP_BACK_RIGHT 17
  727. #ifdef IS_DOS
  728. #define AIL3DIG 0 // .DIG driver
  729. #define AIL3MDI 1 // .MDI driver
  730. #define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only
  731. #define DIG_DETECT_16_BIT_ONLY 0x0002 // Detect 16-bit DMA only
  732. #define DIG_DETECT_8_AND_16_BITS 0x0003 // Detect both 8- and 16-bit DMA
  733. #define DRV_INIT 0x300 // Functions common to .MDI and .DIG
  734. #define DRV_GET_INFO 0x301 // drivers
  735. #define DRV_SERVE 0x302
  736. #define DRV_PARSE_ENV 0x303
  737. #define DRV_VERIFY_IO 0x304
  738. #define DRV_INIT_DEV 0x305
  739. #define DRV_SHUTDOWN_DEV 0x306
  740. #define DIG_HW_VOLUME 0x400 // .DIG driver functions
  741. #define DIG_START_P_CMD 0x401
  742. #define DIG_STOP_P_REQ 0x402
  743. #define DIG_START_R_CMD 0x403
  744. #define DIG_STOP_R_REQ 0x404
  745. #define DIG_VSE 0x405
  746. #define MDI_HW_VOLUME 0x500 // .MDI driver functions
  747. #define MDI_INIT_INS_MGR 0x501
  748. #define MDI_MIDI_XMIT 0x502
  749. #define MDI_INSTALL_T_SET 0x503
  750. #define MDI_GET_T_STATUS 0x504
  751. #define MDI_PROT_UNPROT_T 0x505
  752. #define MDI_VSE 0x506
  753. #else
  754. //
  755. // Pass to AIL_midiOutOpen for NULL MIDI driver
  756. //
  757. #define MIDI_NULL_DRIVER ((U32)(S32)-2)
  758. #endif
  759. //
  760. // Non-specific XMIDI/MIDI controllers and event types
  761. //
  762. #define SYSEX_BYTE 105
  763. #define PB_RANGE 106
  764. #define CHAN_MUTE 107
  765. #define CALLBACK_PFX 108
  766. #define SEQ_BRANCH 109
  767. #define CHAN_LOCK 110
  768. #define CHAN_PROTECT 111
  769. #define VOICE_PROTECT 112
  770. #define TIMBRE_PROTECT 113
  771. #define PATCH_BANK_SEL 114
  772. #define INDIRECT_C_PFX 115
  773. #define FOR_LOOP 116
  774. #define NEXT_LOOP 117
  775. #define CLEAR_BEAT_BAR 118
  776. #define CALLBACK_TRIG 119
  777. #define SEQ_INDEX 120
  778. #define GM_BANK_MSB 0
  779. #define MODULATION 1
  780. #define DATA_MSB 6
  781. #define PART_VOLUME 7
  782. #define PANPOT 10
  783. #define EXPRESSION 11
  784. #define GM_BANK_LSB 32
  785. #define DATA_LSB 38
  786. #define SUSTAIN 64
  787. #define REVERB 91
  788. #define CHORUS 93
  789. #define RPN_LSB 100
  790. #define RPN_MSB 101
  791. #define RESET_ALL_CTRLS 121
  792. #define ALL_NOTES_OFF 123
  793. #define EV_NOTE_OFF 0x80
  794. #define EV_NOTE_ON 0x90
  795. #define EV_POLY_PRESS 0xa0
  796. #define EV_CONTROL 0xb0
  797. #define EV_PROGRAM 0xc0
  798. #define EV_CHAN_PRESS 0xd0
  799. #define EV_PITCH 0xe0
  800. #define EV_SYSEX 0xf0
  801. #define EV_ESC 0xf7
  802. #define EV_META 0xff
  803. #define META_EOT 0x2f
  804. #define META_TEMPO 0x51
  805. #define META_TIME_SIG 0x58
  806. //
  807. // SAMPLE.system_data[] usage
  808. //
  809. #define VOC_BLK_PTR 1 // Pointer to current block
  810. #define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block
  811. #define VOC_N_REPS 3 // # of iterations left in repeat loop
  812. #define VOC_MARKER 4 // Marker to search for, or -1 if all
  813. #define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0
  814. #define STR_HSTREAM 6 // Stream, if any, that owns the HSAMPLE
  815. #define SSD_TEMP 7 // Temporary storage location for general use
  816. //
  817. // Timer status values
  818. //
  819. #define AILT_FREE 0 // Timer handle is free for allocation
  820. #define AILT_STOPPED 1 // Timer is stopped
  821. #define AILT_RUNNING 2 // Timer is running
  822. //
  823. // SAMPLE.status flag values
  824. //
  825. #define SMP_FREE 0x0001 // Sample is available for allocation
  826. #define SMP_DONE 0x0002 // Sample has finished playing, or has
  827. // never been started
  828. #define SMP_PLAYING 0x0004 // Sample is playing
  829. #define SMP_STOPPED 0x0008 // Sample has been stopped
  830. #define SMP_PLAYINGBUTRELEASED 0x0010 // Sample is playing, but digital handle
  831. // has been temporarily released
  832. //
  833. // SEQUENCE.status flag values
  834. //
  835. #define SEQ_FREE 0x0001 // Sequence is available for allocation
  836. #define SEQ_DONE 0x0002 // Sequence has finished playing, or has
  837. // never been started
  838. #define SEQ_PLAYING 0x0004 // Sequence is playing
  839. #define SEQ_STOPPED 0x0008 // Sequence has been stopped
  840. #define SEQ_PLAYINGBUTRELEASED 0x0010 // Sequence is playing, but MIDI handle
  841. // has been temporarily released
  842. #ifdef IS_DOS
  843. //
  844. // MIDI driver types
  845. //
  846. #define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible)
  847. #define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2)
  848. #define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3)
  849. #define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver
  850. //
  851. // .INI installation result codes
  852. //
  853. #define AIL_INIT_SUCCESS 0 // Driver installed successfully
  854. #define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists
  855. #define AIL_INIT_FAILURE 2 // Driver could not be initialized
  856. #ifdef __BORLANDC__
  857. #ifndef REALPTR
  858. #define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff) \
  859. - AIL_sel_base(_DS)))
  860. #endif
  861. #else
  862. #ifndef REALPTR
  863. #define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff)))
  864. #endif
  865. #endif
  866. #else
  867. #ifdef IS_WINDOWS
  868. //
  869. // AIL_set_direct_buffer_control() command values
  870. //
  871. #define AILDS_RELINQUISH 0 // App returns control of secondary buffer
  872. #define AILDS_SEIZE 1 // App takes control of secondary buffer
  873. #define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer
  874. #endif
  875. #endif
  876. //
  877. // General type definitions for portability
  878. //
  879. #ifndef C8
  880. #define C8 char
  881. #endif
  882. #ifndef U8
  883. #define U8 unsigned char
  884. #endif
  885. #ifndef S8
  886. #define S8 signed char
  887. #endif
  888. #ifndef U16
  889. #define U16 unsigned short
  890. #endif
  891. #ifndef S16
  892. #define S16 signed short
  893. #endif
  894. typedef void VOIDFUNC(void);
  895. #ifdef IS_PS2
  896. #ifndef U128
  897. #define U128 u_long128
  898. #endif
  899. #ifndef U64
  900. #define U64 unsigned long
  901. #endif
  902. #ifndef S64
  903. #define S64 signed long
  904. #endif
  905. #ifndef U32
  906. #define U32 unsigned int
  907. #endif
  908. #ifndef S32
  909. #define S32 signed int
  910. #endif
  911. #ifndef UINTa
  912. #define UINTa unsigned int
  913. #endif
  914. #ifndef SINTa
  915. #define SINTa signed int
  916. #endif
  917. #else
  918. #ifdef IS_PS3
  919. #ifndef U64
  920. #define U64 unsigned long long
  921. #endif
  922. #ifndef S64
  923. #define S64 signed long long
  924. #endif
  925. #ifndef U32
  926. #define U32 unsigned int
  927. #endif
  928. #ifndef S32
  929. #define S32 signed int
  930. #endif
  931. #ifndef UINTa
  932. #define UINTa unsigned int
  933. #endif
  934. #ifndef SINTa
  935. #define SINTa signed int
  936. #endif
  937. #else
  938. #ifdef IS_16
  939. #ifndef U32
  940. #define U32 unsigned long
  941. #endif
  942. #ifndef S32
  943. #define S32 signed long
  944. #endif
  945. #ifndef UINTa
  946. #define UINTa unsigned long
  947. #endif
  948. #ifndef SINTa
  949. #define SINTa signed long
  950. #endif
  951. #else
  952. #if defined(IS_MAC) || defined(IS_WII)
  953. #ifndef U64
  954. #define U64 unsigned long long
  955. #endif
  956. #ifndef S64
  957. #define S64 signed long long
  958. #endif
  959. #else
  960. #ifndef U64
  961. #define U64 unsigned __int64
  962. #endif
  963. #ifndef S64
  964. #define S64 signed __int64
  965. #endif
  966. #endif
  967. #ifndef U32
  968. #define U32 unsigned int
  969. #endif
  970. #ifndef S32
  971. #define S32 signed int
  972. #endif
  973. #ifdef _WIN64
  974. #ifndef UINTa
  975. #define UINTa unsigned __int64
  976. #endif
  977. #ifndef SINTa
  978. #define SINTa signed __int64
  979. #endif
  980. #else
  981. #ifdef _Wp64
  982. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  983. #ifndef UINTa
  984. typedef __w64 unsigned long UINTa;
  985. #define UINTa UINTa
  986. #endif
  987. #ifndef SINTa
  988. typedef __w64 signed long SINTa;
  989. #define SINTa SINTa
  990. #endif
  991. #else
  992. #ifndef UINTa
  993. #define UINTa unsigned long
  994. #endif
  995. #ifndef SINTa
  996. #define SINTa signed long
  997. #endif
  998. #endif
  999. #else
  1000. #ifndef UINTa
  1001. #define UINTa unsigned int
  1002. #endif
  1003. #ifndef SINTa
  1004. #define SINTa signed int
  1005. #endif
  1006. #endif
  1007. #endif
  1008. #endif
  1009. #endif
  1010. #endif
  1011. #ifndef F32
  1012. #define F32 float
  1013. #endif
  1014. #ifndef F64
  1015. #define F64 double
  1016. #endif
  1017. #ifndef REALFAR
  1018. #define REALFAR unsigned int
  1019. #endif
  1020. #ifndef FILE_ERRS
  1021. #define FILE_ERRS
  1022. #define AIL_NO_ERROR 0
  1023. #define AIL_IO_ERROR 1
  1024. #define AIL_OUT_OF_MEMORY 2
  1025. #define AIL_FILE_NOT_FOUND 3
  1026. #define AIL_CANT_WRITE_FILE 4
  1027. #define AIL_CANT_READ_FILE 5
  1028. #define AIL_DISK_FULL 6
  1029. #endif
  1030. #define MIN_VAL 0
  1031. #define NOM_VAL 1
  1032. #define MAX_VAL 2
  1033. //
  1034. // Preference names and default values
  1035. //
  1036. #define DIG_RESAMPLING_TOLERANCE 0
  1037. #define DEFAULT_DRT 131 // Resampling triggered at +/- 0.2%
  1038. #define DIG_MIXER_CHANNELS 1
  1039. #define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures
  1040. #define DIG_MAX_PREDELAY_MS 2
  1041. #define DEFAULT_MPDMS 500 // Max predelay reverb time in ms
  1042. #define MDI_SERVICE_RATE 3
  1043. #define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz
  1044. #define MDI_SEQUENCES 4
  1045. #define DEFAULT_MS 8 // 8 sequence handles/driver
  1046. #define MDI_DEFAULT_VOLUME 5
  1047. #define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127)
  1048. #define MDI_QUANT_ADVANCE 6
  1049. #define DEFAULT_MQA 1 // Beat/bar count +1 interval
  1050. #define MDI_ALLOW_LOOP_BRANCHING 7
  1051. #define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops
  1052. #define MDI_DEFAULT_BEND_RANGE 8
  1053. #define DEFAULT_MDBR 2 // Default pitch-bend range = 2
  1054. #define DIG_3D_MUTE_AT_MAX 46
  1055. #define DEFAULT_D3MAM NO // off by default
  1056. #if defined(IS_WINDOWS) || defined(IS_DOS)
  1057. #define MDI_DOUBLE_NOTE_OFF 9
  1058. #define DEFAULT_MDNO NO // For stuck notes on SB daughterboards
  1059. #endif
  1060. #define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by
  1061. #define DEFAULT_DERF YES // default
  1062. #if defined(IS_WINDOWS) || defined(IS_MAC) || defined(IS_LINUX)
  1063. #define MDI_SYSEX_BUFFER_SIZE 10
  1064. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  1065. #define DIG_OUTPUT_BUFFER_SIZE 11
  1066. #define DEFAULT_DOBS 49152 // 48K output buffer size
  1067. #define AIL_MM_PERIOD 12
  1068. #if defined(IS_WINDOWS)
  1069. #define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
  1070. #else
  1071. #define DEFAULT_AMP 15 // Default MM timer period = 15 msec (mac and linux)
  1072. #endif
  1073. #endif
  1074. #ifdef IS_PS2
  1075. #define MDI_SYSEX_BUFFER_SIZE 10
  1076. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  1077. #define AIL_MM_PERIOD 12
  1078. #define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
  1079. #define AIL_TIMERS 13
  1080. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1081. #define AIL_MUTEX_PROTECTION 44
  1082. #define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
  1083. #define DIG_DS_FRAGMENT_SIZE 34
  1084. #define DEFAULT_DDFS 12 // Use 12 millisecond buffer fragments with PS2
  1085. #define DIG_DS_FRAGMENT_CNT 35
  1086. #define DEFAULT_DDFC 32 // Use 32 buffers with PS2
  1087. #define AIL_LOCK_PROTECTION 18
  1088. #define DEFAULT_ALP NO // Don't suspend foreground thread by default
  1089. #endif
  1090. #ifdef IS_PS3
  1091. #define MDI_SYSEX_BUFFER_SIZE 10
  1092. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  1093. #define DIG_DS_FRAGMENT_SIZE 34
  1094. #define DEFAULT_DDFS 5 // Use 5 millisecond buffer fragments
  1095. #define DIG_DS_FRAGMENT_CNT 35
  1096. #define DEFAULT_DDFC 32 // Use 32 buffer fragments
  1097. #define DIG_DS_MIX_FRAGMENT_CNT 42
  1098. #define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments
  1099. #define AIL_MM_PERIOD 12
  1100. #define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
  1101. #define AIL_TIMERS 13
  1102. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1103. #define AIL_MUTEX_PROTECTION 44
  1104. #define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
  1105. #define AIL_LOCK_PROTECTION 18
  1106. #define DEFAULT_ALP NO // Don't suspend foreground thread by default
  1107. #endif
  1108. #ifdef IS_WII
  1109. #define MDI_SYSEX_BUFFER_SIZE 10
  1110. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  1111. #define DIG_DS_FRAGMENT_SIZE 34
  1112. #define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments
  1113. #define DIG_DS_FRAGMENT_CNT 35
  1114. #define DEFAULT_DDFC 16 // Use 16 buffer fragments
  1115. #define DIG_DS_MIX_FRAGMENT_CNT 42
  1116. #define DEFAULT_DDMFC 4 // Mix ahead 4 buffer fragments
  1117. #define AIL_MM_PERIOD 12
  1118. #define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
  1119. #define AIL_TIMERS 13
  1120. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1121. #endif
  1122. #ifdef IS_XBOX
  1123. #define MDI_SYSEX_BUFFER_SIZE 10
  1124. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  1125. #define AIL_MM_PERIOD 12
  1126. #define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
  1127. #define AIL_TIMERS 13
  1128. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1129. #define AIL_MUTEX_PROTECTION 44
  1130. #define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
  1131. #define DIG_DS_FRAGMENT_SIZE 34
  1132. #define DEFAULT_DDFS 12 // Use 12 millisecond buffer fragments with DirectSound
  1133. #define DIG_DS_FRAGMENT_CNT 35
  1134. #define DEFAULT_DDFC 32 // Use 32 buffers with DirectSound
  1135. #define AIL_LOCK_PROTECTION 18
  1136. #define DEFAULT_ALP NO // Don't suspend foreground thread by default
  1137. #endif
  1138. #ifdef IS_XENON
  1139. #define MDI_SYSEX_BUFFER_SIZE 10
  1140. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  1141. #define DIG_DS_FRAGMENT_SIZE 34
  1142. #define DEFAULT_DDFS 16 // Use 16 millisecond buffer fragments
  1143. #define DIG_DS_FRAGMENT_CNT 35
  1144. #define DEFAULT_DDFC 48 // Use 48 buffer fragments
  1145. #define DIG_DS_MIX_FRAGMENT_CNT 42
  1146. #define DEFAULT_DDMFC 4 // Mix ahead 4 buffer fragments
  1147. #define AIL_MM_PERIOD 12
  1148. #define DEFAULT_AMP 7 // Default MM timer period = 7 msec.
  1149. #define AIL_TIMERS 13
  1150. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1151. #define AIL_MUTEX_PROTECTION 44
  1152. #define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
  1153. #define AIL_LOCK_PROTECTION 18
  1154. #define DEFAULT_ALP NO // Don't suspend foreground thread by default
  1155. #define AIL_CPU_AFFINITY 50
  1156. #define DEFAULT_CPUAF 2 // Use Xenon CPU 2 by default
  1157. #endif
  1158. #ifdef IS_LINUX
  1159. #define AIL_TIMERS 13
  1160. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1161. #define AIL_MUTEX_PROTECTION 44
  1162. #define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
  1163. #endif
  1164. #ifdef IS_MAC
  1165. #define DIG_SM_FRAGMENT_SIZE 34
  1166. #define DEFAULT_DSFS 8 // Use 8 millisecond buffer fragments with Sound Manager
  1167. #define DIG_SM_MIX_FRAGMENT_CNT 42
  1168. #define DEFAULT_DSMFC 8 // Buffer 8 fragments ahead (should be an even number)
  1169. #define DIG_SM_FRAGMENT_CNT 35
  1170. #define DEFAULT_DSFC 64 // Allow up to 64 buffer fragments with Sound Manager (should be an even number)
  1171. #endif
  1172. #if defined(IS_WINDOWS)
  1173. #define DIG_DS_FRAGMENT_SIZE 34
  1174. #define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use
  1175. #define DIG_DS_FRAGMENT_CNT 35
  1176. #define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use
  1177. #define DIG_DS_MIX_FRAGMENT_CNT 42
  1178. #define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments
  1179. #define DIG_DS_USE_PRIMARY 36
  1180. #define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default
  1181. #define DIG_DS_DSBCAPS_CTRL3D 37
  1182. #define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default
  1183. #define DIG_DS_CREATION_HANDLER 38
  1184. #define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default
  1185. #define AIL_TIMERS 13
  1186. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  1187. #define DIG_MAX_CHAIN_ELEMENT_SIZE 14
  1188. #define DEFAULT_MCES 8192 // max of 8192 bytes/waveOut buffer
  1189. #define DIG_MIN_CHAIN_ELEMENT_TIME 45
  1190. #define DEFAULT_MCET 100 // 100 milliseconds buffers
  1191. #define DIG_USE_WAVEOUT 15
  1192. #define DEFAULT_DUW NO // Use DirectSound by default
  1193. #define DIG_DS_SECONDARY_SIZE 16
  1194. #define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default
  1195. #define DIG_DS_SAMPLE_CEILING 17
  1196. #define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples
  1197. #define AIL_LOCK_PROTECTION 18
  1198. #define DEFAULT_ALP NO // Don't suspend foreground thread by default
  1199. #define AIL_MUTEX_PROTECTION 44
  1200. #define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
  1201. #define DIG_PREFERRED_WO_DEVICE 40
  1202. #define DEFAULT_DPWOD WAVE_MAPPER // Preferred WaveOut device == WAVE_MAPPER
  1203. #define DIG_PREFERRED_DS_DEVICE 47
  1204. #define DEFAULT_DPDSD 0 // Preferred DirectSound device == default NULL GUID
  1205. #else
  1206. #ifdef IS_DOS
  1207. #define DIG_SERVICE_RATE 10
  1208. #define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz
  1209. #define DIG_HARDWARE_SAMPLE_RATE 11
  1210. #define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default
  1211. #define DIG_DMA_RESERVE 12
  1212. #define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA
  1213. #define DIG_LATENCY 13
  1214. #define DEFAULT_DL 100 // Half-buffer size in ms = 100
  1215. #define DIG_USE_STEREO 14
  1216. #define DEFAULT_DUS NO // Use mono output only
  1217. #define DIG_USE_16_BITS 15
  1218. #define DEFAULT_DU16 NO // Use 8-bit output by default
  1219. #define DIG_ALLOW_16_BIT_DMA 16
  1220. #define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary
  1221. #define DIG_SS_LOCK 17
  1222. #define DEFAULT_DSL NO // Don't disable IRQs while mixing
  1223. #define AIL_SCAN_FOR_HARDWARE 18
  1224. #define DEFAULT_ASH YES // Scan for I/O settings if necessary
  1225. #define AIL_ALLOW_VDM_EXECUTION 19
  1226. #define DEFAULT_AVE YES // Allow Windows "DOS box" execution
  1227. #endif
  1228. #endif
  1229. // ----------------------------------
  1230. // DLS Preference names and default values
  1231. // Unless otherwise specified, values must be established
  1232. // BEFORE calling DLSMSSOpen()!
  1233. // ----------------------------------
  1234. #define DLS_TIMEBASE 20
  1235. #define DEFAULT_DTB 120 // 120 intervals/second by default
  1236. #define DLS_VOICE_LIMIT 21
  1237. #define DEFAULT_DVL 64 // 64 voices supported
  1238. #define DLS_BANK_SELECT_ALIAS 22
  1239. #define DEFAULT_DBSA NO // Do not treat controller 114 as bank
  1240. #define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer
  1241. #define DEFAULT_DSB YES // until at least 2 available
  1242. #define DLS_VOLUME_BOOST 24
  1243. #define DEFAULT_DVB 0 // Boost final volume by 0 dB
  1244. #define DLS_ENABLE_FILTERING 25 // Filtering = on by default
  1245. #define DEFAULT_DEF YES // (may be changed at any time)
  1246. #ifdef IS_X86
  1247. #define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present
  1248. #define DEFAULT_AEMS YES // (may be changed at any time)
  1249. #endif
  1250. #define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to
  1251. #define DEFAULT_DGP YES // default GM driver layer
  1252. // (may be changed at any time)
  1253. #define DLS_ADPCM_TO_ASI_THRESHOLD 39 // Size in samples to switch to ASI
  1254. #define DEFAULT_DATAT 32768
  1255. //
  1256. // Add'l platform-independent prefs
  1257. //
  1258. #define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if
  1259. #define DEFAULT_DIL 250 // explicit size request cannot be satisfied
  1260. #ifdef IS_WINDOWS
  1261. #define DIG_USE_WAVEIN 43
  1262. #define DEFAULT_DUWI YES // Use waveIn for input by default
  1263. #endif
  1264. #define DIG_LEVEL_RAMP_SAMPLES 48
  1265. #define DEFAULT_DLRS 32 // Ramp level changes over first 32 samples in each buffer to reduce zipper noise
  1266. #define DIG_ENCODE_QUALITY_PERCENT 49
  1267. #define DEFAULT_DEQP 50 // Default encoding quality (e.g., for DTS) = 50%
  1268. #define N_PREFS 51 // # of preference types
  1269. typedef MSS_STRUCT _AILSOUNDINFO {
  1270. S32 format;
  1271. void const FAR* data_ptr;
  1272. U32 data_len;
  1273. U32 rate;
  1274. S32 bits;
  1275. S32 channels;
  1276. U32 samples;
  1277. U32 block_size;
  1278. void const FAR* initial_ptr;
  1279. } AILSOUNDINFO;
  1280. #ifndef RIB_H // RIB.H contents included if RIB.H not already included
  1281. #define RIB_H
  1282. #define ARY_CNT(x) (sizeof((x)) / sizeof((x)[0]))
  1283. // ----------------------------------
  1284. // RIB data types
  1285. // ----------------------------------
  1286. typedef S32 RIBRESULT;
  1287. #define RIB_NOERR 0 // Success -- no error
  1288. #define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available
  1289. #define RIB_NOT_FOUND 2 // Resource not found
  1290. #define RIB_OUT_OF_MEM 3 // Out of system RAM
  1291. //
  1292. // Handle to interface provider
  1293. //
  1294. typedef U32 HPROVIDER;
  1295. //
  1296. // Handle representing token used to obtain property data
  1297. //
  1298. // This needs to be large enough to store a function pointer
  1299. //
  1300. typedef UINTa HPROPERTY;
  1301. //
  1302. // Handle representing an enumerated interface entry
  1303. //
  1304. // RIB_enumerate_interface() returns 1 if valid next entry found, else
  1305. // 0 if end of list reached
  1306. //
  1307. typedef U32 HINTENUM;
  1308. #define HINTENUM_FIRST 0
  1309. //
  1310. // Handle representing an enumerated provider entry
  1311. //
  1312. // RIB_enumerate_providers() returns 1 if valid next entry found, else
  1313. // 0 if end of list reached
  1314. //
  1315. typedef U32 HPROENUM;
  1316. #define HPROENUM_FIRST 0
  1317. //
  1318. // Data types for RIB properties
  1319. //
  1320. typedef enum
  1321. {
  1322. RIB_NONE = 0, // No type
  1323. RIB_CUSTOM, // Used for pointers to application-specific structures
  1324. RIB_DEC, // Used for 32-bit integer values to be reported in decimal
  1325. RIB_HEX, // Used for 32-bit integer values to be reported in hex
  1326. RIB_FLOAT, // Used for 32-bit single-precision FP values
  1327. RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages
  1328. RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE
  1329. RIB_STRING, // Used for pointers to null-terminated ASCII strings
  1330. RIB_READONLY = 0x80000000 // Property is read-only
  1331. }
  1332. RIB_DATA_SUBTYPE;
  1333. //
  1334. // RIB_ENTRY_TYPE structure, used to register an interface or request one
  1335. //
  1336. typedef enum
  1337. {
  1338. RIB_FUNCTION = 0,
  1339. RIB_PROPERTY // Property: read-only or read-write data type
  1340. }
  1341. RIB_ENTRY_TYPE;
  1342. //
  1343. // RIB_INTERFACE_ENTRY, used to represent a function or data entry in an
  1344. // interface
  1345. //
  1346. typedef MSS_STRUCT
  1347. {
  1348. RIB_ENTRY_TYPE type; // See list above
  1349. C8 FAR *entry_name; // Name of desired function or property
  1350. UINTa token; // Function pointer or property token
  1351. RIB_DATA_SUBTYPE subtype; // Property subtype
  1352. }
  1353. RIB_INTERFACE_ENTRY;
  1354. //
  1355. // Standard RAD Interface Broker provider identification properties
  1356. //
  1357. #define PROVIDER_NAME ((U32) (S32) (-100)) // RIB_STRING name of decoder
  1358. #define PROVIDER_VERSION ((U32) (S32) (-101)) // RIB_HEX BCD version number
  1359. //
  1360. // Standard function to obtain provider properties (see PROVIDER_ defines
  1361. // above)
  1362. //
  1363. // Each provider of a searchable interface must export this function
  1364. //
  1365. typedef S32 (AILCALL FAR *PROVIDER_PROPERTY) (HPROPERTY index,
  1366. void FAR * before_value,
  1367. void const FAR * new_value,
  1368. void FAR * after_value
  1369. );
  1370. //
  1371. // Macros to simplify interface registrations/requests for functions,
  1372. // and properties
  1373. //
  1374. #define FN(entry_name) { RIB_FUNCTION, #entry_name, (UINTa) &(entry_name), RIB_NONE }
  1375. #define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (UINTa) &(entry_name), RIB_NONE }
  1376. #define PR(entry_name,ID) { RIB_PROPERTY, (entry_name), (UINTa) &(ID), RIB_NONE }
  1377. #define REG_PR(entry_name,ID,subtype) { RIB_PROPERTY, (entry_name), (UINTa) (ID), subtype }
  1378. #define RIB_register(x,y,z) RIB_register_interface ((HPROVIDER)(x), y, ARY_CNT(z), z)
  1379. #define RIB_unregister(x,y,z) RIB_unregister_interface((HPROVIDER)(ssx), y, ARY_CNT(z), z)
  1380. #define RIB_unregister_all(x) RIB_unregister_interface((HPROVIDER)(x), NULL, 0, NULL)
  1381. #define RIB_free_libraries() RIB_free_provider_library((HPROVIDER)(NULL));
  1382. #define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z)
  1383. // ----------------------------------
  1384. // Standard RIB API prototypes
  1385. // ----------------------------------
  1386. DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (long module);
  1387. DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider);
  1388. DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 const FAR *filename);
  1389. DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider);
  1390. DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider,
  1391. C8 const FAR *interface_name,
  1392. S32 entry_count,
  1393. RIB_INTERFACE_ENTRY const FAR *rlist);
  1394. DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider,
  1395. C8 const FAR *interface_name,
  1396. S32 entry_count,
  1397. RIB_INTERFACE_ENTRY const FAR *rlist);
  1398. DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider,
  1399. C8 const FAR *interface_name,
  1400. S32 entry_count,
  1401. RIB_INTERFACE_ENTRY FAR *rlist);
  1402. DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider,
  1403. C8 const FAR *interface_name,
  1404. RIB_ENTRY_TYPE entry_type,
  1405. C8 const FAR *entry_name,
  1406. UINTa FAR *token);
  1407. DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider,
  1408. C8 FAR *interface_name,
  1409. RIB_ENTRY_TYPE type,
  1410. HINTENUM FAR *next,
  1411. RIB_INTERFACE_ENTRY FAR *dest);
  1412. DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name,
  1413. HPROENUM FAR *next,
  1414. HPROVIDER FAR *dest);
  1415. DXDEC C8 FAR * AILCALL RIB_type_string (void const FAR * data,
  1416. RIB_DATA_SUBTYPE subtype);
  1417. DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 const FAR *interface_name,
  1418. C8 const FAR *property_name,
  1419. C8 const FAR *file_suffix);
  1420. DXDEC HPROVIDER AILCALL RIB_find_provider (C8 const FAR *interface_name,
  1421. C8 const FAR *property_name,
  1422. void const FAR *property_value);
  1423. //
  1424. // Static library definitions
  1425. //
  1426. #ifdef IS_STATIC
  1427. #define RIB_MAIN_NAME( name ) name##_RIB_Main
  1428. DXDEC S32 AILCALL RIB_MAIN_NAME(SRS)( HPROVIDER provider_handle, U32 up_down );
  1429. DXDEC S32 AILCALL RIB_MAIN_NAME(DTS)( HPROVIDER provider_handle, U32 up_down );
  1430. DXDEC S32 AILCALL RIB_MAIN_NAME(DolbySurround)( HPROVIDER provider_handle, U32 up_down );
  1431. DXDEC S32 AILCALL RIB_MAIN_NAME(MP3Dec)( HPROVIDER provider_handle, U32 up_down );
  1432. DXDEC S32 AILCALL RIB_MAIN_NAME(OggDec)( HPROVIDER provider_handle, U32 up_down );
  1433. DXDEC S32 AILCALL RIB_MAIN_NAME(SpxDec)( HPROVIDER provider_handle, U32 up_down );
  1434. DXDEC S32 AILCALL RIB_MAIN_NAME(SpxEnc)( HPROVIDER provider_handle, U32 up_down );
  1435. DXDEC S32 AILCALL RIB_MAIN_NAME(Voice)( HPROVIDER provider_handle, U32 up_down );
  1436. DXDEC S32 AILCALL RIB_MAIN_NAME(SpxVoice)( HPROVIDER provider_handle, U32 up_down );
  1437. DXDEC S32 AILCALL RIB_MAIN_NAME(DSP)( HPROVIDER provider_handle, U32 up_down );
  1438. #ifdef IS_XENON
  1439. DXDEC S32 AILCALL RIB_MAIN_NAME(XMADec)( HPROVIDER provider_handle, U32 up_down );
  1440. #endif
  1441. #define Register_RIB(name) RIB_load_static_provider_library(RIB_MAIN_NAME(name),#name)
  1442. #else
  1443. #define RIB_MAIN_NAME( name ) RIB_Main
  1444. DXDEC S32 AILCALL RIB_Main( HPROVIDER provider_handle, U32 up_down );
  1445. #endif
  1446. typedef S32 ( AILCALL FAR * RIB_MAIN_FUNC) ( HPROVIDER provider_handle, U32 up_down );
  1447. DXDEC HPROVIDER AILCALL RIB_load_static_provider_library (RIB_MAIN_FUNC main, char FAR* description);
  1448. DXDEC HPROVIDER AILCALL RIB_find_files_provider (C8 const FAR *interface_name,
  1449. C8 const FAR *property_name_1,
  1450. C8 const FAR *file_suffix_1,
  1451. C8 const FAR *property_name_2,
  1452. C8 const FAR *file_suffix_2);
  1453. DXDEC HPROVIDER AILCALL RIB_find_file_dec_provider (C8 const FAR *interface_name,
  1454. C8 const FAR *property_name_1,
  1455. U32 decimal_property_value_1,
  1456. C8 const FAR *property_name_2,
  1457. C8 const FAR *file_suffix_2);
  1458. DXDEC S32 AILCALL RIB_load_application_providers
  1459. (C8 const FAR *filespec);
  1460. DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider,
  1461. U32 index,
  1462. SINTa value);
  1463. DXDEC SINTa AILCALL RIB_provider_user_data (HPROVIDER provider,
  1464. U32 index);
  1465. DXDEC void AILCALL RIB_set_provider_system_data
  1466. (HPROVIDER provider,
  1467. U32 index,
  1468. SINTa value);
  1469. DXDEC SINTa AILCALL RIB_provider_system_data (HPROVIDER provider,
  1470. U32 index);
  1471. DXDEC C8 FAR * AILCALL RIB_error (void);
  1472. #endif
  1473. #ifndef MSS_ASI_VERSION // MSSASI.H contents included if MSSASI.H not already included
  1474. #define AIL_ASI_VERSION 1
  1475. #define AIL_ASI_REVISION 0
  1476. //
  1477. // Handle to stream being managed by ASI codec
  1478. //
  1479. typedef SINTa HASISTREAM;
  1480. //
  1481. // ASI result codes
  1482. //
  1483. typedef S32 ASIRESULT;
  1484. #define ASI_NOERR 0 // Success -- no error
  1485. #define ASI_NOT_ENABLED 1 // ASI not enabled
  1486. #define ASI_ALREADY_STARTED 2 // ASI already started
  1487. #define ASI_INVALID_PARAM 3 // Invalid parameters used
  1488. #define ASI_INTERNAL_ERR 4 // Internal error in ASI driver
  1489. #define ASI_OUT_OF_MEM 5 // Out of system RAM
  1490. #define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
  1491. #define ASI_NOT_FOUND 7 // ASI supported device not found
  1492. #define ASI_NOT_INIT 8 // ASI not initialized
  1493. #define ASI_CLOSE_ERR 9 // ASI not closed correctly
  1494. // ----------------------------------
  1495. // Application-provided ASI callbacks
  1496. // ----------------------------------
  1497. //
  1498. // AILASIFETCHCB: Called by ASI to obtain data from stream source
  1499. //
  1500. // offset normally will be either 0 at the first call made by the codec
  1501. // or -1 to specify a continuous stream, except when ASI_stream_seek()
  1502. // is called to restart the stream codec at a new stream offset. In this
  1503. // case, the application must execute the seek operation on the ASI codec's
  1504. // behalf.
  1505. //
  1506. // In response to this callback, the application should read the requested
  1507. // data and copy it to the specified destination buffer, returning the number
  1508. // of bytes copied (which can be less than bytes_requested if the end of
  1509. // the stream is reached).
  1510. //
  1511. typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (UINTa user, // User value passed to ASI_open_stream()
  1512. void FAR *dest, // Location to which stream data should be copied by app
  1513. S32 bytes_requested, // # of bytes requested by ASI codec
  1514. S32 offset); // If not -1, application should seek to this point in stream
  1515. //############################################################################
  1516. //## ##
  1517. //## Interface "ASI codec" ##
  1518. //## ##
  1519. //############################################################################
  1520. //
  1521. // Initialize ASI stream codec
  1522. //
  1523. // No other ASI functions may be called outside an ASI_startup() /
  1524. // ASI_shutdown() pair, except for the standard RIB function
  1525. // PROVIDER_property() where appropriate.
  1526. //
  1527. typedef ASIRESULT (AILCALL FAR *ASI_STARTUP)(void);
  1528. //
  1529. // Shut down ASI codec
  1530. //
  1531. typedef ASIRESULT (AILCALL FAR * ASI_SHUTDOWN)(void);
  1532. //
  1533. // Return codec error message, or NULL if no errors have occurred since
  1534. // last call
  1535. //
  1536. // The ASI error text state is global to all streams
  1537. //
  1538. typedef C8 FAR * (AILCALL FAR * ASI_ERROR)(void);
  1539. //############################################################################
  1540. //## ##
  1541. //## Interface "ASI stream" ##
  1542. //## ##
  1543. //############################################################################
  1544. //
  1545. // Open a stream, returning handle to stream
  1546. //
  1547. typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (UINTa user, // User value passed to fetch callback
  1548. AILASIFETCHCB fetch_CB, // Source data fetch handler
  1549. U32 total_size); // Total size for %-done calculations (0=unknown)
  1550. //
  1551. // Translate data in stream, returning # of bytes actually decoded or encoded
  1552. //
  1553. // Any number of bytes may be requested. Requesting more data than is
  1554. // available in the codec's internal buffer will cause the AILASIFETCHCB
  1555. // handler to be called to fetch more data from the stream.
  1556. //
  1557. typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream
  1558. void FAR *buffer, // Destination for processed data
  1559. S32 buffer_size); // # of bytes to return in buffer
  1560. //
  1561. // Restart stream decoding process at new offset
  1562. //
  1563. // Relevant for decoders only
  1564. //
  1565. // Seek destination is given as offset in bytes from beginning of stream
  1566. //
  1567. // At next ASI_stream_process() call, decoder will seek to the closest possible
  1568. // point in the stream which occurs at or after the specified position
  1569. //
  1570. // This function has no effect for decoders which do not support random
  1571. // seeks on a given stream type
  1572. //
  1573. // Warning: some decoders may need to implement seeking by reparsing
  1574. // the entire stream up to the specified offset, through multiple calls
  1575. // to the data-fetch callback. This operation may be extremely
  1576. // time-consuming on large files or slow network connections.
  1577. //
  1578. // A stream_offset value of -1 may be used to inform the decoder that the
  1579. // application has changed the input stream offset on its own, e.g. for a
  1580. // double-buffering application where the ASI decoder is not accessing the
  1581. // stream directly. ASI decoders should respond to this by flushing all
  1582. // internal buffers and resynchronizing themselves to the data stream.
  1583. //
  1584. typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream,
  1585. S32 stream_offset);
  1586. //
  1587. // Retrieve or set a property value by index (returns 1 on success)
  1588. //
  1589. typedef S32 (AILCALL FAR *ASI_STREAM_PROPERTY) (HASISTREAM stream,
  1590. HPROPERTY property,
  1591. void FAR * before_value,
  1592. void const FAR * new_value,
  1593. void FAR * after_value
  1594. );
  1595. //
  1596. // Close stream, freeing handle and all internally-allocated resources
  1597. //
  1598. typedef ASIRESULT (AILCALL FAR *ASI_STREAM_CLOSE) (HASISTREAM stream);
  1599. #endif
  1600. //############################################################################
  1601. //## ##
  1602. //## Interface "MSS mixer services" ##
  1603. //## ##
  1604. //############################################################################
  1605. //
  1606. // Operation flags used by mixer and filter modules
  1607. //
  1608. #define M_DEST_STEREO 1 // Set to enable stereo mixer output
  1609. #define M_SRC_16 2 // Set to enable mixing of 16-bit samples
  1610. #define M_FILTER 4 // Set to enable filtering when resampling
  1611. #define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples
  1612. #define M_ORDER 16 // Set to reverse L/R stereo order for sample
  1613. #define M_RESAMPLE 32 // Set to enable playback ratios other than 65536
  1614. #define M_VOL_SCALING 64 // Set to enable volume scalars other than 2048
  1615. #define M_COPY16_NOVOL 128
  1616. #ifdef IS_32
  1617. //
  1618. // Initialize mixer
  1619. //
  1620. // No other mixer functions may be called outside a MIXER_startup() /
  1621. // MIXER_shutdown() pair, except for the standard RIB function
  1622. // PROVIDER_property() as appropriate.
  1623. //
  1624. typedef void (AILCALL FAR *MIXER_STARTUP)(void);
  1625. //
  1626. // Shut down mixer
  1627. //
  1628. typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void);
  1629. //
  1630. // Flush mixer buffer
  1631. //
  1632. typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest,
  1633. S32 len
  1634. #ifdef IS_X86
  1635. ,U32 MMX_available
  1636. #endif
  1637. );
  1638. //
  1639. // Perform audio mixing operation
  1640. //
  1641. typedef void (AILCALL FAR *MIXER_MERGE) (void const FAR * FAR *src,
  1642. U32 FAR *src_fract,
  1643. void const FAR *src_end,
  1644. S32 FAR * FAR *dest,
  1645. void FAR *dest_end,
  1646. S32 FAR *left_val,
  1647. S32 FAR *right_val,
  1648. S32 playback_ratio,
  1649. S32 scale_left,
  1650. S32 scale_right,
  1651. U32 operation
  1652. #ifdef IS_X86
  1653. ,U32 MMX_available
  1654. #endif
  1655. );
  1656. //
  1657. // Translate mixer buffer contents to final output format
  1658. //
  1659. // "option" parameter is big_endian_output on Mac, MMX on x86, overwrite flag on PS2
  1660. //
  1661. typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src,
  1662. S32 src_len,
  1663. void FAR *dest,
  1664. U32 operation
  1665. #if defined(IS_BE) || defined(IS_X86) || defined(IS_PS2)
  1666. ,U32 option
  1667. #endif
  1668. );
  1669. #else
  1670. //
  1671. // Initialize mixer
  1672. //
  1673. // No other mixer functions may be called outside a MIXER_startup() /
  1674. // MIXER_shutdown() pair, except for the standard RIB function
  1675. // PROVIDER_property() as appropriate.
  1676. //
  1677. typedef void (AILCALL FAR *MIXER_STARTUP)(void);
  1678. //
  1679. // Shut down mixer
  1680. //
  1681. typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void);
  1682. //
  1683. // Flush mixer buffer
  1684. //
  1685. typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest,
  1686. S32 len,
  1687. U32 MMX_available);
  1688. //
  1689. // Perform audio mixing operation
  1690. //
  1691. typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel,
  1692. U32 dest_sel,
  1693. U32 FAR *src_fract,
  1694. U32 FAR *src_offset,
  1695. U32 FAR *dest_offset,
  1696. U32 src_end_offset,
  1697. U32 dest_end_offset,
  1698. S32 FAR *left_val,
  1699. S32 FAR *right_val,
  1700. S32 playback_ratio,
  1701. S32 scale_both,
  1702. U32 operation);
  1703. //
  1704. // Translate mixer buffer contents to final output format
  1705. //
  1706. typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src,
  1707. S32 src_len,
  1708. void FAR *dest,
  1709. U32 operation,
  1710. U32 option);
  1711. #endif
  1712. typedef MSS_STRUCT _MSS_BB // Used in both MC and conventional mono/stereo configurations
  1713. {
  1714. S32 FAR *buffer; // Build buffer
  1715. S32 bytes; // Size in bytes
  1716. S32 chans; // Always mono (1) or stereo (2)
  1717. S32 speaker_offset; // Destination offset in interleaved PCM block for left channel
  1718. }
  1719. MSS_BB;
  1720. typedef MSS_STRUCT _ADPCMDATATAG
  1721. {
  1722. U32 blocksize;
  1723. U32 extrasamples;
  1724. U32 blockleft;
  1725. U32 step;
  1726. UINTa savesrc;
  1727. U32 sample;
  1728. UINTa destend;
  1729. UINTa srcend;
  1730. U32 samplesL;
  1731. U32 samplesR;
  1732. U16 moresamples[16];
  1733. } ADPCMDATA;
  1734. typedef void (AILCALL FAR * MIXER_MC_COPY) ( MSS_BB FAR * build,
  1735. S32 n_build_buffers,
  1736. void FAR * lpWaveAddr,
  1737. S32 hw_format,
  1738. #ifdef IS_X86
  1739. S32 use_MMX,
  1740. #endif
  1741. S32 samples_per_buffer,
  1742. S32 physical_channels_per_sample );
  1743. typedef void (AILCALL FAR * MIXER_ADPCM_DECODE ) ( void FAR * dest,
  1744. void const FAR * in,
  1745. S32 out_len,
  1746. S32 in_len,
  1747. S32 input_format,
  1748. ADPCMDATA FAR *adpcm_data);
  1749. //
  1750. // Type definitions
  1751. //
  1752. MSS_STRUCT _DIG_DRIVER;
  1753. MSS_STRUCT _MDI_DRIVER;
  1754. typedef MSS_STRUCT _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver
  1755. typedef MSS_STRUCT _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver
  1756. typedef MSS_STRUCT _SAMPLE FAR * HSAMPLE; // Handle to sample
  1757. typedef MSS_STRUCT _SMPATTRIBS FAR * HSATTRIBS; // Handle to sample performance attributes
  1758. typedef MSS_STRUCT _SEQUENCE FAR * HSEQUENCE; // Handle to sequence
  1759. typedef S32 HTIMER; // Handle to timer
  1760. #ifdef IS_DOS
  1761. //
  1762. // Type definitions
  1763. //
  1764. typedef MSS_STRUCT // I/O parameters structure
  1765. {
  1766. S16 IO;
  1767. S16 IRQ;
  1768. S16 DMA_8_bit;
  1769. S16 DMA_16_bit;
  1770. S32 IO_reserved[4];
  1771. }
  1772. IO_PARMS;
  1773. typedef MSS_STRUCT // Standard MSS 3.X VDI driver header
  1774. {
  1775. S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z
  1776. U32 driver_version;
  1777. REALFAR common_IO_configurations;
  1778. U16 num_IO_configurations;
  1779. REALFAR environment_string;
  1780. IO_PARMS IO;
  1781. S16 service_rate;
  1782. U16 busy;
  1783. U16 driver_num; // Driver number
  1784. U16 this_ISR; // Offset of INT 66H dispatcher
  1785. REALFAR prev_ISR; // Pointer to previous INT 66H ISR
  1786. S8 scratch[128]; // Shared scratch workspace
  1787. S8 dev_name[80]; // Device name (VDI version >= 1.12 only)
  1788. }
  1789. VDI_HDR;
  1790. typedef MSS_STRUCT
  1791. {
  1792. U16 minimum_physical_sample_rate;
  1793. U16 nominal_physical_sample_rate;
  1794. U16 maximum_physical_sample_rate;
  1795. U16 minimum_DMA_half_buffer_size;
  1796. U16 maximum_DMA_half_buffer_size;
  1797. U32 flags;
  1798. }
  1799. DIG_MODE;
  1800. typedef MSS_STRUCT
  1801. {
  1802. U8 format_supported[16];
  1803. DIG_MODE format_data[16];
  1804. }
  1805. DIG_DDT;
  1806. typedef MSS_STRUCT
  1807. {
  1808. REALFAR DMA_buffer_A;
  1809. REALFAR DMA_buffer_B;
  1810. S16 active_buffer;
  1811. }
  1812. DIG_DST;
  1813. typedef MSS_STRUCT
  1814. {
  1815. REALFAR library_environment;
  1816. REALFAR GTL_suffix;
  1817. U16 num_voices;
  1818. U16 max_melodic_channel;
  1819. U16 min_melodic_channel;
  1820. U16 percussion_channel;
  1821. }
  1822. MDI_DDT;
  1823. typedef MSS_STRUCT
  1824. {
  1825. S8 library_directory[128];
  1826. S8 GTL_filename[128];
  1827. S8 MIDI_data[512];
  1828. }
  1829. MDI_DST;
  1830. typedef MSS_STRUCT // Initialization file structure
  1831. {
  1832. char device_name[128]; // Device name
  1833. char driver_name[128]; // Driver filename
  1834. IO_PARMS IO; // I/O parameters for driver
  1835. }
  1836. AIL_INI;
  1837. typedef MSS_STRUCT // Handle to driver
  1838. {
  1839. REALFAR seg; // Seg:off pointer to driver (off=0)
  1840. U32 sel; // Selector for driver (off=0)
  1841. void *buf; // Protected-mode pointer to driver
  1842. U32 size; // Size of driver image
  1843. VDI_HDR *VHDR; // Pointer to driver header (same as buf)
  1844. S32 type; // AIL3DIG or AIL3MDI (see below)
  1845. S32 initialized; // 1 if hardware successfully init'd, else 0
  1846. S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ #
  1847. HTIMER server; // DRV_SERVE periodic timer, if requested
  1848. // Vector to high-level destructor, if any
  1849. void (AILCALL *destructor)(HDIGDRIVER);
  1850. // High-level descriptor (DIG_ or MDI_DRIVER)
  1851. void *descriptor;
  1852. }
  1853. AIL_DRIVER;
  1854. typedef MSS_STRUCT // VDI interface register structure
  1855. {
  1856. S16 AX;
  1857. S16 BX;
  1858. S16 CX;
  1859. S16 DX;
  1860. S16 SI;
  1861. S16 DI;
  1862. }
  1863. VDI_CALL;
  1864. #endif
  1865. //
  1866. // Function pointer types
  1867. //
  1868. typedef void (AILCALLBACK FAR* AILINCB) (void const FAR *data, S32 len, UINTa user_data);
  1869. typedef void (AILCALLBACK FAR* AILTRACECB) (C8 *text, S32 nest_depth);
  1870. typedef void (AILCALLBACK FAR* AILTIMERCB) (UINTa user);
  1871. typedef void (AILCALLBACK FAR* AILSAMPLECB) (HSAMPLE sample);
  1872. typedef F32 (AILCALLBACK FAR* AILFALLOFFCB) (HSAMPLE sample, F32 distance, F32 rolloff_factor, F32 min_dist, F32 max_dist);
  1873. typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2);
  1874. typedef S32 (AILCALLBACK FAR* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch);
  1875. typedef S32 (AILCALLBACK FAR* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data);
  1876. typedef void (AILCALLBACK FAR* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data);
  1877. typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure);
  1878. typedef void (AILCALLBACK FAR* AILSEQUENCECB) (HSEQUENCE seq);
  1879. typedef S32 (AILCALLBACK FAR *SS_STREAM_CB) (HSAMPLE S, S16 FAR *dest_mono_sample_buffer, S32 dest_buffer_size);
  1880. //
  1881. // Handle to sample and driver being managed by pipeline filter
  1882. //
  1883. typedef SINTa HSAMPLESTATE;
  1884. typedef SINTa HDRIVERSTATE;
  1885. //
  1886. // Digital pipeline stages
  1887. //
  1888. // These are the points at which external modules may be installed into
  1889. // a given HSAMPLE or HDIGDRIVER's processing pipeline
  1890. //
  1891. typedef enum
  1892. {
  1893. SP_ASI_DECODER = 0, // Must be "ASI codec stream" provider
  1894. SP_FILTER, // Must be "MSS pipeline filter" provider
  1895. SP_FILTER_0 = SP_FILTER, // Must be "MSS pipeline filter" provider
  1896. SP_FILTER_1, // Must be "MSS pipeline filter" provider
  1897. SP_FILTER_2, // Must be "MSS pipeline filter" provider
  1898. SP_FILTER_3, // Must be "MSS pipeline filter" provider
  1899. SP_FILTER_4, // Must be "MSS pipeline filter" provider
  1900. SP_FILTER_5, // Must be "MSS pipeline filter" provider
  1901. SP_FILTER_6, // Must be "MSS pipeline filter" provider
  1902. SP_FILTER_7, // Must be "MSS pipeline filter" provider
  1903. SP_MERGE, // Must be "MSS mixer" provider
  1904. N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid sample pipeline stages)
  1905. SP_OUTPUT = N_SAMPLE_STAGES, // Used to set/get prefs/attribs on a driver's output or matrix filter (if present)
  1906. SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown
  1907. }
  1908. SAMPLESTAGE;
  1909. typedef enum
  1910. {
  1911. DP_FLUSH = 0, // Must be "MSS mixer" provider
  1912. DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default)
  1913. DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default)
  1914. DP_COPY, // Must be "MSS mixer" provider
  1915. DP_MC_COPY, // Must be "MSS mixer" provider
  1916. DP_ADPCM_DECODE, // Must be "MSS mixer" provider
  1917. N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages)
  1918. DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown
  1919. }
  1920. DIGDRVSTAGE;
  1921. typedef MSS_STRUCT
  1922. {
  1923. ASI_STREAM_OPEN ASI_stream_open;
  1924. ASI_STREAM_PROCESS ASI_stream_process;
  1925. ASI_STREAM_SEEK ASI_stream_seek;
  1926. ASI_STREAM_CLOSE ASI_stream_close;
  1927. ASI_STREAM_PROPERTY ASI_stream_property;
  1928. HPROPERTY INPUT_BIT_RATE;
  1929. HPROPERTY INPUT_SAMPLE_RATE;
  1930. HPROPERTY INPUT_BITS;
  1931. HPROPERTY INPUT_CHANNELS;
  1932. HPROPERTY OUTPUT_BIT_RATE;
  1933. HPROPERTY OUTPUT_SAMPLE_RATE;
  1934. HPROPERTY OUTPUT_BITS;
  1935. HPROPERTY OUTPUT_CHANNELS;
  1936. HPROPERTY OUTPUT_RESERVOIR;
  1937. HPROPERTY POSITION;
  1938. HPROPERTY PERCENT_DONE;
  1939. HPROPERTY MIN_INPUT_BLOCK_SIZE;
  1940. HPROPERTY RAW_RATE;
  1941. HPROPERTY RAW_BITS;
  1942. HPROPERTY RAW_CHANNELS;
  1943. HPROPERTY REQUESTED_RATE;
  1944. HPROPERTY REQUESTED_BITS;
  1945. HPROPERTY REQUESTED_CHANS;
  1946. HPROPERTY STREAM_SEEK_POS;
  1947. HPROPERTY DATA_START_OFFSET;
  1948. HPROPERTY DATA_LEN;
  1949. HASISTREAM stream;
  1950. }
  1951. ASISTAGE;
  1952. typedef MSS_STRUCT
  1953. {
  1954. struct _FLTPROVIDER FAR *provider;
  1955. HSAMPLESTATE sample_state;
  1956. }
  1957. FLTSTAGE;
  1958. typedef MSS_STRUCT
  1959. {
  1960. S32 active; // Pass-through if 0, active if 1
  1961. HPROVIDER provider;
  1962. union
  1963. {
  1964. ASISTAGE ASI;
  1965. MIXER_MERGE MSS_mixer_merge;
  1966. FLTSTAGE FLT;
  1967. }
  1968. TYPE;
  1969. }
  1970. SPINFO;
  1971. typedef MSS_STRUCT
  1972. {
  1973. S32 active; // Pass-through if 0, active if 1
  1974. HPROVIDER provider;
  1975. union
  1976. {
  1977. MIXER_FLUSH MSS_mixer_flush;
  1978. MIXER_COPY MSS_mixer_copy;
  1979. MIXER_MC_COPY MSS_mixer_mc_copy;
  1980. MIXER_ADPCM_DECODE MSS_mixer_adpcm_decode;
  1981. }
  1982. TYPE;
  1983. }
  1984. DPINFO;
  1985. //
  1986. // Other data types
  1987. //
  1988. typedef enum
  1989. {
  1990. WIN32_TIMER_THREAD, // Handle to thread used to run mixer and all other background tasks/timers
  1991. WIN32_STREAM_THREAD, // Handle to thread to do disk IO in the streaming API
  1992. WIN32_HWAVEOUT, // waveOut handle for HDIGDRIVER, if any
  1993. WIN32_HWAVEIN, // waveIn handle for HDIGINPUT, if any
  1994. WIN32_LPDS, // lpDirectSound pointer for HSAMPLE
  1995. WIN32_LPDSB, // lpDirectSoundBuffer pointer for HSAMPLE
  1996. WIN32_HWND, // HWND that will be used to open DirectSound driver
  1997. PS3_TIMER_THREAD, // Handle to thread to run background task/timer
  1998. PS3_STREAM_THREAD, // Handle to thread to do disk IO in the streaming API
  1999. PS3_AUDIO_PORT, // cellaudio port that Miles is using
  2000. PS3_AUDIO_ADDRESS, // address of cellaudio sound buffer
  2001. PS3_AUDIO_LENGTH, // length of cellaudio sound buffer
  2002. PS3_AUDIO_POSITION, // current playback position of cellaudio sound buffer
  2003. XB_TIMER_THREAD, // Handle to thread used to run background tasks/timers
  2004. XB_STREAM_THREAD, // Handle to thread to do disk IO in the streaming API
  2005. XB_LPDS, // lpDirectSound pointer for HSAMPLE
  2006. XB_LPDSB, // lpDirectSoundBuffer pointer for HSAMPLE
  2007. XB360_TIMER_THREAD, // Handle to thread used to run mixer and all other background tasks/timers
  2008. XB360_STREAM_THREAD, // Handle to thread to do disk IO in the streaming API
  2009. XB360_LPXAB // IXAudioSourceVoice pointer for HDIGDRIVER
  2010. }
  2011. MSS_PLATFORM_PROPERTY;
  2012. typedef MSS_STRUCT _SMPATTRIBS
  2013. {
  2014. F32 cone_inner_angle;
  2015. F32 cone_outer_angle;
  2016. F32 cone_outer_volume;
  2017. F32 max_distance;
  2018. F32 min_distance;
  2019. S32 auto_3D_wet_atten;
  2020. S32 is_3D;
  2021. F32 X_pos;
  2022. F32 Y_pos;
  2023. F32 Z_pos;
  2024. F32 X_face;
  2025. F32 Y_face;
  2026. F32 Z_face;
  2027. F32 X_up;
  2028. F32 Y_up;
  2029. F32 Z_up;
  2030. F32 X_meters_per_ms;
  2031. F32 Y_meters_per_ms;
  2032. F32 Z_meters_per_ms;
  2033. F32 channel_levels[MAX_SPEAKERS];
  2034. S32 n_channel_levels;
  2035. F32 exclusion;
  2036. F32 obstruction;
  2037. F32 occlusion;
  2038. S32 loop_count;
  2039. S32 loop_start_offset;
  2040. S32 loop_end_offset;
  2041. F32 LPF_cutoff;
  2042. S32 playback_rate;
  2043. U32 position;
  2044. F32 dry_level;
  2045. F32 wet_level;
  2046. U32 playback_status;
  2047. F32 FL_51_level;
  2048. F32 FR_51_level;
  2049. F32 BL_51_level;
  2050. F32 BR_51_level;
  2051. F32 C_51_level;
  2052. F32 LFE_51_level;
  2053. F32 left_volume; // Used in non-5.1 API modes
  2054. F32 right_volume;
  2055. SAMPLESTAGE filter_stages [MAX_SAVED_FILTER_PROPERTIES];
  2056. HPROVIDER filter_providers [MAX_SAVED_FILTER_PROPERTIES];
  2057. UINTa filter_property_tokens[MAX_SAVED_FILTER_PROPERTIES];
  2058. U32 filter_property_values[MAX_SAVED_FILTER_PROPERTIES];
  2059. S32 n_filter_properties;
  2060. }
  2061. SMPATTRIBS;
  2062. typedef MSS_STRUCT _AIL_INPUT_INFO // Input descriptor type
  2063. {
  2064. U32 device_ID; // DS LPGUID or wave device ID
  2065. U32 hardware_format; // e.g., DIG_F_STEREO_16
  2066. U32 hardware_rate; // e.g., 22050
  2067. AILINCB callback; // Callback function to receive incoming data
  2068. S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY)
  2069. UINTa user_data; // this is a user defined value
  2070. }
  2071. AIL_INPUT_INFO;
  2072. typedef MSS_STRUCT _AILTIMER // Timer instance
  2073. {
  2074. U32 status;
  2075. AILTIMERCB callback;
  2076. UINTa user;
  2077. S32 elapsed;
  2078. S32 value;
  2079. S32 callingCT; // Calling EXE's task number (16 bit only)
  2080. S32 callingDS; // Calling EXE's DS (used in 16 bit only)
  2081. } AILTIMERSTR;
  2082. #ifndef IS_WIN64
  2083. #define OFSblocksize 0 // these constants valid for 32-bit versions only!
  2084. #define OFSextrasamples 4
  2085. #define OFSblockleft 8
  2086. #define OFSstep 12
  2087. #define OFSsavesrc 16
  2088. #define OFSsample 20
  2089. #define OFSdestend 24
  2090. #define OFSsrcend 28
  2091. #define OFSsamplesL 32
  2092. #define OFSsamplesR 36
  2093. #define OFSmoresamples 40
  2094. #endif
  2095. typedef MSS_STRUCT LOWPASS_CONSTANT_INFO
  2096. {
  2097. S32 A;
  2098. S32 B0, B1;
  2099. } LOWPASS_CONSTANT_INFO;
  2100. typedef MSS_STRUCT LOWPASS_UPDATED_INFO
  2101. {
  2102. S32 XL0, XL1;
  2103. S32 YL0, YL1;
  2104. S32 XR0, XR1;
  2105. S32 YR0, YR1;
  2106. } LOWPASS_UPDATED_INFO;
  2107. typedef MSS_STRUCT LOWPASS_INFO
  2108. {
  2109. LOWPASS_UPDATED_INFO u;
  2110. LOWPASS_CONSTANT_INFO c;
  2111. F32 cutoff;
  2112. S32 on;
  2113. } LOWPASS_INFO;
  2114. typedef union STAGE_BUFFER
  2115. {
  2116. union STAGE_BUFFER * next;
  2117. U8 data[ 1 ];
  2118. } STAGE_BUFFER;
  2119. typedef MSS_STRUCT _MSSVECTOR3D
  2120. {
  2121. F32 x;
  2122. F32 y;
  2123. F32 z;
  2124. } MSSVECTOR3D;
  2125. typedef MSS_STRUCT _S3DSTATE // Portion of HSAMPLE that deals with 3D positioning
  2126. {
  2127. MSSVECTOR3D position; // 3D position
  2128. MSSVECTOR3D face; // 3D orientation
  2129. MSSVECTOR3D up; // 3D up-vector
  2130. MSSVECTOR3D velocity; // 3D velocity
  2131. S32 doppler_valid; // TRUE if OK to apply Doppler shift
  2132. F32 doppler_shift; // Scalar for S->playback rate
  2133. F32 inner_angle; // Cone attenuation parameters
  2134. F32 outer_angle; // (Angles divided by two and convered to rads for dot-product comparisons)
  2135. F32 outer_volume;
  2136. S32 cone_enabled;
  2137. F32 max_dist; // Sample distances
  2138. F32 min_dist;
  2139. S32 dist_changed; // TRUE if min/max distances have changed and need to be sent to the hardware
  2140. S32 auto_3D_atten; // TRUE if distance/cone attenuation should be applied to wet signal
  2141. F32 atten_3D; // Attenuation due to distance/cone effects, calculated by software 3D positioner
  2142. HSAMPLE owner; // May be NULL if used for temporary/internal calculations
  2143. AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired
  2144. }
  2145. S3DSTATE;
  2146. typedef MSS_STRUCT _SAMPLE // Sample instance
  2147. {
  2148. char tag[4]; // HSAM
  2149. HDIGDRIVER driver; // Driver for playback
  2150. S32 index; // Numeric index of this sample
  2151. void const FAR *start[2]; // Sample buffer address (W)
  2152. U32 len [2]; // Sample buffer size in bytes (W)
  2153. U32 pos [2]; // Index to next byte (R/W)
  2154. U32 done [2]; // Nonzero if buffer with len=0 sent by app
  2155. S32 reset_ASI [2]; // Reset the ASI decoder at the end of the buffer
  2156. S32 reset_seek_pos[2]; // New destination offset in stream source data, for ASI codecs that care
  2157. S32 exhaust_ASI; // Are we prolonging the buffer lifetime until ASI output is exhausted?
  2158. U32 src_fract; // Fractional part of source address
  2159. S32 left_val; // Mixer source value from end of last buffer
  2160. S32 right_val; // Mixer source value from end of last buffer
  2161. S32 current_buffer; // Buffer # active (0/1)
  2162. S32 last_buffer; // Last active buffer (for double-buffering)
  2163. S32 starved; // Buffer stream has run out of data
  2164. S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite)
  2165. S32 loop_start; // Starting offset of loop block (0=SOF)
  2166. S32 loop_end; // End offset of loop block (-1=EOF)
  2167. S32 orig_loop_count; // Original loop properties specified by app, before any
  2168. S32 orig_loop_start; // alignment constraints
  2169. S32 orig_loop_end;
  2170. S32 format; // DIG_F format (8/16 bits, mono/stereo)
  2171. U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only)
  2172. S32 playback_rate; // Playback rate in hertz
  2173. F32 save_volume; // Sample volume 0-1.0
  2174. F32 save_pan; // Mono panpot/stereo balance (0=L ... 1.0=R)
  2175. F32 left_volume; // Left/mono volume 0 to 1.0
  2176. F32 right_volume; // Right volume 0 to 1.0
  2177. F32 wet_level; // reverb level 0 to 1.0
  2178. F32 dry_level; // non-reverb level 0 to 1.0
  2179. F32 obstruction;
  2180. F32 occlusion;
  2181. F32 exclusion;
  2182. F32 auto_3D_channel_levels[MAX_SPEAKERS]; // Channel levels set by 3D positioner (always 1.0 if not 3D-positioned)
  2183. F32 user_channel_levels[MAX_SPEAKERS]; // Channel levels set by AIL_set_sample_channel_levels() [driver->logical_channels]
  2184. S32 cur_scale[MAX_SPEAKERS]; // Calculated 11-bit volume scale factors for current/previous mixing interval
  2185. S32 prev_scale[MAX_SPEAKERS]; // (These are all indexed by build buffer*2, not speaker indexes!)
  2186. S32 ramps_left[MAX_SPEAKERS];
  2187. LOWPASS_INFO lp; // low pass info
  2188. F32 cutoff_param;
  2189. F32 calculated_cut;
  2190. S32 service_type; // 1 if single-buffered; 2 if streamed
  2191. AILSAMPLECB SOB; // Start-of-block callback function
  2192. AILSAMPLECB EOB; // End-of-buffer callback function
  2193. AILSAMPLECB EOS; // End-of-sample callback function
  2194. SINTa user_data [8]; // Miscellaneous user data
  2195. SINTa system_data[8]; // Miscellaneous system data
  2196. ADPCMDATA adpcm;
  2197. S32 last_decomp_left; // last sample in an asi or adpcm buffer
  2198. S32 last_decomp_right; // last sample in an asi or adpcm buffer
  2199. S32 doeob; // Flags to trigger callbacks
  2200. S32 dosob;
  2201. S32 doeos;
  2202. //
  2203. // Sample pipeline stages
  2204. //
  2205. SPINFO pipeline[N_SAMPLE_STAGES];
  2206. S32 n_active_filters; // # of SP_FILTER_n stages active
  2207. //
  2208. // 3D-related state for all platforms (including Xbox)
  2209. //
  2210. S32 is_3D; // TRUE if channel levels are derived automatically from 3D positional state, FALSE if they're controlled manually
  2211. S3DSTATE S3D; // Software version applies 3D positioning only if is_3D == TRUE, but output filters always use it
  2212. #ifdef MSS_VFLT_SUPPORTED
  2213. void FAR *voice; // Optional object used by output filter to store per-sample information such as DS3D buffers
  2214. #endif
  2215. //
  2216. // Platform-specific members
  2217. //
  2218. #ifdef IS_XBOX
  2219. AILLPDIRECTSOUNDBUFFER pDSB;
  2220. S32 hw_rate;
  2221. S32 hw_channels;
  2222. S32 hw_bits;
  2223. S32 direct_mode;
  2224. STAGE_BUFFER * ds_staging_buffer;
  2225. S32 waiting_for_which_half;
  2226. S32 cleared_bufs;
  2227. S32 cleared_bytes;
  2228. S32 need_more_zeroes;
  2229. S32 ds_stage_size;
  2230. F32 shadow_FL;
  2231. F32 shadow_FR;
  2232. F32 shadow_FC;
  2233. F32 shadow_LF;
  2234. F32 shadow_BL;
  2235. F32 shadow_BR;
  2236. MSSVECTOR3D shadow_position;
  2237. MSSVECTOR3D shadow_face;
  2238. MSSVECTOR3D shadow_velocity;
  2239. S32 shadow_playback_rate;
  2240. F32 shadow_volume;
  2241. F32 shadow_occlusion;
  2242. F32 shadow_obstruction;
  2243. F32 shadow_exclusion;
  2244. F32 shadow_min_dist;
  2245. F32 shadow_max_dist;
  2246. F32 shadow_inner_angle;
  2247. F32 shadow_outer_angle;
  2248. F32 shadow_outer_volume;
  2249. F32 shadow_wet_level;
  2250. F32 shadow_dry_level;
  2251. S32 shadow_auto_3D_atten;
  2252. S32 shadow_is_3D;
  2253. #endif
  2254. F32 leftb_volume; // Left/mono volume 0 to 1.0 (back)
  2255. F32 rightb_volume; // Right volume 0 to 1.0 (back)
  2256. F32 center_volume; // Center volume 0 to 1.0
  2257. F32 low_volume; // Low volume 0 to 1.0
  2258. F32 save_fb_pan; // Sample volume 0-1.0
  2259. F32 save_center; // saved center level
  2260. F32 save_low; // saved sub level
  2261. #ifdef IS_WINDOWS
  2262. //
  2263. // DirectSound-specific data
  2264. //
  2265. S32 service_interval; // Service sample every n ms
  2266. S32 service_tick; // Current service countdown value
  2267. S32 buffer_segment_size; // Buffer segment size to fill
  2268. S32 prev_segment; // Previous segment # (0...n)
  2269. S32 prev_cursor; // Previous play cursor location
  2270. S32 bytes_remaining; // # of bytes left to play (if not -1)
  2271. S32 direct_control; // 1 if app controls buffer, 0 if MSS
  2272. #endif
  2273. }
  2274. SAMPLE;
  2275. //
  2276. // used for AIL_process
  2277. //
  2278. typedef MSS_STRUCT _AILMIXINFO {
  2279. AILSOUNDINFO Info;
  2280. ADPCMDATA mss_adpcm;
  2281. U32 src_fract;
  2282. S32 left_val;
  2283. S32 right_val;
  2284. } AILMIXINFO;
  2285. #if defined(IS_WINDOWS) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_XBOX) || defined(IS_XENON) || defined(IS_PS3) || defined(IS_PS2) || defined(IS_WII)
  2286. DXDEC U32 AILCALL AIL_get_timer_highest_delay (void);
  2287. DXDEC void AILCALL AIL_serve(void);
  2288. #ifdef IS_MAC
  2289. typedef void * LPSTR;
  2290. #define WHDR_DONE 0
  2291. typedef MSS_STRUCT _WAVEIN
  2292. {
  2293. long temp;
  2294. } * HWAVEIN;
  2295. typedef MSS_STRUCT _WAVEHDR
  2296. {
  2297. S32 dwFlags;
  2298. S32 dwBytesRecorded;
  2299. S32 dwUser;
  2300. S32 temp;
  2301. void * lpData;
  2302. S32 dwBufferLength;
  2303. S32 longdwLoops;
  2304. S32 dwLoops;
  2305. void * lpNext;
  2306. U32 * reserved;
  2307. } WAVEHDR, * LPWAVEHDR;
  2308. #endif
  2309. #define N_WAVEIN_BUFFERS 8 // Use a ring of 8 buffers by default
  2310. typedef MSS_STRUCT _DIG_INPUT_DRIVER FAR *HDIGINPUT; // Handle to digital input driver
  2311. #ifdef IS_MAC
  2312. #define AIL_DIGITAL_INPUT_DEFAULT 0
  2313. typedef MSS_STRUCT _DIG_INPUT_DRIVER // Handle to digital input driver
  2314. {
  2315. C8 tag[4]; // HDIN
  2316. S32 input_enabled; // 1 if enabled, 0 if not
  2317. U32 incoming_buffer_size;
  2318. void * incoming_buffer[ 2 ];
  2319. void* outgoing_buffer;
  2320. U32 which_buffer;
  2321. AIL_INPUT_INFO info; // Input device descriptor
  2322. AILMIXINFO incoming_info;
  2323. long device;
  2324. #if defined(__SOUND__)
  2325. SPB record_rec;
  2326. #endif
  2327. } DIG_INPUT_DRIVER;
  2328. #else
  2329. #define AIL_DIGITAL_INPUT_DEFAULT ((U32)WAVE_MAPPER)
  2330. typedef MSS_STRUCT _DIG_INPUT_DRIVER // Handle to digital input driver
  2331. {
  2332. C8 tag[4]; // HDIN
  2333. HTIMER background_timer; // Background timer handle
  2334. AIL_INPUT_INFO info; // Input device descriptor
  2335. S32 input_enabled; // 1 if enabled, 0 if not
  2336. UINTa callback_user; // Callback user value
  2337. //
  2338. // Provider-independent data
  2339. //
  2340. U32 DMA_size; // Size of each DMA sub-buffer in bytes
  2341. void FAR *DMA[N_WAVEIN_BUFFERS]; // Simulated DMA buffers
  2342. U8 silence; // Silence value for current format (0 or 128)
  2343. S32 device_active; // 1 if buffers submittable, 0 if not
  2344. #ifdef IS_WINDOWS
  2345. //
  2346. // waveOut-specific data
  2347. //
  2348. HWAVEIN hWaveIn; // Handle to wave input device
  2349. volatile MWAVEHDR wavehdr[N_WAVEIN_BUFFERS]; // Handles to wave headers
  2350. #endif
  2351. }
  2352. DIG_INPUT_DRIVER;
  2353. #endif
  2354. #endif
  2355. typedef MSS_STRUCT REVERB_CONSTANT_INFO
  2356. {
  2357. F32 FAR* start0, FAR* start1, FAR* start2, FAR* start3, FAR* start4, FAR* start5;
  2358. F32 FAR* end0, FAR* end1, FAR* end2, FAR* end3, FAR* end4, FAR* end5;
  2359. F32 C0, C1, C2, C3, C4, C5;
  2360. F32 A;
  2361. F32 B0, B1;
  2362. } REVERB_CONSTANT_INFO;
  2363. typedef MSS_STRUCT REVERB_UPDATED_INFO
  2364. {
  2365. F32 FAR * address0, FAR * address1, FAR * address2, FAR * address3, FAR * address4, FAR * address5;
  2366. F32 X0, X1, Y0, Y1;
  2367. } REVERB_UPDATED_INFO;
  2368. typedef MSS_STRUCT REVERB_INFO
  2369. {
  2370. REVERB_UPDATED_INFO u;
  2371. REVERB_CONSTANT_INFO c;
  2372. } REVERB_INFO;
  2373. typedef MSS_STRUCT _MSS_RECEIVER_LIST
  2374. {
  2375. MSSVECTOR3D direction; // Normalized direction vector from listener
  2376. S32 speaker_index[MAX_SPEAKERS]; // List of speakers affected by sounds in this direction
  2377. F32 speaker_level[MAX_SPEAKERS]; // Each speaker's degree of effect from this source
  2378. S32 n_speakers_affected;
  2379. }
  2380. MSS_RECEIVER_LIST;
  2381. typedef MSS_STRUCT _D3DSTATE
  2382. {
  2383. S32 mute_at_max;
  2384. MSSVECTOR3D listen_position;
  2385. MSSVECTOR3D listen_face;
  2386. MSSVECTOR3D listen_up;
  2387. MSSVECTOR3D listen_cross;
  2388. MSSVECTOR3D listen_velocity;
  2389. F32 rolloff_factor;
  2390. F32 doppler_factor;
  2391. F32 distance_factor;
  2392. F32 falloff_power;
  2393. //
  2394. // Precalculated listener info
  2395. //
  2396. S32 ambient_channels [MAX_SPEAKERS]; // E.g., LFE
  2397. S32 n_ambient_channels;
  2398. S32 directional_channels[MAX_SPEAKERS+1]; // Channel index, or -1 if virtual
  2399. MSSVECTOR3D listener_to_speaker [MAX_SPEAKERS+1];
  2400. S32 n_directional_channels;
  2401. MSS_RECEIVER_LIST receiver_specifications[MAX_RECEIVER_SPECS]; // Constellation of receiver vectors
  2402. S32 n_receiver_specs;
  2403. MSSVECTOR3D speaker_positions [MAX_SPEAKERS]; // Listener-relative speaker locations
  2404. F32 speaker_wet_reverb_response [MAX_SPEAKERS]; // Reverb sensitivity of each speaker
  2405. F32 speaker_dry_reverb_response [MAX_SPEAKERS];
  2406. }
  2407. D3DSTATE;
  2408. typedef enum
  2409. {
  2410. MSS_MC_MONO = 1, // For compatibility with S32 channel param
  2411. MSS_MC_STEREO = 2,
  2412. MSS_MC_USE_SYSTEM_CONFIG = 0x10, // Leave space between entries for new variations
  2413. MSS_MC_HEADPHONES = 0x20, // with similar quality levels/speaker counts
  2414. MSS_MC_DOLBY_SURROUND = 0x30,
  2415. MSS_MC_SRS_CIRCLE_SURROUND = 0x40,
  2416. MSS_MC_40_DTS = 0x48,
  2417. MSS_MC_40_DISCRETE = 0x50,
  2418. MSS_MC_51_DTS = 0x58,
  2419. MSS_MC_51_DISCRETE = 0x60,
  2420. MSS_MC_61_DISCRETE = 0x70,
  2421. MSS_MC_71_DISCRETE = 0x80,
  2422. MSS_MC_81_DISCRETE = 0x90,
  2423. MSS_MC_DIRECTSOUND3D = 0xA0,
  2424. MSS_MC_EAX2 = 0xC0,
  2425. MSS_MC_EAX3 = 0xD0,
  2426. MSS_MC_EAX4 = 0xE0
  2427. }
  2428. MSS_MC_SPEC;
  2429. typedef MSS_STRUCT _DIG_DRIVER // Handle to digital audio driver
  2430. {
  2431. char tag[4]; // HDIG
  2432. HTIMER backgroundtimer; // Background timer handle
  2433. F32 master_volume; // Master sample volume 0-1.0
  2434. S32 DMA_rate; // Hardware sample rate
  2435. S32 hw_format; // DIG_F code in use
  2436. S32 n_active_samples; // # of samples being processed
  2437. MSS_MC_SPEC channel_spec; // Original "channels" value passed to AIL_open_digital_driver()
  2438. D3DSTATE D3D; // 3D listener parms for all platforms
  2439. #ifdef IS_XBOX
  2440. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2441. AILLPDIRECTSOUND pDS; // DirectSound output driver
  2442. S32 use_3d; // are we using 3D?
  2443. S32 use_reverb;
  2444. STAGE_BUFFER * staging_buffer_ring;
  2445. STAGE_BUFFER * staging_mem_ptr;
  2446. MSSVECTOR3D shadow_listen_position;
  2447. MSSVECTOR3D shadow_listen_face;
  2448. MSSVECTOR3D shadow_listen_up;
  2449. MSSVECTOR3D shadow_listen_velocity;
  2450. F32 shadow_listen_doppler_factor;
  2451. F32 shadow_listen_distance_factor;
  2452. F32 shadow_listen_rolloff_factor;
  2453. S32 shadow_room_type;
  2454. F32 shadow_master_wet;
  2455. F32 shadow_reverb_decay_time_s;
  2456. F32 shadow_reverb_damping;
  2457. F32 shadow_reverb_predelay_s;
  2458. #else
  2459. S32 quiet; // # of consecutive quiet sample periods
  2460. U32 hw_mode_flags; // DIG_PCM_ flags for mode in use
  2461. S32 playing; // Playback active if non-zero
  2462. #endif
  2463. S32 bytes_per_channel; // # of bytes per channel (always 1 or 2 for 8- or 16-bit hardware output)
  2464. S32 samples_per_buffer; // # of samples per build buffer / half-buffer
  2465. S32 physical_channels_per_sample; // # of channels per *physical* sample (1 or 2, or more in discrete MC mode)
  2466. S32 logical_channels_per_sample; // # of logical channels per sample (may differ from physical channel count in matrix formats)
  2467. #ifdef IS_LINUX
  2468. S32 released; // has the sound manager been released?
  2469. #endif
  2470. #ifdef IS_PS2
  2471. struct RAD_IOP_SOUND_DATA * IOP;
  2472. S32 IOP_overwrite; // FALSE if RADIOP layer requests addition to output buffer (rather than writes)
  2473. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2474. #endif
  2475. HSAMPLE samples; // Pointer to list of SAMPLEs
  2476. U32 *sample_status; // SMP_ flags: _FREE, _DONE, _PLAYING, moved out of SAMPLEs for faster iteration
  2477. S32 n_samples; // # of SAMPLEs
  2478. SINTa system_data[8]; // Miscellaneous system data
  2479. //
  2480. // Build buffers
  2481. //
  2482. // In multichannel mode, source samples may be mixed into more than one
  2483. // build buffer
  2484. //
  2485. MSS_BB build[MAX_SPEAKERS+EXTRA_BUILD_BUFFERS];
  2486. S32 n_build_buffers; // # of build buffers actually used for output processing
  2487. S32 build_size; // # of bytes in build buffer 0, used for position comparisons
  2488. #ifndef IS_XBOX
  2489. S32 hardware_buffer_size; // Size of each output buffer
  2490. #endif
  2491. #ifdef IS_WINDOWS
  2492. //
  2493. // waveOut-specific interface data
  2494. //
  2495. HWAVEOUT hWaveOut; // Wave output driver
  2496. U32 reset_works; // TRUE if OK to do waveOutReset
  2497. U32 request_reset; // If nonzero, do waveOutReset ASAP
  2498. LPWAVEHDR first; // Pointer to first WAVEHDR in chain
  2499. S32 n_buffers; // # of output WAVEHDRs in chain
  2500. LPWAVEHDR volatile FAR *return_list; // Circular list of returned WAVEHDRs
  2501. S32 volatile return_head; // Head of WAVEHDR list (insertion point)
  2502. S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point)
  2503. //
  2504. // DirectSound-specific interface data
  2505. //
  2506. UINTa guid; // The guid id of the ds driver
  2507. AILLPDIRECTSOUND pDS; // DirectSound output driver (don't
  2508. // use with Smacker directly anymore!)
  2509. U32 ds_priority; // priority opened with
  2510. S32 emulated_ds; // is ds emulated or not?
  2511. AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null
  2512. UINTa dsHwnd; // HWND used with DirectSound
  2513. AILLPDIRECTSOUNDBUFFER FAR * lpbufflist; // List of pointers to secondary buffers
  2514. HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer
  2515. S32 FAR *sec_format; // DIG_F_ format for secondary buffer
  2516. S32 max_buffs; // Max. allowable # of secondary buffers
  2517. //
  2518. // Driver output configuration
  2519. //
  2520. // Note: # of "logical" (source) channels per sample = dig->channels_per_sample
  2521. // # of "physical" (DAC) channels per sample = dig->wformat.wf.nChannels
  2522. //
  2523. // These may be different if a matrix format (e.g., Dolby/SRS)
  2524. // is in use!
  2525. //
  2526. MPCMWAVEFORMAT wformat; // format from waveout open
  2527. C8 wfextra[32]; // Extension to PCMWAVEFORMAT (e.g., WAVE_FORMAT_EXTENSIBLE)
  2528. //
  2529. // Misc. data
  2530. //
  2531. S32 released; // has the sound manager been released?
  2532. U32 foreground_timer; // Foreground timer handle
  2533. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2534. S32 callingCT; // Calling EXE's task number (16 bit only)
  2535. S32 callingDS; // Calling EXE's DS (used in 16 bit only)
  2536. //
  2537. // Vars for waveOut emulation
  2538. //
  2539. S32 DS_initialized;
  2540. AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none)
  2541. AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim)
  2542. S32 DS_buffer_size; // Size of entire output buffer
  2543. S32 DS_frag_cnt; // Total fragment count and size, and
  2544. S32 DS_frag_size; // last fragment occupied by play cursor
  2545. S32 DS_last_frag;
  2546. S32 DS_last_write;
  2547. S32 DS_last_timer;
  2548. S32 DS_skip_time;
  2549. S32 DS_use_default_format; // 1 to force use of default DS primary buffer format
  2550. U32 position_error; // last status from position report (can be used
  2551. // to watch for headset removal)
  2552. U32 last_ds_play;
  2553. U32 last_ds_write;
  2554. U32 last_ds_move;
  2555. #else
  2556. #ifdef IS_DOS
  2557. // must be first in the DOS section
  2558. void *DMA[2]; // Protected-mode pointers to half-buffers
  2559. // (note that DMA[0] may != DMA_buf)
  2560. REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0)
  2561. U32 DMA_sel; // Selector for DMA buffers (off=0)
  2562. void *DMA_buf; // Protected-mode pointer to DMA buffers
  2563. S16 *buffer_flag; // Protected-mode pointer to buffer flag
  2564. S32 last_buffer; // Last active buffer flag value in driver
  2565. AIL_DRIVER *drvr; // Base driver descriptor
  2566. DIG_DDT *DDT; // Protected-mode pointer to DDT
  2567. DIG_DST *DST; // Protected-mode pointer to DST
  2568. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2569. #endif
  2570. #endif
  2571. #ifdef IS_X86
  2572. S32 use_MMX; // Use MMX with this driver if TRUE
  2573. #endif
  2574. U32 us_count;
  2575. U32 ms_count;
  2576. U32 last_ms_polled;
  2577. U32 last_percent;
  2578. //
  2579. // Digital driver pipeline filter stages
  2580. //
  2581. DPINFO pipeline[N_DIGDRV_STAGES];
  2582. #ifdef MSS_VFLT_SUPPORTED
  2583. struct _FLTPROVIDER FAR *voice_filter;
  2584. SS_STREAM_CB stream_callback;
  2585. #endif
  2586. struct _FLTPROVIDER FAR *matrix_filter;
  2587. //
  2588. // Reverb
  2589. //
  2590. S32 room_type; // Changes to this drive master_wet and duration/damping/predelay!
  2591. F32 master_wet; // Master reverb level 0-1.0
  2592. F32 master_dry; // Master non-reverb level 0-1.0
  2593. REVERB_INFO ri;
  2594. S32 FAR *reverb_build_buffer;
  2595. S32 reverb_total_size;
  2596. S32 reverb_fragment_size;
  2597. S32 reverb_buffer_size;
  2598. S32 reverb_on;
  2599. U32 reverb_off_time_ms;
  2600. U32 reverb_duration_ms;
  2601. F32 reverb_decay_time_s;
  2602. F32 reverb_predelay_s;
  2603. F32 reverb_damping;
  2604. S32 reverb_head;
  2605. S32 reverb_tail;
  2606. #ifdef IS_XENON
  2607. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2608. void * hw_buf;
  2609. U32 hw_datarate;
  2610. U32 hw_align;
  2611. void * XA_voice;
  2612. S32 XA_buffer_size;
  2613. S32 XA_frag_cnt;
  2614. S32 XA_frag_size;
  2615. S32 XA_last_frag;
  2616. S32 XA_last_write;
  2617. S32 XA_skip_time;
  2618. U32 last_xa_play;
  2619. U32 last_xa_move;
  2620. S32 XA_last_timer;
  2621. #endif
  2622. #ifdef IS_PS3
  2623. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2624. void * hw_buf;
  2625. U32 hw_datarate;
  2626. U32 hw_align;
  2627. U32 port;
  2628. S32 hw_buffer_size;
  2629. S32 snd_frag_cnt;
  2630. S32 snd_frag_size;
  2631. S32 snd_last_frag;
  2632. S32 snd_last_write;
  2633. S32 snd_skip_time;
  2634. U32 snd_last_play;
  2635. U32 snd_last_move;
  2636. S32 snd_last_timer;
  2637. #endif
  2638. #ifdef IS_WII
  2639. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2640. U32 hw_datarate;
  2641. S32 hw_buffer_size;
  2642. S32 each_buffer_size;
  2643. S32 snd_frag_cnt;
  2644. S32 snd_frag_size;
  2645. S32 snd_last_frag;
  2646. S32 snd_last_write;
  2647. S32 snd_skip_time;
  2648. U32 snd_last_play;
  2649. U32 snd_last_move;
  2650. S32 snd_last_timer;
  2651. void * buffer[ 2 ];
  2652. U32 physical[ 2 ];
  2653. #ifdef AX_OUTPUT_BUFFER_DOUBLE
  2654. AXVPB* voice[ 2 ];
  2655. #endif
  2656. #endif
  2657. #ifdef IS_WINDOWS
  2658. S32 no_wom_done; // don't process WOM_DONEs on this driver
  2659. U32 wom_done_buffers;
  2660. #endif
  2661. #ifdef XAUDIOFRAMESIZE_NATIVE
  2662. XAUDIOPACKET packet;
  2663. #endif
  2664. #ifdef IS_MAC
  2665. U32 n_samples_allocated;
  2666. U32 n_samples_used;
  2667. U32 n_samples_played;
  2668. U32 total_buffer_size;
  2669. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  2670. U32 reset_works; // TRUE if OK to do waveOutReset
  2671. U32 request_reset; // If nonzero, do waveOutReset ASAP
  2672. S32 released; // has the sound manager been released?
  2673. U32 loaded[2];
  2674. U32 work_buffer;
  2675. U32 play_buffer;
  2676. #if defined(__SOUND__)
  2677. ExtSoundHeader sound_header;
  2678. SndChannelPtr sound_channel;
  2679. SndCallBackUPP global_callback;
  2680. Ptr buffers[2];
  2681. #endif
  2682. #endif
  2683. }
  2684. DIG_DRIVER;
  2685. typedef MSS_STRUCT // MIDI status log structure
  2686. {
  2687. S32 program [NUM_CHANS]; // Program Change
  2688. S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB
  2689. S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB
  2690. S32 c_lock [NUM_CHANS]; // Channel Lock
  2691. S32 c_prot [NUM_CHANS]; // Channel Lock Protection
  2692. S32 c_mute [NUM_CHANS]; // Channel Mute
  2693. S32 c_v_prot [NUM_CHANS]; // Voice Protection
  2694. S32 bank [NUM_CHANS]; // Patch Bank Select
  2695. S32 gm_bank_l [NUM_CHANS]; // GM Bank Select
  2696. S32 gm_bank_m [NUM_CHANS]; // GM Bank Select
  2697. S32 indirect [NUM_CHANS]; // ICA indirect controller value
  2698. S32 callback [NUM_CHANS]; // Callback Trigger
  2699. S32 mod [NUM_CHANS]; // Modulation
  2700. S32 vol [NUM_CHANS]; // Volume
  2701. S32 pan [NUM_CHANS]; // Panpot
  2702. S32 exp [NUM_CHANS]; // Expression
  2703. S32 sus [NUM_CHANS]; // Sustain
  2704. S32 reverb [NUM_CHANS]; // Reverb
  2705. S32 chorus [NUM_CHANS]; // Chorus
  2706. S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed)
  2707. S32 RPN_L [NUM_CHANS]; // RPN # LSB
  2708. S32 RPN_M [NUM_CHANS]; // RPN # MSB
  2709. }
  2710. CTRL_LOG;
  2711. typedef MSS_STRUCT _SEQUENCE // XMIDI sequence state table
  2712. {
  2713. char tag[4]; // HSEQ
  2714. HMDIDRIVER driver; // Driver for playback
  2715. U32 status; // SEQ_ flags
  2716. void const FAR *TIMB; // XMIDI IFF chunk pointers
  2717. void const FAR *RBRN;
  2718. void const FAR *EVNT;
  2719. U8 const FAR *EVNT_ptr; // Current event pointer
  2720. U8 FAR *ICA; // Indirect Controller Array
  2721. AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler
  2722. AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler
  2723. AILBEATCB beat_callback; // XMIDI beat/bar change handler
  2724. AILSEQUENCECB EOS; // End-of-sequence callback function
  2725. S32 loop_count; // 0=one-shot, -1=indefinite, ...
  2726. S32 interval_count; // # of intervals until next event
  2727. S32 interval_num; // # of intervals since start
  2728. S32 volume; // Sequence volume 0-127
  2729. S32 volume_target; // Target sequence volume 0-127
  2730. S32 volume_accum; // Accumulated volume period
  2731. S32 volume_period; // Period for volume stepping
  2732. S32 tempo_percent; // Relative tempo percentage 0-100
  2733. S32 tempo_target; // Target tempo 0-100
  2734. S32 tempo_accum; // Accumulated tempo period
  2735. S32 tempo_period; // Period for tempo stepping
  2736. S32 tempo_error; // Error counter for tempo DDA
  2737. S32 beat_count; // Sequence playback position
  2738. S32 measure_count;
  2739. S32 time_numerator; // Sequence timing data
  2740. S32 time_fraction;
  2741. S32 beat_fraction;
  2742. S32 time_per_beat;
  2743. void const FAR *FOR_ptrs[FOR_NEST]; // Loop stack
  2744. S32 FOR_loop_count [FOR_NEST];
  2745. S32 chan_map [NUM_CHANS]; // Physical channel map for sequence
  2746. CTRL_LOG shadow; // Controller values for sequence
  2747. S32 note_count; // # of notes "on"
  2748. S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free)
  2749. S32 note_num [MAX_NOTES]; // Note # for queued note
  2750. S32 note_time [MAX_NOTES]; // Remaining duration in intervals
  2751. SINTa user_data [8]; // Miscellaneous user data
  2752. SINTa system_data[8]; // Miscellaneous system data
  2753. } SEQUENCE;
  2754. #if defined(IS_MAC) || defined(IS_LINUX) || defined(IS_XBOX) || defined(IS_XENON) || defined(IS_PS2) || defined(IS_PS3) || defined(IS_WII)
  2755. MSS_STRUCT MIDIHDR;
  2756. MSS_STRUCT MIDIOUT;
  2757. typedef MSS_STRUCT MIDIOUT* HMIDIOUT;
  2758. typedef HMIDIOUT* LPHMIDIOUT;
  2759. #endif
  2760. typedef MSS_STRUCT _MDI_DRIVER // Handle to XMIDI driver
  2761. {
  2762. char tag[4]; // HMDI
  2763. HTIMER timer; // XMIDI quantization timer
  2764. S32 interval_time; // XMIDI quantization timer interval in uS
  2765. S32 disable; // > 0 to disable XMIDI service
  2766. HSEQUENCE sequences; // Pointer to list of SEQUENCEs
  2767. S32 n_sequences; // # of SEQUENCEs
  2768. S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0
  2769. HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel
  2770. HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel
  2771. HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel
  2772. S32 state [NUM_CHANS]; // Lock state prior to being locked
  2773. S32 notes [NUM_CHANS]; // # of active notes in channel
  2774. AILEVENTCB event_trap; // MIDI event trap callback function
  2775. AILTIMBRECB timbre_trap; // Timbre request callback function
  2776. S32 master_volume; // Master XMIDI note volume 0-127
  2777. SINTa system_data[8]; // Miscellaneous system data
  2778. #if defined(IS_WINDOWS) || defined(IS_MAC) || defined(IS_LINUX)
  2779. S32 released; // has the hmidiout handle been released
  2780. U32 deviceid; // ID of the MIDI device
  2781. U8 FAR *sysdata; // SysEx buffer
  2782. #endif
  2783. #if defined(IS_XBOX) || defined(IS_XENON) || defined(IS_WII) || defined(IS_PS2) || defined(IS_PS3)
  2784. HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
  2785. #endif
  2786. #ifdef IS_LINUX
  2787. struct MIDIHDR FAR *mhdr; // SysEx header
  2788. HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
  2789. HMIDIOUT hMidiOut; // MIDI output driver
  2790. #endif
  2791. #ifdef IS_WINDOWS
  2792. struct midihdr_tag FAR *mhdr; // SysEx header
  2793. HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
  2794. S32 callingCT; // Calling EXE's task number (16 bit only)
  2795. S32 callingDS; // Calling EXE's DS (used in 16 bit only)
  2796. HMIDIOUT hMidiOut; // MIDI output driver
  2797. #else
  2798. #ifdef IS_DOS
  2799. S32 message_count; // MIDI message count
  2800. S32 offset; // MIDI buffer offset
  2801. AIL_DRIVER *drvr; // Base driver descriptor
  2802. MDI_DDT *DDT; // Protected-mode pointer to DDT
  2803. MDI_DST *DST; // Protected-mode pointer to DST
  2804. #else
  2805. #if defined(IS_MAC)
  2806. struct MIDIHDR FAR *mhdr; // SysEx header
  2807. HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
  2808. HMIDIOUT hMidiOut; // MIDI output driver
  2809. #endif
  2810. #endif
  2811. #endif
  2812. }
  2813. MDI_DRIVER;
  2814. typedef MSS_STRUCT // XMIDI TIMB IFF chunk
  2815. {
  2816. S8 name[4];
  2817. U8 msb;
  2818. U8 lsb;
  2819. U8 lsb2;
  2820. U8 lsb3;
  2821. U16 n_entries;
  2822. U16 timbre[1];
  2823. }
  2824. TIMB_chunk;
  2825. typedef MSS_STRUCT // XMIDI RBRN IFF entry
  2826. {
  2827. S16 bnum;
  2828. U32 offset;
  2829. }
  2830. RBRN_entry;
  2831. typedef MSS_STRUCT // Wave library entry
  2832. {
  2833. S32 bank; // XMIDI bank, MIDI patch for sample
  2834. S32 patch;
  2835. S32 root_key; // Root MIDI note # for sample (or -1)
  2836. U32 file_offset; // Offset of wave data from start-of-file
  2837. U32 size; // Size of wave sample in bytes
  2838. S32 format; // DIG_F format (8/16 bits, mono/stereo)
  2839. U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo)
  2840. S32 playback_rate; // Playback rate in hertz
  2841. }
  2842. WAVE_ENTRY;
  2843. typedef MSS_STRUCT // Virtual "wave synthesizer" descriptor
  2844. {
  2845. HMDIDRIVER mdi; // MIDI driver for use with synthesizer
  2846. HDIGDRIVER dig; // Digital driver for use with synthesizer
  2847. WAVE_ENTRY FAR *library; // Pointer to wave library
  2848. AILEVENTCB prev_event_fn; // Previous MIDI event trap function
  2849. AILTIMBRECB prev_timb_fn; // Previous timbre request trap function
  2850. CTRL_LOG controls; // MIDI controller states
  2851. WAVE_ENTRY FAR *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel
  2852. HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices
  2853. S32 n_voices; // Actual # of voices allocated to synth
  2854. S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1
  2855. S32 note [MAX_W_VOICES]; // MIDI note number for voice
  2856. S32 root [MAX_W_VOICES]; // MIDI root note for voice
  2857. S32 rate [MAX_W_VOICES]; // Playback rate for voice
  2858. S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice
  2859. U32 time [MAX_W_VOICES]; // Timestamp for voice
  2860. U32 event; // Event counter for LRU timestamps
  2861. }
  2862. WAVE_SYNTH;
  2863. typedef WAVE_SYNTH FAR * HWAVESYNTH;// Handle to virtual wave synthesizer
  2864. //
  2865. // Handle to thread which called AIL_startup()
  2866. //
  2867. // This thread is suspended by MSS callback threads, to simulate DOS-style
  2868. // interrupt handler behavior
  2869. //
  2870. #ifdef IS_WIN32API
  2871. #ifdef NTAPI
  2872. extern HANDLE hAppThread;
  2873. #endif
  2874. #endif
  2875. //
  2876. // Background flag for timers
  2877. //
  2878. extern volatile S32 AIL_bkgnd_flag;
  2879. //
  2880. // Global preference array
  2881. //
  2882. extern SINTa AIL_preference [N_PREFS];
  2883. //
  2884. // DIG_DRIVER list
  2885. //
  2886. extern HDIGDRIVER DIG_first;
  2887. //
  2888. // MDI_DRIVER list
  2889. //
  2890. extern HMDIDRIVER MDI_first;
  2891. //
  2892. // Miscellaneous system services
  2893. //
  2894. #define FILE_READ_WITH_SIZE ((void FAR*)(S32)-1)
  2895. #ifndef NO_OLD_SYS_FUNCTIONS
  2896. #define MEM_alloc_lock AIL_mem_alloc_lock
  2897. #define MEM_free_lock AIL_mem_free_lock
  2898. #define FILE_error AIL_file_error
  2899. #define FILE_size AIL_file_size
  2900. #define FILE_read AIL_file_read
  2901. #define FILE_write AIL_file_write
  2902. #ifdef IS_DOS
  2903. #define MEM_alloc AIL_mem_alloc
  2904. #define MEM_free AIL_mem_free
  2905. #define MEM_use_malloc AIL_mem_use_malloc
  2906. #define MEM_use_free AIL_mem_use_free
  2907. #define MEM_alloc_DOS AIL_mem_alloc_DOS
  2908. #define MEM_free_DOS AIL_mem_free_DOS
  2909. #define VMM_lock_range AIL_vmm_lock_range
  2910. #define VMM_unlock_range AIL_vmm_unlock_range
  2911. #define VMM_lock AIL_vmm_lock
  2912. #define VMM_unlock AIL_vmm_unlock
  2913. #endif
  2914. #endif
  2915. extern S32 AILCALLBACK SP_ASI_DECODER_callback(UINTa user,
  2916. void FAR *dest,
  2917. S32 bytes_requested,
  2918. S32 offset);
  2919. DXDEC void FAR * AILCALL AIL_mem_alloc_lock(UINTa size);
  2920. DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr);
  2921. DXDEC S32 AILCALL AIL_file_error (void);
  2922. DXDEC S32 AILCALL AIL_file_size (char const FAR *filename);
  2923. DXDEC void FAR * AILCALL AIL_file_read (char const FAR *filename,
  2924. void FAR *dest);
  2925. DXDEC S32 AILCALL AIL_file_write (char const FAR *filename,
  2926. void const FAR *buf,
  2927. U32 len);
  2928. DXDEC S32 AILCALL AIL_WAV_file_write
  2929. (char const FAR *filename,
  2930. void const FAR *buf,
  2931. U32 len,
  2932. S32 rate,
  2933. S32 format);
  2934. DXDEC S32 AILCALL AIL_file_append (char const FAR *filename,
  2935. void const FAR *buf, U32 len);
  2936. #ifndef IS_DOS
  2937. typedef void FAR * (AILCALLBACK FAR *AILMEMALLOCCB)(UINTa size);
  2938. typedef void (AILCALLBACK FAR *AILMEMFREECB)(void FAR *);
  2939. DXDEC AILMEMALLOCCB AILCALL AIL_mem_use_malloc(AILMEMALLOCCB fn);
  2940. DXDEC AILMEMFREECB AILCALL AIL_mem_use_free (AILMEMFREECB fn);
  2941. #endif
  2942. #ifdef ON_MAC_USE_FSS
  2943. DXDEC S32 AILCALL AIL_file_fss_size(FSSpec const FAR *filename);
  2944. DXDEC void FAR * AILCALL AIL_file_fss_read(FSSpec const FAR *filename,
  2945. void FAR *dest);
  2946. DXDEC S32 AILCALL AIL_file_fss_write(FSSpec const FAR *filename,
  2947. void const FAR *buf,
  2948. U32 len);
  2949. DXDEC S32 AILCALL AIL_file_fss_attrib_write
  2950. (FSSpec const FAR *filename,
  2951. void const FAR *buf,
  2952. U32 len,
  2953. U32 type,
  2954. U32 creator );
  2955. DXDEC S32 AILCALL AIL_WAV_file_fss_write
  2956. (FSSpec const FAR *filename,
  2957. void const FAR *buf,
  2958. U32 len,
  2959. S32 rate,
  2960. S32 format);
  2961. #endif
  2962. #ifdef IS_DOS
  2963. extern void * AILCALLBACK (*AIL_mem_alloc) (UINTa);
  2964. extern void AILCALLBACK (*AIL_mem_free) (void *);
  2965. typedef void * (AILCALLBACK *AILMEMALLOCCB)(UINTa size);
  2966. typedef void (AILCALLBACK *AILMEMFREECB)(void *);
  2967. AILMEMALLOCCB cdecl AIL_mem_use_malloc(AILMEMALLOCCB allocf);
  2968. AILMEMFREECB cdecl AIL_mem_use_free (AILMEMFREECB freef);
  2969. //
  2970. // Other memory-management functions
  2971. //
  2972. DXDEC S32 AILCALL AIL_mem_alloc_DOS (U32 n_paras,
  2973. void **protected_ptr,
  2974. U32 *segment_far_ptr,
  2975. U32 *selector);
  2976. DXDEC void AILCALL AIL_mem_free_DOS (void *protected_ptr,
  2977. U32 segment_far_ptr,
  2978. U32 selector);
  2979. DXDEC S32 AILCALL AIL_vmm_lock_range (void *p1, void *p2);
  2980. DXDEC S32 AILCALL AIL_vmm_unlock_range (void *p1, void *p2);
  2981. DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size);
  2982. DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size);
  2983. DXDEC U32 AILCALL AIL_sel_base (U32 sel);
  2984. DXDEC void AILCALL AIL_sel_set_limit (U32 sel,
  2985. U32 limit);
  2986. //
  2987. // Last IO_PARMS structure used to attempt device detection
  2988. //
  2989. extern IO_PARMS AIL_last_IO_attempt;
  2990. //
  2991. // Low-level support services
  2992. //
  2993. DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum);
  2994. DXDEC void AILCALL AIL_set_real_vect (U32 vectnum,
  2995. REALFAR real_ptr);
  2996. DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ,
  2997. REALFAR real_base,
  2998. U32 ISR_offset);
  2999. DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ);
  3000. DXDEC U32 AILCALL AIL_disable_interrupts (void);
  3001. DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register);
  3002. DXDEC void AILCALL AIL_switch_stack (void *stack,
  3003. U32 size,
  3004. U32 *SS,
  3005. void **ESP,
  3006. void **EBP);
  3007. DXDEC void AILCALL AIL_restore_stack (U32 SS,
  3008. void *ESP,
  3009. void *EBP);
  3010. DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr,
  3011. S32 fn,
  3012. VDI_CALL *in,
  3013. VDI_CALL *out);
  3014. DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI,
  3015. char *filename);
  3016. DXDEC U32 AILCALL AIL_interrupt_divisor (void);
  3017. #endif
  3018. #ifdef __WATCOMC__
  3019. #pragma warning 14 10 // disable "no reference to symbol" warning on function args
  3020. void MSSBreakPoint();
  3021. #pragma aux MSSBreakPoint = "int 3";
  3022. #else
  3023. #ifdef IS_PS2
  3024. #define MSSBreakPoint() __asm__("break 0")
  3025. #else
  3026. #if defined(IS_XENON) || defined(IS_PS3) || defined(IS_WII)
  3027. #define MSSBreakPoint() (*(int *) 0 = 0);
  3028. #else
  3029. #ifdef IS_WIN64
  3030. #define MSSBreakPoint() __debugbreak();
  3031. #else
  3032. #define MSSBreakPoint() __asm {int 3}
  3033. #endif
  3034. #endif
  3035. #endif
  3036. #endif
  3037. //
  3038. // Compiler-independent CRTL helper functions for PS2
  3039. // Exported here for use in demo programs as well as MSS itself
  3040. //
  3041. #ifdef IS_PS2
  3042. DXDEC F32 AILCALL AIL_sin(F32 x);
  3043. DXDEC F32 AILCALL AIL_cos(F32 x);
  3044. DXDEC F32 AILCALL AIL_tan( F32 x );
  3045. DXDEC F32 AILCALL AIL_acos(F32 x);
  3046. DXDEC F32 AILCALL AIL_atan(F32 x);
  3047. DXDEC F32 AILCALL AIL_ceil( F32 x );
  3048. DXDEC F32 AILCALL AIL_floor( F32 x );
  3049. DXDEC F32 AILCALL AIL_fsqrt( F32 x );
  3050. DXDEC F32 AILCALL AIL_fabs ( F32 x );
  3051. DXDEC F32 AILCALL AIL_log10( F32 x );
  3052. DXDEC F32 AILCALL AIL_log( F32 x );
  3053. DXDEC F32 AILCALL AIL_pow( F32 x, F32 p );
  3054. DXDEC F32 AILCALL AIL_frexpf( F32 x, S32 *pw2 );
  3055. DXDEC F32 AILCALL AIL_ldexpf( F32 x, S32 pw2 );
  3056. #define AIL_exp(x) AIL_pow(2.718281828F,(x))
  3057. #else
  3058. #ifdef IS_WATCOM
  3059. #define AIL_pow powf
  3060. #define AIL_tan tanf
  3061. #else
  3062. #define AIL_pow pow
  3063. #define AIL_tan tan
  3064. #endif
  3065. #define AIL_sin sin
  3066. #define AIL_cos cos
  3067. #define AIL_acos acos
  3068. #define AIL_atan atan
  3069. #define AIL_ceil ceil
  3070. #define AIL_floor floor
  3071. #define AIL_fsqrt(arg) ((F32) sqrt(arg))
  3072. #define AIL_fabs fabs
  3073. #define AIL_log10 log10
  3074. #define AIL_log log
  3075. #define AIL_frexpf(a1,a2) ((F32) frexp(a1,a2))
  3076. #define AIL_ldexpf(a1,a2) ((F32) ldexp(a1,a2))
  3077. #define AIL_exp exp
  3078. #endif
  3079. DXDEC C8 * AILCALL AIL_ftoa(F32 val);
  3080. //
  3081. // High-level support services
  3082. //
  3083. #ifdef IS_DOS
  3084. #ifdef __SW_3R
  3085. extern S32 AILCALL AIL_startup_reg (void);
  3086. #define AIL_startup AIL_startup_reg
  3087. #else
  3088. extern S32 AILCALL AIL_startup_stack (void);
  3089. #define AIL_startup AIL_startup_stack
  3090. #endif
  3091. #define AIL_quick_startup(ud,um,opr,opb,ops) AIL_quick_startup_with_start(&AIL_startup,ud,um,opr,opb,ops)
  3092. #define AIL_get_preference(number) (AIL_preference[number])
  3093. #else
  3094. DXDEC S32 AILCALL AIL_startup (void);
  3095. DXDEC SINTa AILCALL AIL_get_preference (U32 number);
  3096. #endif
  3097. DXDEC void AILCALL AIL_shutdown (void);
  3098. DXDEC SINTa AILCALL AIL_set_preference (U32 number,
  3099. SINTa value);
  3100. DXDEC char FAR *AILCALL AIL_last_error (void);
  3101. DXDEC void AILCALL AIL_set_error (char const FAR * error_msg);
  3102. //
  3103. // Low-level support services
  3104. //
  3105. DXDEC void
  3106. #if !defined(IS_MAC) && !defined(IS_LINUX) && !defined(IS_PS2) && !defined(IS_PS3) && !defined(IS_WII)
  3107. __cdecl
  3108. #endif
  3109. AIL_debug_printf (C8 const FAR *fmt, ...);
  3110. #ifdef IS_X86
  3111. DXDEC U32 AILCALL AIL_MMX_available (void);
  3112. #endif
  3113. DXDEC void AILCALL AIL_lock (void);
  3114. DXDEC void AILCALL AIL_unlock (void);
  3115. #if defined(IS_WIN32API) || defined(IS_MAC) || defined(IS_LINUX)
  3116. DXDEC void AILCALL AIL_lock_mutex (void);
  3117. DXDEC void AILCALL AIL_unlock_mutex (void);
  3118. #endif
  3119. DXDEC void AILCALL AIL_delay (S32 intervals);
  3120. DXDEC S32 AILCALL AIL_background (void);
  3121. #ifndef IS_DOS
  3122. DXDEC AILTRACECB AILCALL AIL_register_trace_callback (AILTRACECB cb,
  3123. S32 level);
  3124. #endif
  3125. //
  3126. // Process services
  3127. //
  3128. DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn);
  3129. DXDEC UINTa AILCALL AIL_set_timer_user (HTIMER timer,
  3130. UINTa user);
  3131. DXDEC void AILCALL AIL_set_timer_period (HTIMER timer,
  3132. U32 microseconds);
  3133. DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer,
  3134. U32 hertz);
  3135. DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer,
  3136. U32 PIT_divisor);
  3137. DXDEC void AILCALL AIL_start_timer (HTIMER timer);
  3138. DXDEC void AILCALL AIL_start_all_timers (void);
  3139. DXDEC void AILCALL AIL_stop_timer (HTIMER timer);
  3140. DXDEC void AILCALL AIL_stop_all_timers (void);
  3141. DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer);
  3142. DXDEC void AILCALL AIL_release_all_timers (void);
  3143. #ifdef IS_WIN32
  3144. /*
  3145. #ifndef __RADINDLL__
  3146. // static function that handles shutdown
  3147. int __cdecl MSS_auto_cleanup(void);
  3148. #ifdef _MSC_VER
  3149. // on MSVC, automatically register a cleanup function
  3150. #define AIL_startup() (MSS_auto_cleanup(),AIL_startup())
  3151. #endif
  3152. #endif
  3153. */
  3154. DXDEC HWND AILCALL AIL_HWND (void);
  3155. #else
  3156. #ifdef IS_MAC
  3157. #if defined(__PROCESSES__)
  3158. DXDEC ProcessSerialNumber AIL_Process(void);
  3159. #endif
  3160. #endif
  3161. #endif
  3162. //
  3163. // high-level digital services
  3164. //
  3165. #define AIL_OPEN_DIGITAL_FORCE_PREFERENCE 1
  3166. #define AIL_OPEN_DIGITAL_NEED_HW_3D 2
  3167. #define AIL_OPEN_DIGITAL_NEED_FULL_3D 4
  3168. #define AIL_OPEN_DIGITAL_NEED_LIGHT_3D 8
  3169. #define AIL_OPEN_DIGITAL_NEED_HW_REVERB 16
  3170. #define AIL_OPEN_DIGITAL_NEED_REVERB 32
  3171. #define AIL_OPEN_DIGITAL_USE_IOP_CORE0 64
  3172. DXDEC HDIGDRIVER AILCALL AIL_open_digital_driver( U32 frequency,
  3173. S32 bits,
  3174. S32 channel,
  3175. U32 flags );
  3176. DXDEC void AILCALL AIL_close_digital_driver( HDIGDRIVER dig );
  3177. #ifdef IS_LINUX
  3178. #define AIL_MSS_version(str,len) \
  3179. { \
  3180. strncpy(str, MSS_VERSION, len); \
  3181. }
  3182. DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
  3183. DXDEC S32 AILCALL AIL_digital_handle_reacquire
  3184. (HDIGDRIVER drvr);
  3185. #else
  3186. #ifdef IS_WINDOWS
  3187. #define AIL_MSS_version(str,len) \
  3188. { \
  3189. HINSTANCE l=LoadLibrary(MSSDLLNAME); \
  3190. if ((UINTa)l<=32) \
  3191. *(str)=0; \
  3192. else { \
  3193. LoadString(l,1,str,len); \
  3194. FreeLibrary(l); \
  3195. } \
  3196. }
  3197. #if 0
  3198. DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr,
  3199. LPHWAVEOUT FAR *lphWaveOut,
  3200. S32 wDeviceID,
  3201. LPWAVEFORMAT lpFormat);
  3202. DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr);
  3203. #endif
  3204. DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
  3205. DXDEC S32 AILCALL AIL_digital_handle_reacquire
  3206. (HDIGDRIVER drvr);
  3207. #else
  3208. #ifdef IS_MAC
  3209. #if defined(__RESOURCES__)
  3210. typedef MSS_STRUCT MSS_VersionType_
  3211. {
  3212. Str255 version_name;
  3213. } MSS_VersionType;
  3214. #define AIL_MSS_version(str,len) \
  3215. { \
  3216. long _res = HOpenResFile(0,0,"\p" MSSDLLNAME,fsRdPerm); \
  3217. if (_res==-1) \
  3218. { \
  3219. str[0]=0; \
  3220. } \
  3221. else \
  3222. { \
  3223. Handle _H; \
  3224. short _Err; \
  3225. long _cur= CurResFile(); \
  3226. UseResFile(_res); \
  3227. _H = GetResource('vers', 2); \
  3228. _Err = ResError(); \
  3229. if((_Err != noErr) || (_H==0)) \
  3230. { \
  3231. str[0]=0; \
  3232. UseResFile(_cur); \
  3233. CloseResFile(_res); \
  3234. } \
  3235. else \
  3236. { \
  3237. if (GetHandleSize(_H)==0) \
  3238. { \
  3239. str[0]=0; \
  3240. UseResFile(_cur); \
  3241. CloseResFile(_res); \
  3242. } \
  3243. else \
  3244. { \
  3245. MSS_VersionType * _vt = (MSS_VersionType*)*_H; \
  3246. if ((U32)_vt->version_name[6]>4) \
  3247. _vt->version_name[6]-=4; \
  3248. else \
  3249. _vt->version_name[6]=0; \
  3250. if (((U32)len) <= ((U32)_vt->version_name[6])) \
  3251. _vt->version_name[6] = (U8)len-1; \
  3252. memcpy( str, _vt->version_name+11, _vt->version_name[6] ); \
  3253. str[_vt->version_name[6]]=0; \
  3254. UseResFile(_cur); \
  3255. CloseResFile(_res); \
  3256. } \
  3257. ReleaseResource(_H); \
  3258. } \
  3259. } \
  3260. }
  3261. #endif
  3262. DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
  3263. DXDEC S32 AILCALL AIL_digital_handle_reacquire
  3264. (HDIGDRIVER drvr);
  3265. #else
  3266. #ifdef IS_DOS
  3267. //
  3268. // DOS installation services
  3269. //
  3270. DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr);
  3271. DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 const *driver_image,
  3272. U32 n_bytes);
  3273. DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr);
  3274. DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig);
  3275. DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_file
  3276. (char const *filename,
  3277. IO_PARMS *IO);
  3278. DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig);
  3279. DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_image
  3280. (void const *driver_image,
  3281. U32 size,
  3282. IO_PARMS *IO);
  3283. #endif
  3284. #endif
  3285. #endif
  3286. #endif
  3287. DXDEC char FAR* AILCALL AIL_set_redist_directory(char const FAR*dir);
  3288. DXDEC S32 AILCALL AIL_background_CPU_percent (void);
  3289. DXDEC S32 AILCALL AIL_digital_CPU_percent (HDIGDRIVER dig);
  3290. DXDEC S32 AILCALL AIL_digital_latency (HDIGDRIVER dig);
  3291. DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle
  3292. (HDIGDRIVER dig);
  3293. DXDEC void AILCALL AIL_set_speaker_configuration
  3294. (HDIGDRIVER dig,
  3295. MSSVECTOR3D FAR *array,
  3296. S32 n_channels,
  3297. F32 falloff_power);
  3298. DXDEC MSSVECTOR3D FAR *
  3299. AILCALL AIL_speaker_configuration
  3300. (HDIGDRIVER dig,
  3301. S32 FAR *n_physical_channels,
  3302. S32 FAR *n_logical_channels,
  3303. F32 FAR *falloff_power,
  3304. MSS_MC_SPEC FAR *channel_spec);
  3305. DXDEC void AILCALL AIL_set_listener_relative_receiver_array
  3306. (HDIGDRIVER dig,
  3307. MSS_RECEIVER_LIST FAR *array,
  3308. S32 n_receivers);
  3309. DXDEC MSS_RECEIVER_LIST FAR *
  3310. AILCALL AIL_listener_relative_receiver_array
  3311. (HDIGDRIVER dig,
  3312. S32 FAR *n_receivers);
  3313. #ifndef IS_XBOX
  3314. DXDEC void AILCALL AIL_set_speaker_reverb_levels
  3315. (HDIGDRIVER dig,
  3316. F32 FAR *wet_array,
  3317. F32 FAR *dry_array,
  3318. S32 n_levels);
  3319. DXDEC void AILCALL AIL_speaker_reverb_levels (HDIGDRIVER dig,
  3320. S32 FAR *n_levels,
  3321. F32 FAR * FAR *wet_array,
  3322. F32 FAR * FAR *dry_array);
  3323. #endif
  3324. DXDEC
  3325. S32 AILEXPORT AIL_calculate_3D_channel_levels (HDIGDRIVER dig, //)
  3326. F32 FAR *channel_levels,
  3327. MSSVECTOR3D FAR *src_pos,
  3328. MSSVECTOR3D FAR *src_face,
  3329. MSSVECTOR3D FAR *src_up,
  3330. F32 src_inner_angle,
  3331. F32 src_outer_angle,
  3332. F32 src_outer_volume,
  3333. F32 src_max_dist,
  3334. F32 src_min_dist,
  3335. MSSVECTOR3D FAR *listen_pos,
  3336. MSSVECTOR3D FAR *listen_face,
  3337. MSSVECTOR3D FAR *listen_up,
  3338. F32 rolloff_factor,
  3339. MSSVECTOR3D FAR *doppler_velocity,
  3340. F32 FAR *doppler_shift);
  3341. DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S);
  3342. DXDEC void AILCALL AIL_init_sample (HSAMPLE S,
  3343. S32 format,
  3344. U32 flags);
  3345. DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S,
  3346. void const FAR *file_image,
  3347. S32 block);
  3348. DXDEC S32 AILCALL AIL_set_sample_info (HSAMPLE S,
  3349. AILSOUNDINFO const FAR * info);
  3350. DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S,
  3351. C8 const FAR *file_type_suffix,
  3352. void const FAR *file_image,
  3353. U32 file_size,
  3354. S32 block);
  3355. DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S,
  3356. SAMPLESTAGE pipeline_stage,
  3357. HPROVIDER provider);
  3358. DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor
  3359. (HDIGDRIVER dig,
  3360. DIGDRVSTAGE pipeline_stage,
  3361. HPROVIDER provider);
  3362. DXDEC HPROVIDER AILCALL AIL_sample_processor (HSAMPLE S,
  3363. SAMPLESTAGE pipeline_stage);
  3364. DXDEC HPROVIDER AILCALL AIL_digital_driver_processor
  3365. (HDIGDRIVER dig,
  3366. DIGDRVSTAGE pipeline_stage);
  3367. DXDEC void AILCALL AIL_set_sample_adpcm_block_size
  3368. (HSAMPLE S,
  3369. U32 blocksize);
  3370. DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S,
  3371. void const FAR *start,
  3372. U32 len);
  3373. DXDEC void AILCALL AIL_start_sample (HSAMPLE S);
  3374. DXDEC void AILCALL AIL_stop_sample (HSAMPLE S);
  3375. DXDEC void AILCALL AIL_resume_sample (HSAMPLE S);
  3376. DXDEC void AILCALL AIL_end_sample (HSAMPLE S);
  3377. DXDEC void AILCALL AIL_set_sample_playback_rate
  3378. (HSAMPLE S,
  3379. S32 playback_rate);
  3380. DXDEC void AILCALL AIL_set_sample_volume_pan (HSAMPLE S,
  3381. F32 volume,
  3382. F32 pan);
  3383. DXDEC void AILCALL AIL_set_sample_volume_levels(HSAMPLE S,
  3384. F32 left_level,
  3385. F32 right_level);
  3386. DXDEC void AILCALL AIL_set_sample_channel_levels (HSAMPLE S,
  3387. F32 FAR *level_array,
  3388. S32 n_levels);
  3389. DXDEC void AILCALL AIL_set_sample_reverb_levels(HSAMPLE S,
  3390. F32 dry_level,
  3391. F32 wet_level);
  3392. DXDEC void AILCALL AIL_set_sample_low_pass_cut_off(HSAMPLE S,
  3393. F32 cut_off);
  3394. DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S,
  3395. S32 loop_count);
  3396. DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S,
  3397. S32 loop_start_offset,
  3398. S32 loop_end_offset);
  3399. DXDEC S32 AILCALL AIL_sample_loop_block (HSAMPLE S,
  3400. S32 *loop_start_offset,
  3401. S32 *loop_end_offset);
  3402. DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S);
  3403. DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S);
  3404. DXDEC void AILCALL AIL_sample_volume_pan (HSAMPLE S, F32 FAR* volume, F32 FAR* pan);
  3405. DXDEC F32 FAR * AILCALL AIL_sample_channel_levels (HSAMPLE S,
  3406. S32 FAR *n_levels);
  3407. DXDEC void AILCALL AIL_sample_volume_levels (HSAMPLE S,
  3408. F32 FAR *left_level,
  3409. F32 FAR *right_level);
  3410. DXDEC void AILCALL AIL_sample_reverb_levels (HSAMPLE S,
  3411. F32 FAR *dry_level,
  3412. F32 FAR *wet_level);
  3413. DXDEC F32 AILCALL AIL_sample_low_pass_cut_off(HSAMPLE S);
  3414. DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S);
  3415. DXDEC void AILCALL AIL_set_digital_master_volume_level
  3416. (HDIGDRIVER dig,
  3417. F32 master_volume);
  3418. DXDEC F32 AILCALL AIL_digital_master_volume_level (HDIGDRIVER dig);
  3419. DXDEC void AILCALL AIL_set_sample_51_volume_pan( HSAMPLE S,
  3420. F32 volume,
  3421. F32 pan,
  3422. F32 fb_pan,
  3423. F32 center_level,
  3424. F32 sub_level );
  3425. DXDEC void AILCALL AIL_sample_51_volume_pan ( HSAMPLE S,
  3426. F32 FAR* volume,
  3427. F32 FAR* pan,
  3428. F32 FAR* fb_pan,
  3429. F32 FAR* center_level,
  3430. F32 FAR* sub_level );
  3431. DXDEC void AILCALL AIL_set_sample_51_volume_levels( HSAMPLE S,
  3432. F32 f_left_level,
  3433. F32 f_right_level,
  3434. F32 b_left_level,
  3435. F32 b_right_level,
  3436. F32 center_level,
  3437. F32 sub_level );
  3438. DXDEC void AILCALL AIL_sample_51_volume_levels ( HSAMPLE S,
  3439. F32 FAR* f_left_level,
  3440. F32 FAR* f_right_level,
  3441. F32 FAR* b_left_level,
  3442. F32 FAR* b_right_level,
  3443. F32 FAR* center_level,
  3444. F32 FAR* sub_level );
  3445. #if !defined(IS_XBOX)
  3446. DXDEC void AILCALL AIL_set_digital_master_reverb
  3447. (HDIGDRIVER dig,
  3448. F32 reverb_decay_time,
  3449. F32 reverb_predelay,
  3450. F32 reverb_damping);
  3451. DXDEC void AILCALL AIL_digital_master_reverb
  3452. (HDIGDRIVER dig,
  3453. F32 FAR* reverb_time,
  3454. F32 FAR* reverb_predelay,
  3455. F32 FAR* reverb_damping);
  3456. #endif
  3457. DXDEC void AILCALL AIL_set_digital_master_reverb_levels
  3458. (HDIGDRIVER dig,
  3459. F32 dry_level,
  3460. F32 wet_level);
  3461. DXDEC void AILCALL AIL_digital_master_reverb_levels
  3462. (HDIGDRIVER dig,
  3463. F32 FAR * dry_level,
  3464. F32 FAR * wet_level);
  3465. //
  3466. // low-level digital services
  3467. //
  3468. DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig,
  3469. S32 playback_rate,
  3470. S32 format);
  3471. DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S);
  3472. DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S,
  3473. U32 buff_num,
  3474. void const FAR *buffer,
  3475. U32 len);
  3476. DXDEC void AILCALL AIL_request_EOB_ASI_reset (HSAMPLE S,
  3477. U32 buff_num,
  3478. S32 new_stream_position);
  3479. DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //)
  3480. U32 FAR *pos0,
  3481. U32 FAR *len0,
  3482. U32 FAR *pos1,
  3483. U32 FAR *len1);
  3484. DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S);
  3485. DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S,
  3486. U32 pos);
  3487. DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S);
  3488. DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback
  3489. (HSAMPLE S,
  3490. AILSAMPLECB SOB);
  3491. DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback
  3492. (HSAMPLE S,
  3493. AILSAMPLECB EOB);
  3494. DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback
  3495. (HSAMPLE S,
  3496. AILSAMPLECB EOS);
  3497. DXDEC AILFALLOFFCB AILCALL AIL_register_falloff_function_callback
  3498. (HSAMPLE S,
  3499. AILFALLOFFCB falloff_cb);
  3500. DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S,
  3501. U32 index,
  3502. SINTa value);
  3503. DXDEC SINTa AILCALL AIL_sample_user_data (HSAMPLE S,
  3504. U32 index);
  3505. DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig);
  3506. DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig,
  3507. S32 FAR *rate,
  3508. S32 FAR *format,
  3509. char FAR *string);
  3510. DXDEC S32 AILCALL AIL_platform_property (void *object,
  3511. MSS_PLATFORM_PROPERTY property,
  3512. void FAR *before_value,
  3513. void const FAR *new_value,
  3514. void FAR *after_value);
  3515. #ifdef IS_WIN32API
  3516. DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S,
  3517. U32 command);
  3518. DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S,
  3519. AILLPDIRECTSOUND *lplpDS,
  3520. AILLPDIRECTSOUNDBUFFER *lplpDSB);
  3521. #ifdef IS_WIN32
  3522. DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd);
  3523. #endif
  3524. #endif
  3525. DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //)
  3526. S32 milliseconds);
  3527. DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //)
  3528. S32 FAR * total_milliseconds,
  3529. S32 FAR * current_milliseconds);
  3530. //
  3531. // Digital input services
  3532. //
  3533. #if defined(IS_WINDOWS) || defined (IS_MAC) || defined(IS_LINUX) || defined(IS_XBOX) || defined(IS_XENON)
  3534. DXDEC HDIGINPUT AILCALL AIL_open_input (AIL_INPUT_INFO FAR *info);
  3535. DXDEC void AILCALL AIL_close_input (HDIGINPUT dig);
  3536. DXDEC AIL_INPUT_INFO FAR *
  3537. AILCALL AIL_get_input_info (HDIGINPUT dig);
  3538. DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig,
  3539. S32 enable);
  3540. #endif
  3541. //
  3542. // High-level XMIDI services
  3543. //
  3544. DXDEC HMDIDRIVER AILCALL AIL_open_XMIDI_driver( U32 flags );
  3545. #define AIL_OPEN_XMIDI_NULL_DRIVER 1
  3546. DXDEC void AILCALL AIL_close_XMIDI_driver( HMDIDRIVER mdi );
  3547. #if defined(IS_MAC) || defined(IS_LINUX)
  3548. DXDEC S32 AILCALL AIL_MIDI_handle_release
  3549. (HMDIDRIVER mdi);
  3550. DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
  3551. (HMDIDRIVER mdi);
  3552. #else
  3553. #ifdef IS_WINDOWS
  3554. DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr,
  3555. LPHMIDIOUT FAR *lphMidiOut,
  3556. S32 dwDeviceID);
  3557. DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi);
  3558. DXDEC S32 AILCALL AIL_MIDI_handle_release
  3559. (HMDIDRIVER mdi);
  3560. DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
  3561. (HMDIDRIVER mdi);
  3562. #else
  3563. #ifdef IS_DOS
  3564. DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi);
  3565. DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_file
  3566. (char const *filename,
  3567. IO_PARMS *IO);
  3568. DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi);
  3569. DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_image
  3570. (void const *driver_image,
  3571. U32 size,
  3572. IO_PARMS *IO);
  3573. DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi);
  3574. DXDEC void AILCALL AIL_set_GTL_filename_prefix (char const*prefix);
  3575. DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi,
  3576. S32 bank,
  3577. S32 patch);
  3578. DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi,
  3579. S32 bank,
  3580. S32 patch);
  3581. DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi,
  3582. S32 bank,
  3583. S32 patch);
  3584. DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi,
  3585. S32 bank,
  3586. S32 patch);
  3587. #endif
  3588. #endif
  3589. #endif
  3590. DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle
  3591. (HMDIDRIVER mdi);
  3592. DXDEC void AILCALL AIL_release_sequence_handle
  3593. (HSEQUENCE S);
  3594. DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S,
  3595. void const FAR *start,
  3596. S32 sequence_num);
  3597. DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S);
  3598. DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S);
  3599. DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S);
  3600. DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S);
  3601. DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S,
  3602. S32 tempo,
  3603. S32 milliseconds);
  3604. DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S,
  3605. S32 volume,
  3606. S32 milliseconds);
  3607. DXDEC void AILCALL AIL_set_sequence_loop_count
  3608. (HSEQUENCE S,
  3609. S32 loop_count);
  3610. DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S);
  3611. DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S);
  3612. DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S);
  3613. DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S);
  3614. DXDEC void AILCALL AIL_set_XMIDI_master_volume
  3615. (HMDIDRIVER mdi,
  3616. S32 master_volume);
  3617. DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi);
  3618. //
  3619. // Low-level XMIDI services
  3620. //
  3621. DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi);
  3622. DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S,
  3623. S32 channel,
  3624. S32 controller_num);
  3625. DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S,
  3626. S32 channel);
  3627. DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S,
  3628. S32 FAR *beat,
  3629. S32 FAR *measure);
  3630. DXDEC void AILCALL AIL_branch_index (HSEQUENCE S,
  3631. U32 marker);
  3632. DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback
  3633. (HSEQUENCE S,
  3634. AILPREFIXCB callback);
  3635. DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback
  3636. (HSEQUENCE S,
  3637. AILTRIGGERCB callback);
  3638. DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback
  3639. (HSEQUENCE S,
  3640. AILSEQUENCECB callback);
  3641. DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S,
  3642. AILBEATCB callback);
  3643. DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi,
  3644. AILEVENTCB callback);
  3645. DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback
  3646. (HMDIDRIVER mdi,
  3647. AILTIMBRECB callback);
  3648. DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S,
  3649. U32 index,
  3650. SINTa value);
  3651. DXDEC SINTa AILCALL AIL_sequence_user_data (HSEQUENCE S,
  3652. U32 index);
  3653. DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S,
  3654. U8 FAR *array);
  3655. DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi);
  3656. DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi,
  3657. S32 channel);
  3658. DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S,
  3659. S32 seq_channel,
  3660. S32 new_channel);
  3661. DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S,
  3662. S32 seq_channel);
  3663. DXDEC void AILCALL AIL_send_channel_voice_message
  3664. (HMDIDRIVER mdi,
  3665. HSEQUENCE S,
  3666. S32 status,
  3667. S32 data_1,
  3668. S32 data_2);
  3669. DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi,
  3670. void const FAR *buffer);
  3671. DXDEC HWAVESYNTH
  3672. AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig,
  3673. HMDIDRIVER mdi,
  3674. void const FAR *wave_lib,
  3675. S32 polyphony);
  3676. DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W);
  3677. DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //)
  3678. S32 milliseconds);
  3679. DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //)
  3680. S32 FAR *total_milliseconds,
  3681. S32 FAR *current_milliseconds);
  3682. //
  3683. // red book functions
  3684. //
  3685. #ifdef IS_LINUX
  3686. MSS_STRUCT SDL_CD;
  3687. #endif
  3688. #if !defined(IS_XBOX) && !defined(IS_XENON) && !defined(IS_PS2) && !defined(IS_PS3) && !defined(IS_WII)
  3689. #ifdef IS_DOS
  3690. typedef MSS_STRUCT _REDBOOKTRACKINFO {
  3691. U32 tracks;
  3692. U32 trackstarts[100];
  3693. } REDBOOKTRACKINFO;
  3694. #endif
  3695. typedef MSS_STRUCT _REDBOOK {
  3696. U32 DeviceID;
  3697. U32 paused;
  3698. U32 pausedsec;
  3699. U32 lastendsec;
  3700. #ifdef IS_DOS
  3701. U32 readcontents;
  3702. REDBOOKTRACKINFO info;
  3703. #endif
  3704. #ifdef IS_MAC
  3705. short vDRefNum;
  3706. #endif
  3707. #ifdef IS_LINUX
  3708. struct SDL_CD *cdrom;
  3709. #endif
  3710. } REDBOOK;
  3711. typedef MSS_STRUCT _REDBOOK FAR* HREDBOOK;
  3712. #define REDBOOK_ERROR 0
  3713. #define REDBOOK_PLAYING 1
  3714. #define REDBOOK_PAUSED 2
  3715. #define REDBOOK_STOPPED 3
  3716. DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which);
  3717. #ifdef IS_MAC
  3718. DXDEC HREDBOOK AILCALL AIL_redbook_open_volume(char const * drive);
  3719. #else
  3720. DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive);
  3721. #endif
  3722. DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand);
  3723. DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand);
  3724. DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand);
  3725. DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand);
  3726. DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand);
  3727. DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand);
  3728. DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum,
  3729. U32 FAR* startmsec,U32 FAR* endmsec);
  3730. DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand);
  3731. DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand);
  3732. DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec);
  3733. DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand);
  3734. DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand);
  3735. DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand);
  3736. DXDEC F32 AILCALL AIL_redbook_volume_level(HREDBOOK hand);
  3737. DXDEC F32 AILCALL AIL_redbook_set_volume_level(HREDBOOK hand, F32 volume);
  3738. #endif
  3739. #ifdef IS_WIN16
  3740. #define AIL_ms_count timeGetTime
  3741. DXDEC U32 AILCALL AIL_us_count(void);
  3742. #else
  3743. DXDEC U32 AILCALL AIL_ms_count(void);
  3744. DXDEC U32 AILCALL AIL_us_count(void);
  3745. #endif
  3746. typedef MSS_STRUCT _STREAM FAR* HSTREAM; // Handle to stream
  3747. typedef void (AILCALLBACK FAR* AILSTREAMCB) (HSTREAM stream);
  3748. typedef MSS_STRUCT _STREAM {
  3749. S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream
  3750. S32 using_ASI; // 1 if using ASI decoder to uncompress stream data
  3751. ASISTAGE FAR *ASI; // handy pointer to our ASI coded
  3752. HSAMPLE samp; // the sample handle
  3753. UINTa fileh; // the open file handle
  3754. U8 FAR* bufs[3]; // the data buffers
  3755. U32 bufsizes[3]; // the size of each buffer
  3756. S32 reset_ASI[3]; // should we reset the ASI at the end of the buffer?
  3757. S32 reset_seek_pos[3]; // new stream position after reset
  3758. S32 bufstart[3]; // offset of where this buffer started
  3759. void FAR* asyncs[3];// async read structures
  3760. S32 loadedbufstart[2]; // offset of where the loaded buffer started
  3761. S32 loadedorder[2]; // order of the buffers as they were loaded
  3762. S32 loadorder; // incremented as each buffer is loaded
  3763. S32 bufsize; // size of each buffer
  3764. S32 readsize; // size of each read block
  3765. U32 buf1; // 0,1,2 (current buffer that we are reading into)
  3766. S32 size1; // holds the current amount of data read
  3767. U32 buf2; // 0,1,2 (the next buffer that we are reading into)
  3768. S32 size2; // next buffer loaded up to
  3769. U32 buf3; // 0,1,2 (the next buffer that we are reading into)
  3770. S32 size3; // next buffer loaded up to
  3771. U32 datarate; // datarate in bytes per second
  3772. S32 filerate; // original datarate of the file
  3773. S32 filetype; // file format type
  3774. U32 fileflags; // file format flags (signed or unsigned)
  3775. S32 totallen; // total length of the sound data
  3776. S32 substart; // subblock loop start
  3777. S32 sublen; // subblock loop len
  3778. S32 subpadding; // amount to pad the final block
  3779. U32 blocksize; // ADPCM block size
  3780. S32 padding; // padding to be done
  3781. S32 padded; // padding done
  3782. S32 loadedsome; // have we done any loads?
  3783. U32 startpos; // point that the sound data begins
  3784. U32 totalread; // total bytes read from the disk
  3785. U32 loopsleft; // how many loops are left
  3786. U32 error; // read error has occurred
  3787. S32 preload; // preload the file into the first buffer
  3788. U32 preloadpos; // position to use in preload
  3789. S32 noback; // no background processing
  3790. S32 alldone; // alldone
  3791. S32 primeamount; // amount to load after a seek
  3792. S32 readatleast; // forced amount to read on next service
  3793. S32 playcontrol; // control: 0=stopped, 1=started, |8=paused, |16=sample paused
  3794. AILSTREAMCB callback; // end of stream callback
  3795. SINTa user_data[8]; // Miscellaneous user data
  3796. void FAR* next; // pointer to next stream
  3797. #if defined(IS_WINDOWS) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_XBOX) || defined(IS_XENON) || defined(IS_PS2) || defined(IS_PS3) || defined(IS_WII)
  3798. S32 autostreaming; // are we autostreaming this stream
  3799. #endif
  3800. S32 docallback; // set when it time to poll for a callback
  3801. } MSTREAM_TYPE;
  3802. DXDEC HSTREAM AILCALL AIL_open_stream(HDIGDRIVER dig, char const FAR * filename, S32 stream_mem);
  3803. DXDEC void AILCALL AIL_close_stream(HSTREAM stream);
  3804. DXDEC HSAMPLE AILCALL AIL_stream_sample_handle(HSTREAM stream);
  3805. DXDEC S32 AILCALL AIL_service_stream(HSTREAM stream, S32 fillup);
  3806. DXDEC void AILCALL AIL_start_stream(HSTREAM stream);
  3807. DXDEC void AILCALL AIL_pause_stream(HSTREAM stream, S32 onoff);
  3808. DXDEC S32 AILCALL AIL_stream_loop_count(HSTREAM stream);
  3809. DXDEC void AILCALL AIL_set_stream_loop_count(HSTREAM stream, S32 count);
  3810. DXDEC void AILCALL AIL_set_stream_loop_block (HSTREAM S,
  3811. S32 loop_start_offset,
  3812. S32 loop_end_offset);
  3813. DXDEC S32 AILCALL AIL_stream_status(HSTREAM stream);
  3814. DXDEC void AILCALL AIL_set_stream_position(HSTREAM stream,S32 offset);
  3815. DXDEC S32 AILCALL AIL_stream_position(HSTREAM stream);
  3816. DXDEC void AILCALL AIL_stream_info(HSTREAM stream, S32 FAR* datarate, S32 FAR* sndtype, S32 FAR* length, S32 FAR* memory);
  3817. DXDEC AILSTREAMCB AILCALL AIL_register_stream_callback(HSTREAM stream, AILSTREAMCB callback);
  3818. DXDEC void AILCALL AIL_auto_service_stream(HSTREAM stream, S32 onoff);
  3819. DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S,
  3820. U32 index,
  3821. SINTa value);
  3822. DXDEC SINTa AILCALL AIL_stream_user_data (HSTREAM S,
  3823. U32 index);
  3824. DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S,
  3825. S32 milliseconds);
  3826. DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //)
  3827. S32 FAR * total_milliseconds,
  3828. S32 FAR * current_milliseconds);
  3829. #ifdef ON_MAC_USE_FSS
  3830. typedef MSS_STRUCT MSS_FILE
  3831. {
  3832. S32 file_type; // 0 = char*, 1 = FSSpec*
  3833. void const FAR* file;
  3834. } MSS_FILE;
  3835. #else
  3836. typedef char MSS_FILE;
  3837. #endif
  3838. typedef U32 (AILCALLBACK FAR*AIL_file_open_callback) (MSS_FILE const FAR* Filename,
  3839. UINTa FAR* FileHandle);
  3840. typedef void (AILCALLBACK FAR*AIL_file_close_callback) (UINTa FileHandle);
  3841. #define AIL_FILE_SEEK_BEGIN 0
  3842. #define AIL_FILE_SEEK_CURRENT 1
  3843. #define AIL_FILE_SEEK_END 2
  3844. typedef S32 (AILCALLBACK FAR*AIL_file_seek_callback) (UINTa FileHandle,
  3845. S32 Offset,
  3846. U32 Type);
  3847. typedef U32 (AILCALLBACK FAR*AIL_file_read_callback) (UINTa FileHandle,
  3848. void FAR* Buffer,
  3849. U32 Bytes);
  3850. DXDEC void AILCALL AIL_set_file_callbacks (AIL_file_open_callback opencb,
  3851. AIL_file_close_callback closecb,
  3852. AIL_file_seek_callback seekcb,
  3853. AIL_file_read_callback readcb);
  3854. #ifdef IS_32
  3855. typedef void FAR* (AILCALLBACK FAR *AIL_file_async_read_callback) (UINTa FileHandle,
  3856. void FAR* Buffer,
  3857. U32 Bytes);
  3858. typedef S32 (AILCALLBACK FAR*AIL_file_async_status_callback) (void FAR* async,
  3859. S32 wait,
  3860. U32 FAR* BytesRead);
  3861. DXDEC void AILCALL AIL_set_file_async_callbacks (AIL_file_open_callback opencb,
  3862. AIL_file_close_callback closecb,
  3863. AIL_file_seek_callback seekcb,
  3864. AIL_file_async_read_callback areadcb,
  3865. AIL_file_async_status_callback statuscb);
  3866. #endif
  3867. //
  3868. // High-level DLS functions
  3869. //
  3870. typedef MSS_STRUCT _DLSFILEID {
  3871. SINTa id;
  3872. struct _DLSFILEID FAR* next;
  3873. } DLSFILEID;
  3874. typedef MSS_STRUCT _DLSFILEID FAR* HDLSFILEID;
  3875. typedef MSS_STRUCT _DLSDEVICE {
  3876. VOIDFUNC FAR* pGetPref;
  3877. VOIDFUNC FAR* pSetPref;
  3878. VOIDFUNC FAR* pMSSOpen;
  3879. VOIDFUNC FAR* pOpen;
  3880. VOIDFUNC FAR* pClose;
  3881. VOIDFUNC FAR* pLoadFile;
  3882. VOIDFUNC FAR* pLoadMem;
  3883. VOIDFUNC FAR* pUnloadFile;
  3884. VOIDFUNC FAR* pUnloadAll;
  3885. VOIDFUNC FAR* pGetInfo;
  3886. VOIDFUNC FAR* pCompact;
  3887. VOIDFUNC FAR* pSetAttr;
  3888. SINTa DLSHandle;
  3889. U32 format;
  3890. U32 buffer_size;
  3891. void FAR* buffer[2];
  3892. HSAMPLE sample;
  3893. HMDIDRIVER mdi;
  3894. HDIGDRIVER dig;
  3895. HDLSFILEID first;
  3896. #ifdef IS_WINDOWS
  3897. HMODULE lib;
  3898. #else
  3899. #ifdef IS_STATIC
  3900. char FAR* DOSname;
  3901. #endif
  3902. #endif
  3903. } DLSDEVICE;
  3904. typedef MSS_STRUCT _DLSDEVICE FAR* HDLSDEVICE;
  3905. typedef MSS_STRUCT _AILDLSINFO {
  3906. char Description[128];
  3907. S32 MaxDLSMemory;
  3908. S32 CurrentDLSMemory;
  3909. S32 LargestSize;
  3910. S32 GMAvailable;
  3911. S32 GMBankSize;
  3912. } AILDLSINFO;
  3913. #ifdef IS_STATIC
  3914. typedef MSS_STRUCT _AILSTATICDLS {
  3915. char FAR* description;
  3916. VOIDFUNC FAR* pDLSOpen;
  3917. VOIDFUNC FAR* pMSSOpen;
  3918. VOIDFUNC FAR* pOpen;
  3919. VOIDFUNC FAR* pClose;
  3920. VOIDFUNC FAR* pLoadFile;
  3921. VOIDFUNC FAR* pLoadMem;
  3922. VOIDFUNC FAR* pUnloadFile;
  3923. VOIDFUNC FAR* pUnloadAll;
  3924. VOIDFUNC FAR* pGetInfo;
  3925. VOIDFUNC FAR* pCompact;
  3926. VOIDFUNC FAR* pSetAttr;
  3927. } AILSTATICDLS;
  3928. #endif
  3929. DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig,
  3930. #ifdef IS_STATIC
  3931. AILSTATICDLS const FAR * staticdls,
  3932. #else
  3933. char const FAR * libname,
  3934. #endif
  3935. U32 flags, U32 rate, S32 bits, S32 channels);
  3936. //
  3937. // Parameters for the dwFlag used in DLSClose() and flags in AIL_DLS_close
  3938. //
  3939. #define RETAIN_DLS_COLLECTION 0x00000001
  3940. #define RETURN_TO_BOOTUP_STATE 0x00000002
  3941. #define RETURN_TO_GM_ONLY_STATE 0x00000004
  3942. #define DLS_COMPACT_MEMORY 0x00000008
  3943. DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags);
  3944. DXDEC HDLSFILEID AILCALL AIL_DLS_load_file(HDLSDEVICE dls, char const FAR* filename, U32 flags);
  3945. DXDEC HDLSFILEID AILCALL AIL_DLS_load_memory(HDLSDEVICE dls, void const FAR* memfile, U32 flags);
  3946. //
  3947. // other parameters for AIL_DLS_unload
  3948. //
  3949. #define AIL_DLS_UNLOAD_MINE 0
  3950. #define AIL_DLS_UNLOAD_ALL ((HDLSFILEID)(UINTa)(SINTa)-1)
  3951. DXDEC void AILCALL AIL_DLS_unload(HDLSDEVICE dls, HDLSFILEID dlsid);
  3952. DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls);
  3953. DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO FAR* info, S32 FAR* PercentCPU);
  3954. DXDEC HSAMPLE AILCALL AIL_DLS_sample_handle(HDLSDEVICE dls);
  3955. //
  3956. // Quick-integration service functions and data types
  3957. //
  3958. typedef MSS_STRUCT
  3959. {
  3960. U32 const FAR *data;
  3961. S32 size;
  3962. S32 type;
  3963. void FAR *handle;
  3964. S32 status;
  3965. void FAR* next;
  3966. S32 speed;
  3967. F32 volume;
  3968. F32 extravol;
  3969. F32 dry;
  3970. F32 wet;
  3971. F32 cutoff;
  3972. HDLSFILEID dlsid;
  3973. void FAR* dlsmem;
  3974. void FAR* dlsmemunc;
  3975. S32 milliseconds;
  3976. S32 length;
  3977. SINTa userdata;
  3978. }
  3979. AUDIO_TYPE;
  3980. #define QSTAT_DONE 1 // Data has finished playing
  3981. #define QSTAT_LOADED 2 // Data has been loaded, but not yet played
  3982. #define QSTAT_PLAYING 3 // Data is currently playing
  3983. typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type
  3984. #define AIL_QUICK_USE_WAVEOUT 2
  3985. #define AIL_QUICK_MIDI_AND_DLS 2
  3986. #define AIL_QUICK_DLS_ONLY 3
  3987. #define AIL_QUICK_MIDI_AND_VORTEX_DLS 4
  3988. #define AIL_QUICK_MIDI_AND_SONICVIBES_DLS 5
  3989. DXDEC S32 AILCALL
  3990. #if defined(IS_WINDOWS) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_XBOX) || defined(IS_XENON) || defined(IS_PS2) || defined(IS_PS3) || defined(IS_WII)
  3991. AIL_quick_startup (
  3992. #else
  3993. AIL_quick_startup_with_start(void* startup,
  3994. #endif
  3995. S32 use_digital,
  3996. S32 use_MIDI,
  3997. U32 output_rate,
  3998. S32 output_bits,
  3999. S32 output_channels);
  4000. DXDEC void AILCALL AIL_quick_shutdown (void);
  4001. DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig,
  4002. HMDIDRIVER FAR* pmdi,
  4003. HDLSDEVICE FAR* pdls );
  4004. DXDEC HAUDIO AILCALL AIL_quick_load (char const FAR *filename);
  4005. #ifdef ON_MAC_USE_FSS
  4006. DXDEC HAUDIO AILCALL AIL_quick_fss_load (FSSpec const FAR *filename);
  4007. #endif
  4008. DXDEC HAUDIO AILCALL AIL_quick_load_mem (void const FAR *mem,
  4009. U32 size);
  4010. DXDEC HAUDIO AILCALL AIL_quick_load_named_mem (void const FAR *mem,
  4011. char const FAR *filename,
  4012. U32 size);
  4013. DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio);
  4014. DXDEC void AILCALL AIL_quick_unload (HAUDIO audio);
  4015. DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio,
  4016. U32 loop_count);
  4017. DXDEC void AILCALL AIL_quick_halt (HAUDIO audio);
  4018. DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio);
  4019. DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char const FAR *filename,
  4020. U32 loop_count,
  4021. S32 wait_request);
  4022. #ifdef ON_MAC_USE_FSS
  4023. DXDEC HAUDIO AILCALL AIL_quick_fss_load_and_play (FSSpec const FAR *filename,
  4024. U32 loop_count,
  4025. S32 wait_request);
  4026. #endif
  4027. DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed);
  4028. DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, F32 volume, F32 extravol);
  4029. DXDEC void AILCALL AIL_quick_set_reverb_levels (HAUDIO audio,
  4030. F32 dry_level,
  4031. F32 wet_level);
  4032. DXDEC void AILCALL AIL_quick_set_low_pass_cut_off(HAUDIO S,
  4033. F32 cut_off);
  4034. DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds);
  4035. DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio);
  4036. DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio);
  4037. #define AIL_QUICK_XMIDI_TYPE 1
  4038. #define AIL_QUICK_DIGITAL_TYPE 2
  4039. #define AIL_QUICK_DLS_XMIDI_TYPE 3
  4040. #define AIL_QUICK_MPEG_DIGITAL_TYPE 4
  4041. #define AIL_QUICK_OGG_VORBIS_TYPE 5
  4042. #define AIL_QUICK_V12_VOICE_TYPE 6
  4043. #define AIL_QUICK_V24_VOICE_TYPE 7
  4044. #define AIL_QUICK_V29_VOICE_TYPE 8
  4045. #define AIL_QUICK_OGG_SPEEX_TYPE 9
  4046. #define AIL_QUICK_S8_VOICE_TYPE 10
  4047. #define AIL_QUICK_S16_VOICE_TYPE 11
  4048. #define AIL_QUICK_S32_VOICE_TYPE 12
  4049. DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio);
  4050. DXDEC void AILCALL AIL_save_sample_attributes(HSAMPLE S,
  4051. HSATTRIBS D);
  4052. DXDEC U32 AILCALL AIL_load_sample_attributes(HSAMPLE S,
  4053. HSATTRIBS D);
  4054. DXDEC S32 AILCALL AIL_WAV_info(void const FAR* data, AILSOUNDINFO FAR* info);
  4055. DXDEC S32 AILCALL AIL_size_processed_digital_audio(
  4056. U32 dest_rate,
  4057. U32 dest_format,
  4058. S32 num_srcs,
  4059. AILMIXINFO const FAR * src);
  4060. DXDEC S32 AILCALL AIL_process_digital_audio(
  4061. void FAR *dest_buffer,
  4062. S32 dest_buffer_size,
  4063. U32 dest_rate,
  4064. U32 dest_format,
  4065. S32 num_srcs,
  4066. AILMIXINFO FAR* src);
  4067. #define AIL_LENGTHY_INIT 0
  4068. #define AIL_LENGTHY_SET_PROPERTY 1
  4069. #define AIL_LENGTHY_UPDATE 2
  4070. #define AIL_LENGTHY_DONE 3
  4071. typedef S32 (AILCALLBACK FAR* AILLENGTHYCB)(U32 state,UINTa user);
  4072. typedef S32 (AILCALLBACK FAR* AILCODECSETPROP)(char const FAR* property,void const FAR * value);
  4073. DXDEC S32 AILCALL AIL_compress_ASI(AILSOUNDINFO const FAR * info, //)
  4074. char const FAR* filename_ext,
  4075. void FAR* FAR* outdata,
  4076. U32 FAR* outsize,
  4077. AILLENGTHYCB callback);
  4078. DXDEC S32 AILCALL AIL_decompress_ASI(void const FAR* indata, //)
  4079. U32 insize,
  4080. char const FAR* filename_ext,
  4081. void FAR* FAR* wav,
  4082. U32 FAR* wavsize,
  4083. AILLENGTHYCB callback);
  4084. DXDEC S32 AILCALL AIL_compress_ADPCM(AILSOUNDINFO const FAR * info,
  4085. void FAR* FAR* outdata, U32 FAR* outsize);
  4086. DXDEC S32 AILCALL AIL_decompress_ADPCM(AILSOUNDINFO const FAR * info,
  4087. void FAR* FAR* outdata, U32 FAR* outsize);
  4088. DXDEC S32 AILCALL AIL_compress_DLS(void const FAR* dls,
  4089. char const FAR* compression_extension,
  4090. void FAR* FAR* mls, U32 FAR* mlssize,
  4091. AILLENGTHYCB callback);
  4092. DXDEC S32 AILCALL AIL_merge_DLS_with_XMI(void const FAR* xmi, void const FAR* dls,
  4093. void FAR* FAR* mss, U32 FAR* msssize);
  4094. DXDEC S32 AILCALL AIL_extract_DLS( void const FAR *source_image, //)
  4095. U32 source_size,
  4096. void FAR * FAR *XMI_output_data,
  4097. U32 FAR *XMI_output_size,
  4098. void FAR * FAR *DLS_output_data,
  4099. U32 FAR *DLS_output_size,
  4100. AILLENGTHYCB callback);
  4101. #define AILFILTERDLS_USINGLIST 1
  4102. DXDEC S32 AILCALL AIL_filter_DLS_with_XMI(void const FAR* xmi, void const FAR* dls,
  4103. void FAR* FAR* dlsout, U32 FAR* dlssize,
  4104. S32 flags, AILLENGTHYCB callback);
  4105. #define AILMIDITOXMI_USINGLIST 1
  4106. #define AILMIDITOXMI_TOLERANT 2
  4107. DXDEC S32 AILCALL AIL_MIDI_to_XMI (void const FAR* MIDI,
  4108. U32 MIDI_size,
  4109. void FAR* FAR*XMIDI,
  4110. U32 FAR* XMIDI_size,
  4111. S32 flags);
  4112. #define AILDLSLIST_ARTICULATION 1
  4113. #define AILDLSLIST_DUMP_WAVS 2
  4114. #if defined(IS_WIN32) || defined(IS_MAC)
  4115. DXDEC S32 AILCALL AIL_list_DLS (void const FAR* DLS,
  4116. char FAR* FAR* lst,
  4117. U32 FAR* lst_size,
  4118. S32 flags,
  4119. C8 FAR* title);
  4120. #define AILMIDILIST_ROLANDSYSEX 1
  4121. #define AILMIDILIST_ROLANDUN 2
  4122. #define AILMIDILIST_ROLANDAB 4
  4123. DXDEC S32 AILCALL AIL_list_MIDI (void const FAR* MIDI,
  4124. U32 MIDI_size,
  4125. char FAR* FAR* lst,
  4126. U32 FAR* lst_size,
  4127. S32 flags);
  4128. #endif
  4129. #define AILFILETYPE_UNKNOWN 0
  4130. #define AILFILETYPE_PCM_WAV 1
  4131. #define AILFILETYPE_ADPCM_WAV 2
  4132. #define AILFILETYPE_OTHER_WAV 3
  4133. #define AILFILETYPE_VOC 4
  4134. #define AILFILETYPE_MIDI 5
  4135. #define AILFILETYPE_XMIDI 6
  4136. #define AILFILETYPE_XMIDI_DLS 7
  4137. #define AILFILETYPE_XMIDI_MLS 8
  4138. #define AILFILETYPE_DLS 9
  4139. #define AILFILETYPE_MLS 10
  4140. #define AILFILETYPE_MPEG_L1_AUDIO 11
  4141. #define AILFILETYPE_MPEG_L2_AUDIO 12
  4142. #define AILFILETYPE_MPEG_L3_AUDIO 13
  4143. #define AILFILETYPE_OTHER_ASI_WAV 14
  4144. #define AILFILETYPE_XBOX_ADPCM_WAV 15
  4145. #define AILFILETYPE_OGG_VORBIS 16
  4146. #define AILFILETYPE_V12_VOICE 17
  4147. #define AILFILETYPE_V24_VOICE 18
  4148. #define AILFILETYPE_V29_VOICE 19
  4149. #define AILFILETYPE_OGG_SPEEX 20
  4150. #define AILFILETYPE_S8_VOICE 21
  4151. #define AILFILETYPE_S16_VOICE 22
  4152. #define AILFILETYPE_S32_VOICE 23
  4153. DXDEC S32 AILCALL AIL_file_type(void const FAR* data, U32 size);
  4154. DXDEC S32 AILCALL AIL_file_type_named(void const FAR* data, char const FAR* filename, U32 size);
  4155. DXDEC S32 AILCALL AIL_find_DLS (void const FAR* data, U32 size,
  4156. void FAR* FAR* xmi, U32 FAR* xmisize,
  4157. void FAR* FAR* dls, U32 FAR* dlssize);
  4158. typedef MSS_STRUCT
  4159. {
  4160. //
  4161. // File-level data accessible to app
  4162. //
  4163. // This is valid after AIL_inspect_MP3() is called (even if the file contains no valid frames)
  4164. //
  4165. U8 FAR *MP3_file_image; // Original MP3_file_image pointer passed to AIL_inspect_MP3()
  4166. S32 MP3_image_size; // Original MP3_image_size passed to AIL_inspect_MP3()
  4167. U8 FAR *ID3v2; // ID3v2 tag, if not NULL
  4168. S32 ID3v2_size; // Size of tag in bytes
  4169. U8 FAR *ID3v1; // ID3v1 tag, if not NULL (always 128 bytes long if present)
  4170. U8 FAR *start_MP3_data; // Pointer to start of data area in file (not necessarily first valid frame)
  4171. U8 FAR *end_MP3_data; // Pointer to last valid byte in MP3 data area (before ID3v1 tag, if any)
  4172. //
  4173. // Information about current frame being inspected, valid if AIL_enumerate_MP3_frames() returns
  4174. // TRUE
  4175. //
  4176. S32 sample_rate; // Sample rate in Hz (normally constant across all frames in file)
  4177. S32 bit_rate; // Bits/second for current frame
  4178. S32 channels_per_sample; // 1 or 2
  4179. S32 samples_per_frame; // Always 576 or 1152 samples in each MP3 frame, depending on rate
  4180. S32 byte_offset; // Offset of frame from start_MP3_data (i.e., suitable for use as loop point)
  4181. S32 next_frame_expected; // Anticipated offset of next frame to be enumerated, if any
  4182. S32 average_frame_size; // Average source bytes per frame, determined solely by bit rate and sample rate
  4183. S32 data_size; // # of data-only bytes in this particular frame
  4184. S32 header_size; // 4 or 6 bytes, depending on CRC
  4185. S32 side_info_size; // Valid for layer 3 side info only
  4186. S32 ngr; // Always 2 for MPEG1, else 1
  4187. S32 main_data_begin; // Always 0 in files with no bit reservoir
  4188. S32 hpos; // Current bit position in header/side buffer
  4189. S32 MPEG1; // Data copied directly from frame header, see ISO docs for info...
  4190. S32 MPEG25;
  4191. S32 layer;
  4192. S32 protection_bit;
  4193. S32 bitrate_index;
  4194. S32 sampling_frequency;
  4195. S32 padding_bit;
  4196. S32 private_bit;
  4197. S32 mode;
  4198. S32 mode_extension;
  4199. S32 copyright;
  4200. S32 original;
  4201. S32 emphasis;
  4202. //
  4203. // LAME/Xing info tag data
  4204. //
  4205. S32 Xing_valid;
  4206. S32 Info_valid;
  4207. U32 header_flags;
  4208. S32 frame_count;
  4209. S32 byte_count;
  4210. S32 VBR_scale;
  4211. U8 TOC[100];
  4212. S32 enc_delay;
  4213. S32 enc_padding;
  4214. //
  4215. // Private (undocumented) data used during frame enumeration
  4216. //
  4217. U8 FAR *ptr;
  4218. S32 bytes_left;
  4219. S32 check_valid;
  4220. S32 check_MPEG1;
  4221. S32 check_MPEG25;
  4222. S32 check_layer;
  4223. S32 check_protection_bit;
  4224. S32 check_sampling_frequency;
  4225. S32 check_mode;
  4226. S32 check_copyright;
  4227. S32 check_original;
  4228. }
  4229. MP3_INFO;
  4230. DXDEC void AILCALL AIL_inspect_MP3 (MP3_INFO FAR *inspection_state,
  4231. U8 FAR *MP3_file_image,
  4232. S32 MP3_image_size);
  4233. DXDEC S32 AILCALL AIL_enumerate_MP3_frames (MP3_INFO FAR *inspection_state);
  4234. //
  4235. // RAD room types - currently the same as EAX
  4236. //
  4237. enum
  4238. {
  4239. ENVIRONMENT_GENERIC, // factory default
  4240. ENVIRONMENT_PADDEDCELL,
  4241. ENVIRONMENT_ROOM, // standard environments
  4242. ENVIRONMENT_BATHROOM,
  4243. ENVIRONMENT_LIVINGROOM,
  4244. ENVIRONMENT_STONEROOM,
  4245. ENVIRONMENT_AUDITORIUM,
  4246. ENVIRONMENT_CONCERTHALL,
  4247. ENVIRONMENT_CAVE,
  4248. ENVIRONMENT_ARENA,
  4249. ENVIRONMENT_HANGAR,
  4250. ENVIRONMENT_CARPETEDHALLWAY,
  4251. ENVIRONMENT_HALLWAY,
  4252. ENVIRONMENT_STONECORRIDOR,
  4253. ENVIRONMENT_ALLEY,
  4254. ENVIRONMENT_FOREST,
  4255. ENVIRONMENT_CITY,
  4256. ENVIRONMENT_MOUNTAINS,
  4257. ENVIRONMENT_QUARRY,
  4258. ENVIRONMENT_PLAIN,
  4259. ENVIRONMENT_PARKINGLOT,
  4260. ENVIRONMENT_SEWERPIPE,
  4261. ENVIRONMENT_UNDERWATER,
  4262. ENVIRONMENT_DRUGGED,
  4263. ENVIRONMENT_DIZZY,
  4264. ENVIRONMENT_PSYCHOTIC,
  4265. ENVIRONMENT_COUNT // total number of environments
  4266. };
  4267. //
  4268. // enumerated values for EAX
  4269. //
  4270. #ifndef EAX_H_INCLUDED
  4271. enum
  4272. {
  4273. EAX_ENVIRONMENT_GENERIC, // factory default
  4274. EAX_ENVIRONMENT_PADDEDCELL,
  4275. EAX_ENVIRONMENT_ROOM, // standard environments
  4276. EAX_ENVIRONMENT_BATHROOM,
  4277. EAX_ENVIRONMENT_LIVINGROOM,
  4278. EAX_ENVIRONMENT_STONEROOM,
  4279. EAX_ENVIRONMENT_AUDITORIUM,
  4280. EAX_ENVIRONMENT_CONCERTHALL,
  4281. EAX_ENVIRONMENT_CAVE,
  4282. EAX_ENVIRONMENT_ARENA,
  4283. EAX_ENVIRONMENT_HANGAR,
  4284. EAX_ENVIRONMENT_CARPETEDHALLWAY,
  4285. EAX_ENVIRONMENT_HALLWAY,
  4286. EAX_ENVIRONMENT_STONECORRIDOR,
  4287. EAX_ENVIRONMENT_ALLEY,
  4288. EAX_ENVIRONMENT_FOREST,
  4289. EAX_ENVIRONMENT_CITY,
  4290. EAX_ENVIRONMENT_MOUNTAINS,
  4291. EAX_ENVIRONMENT_QUARRY,
  4292. EAX_ENVIRONMENT_PLAIN,
  4293. EAX_ENVIRONMENT_PARKINGLOT,
  4294. EAX_ENVIRONMENT_SEWERPIPE,
  4295. EAX_ENVIRONMENT_UNDERWATER,
  4296. EAX_ENVIRONMENT_DRUGGED,
  4297. EAX_ENVIRONMENT_DIZZY,
  4298. EAX_ENVIRONMENT_PSYCHOTIC,
  4299. EAX_ENVIRONMENT_COUNT // total number of environments
  4300. };
  4301. #define EAX_REVERBMIX_USEDISTANCE (-1.0F)
  4302. #endif
  4303. #if defined(IS_WIN32API) || defined(IS_MAC) || defined(IS_LINUX) || defined(IS_DOS) || defined(IS_PS2) || defined(IS_PS3) || defined(IS_WII)
  4304. //
  4305. // Auxiliary 2D interface calls
  4306. //
  4307. DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary);
  4308. //
  4309. // 3D-related calls
  4310. //
  4311. DXDEC S32 AILCALL AIL_room_type (HDIGDRIVER dig);
  4312. DXDEC void AILCALL AIL_set_room_type (HDIGDRIVER dig,
  4313. S32 room_type);
  4314. DXDEC F32 AILCALL AIL_3D_rolloff_factor (HDIGDRIVER dig);
  4315. DXDEC void AILCALL AIL_set_3D_rolloff_factor (HDIGDRIVER dig,
  4316. F32 factor);
  4317. DXDEC F32 AILCALL AIL_3D_doppler_factor (HDIGDRIVER dig);
  4318. DXDEC void AILCALL AIL_set_3D_doppler_factor (HDIGDRIVER dig,
  4319. F32 factor);
  4320. DXDEC F32 AILCALL AIL_3D_distance_factor (HDIGDRIVER dig);
  4321. DXDEC void AILCALL AIL_set_3D_distance_factor (HDIGDRIVER dig,
  4322. F32 factor);
  4323. DXDEC void AILCALL AIL_set_sample_obstruction (HSAMPLE S,
  4324. F32 obstruction);
  4325. DXDEC void AILCALL AIL_set_sample_occlusion (HSAMPLE S,
  4326. F32 occlusion);
  4327. DXDEC void AILCALL AIL_set_sample_exclusion (HSAMPLE S,
  4328. F32 exclusion);
  4329. DXDEC F32 AILCALL AIL_sample_obstruction (HSAMPLE S);
  4330. DXDEC F32 AILCALL AIL_sample_occlusion (HSAMPLE S);
  4331. DXDEC F32 AILCALL AIL_sample_exclusion (HSAMPLE S);
  4332. DXDEC void AILCALL AIL_set_sample_3D_distances (HSAMPLE S,
  4333. F32 max_dist,
  4334. F32 min_dist,
  4335. S32 auto_3D_wet_atten);
  4336. DXDEC void AILCALL AIL_sample_3D_distances (HSAMPLE S,
  4337. F32 FAR * max_dist,
  4338. F32 FAR * min_dist,
  4339. S32 FAR * auto_3D_wet_atten);
  4340. DXDEC void AILCALL AIL_set_sample_3D_cone (HSAMPLE S,
  4341. F32 inner_angle,
  4342. F32 outer_angle,
  4343. F32 outer_volume_level);
  4344. DXDEC void AILCALL AIL_sample_3D_cone (HSAMPLE S,
  4345. F32 FAR* inner_angle,
  4346. F32 FAR* outer_angle,
  4347. F32 FAR* outer_volume_level);
  4348. DXDEC void AILCALL AIL_set_sample_3D_position (HSAMPLE obj,
  4349. F32 X,
  4350. F32 Y,
  4351. F32 Z);
  4352. DXDEC void AILCALL AIL_set_sample_3D_velocity (HSAMPLE obj,
  4353. F32 dX_per_ms,
  4354. F32 dY_per_ms,
  4355. F32 dZ_per_ms,
  4356. F32 magnitude);
  4357. DXDEC void AILCALL AIL_set_sample_3D_velocity_vector (HSAMPLE obj,
  4358. F32 dX_per_ms,
  4359. F32 dY_per_ms,
  4360. F32 dZ_per_ms);
  4361. DXDEC void AILCALL AIL_set_sample_3D_orientation (HSAMPLE obj,
  4362. F32 X_face,
  4363. F32 Y_face,
  4364. F32 Z_face,
  4365. F32 X_up,
  4366. F32 Y_up,
  4367. F32 Z_up);
  4368. DXDEC S32 AILCALL AIL_sample_3D_position (HSAMPLE obj,
  4369. F32 FAR *X,
  4370. F32 FAR *Y,
  4371. F32 FAR *Z);
  4372. DXDEC void AILCALL AIL_sample_3D_velocity (HSAMPLE obj,
  4373. F32 FAR *dX_per_ms,
  4374. F32 FAR *dY_per_ms,
  4375. F32 FAR *dZ_per_ms);
  4376. DXDEC void AILCALL AIL_sample_3D_orientation (HSAMPLE obj,
  4377. F32 FAR *X_face,
  4378. F32 FAR *Y_face,
  4379. F32 FAR *Z_face,
  4380. F32 FAR *X_up,
  4381. F32 FAR *Y_up,
  4382. F32 FAR *Z_up);
  4383. DXDEC void AILCALL AIL_update_sample_3D_position (HSAMPLE obj,
  4384. F32 dt_milliseconds);
  4385. DXDEC void AILCALL AIL_set_listener_3D_position (HDIGDRIVER dig,
  4386. F32 X,
  4387. F32 Y,
  4388. F32 Z);
  4389. DXDEC void AILCALL AIL_set_listener_3D_velocity (HDIGDRIVER dig,
  4390. F32 dX_per_ms,
  4391. F32 dY_per_ms,
  4392. F32 dZ_per_ms,
  4393. F32 magnitude);
  4394. DXDEC void AILCALL AIL_set_listener_3D_velocity_vector (HDIGDRIVER dig,
  4395. F32 dX_per_ms,
  4396. F32 dY_per_ms,
  4397. F32 dZ_per_ms);
  4398. DXDEC void AILCALL AIL_set_listener_3D_orientation (HDIGDRIVER dig,
  4399. F32 X_face,
  4400. F32 Y_face,
  4401. F32 Z_face,
  4402. F32 X_up,
  4403. F32 Y_up,
  4404. F32 Z_up);
  4405. DXDEC void AILCALL AIL_listener_3D_position (HDIGDRIVER dig,
  4406. F32 FAR *X,
  4407. F32 FAR *Y,
  4408. F32 FAR *Z);
  4409. DXDEC void AILCALL AIL_listener_3D_velocity (HDIGDRIVER dig,
  4410. F32 FAR *dX_per_ms,
  4411. F32 FAR *dY_per_ms,
  4412. F32 FAR *dZ_per_ms);
  4413. DXDEC void AILCALL AIL_listener_3D_orientation (HDIGDRIVER dig,
  4414. F32 FAR *X_face,
  4415. F32 FAR *Y_face,
  4416. F32 FAR *Z_face,
  4417. F32 FAR *X_up,
  4418. F32 FAR *Y_up,
  4419. F32 FAR *Z_up);
  4420. DXDEC void AILCALL AIL_update_listener_3D_position (HDIGDRIVER dig,
  4421. F32 dt_milliseconds);
  4422. #endif
  4423. #ifdef MSS_FLT_SUPPORTED
  4424. //
  4425. // Filter result codes
  4426. //
  4427. typedef SINTa FLTRESULT;
  4428. #define FLT_NOERR 0 // Success -- no error
  4429. #define FLT_NOT_ENABLED 1 // FLT not enabled
  4430. #define FLT_ALREADY_STARTED 2 // FLT already started
  4431. #define FLT_INVALID_PARAM 3 // Invalid parameters used
  4432. #define FLT_INTERNAL_ERR 4 // Internal error in FLT driver
  4433. #define FLT_OUT_OF_MEM 5 // Out of system RAM
  4434. #define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
  4435. #define FLT_NOT_FOUND 7 // FLT supported device not found
  4436. #define FLT_NOT_INIT 8 // FLT not initialized
  4437. #define FLT_CLOSE_ERR 9 // FLT not closed correctly
  4438. //############################################################################
  4439. //## ##
  4440. //## Interface "MSS pipeline filter" (some functions shared by ##
  4441. //## "MSS voice filter") ##
  4442. //## ##
  4443. //############################################################################
  4444. typedef FLTRESULT (AILCALL FAR *FLT_STARTUP)(void);
  4445. typedef FLTRESULT (AILCALL FAR *FLT_SHUTDOWN)(void);
  4446. typedef C8 FAR * (AILCALL FAR *FLT_ERROR)(void);
  4447. typedef HDRIVERSTATE (AILCALL FAR *FLT_OPEN_DRIVER) (HDIGDRIVER dig);
  4448. typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state);
  4449. typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver);
  4450. typedef S32 (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver, void FAR *output_buffer);
  4451. //############################################################################
  4452. //## ##
  4453. //## Interface "Pipeline filter sample services" ##
  4454. //## ##
  4455. //############################################################################
  4456. typedef HSAMPLESTATE (AILCALL FAR * FLTSMP_OPEN_SAMPLE) (HDRIVERSTATE driver,
  4457. HSAMPLE S);
  4458. typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state);
  4459. typedef void (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state,
  4460. void FAR * source_buffer,
  4461. void FAR * dest_buffer, // may be the same as src
  4462. S32 n_samples,
  4463. S32 playback_rate,
  4464. S32 is_stereo );
  4465. typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROPERTY) (HSAMPLESTATE state,
  4466. HPROPERTY property,
  4467. void FAR* before_value,
  4468. void const FAR* new_value,
  4469. void FAR* after_value
  4470. );
  4471. //############################################################################
  4472. //## ##
  4473. //## Interface "MSS output filter" ##
  4474. //## ##
  4475. //############################################################################
  4476. typedef S32 (AILCALL FAR * VFLT_ASSIGN_SAMPLE_VOICE) (HDRIVERSTATE driver,
  4477. HSAMPLE S);
  4478. typedef void (AILCALL FAR * VFLT_RELEASE_SAMPLE_VOICE) (HDRIVERSTATE driver,
  4479. HSAMPLE S);
  4480. typedef S32 (AILCALL FAR * VFLT_START_SAMPLE_VOICE) (HDRIVERSTATE driver,
  4481. HSAMPLE S);
  4482. //############################################################################
  4483. //## ##
  4484. //## Interface "Voice filter driver services" ##
  4485. //## ##
  4486. //############################################################################
  4487. typedef S32 (AILCALL FAR * VDRV_DRIVER_PROPERTY) (HDRIVERSTATE driver,
  4488. HPROPERTY property,
  4489. void FAR* before_value,
  4490. void const FAR* new_value,
  4491. void FAR* after_value
  4492. );
  4493. typedef S32 (AILCALL FAR * VDRV_FORCE_UPDATE) (HDRIVERSTATE driver);
  4494. //############################################################################
  4495. //## ##
  4496. //## Interface "Voice filter sample services" ##
  4497. //## ##
  4498. //############################################################################
  4499. typedef S32 (AILCALL FAR * VSMP_SAMPLE_PROPERTY) (HSAMPLE S,
  4500. HPROPERTY property,
  4501. void FAR* before_value,
  4502. void const FAR* new_value,
  4503. void FAR* after_value
  4504. );
  4505. //
  4506. // Pipeline filter calls
  4507. //
  4508. DXDEC HPROVIDER AILCALL AIL_digital_output_filter (HDIGDRIVER dig);
  4509. DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next,
  4510. HPROVIDER FAR *dest,
  4511. C8 FAR * FAR *name);
  4512. DXDEC HDRIVERSTATE
  4513. AILCALL AIL_open_filter (HPROVIDER lib,
  4514. HDIGDRIVER dig);
  4515. DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter);
  4516. DXDEC S32 AILCALL AIL_find_filter (C8 const *name,
  4517. HPROVIDER *ret);
  4518. DXDEC S32 AILCALL AIL_enumerate_filter_properties
  4519. (HPROVIDER lib,
  4520. HINTENUM FAR * next,
  4521. RIB_INTERFACE_ENTRY FAR * dest);
  4522. DXDEC S32 AILCALL AIL_filter_property (HPROVIDER lib,
  4523. C8 const FAR* name,
  4524. void FAR* before_value,
  4525. void const FAR* new_value,
  4526. void FAR* after_value
  4527. );
  4528. DXDEC S32 AILCALL AIL_enumerate_output_filter_driver_properties
  4529. (HPROVIDER lib,
  4530. HINTENUM FAR * next,
  4531. RIB_INTERFACE_ENTRY FAR * dest);
  4532. DXDEC S32 AILCALL AIL_output_filter_driver_property
  4533. (HDIGDRIVER dig,
  4534. C8 const FAR * name,
  4535. void FAR* before_value,
  4536. void const FAR* new_value,
  4537. void FAR* after_value
  4538. );
  4539. DXDEC S32 AILCALL AIL_enumerate_output_filter_sample_properties
  4540. (HPROVIDER lib,
  4541. HINTENUM FAR * next,
  4542. RIB_INTERFACE_ENTRY FAR * dest);
  4543. DXDEC S32 AILCALL AIL_enumerate_filter_sample_properties
  4544. (HPROVIDER lib,
  4545. HINTENUM FAR * next,
  4546. RIB_INTERFACE_ENTRY FAR * dest);
  4547. DXDEC S32 AILCALL AIL_enumerate_sample_stage_properties
  4548. (HSAMPLE S,
  4549. SAMPLESTAGE stage,
  4550. HINTENUM FAR * next,
  4551. RIB_INTERFACE_ENTRY FAR * dest);
  4552. DXDEC S32 AILCALL AIL_sample_stage_property
  4553. (HSAMPLE S,
  4554. SAMPLESTAGE stage,
  4555. C8 const FAR * name,
  4556. void FAR* before_value,
  4557. void const FAR* new_value,
  4558. void FAR* after_value
  4559. );
  4560. #define AIL_filter_sample_property(S,name,beforev,newv,afterv) AIL_sample_stage_property((S),SP_FILTER_0,(name),(beforev),(newv),(afterv))
  4561. typedef MSS_STRUCT _FLTPROVIDER
  4562. {
  4563. PROVIDER_PROPERTY PROVIDER_property;
  4564. FLT_STARTUP startup;
  4565. FLT_ERROR error;
  4566. FLT_SHUTDOWN shutdown;
  4567. FLT_OPEN_DRIVER open_driver;
  4568. FLT_CLOSE_DRIVER close_driver;
  4569. FLT_PREMIX_PROCESS premix_process;
  4570. FLT_POSTMIX_PROCESS postmix_process;
  4571. FLTSMP_OPEN_SAMPLE open_sample;
  4572. FLTSMP_CLOSE_SAMPLE close_sample;
  4573. FLTSMP_SAMPLE_PROCESS sample_process;
  4574. FLTSMP_SAMPLE_PROPERTY sample_property;
  4575. VFLT_ASSIGN_SAMPLE_VOICE assign_sample_voice;
  4576. VFLT_RELEASE_SAMPLE_VOICE release_sample_voice;
  4577. VFLT_START_SAMPLE_VOICE start_sample_voice;
  4578. VDRV_DRIVER_PROPERTY driver_property;
  4579. VDRV_FORCE_UPDATE force_update;
  4580. VSMP_SAMPLE_PROPERTY output_sample_property;
  4581. HDIGDRIVER dig;
  4582. HPROVIDER provider;
  4583. HDRIVERSTATE driver_state;
  4584. S32 provider_flags;
  4585. struct _FLTPROVIDER FAR *next;
  4586. }
  4587. FLTPROVIDER;
  4588. //
  4589. // Values for "Flags" property exported by all MSS Pipeline Filter and MSS Output Filter
  4590. // providers
  4591. //
  4592. #define FPROV_ON_SAMPLES 0x0001 // Pipeline filter that operates on input samples (and is enumerated by AIL_enumerate_filters)
  4593. #define FPROV_ON_POSTMIX 0x0002 // Pipeline filter that operates on the post mixed output (capture filter)
  4594. #define FPROV_MATRIX 0x0004 // This is a matrix output filter (e.g., SRS/Dolby)
  4595. #define FPROV_VOICE 0x0008 // This is a per-voice output filter (e.g., DirectSound 3D)
  4596. #define FPROV_3D 0x0010 // Output filter uses S3D substructure for positioning
  4597. #define FPROV_OCCLUSION 0x0020 // Output filter supports occlusion (doesn't need per-sample lowpass)
  4598. #define FPROV_EAX 0x0040 // Output filter supports EAX-compatible environmental reverb
  4599. #ifdef IS_WIN32
  4600. #define MSS_EAX_AUTO_GAIN 1
  4601. #define MSS_EAX_AUTOWAH 2
  4602. #define MSS_EAX_CHORUS 3
  4603. #define MSS_EAX_DISTORTION 4
  4604. #define MSS_EAX_ECHO 5
  4605. #define MSS_EAX_EQUALIZER 6
  4606. #define MSS_EAX_FLANGER 7
  4607. #define MSS_EAX_FSHIFTER 8
  4608. #define MSS_EAX_VMORPHER 9
  4609. #define MSS_EAX_PSHIFTER 10
  4610. #define MSS_EAX_RMODULATOR 11
  4611. #define MSS_EAX_REVERB 12
  4612. typedef MSS_STRUCT EAX_SAMPLE_SLOT_VOLUME
  4613. {
  4614. S32 Slot; // 0, 1, 2, 3
  4615. S32 Send;
  4616. S32 SendHF;
  4617. S32 Occlusion;
  4618. F32 OcclusionLFRatio;
  4619. F32 OcclusionRoomRatio;
  4620. F32 OcclusionDirectRatio;
  4621. } EAX_SAMPLE_SLOT_VOLUME;
  4622. typedef MSS_STRUCT EAX_SAMPLE_SLOT_VOLUMES
  4623. {
  4624. U32 NumVolumes; // 0, 1, or 2
  4625. EAX_SAMPLE_SLOT_VOLUME volumes[ 2 ];
  4626. } EAX_SAMPLE_SLOT_VOLUMES;
  4627. // Use this structure for EAX REVERB
  4628. typedef MSS_STRUCT EAX_REVERB
  4629. {
  4630. S32 Effect; // set to MSS_EAX_REVERB
  4631. S32 Volume; // -10000 to 0
  4632. U32 Environment; // one of the ENVIRONMENT_ enums
  4633. F32 EnvironmentSize; // environment size in meters
  4634. F32 EnvironmentDiffusion; // environment diffusion
  4635. S32 Room; // room effect level (at mid frequencies)
  4636. S32 RoomHF; // relative room effect level at high frequencies
  4637. S32 RoomLF; // relative room effect level at low frequencies
  4638. F32 DecayTime; // reverberation decay time at mid frequencies
  4639. F32 DecayHFRatio; // high-frequency to mid-frequency decay time ratio
  4640. F32 DecayLFRatio; // low-frequency to mid-frequency decay time ratio
  4641. S32 Reflections; // early reflections level relative to room effect
  4642. F32 ReflectionsDelay; // initial reflection delay time
  4643. F32 ReflectionsPanX; // early reflections panning vector
  4644. F32 ReflectionsPanY; // early reflections panning vector
  4645. F32 ReflectionsPanZ; // early reflections panning vector
  4646. S32 Reverb; // late reverberation level relative to room effect
  4647. F32 ReverbDelay; // late reverberation delay time relative to initial reflection
  4648. F32 ReverbPanX; // late reverberation panning vector
  4649. F32 ReverbPanY; // late reverberation panning vector
  4650. F32 ReverbPanZ; // late reverberation panning vector
  4651. F32 EchoTime; // echo time
  4652. F32 EchoDepth; // echo depth
  4653. F32 ModulationTime; // modulation time
  4654. F32 ModulationDepth; // modulation depth
  4655. F32 AirAbsorptionHF; // change in level per meter at high frequencies
  4656. F32 HFReference; // reference high frequency
  4657. F32 LFReference; // reference low frequency
  4658. F32 RoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
  4659. U32 Flags; // modifies the behavior of properties
  4660. } EAX_REVERB;
  4661. // Use this structure for EAX AUTOGAIN
  4662. typedef MSS_STRUCT EAX_AUTOGAIN
  4663. {
  4664. S32 Effect; // set to MSS_EAX_AUTO_GAIN
  4665. S32 Volume; // -10000 to 0
  4666. U32 OnOff; // Switch Compressor on or off (1 or 0)
  4667. } EAX_AUTOGAIN;
  4668. // Use this structure for EAX AUTOWAH
  4669. typedef MSS_STRUCT EAX_AUTOWAH
  4670. {
  4671. S32 Effect; // set to MSS_EAX_AUTOWAH
  4672. S32 Volume; // -10000 to 0
  4673. F32 AttackTime; // Attack time (seconds)
  4674. F32 ReleaseTime; // Release time (seconds)
  4675. S32 Resonance; // Resonance (mB)
  4676. S32 PeakLevel; // Peak level (mB)
  4677. } EAX_AUTOWAH;
  4678. // Use this structure for EAX CHORUS
  4679. typedef MSS_STRUCT EAX_CHORUS
  4680. {
  4681. S32 Effect; // set to MSS_EAX_CHORUS
  4682. S32 Volume; // -10000 to 0
  4683. U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle
  4684. S32 Phase; // Phase (Degrees)
  4685. F32 Rate; // Rate (Hz)
  4686. F32 Depth; // Depth (0 to 1)
  4687. F32 Feedback; // Feedback (-1 to 1)
  4688. F32 Delay; // Delay (seconds)
  4689. } EAX_CHORUS;
  4690. // Use this structure for EAX DISTORTION
  4691. typedef MSS_STRUCT EAX_DISTORTION
  4692. {
  4693. S32 Effect; // set to MSS_EAX_DISTORTION
  4694. S32 Volume; // -10000 to 0
  4695. F32 Edge; // Controls the shape of the distortion (0 to 1)
  4696. S32 Gain; // Controls the post distortion gain (mB)
  4697. F32 LowPassCutOff; // Controls the cut-off of the filter pre-distortion (Hz)
  4698. F32 EQCenter; // Controls the center frequency of the EQ post-distortion (Hz)
  4699. F32 EQBandwidth; // Controls the bandwidth of the EQ post-distortion (Hz)
  4700. } EAX_DISTORTION;
  4701. // Use this structure for EAX ECHO
  4702. typedef MSS_STRUCT EAX_ECHO
  4703. {
  4704. S32 Effect; // set to MSS_EAX_ECHO
  4705. S32 Volume; // -10000 to 0
  4706. F32 Delay; // Controls the initial delay time (seconds)
  4707. F32 LRDelay; // Controls the delay time between the first and second taps (seconds)
  4708. F32 Damping; // Controls a low-pass filter that dampens the echoes (0 to 1)
  4709. F32 Feedback; // Controls the duration of echo repetition (0 to 1)
  4710. F32 Spread; // Controls the left-right spread of the echoes
  4711. } EAX_ECHO;
  4712. // Use this structure for EAXEQUALIZER_ALLPARAMETERS
  4713. typedef MSS_STRUCT EAX_EQUALIZER
  4714. {
  4715. S32 Effect; // set to MSS_EAX_EQUALIZER
  4716. S32 Volume; // -10000 to 0
  4717. S32 LowGain; // (mB)
  4718. F32 LowCutOff; // (Hz)
  4719. S32 Mid1Gain; // (mB)
  4720. F32 Mid1Center; // (Hz)
  4721. F32 Mid1Width; // (octaves)
  4722. F32 Mid2Gain; // (mB)
  4723. F32 Mid2Center; // (Hz)
  4724. F32 Mid2Width; // (octaves)
  4725. S32 HighGain; // (mB)
  4726. F32 HighCutOff; // (Hz)
  4727. } EAX_EQUALIZER;
  4728. // Use this structure for EAX FLANGER
  4729. typedef MSS_STRUCT EAX_FLANGER
  4730. {
  4731. S32 Effect; // set to MSS_EAX_FLANGER
  4732. S32 Volume; // -10000 to 0
  4733. U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle
  4734. S32 Phase; // Phase (Degrees)
  4735. F32 Rate; // Rate (Hz)
  4736. F32 Depth; // Depth (0 to 1)
  4737. F32 Feedback; // Feedback (0 to 1)
  4738. F32 Delay; // Delay (seconds)
  4739. } EAX_FLANGER;
  4740. // Use this structure for EAX FREQUENCY SHIFTER
  4741. typedef MSS_STRUCT EAX_FSHIFTER
  4742. {
  4743. S32 Effect; // set to MSS_EAX_FSHIFTER
  4744. S32 Volume; // -10000 to 0
  4745. F32 Frequency; // (Hz)
  4746. U32 LeftDirection; // direction - 0 = down, 1 = up, 2 = off
  4747. U32 RightDirection; // direction - 0 = down, 1 = up, 2 = off
  4748. } EAX_FSHIFTER;
  4749. // Use this structure for EAX VOCAL MORPHER
  4750. typedef MSS_STRUCT EAX_VMORPHER
  4751. {
  4752. S32 Effect; // set to MSS_EAX_VMORPHER
  4753. S32 Volume; // -10000 to 0
  4754. U32 PhonemeA; // phoneme: 0 to 29 - A E I O U AA AE AH AO EH ER IH IY UH UW B D G J K L M N P R S T V Z
  4755. S32 PhonemeACoarseTuning; // (semitones)
  4756. U32 PhonemeB; // phoneme: 0 to 29 - A E I O U AA AE AH AO EH ER IH IY UH UW B D G J K L M N P R S T V Z
  4757. S32 PhonemeBCoarseTuning; // (semitones)
  4758. U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle, 2 = sawtooth
  4759. F32 Rate; // (Hz)
  4760. } EAX_VMORPHER;
  4761. // Use this structure for EAX PITCH SHIFTER
  4762. typedef MSS_STRUCT EAX_PSHIFTER
  4763. {
  4764. S32 Effect; // set to MSS_EAX_PSHIFTER
  4765. S32 Volume; // -10000 to 0
  4766. S32 CoarseTune; // Amount of pitch shift (semitones)
  4767. S32 FineTune; // Amount of pitch shift (cents)
  4768. } EAX_PSHIFTER;
  4769. // Use this structure for EAX RING MODULATOR
  4770. typedef MSS_STRUCT EAX_RMODULATOR
  4771. {
  4772. S32 Effect; // set to MSS_EAX_RMODULATOR
  4773. S32 Volume; // -10000 to 0
  4774. F32 Frequency; // Frequency of modulation (Hz)
  4775. F32 HighPassCutOff; // Cut-off frequency of high-pass filter (Hz)
  4776. U32 Waveform; // Waveform selector - 0 = sinusoid, 1 = triangle, 2 = sawtooth
  4777. } EAX_RMODULATOR;
  4778. #endif
  4779. #else
  4780. typedef MSS_STRUCT _FLTPROVIDER
  4781. {
  4782. U32 junk;
  4783. } FLTPROVIDER;
  4784. #endif
  4785. #ifndef IS_PS2
  4786. #if defined(_PUSHPOP_SUPPORTED) || PRAGMA_STRUCT_PACKPUSH
  4787. #pragma pack(pop)
  4788. #else
  4789. #pragma pack()
  4790. #endif
  4791. #else
  4792. // round up to multiples of 16 for DMA alignment
  4793. #define SPR_IS_NEEDED (((2 * 578 * sizeof(S16)) + 15) & ~15) // 2320
  4794. #define SPR_XR_NEEDED (((2 * 32 * 18 * sizeof(F32)) + 15) & ~15) // 4608
  4795. #define SPR_LR_NEEDED (((2 * 32 * 18 * sizeof(F32)) + 15) & ~15) // 4608
  4796. #define SPR_RES_NEEDED (((32 * 18 * sizeof(F32)) + 15) & ~15) // 2304
  4797. #define SPR_S_NEEDED (((2 * 32 * 18 * sizeof(F32)) + 15) & ~15) // 4608
  4798. #define SPR_U_NEEDED (((2 * 2 * 17 * 16 * sizeof(F32)) + 15) & ~15) // 4352
  4799. #define SPR_MEM (0x70000000)
  4800. #define SPR_U_START (SPR_MEM)
  4801. #define SPR_S_START (SPR_U_START + SPR_U_NEEDED)
  4802. #define SPR_RES_START (SPR_S_START + SPR_S_NEEDED)
  4803. #define SPR_LR_START (SPR_RES_START + SPR_RES_NEEDED)
  4804. #define SPR_IS_START (SPR_RES_START + SPR_RES_NEEDED) // Shared with LR space (LR is larger)
  4805. #define END_SPR_MEM (SPR_LR_START + SPR_LR_NEEDED)
  4806. #define SPR_BYTES_USED (END_SPR_MEM - SPR_MEM)
  4807. typedef enum
  4808. {
  4809. MSS_DO_NOT_USE,
  4810. MSS_USE_AND_SAVE,
  4811. MSS_USE_WITHOUT_SAVING,
  4812. MSS_USED = 100, // Internal use only
  4813. }
  4814. MSS_RESOURCE_POLICY;
  4815. DXDEC MSS_RESOURCE_POLICY AILCALL AIL_set_scratchpad_policy(MSS_RESOURCE_POLICY policy);
  4816. DXDEC MSS_RESOURCE_POLICY AILCALL AIL_scratchpad_policy (void);
  4817. #endif
  4818. #ifndef __RADINDLL__
  4819. #ifdef FSSpec
  4820. #undef FSSpec
  4821. #endif
  4822. #endif
  4823. #ifdef __cplusplus
  4824. }
  4825. #endif
  4826. #endif