SOS.H 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /****************************************************************************
  15. File : sos.h
  16. Programmer(s) : Don Fowler, Nick Skrepetos
  17. Date :
  18. Purpose : Include Files For Zortech C++ Compiler
  19. Last Updated :
  20. ****************************************************************************
  21. Copyright(c) 1993,1994 Human Machine Interfaces
  22. All Rights Reserved
  23. ****************************************************************************/
  24. #ifndef _SOS_DEFINED
  25. #define _SOS_DEFINED
  26. #include "sosdefs.h"
  27. #pragma pack(4)
  28. // error definition for sound operating system
  29. #define _SOS_ERR -1
  30. // number of drivers allowed to be open at one time
  31. #define _SOS_MAX_DRIVERS 5
  32. // structure definition for the capabilities
  33. typedef struct _tagCAPABILITIES
  34. {
  35. BYTE szDeviceName[ 32 ]; // device name
  36. WORD wDeviceVersion; // device version
  37. WORD wBitsPerSample; // bits per sound sample
  38. WORD wChannels; // stereo/mono sound card
  39. WORD wMinRate; // minimum rate
  40. WORD wMaxRate; // maximum rate
  41. WORD wMixerOnBoard; // board contains mixer
  42. WORD wMixerFlags; // mixer capabilities
  43. WORD wFlags; // miscellaneous flags
  44. short far * lpPortList; // list of usable ports
  45. short far * lpDMAList; // list of usable dma channels
  46. short far * lpIRQList; // list of usable irq channels
  47. short far * lpRateList; // list of usable rates, -1 if any in min to max
  48. WORD fBackground; // foreground or background driver
  49. WORD wDeviceID; // ID for the device
  50. WORD wTimerID; // ID for the timer
  51. } _SOS_CAPABILITIES;
  52. // far pointer to the device capabilities structure
  53. typedef _SOS_CAPABILITIES far * LPSOSDEVICECAPS;
  54. // flag types for driver
  55. #define _FLAGS_SIGNED 0x8000
  56. // devices that can be loaded
  57. #define _SOUND_BLASTER_8_MONO 0xe000
  58. #define _SOUND_BLASTER_8_ST 0xe001
  59. #define _SBPRO_8_ST _SOUND_BLASTER_8_ST
  60. #define _SBPRO_8_MONO 0xe00f
  61. #define _SOUND_MASTER_II_8_MONO 0xe002
  62. #define _MV_PAS_8_MONO 0xe003
  63. #define _MV_PAS_16_MONO 0xe004
  64. #define _MV_PAS_8_ST 0xe005
  65. #define _MV_PAS_16_ST 0xe006
  66. #define _ADLIB_GOLD_8_ST 0xe007
  67. #define _ADLIB_GOLD_16_ST 0xe008
  68. #define _ADLIB_GOLD_8_MONO 0xe009
  69. #define _ADLIB_GOLD_16_MONO 0xe00a
  70. #define _MICROSOFT_8_MONO 0xe00b
  71. #define _MICROSOFT_8_ST 0xe00c
  72. #define _MICROSOFT_16_MONO 0xe00d
  73. #define _MICROSOFT_16_ST 0xe00e
  74. #define _SOUND_SOURCE_8_MONO_PC 0xe010
  75. #define _SOUND_SOURCE_8_MONO_TANDY 0xe011
  76. #define _GENERAL_PORT_8_MONO 0xe012
  77. #define _GENERAL_PORT_8_MONO_R 0xe013
  78. #define _SIERRA_8_MONO 0xe014
  79. #define _SB16_8_MONO 0xe015
  80. #define _SB16_8_ST 0xe016
  81. #define _SB16_16_MONO 0xe017
  82. #define _SB16_16_ST 0xe018
  83. #define _ESS_AUDIODRIVE_8_MONO 0xe019
  84. #define _ESS_AUDIODRIVE_8_ST 0xe01a
  85. #define _ESS_AUDIODRIVE_16_MONO 0xe01b
  86. #define _ESS_AUDIODRIVE_16_ST 0xe01c
  87. #define _SOUNDSCAPE_8_MONO 0xe01d
  88. #define _SOUNDSCAPE_8_ST 0xe01e
  89. #define _SOUNDSCAPE_16_MONO 0xe01f
  90. #define _SOUNDSCAPE_16_ST 0xe020
  91. #define _RAP10_8_MONO 0xe021
  92. #define _RAP10_16_MONO 0xe022
  93. #define _GUS_8_MONO 0xe023
  94. #define _GUS_8_ST 0xe024
  95. #define _GUS_16_MONO 0xe025
  96. #define _GUS_16_ST 0xe026
  97. #define _GUS_MAX_8_MONO 0xe027
  98. #define _GUS_MAX_8_ST 0xe028
  99. #define _GUS_MAX_16_MONO 0xe029
  100. #define _GUS_MAX_16_ST 0xe02a
  101. #define _WAVEJAMMER_8_MONO 0xe02b
  102. #define _WAVEJAMMER_8_ST 0xe02c
  103. #define _WAVEJAMMER_16_MONO 0xe02d
  104. #define _WAVEJAMMER_16_ST 0xe02e
  105. #define _TEMPOCS_8_MONO 0xe02f
  106. #define _TEMPOCS_8_ST 0xe030
  107. #define _TEMPOCS_16_MONO 0xe031
  108. #define _TEMPOCS_16_ST 0xe032
  109. #define _WAVEJAMMERCD_8_MONO 0xe033
  110. #define _WAVEJAMMERCD_8_ST 0xe034
  111. #define _WAVEJAMMERCD_16_MONO 0xe035
  112. #define _WAVEJAMMERCD_16_ST 0xe036
  113. #define _SOUND_BLASTER_8_MONO_R 0xe050
  114. #define _MICROSOFT_8_MONO_R 0xe051
  115. #define _SOUND_MASTER_II_8_MONO_R 0xe052
  116. #define _ADLIB_GOLD_8_MONO_R 0xe053
  117. #define _MV_PAS_8_MONO_R 0xe054
  118. #define _RAP10_8_MONO_R 0xe058
  119. #define _RAP10_16_MONO_R 0xe059
  120. #define _SB16_8_MONO_R 0xe05a
  121. #define _SB16_8_ST_R 0xe05b
  122. #define _SB16_16_MONO_R 0xe05c
  123. #define _SB16_16_ST_R 0xe05d
  124. #define _MV_PAS_16_MONO_R 0xe060
  125. #define _SOUNDSCAPE_8_MONO_R 0xe061
  126. #define _SOUNDSCAPE_8_ST_R 0xe062
  127. #define _SOUNDSCAPE_16_MONO_R 0xe063
  128. #define _SOUNDSCAPE_16_ST_R 0xe064
  129. #define _ESS_AUDIODRIVE_8_MONO_R 0xe065
  130. #define _ESS_AUDIODRIVE_8_ST_R 0xe066
  131. #define _ESS_AUDIODRIVE_16_MONO_R 0xe067
  132. #define _ESS_AUDIODRIVE_16_ST_R 0xe068
  133. #define _SPEECH_THING_8_MONO 0xe090
  134. #define _YAMAHA_8_MONO 0xe106
  135. #define _INT_SPEAKER_8_MONO 0xe107
  136. // call indexes for the loadable drivers
  137. enum
  138. {
  139. _DRV_INIT,
  140. _DRV_UNINIT,
  141. _DRV_SETRATE,
  142. _DRV_SETACTION,
  143. _DRV_START,
  144. _DRV_STOP,
  145. _DRV_PAUSE,
  146. _DRV_RESUME,
  147. _DRV_CAPABILITIES,
  148. _DRV_PLAY_FOREGROUND,
  149. _DRV_GET_FILL_INFO,
  150. _DRV_GET_CALL_FUNCTIONS,
  151. _DRV_SET_CALL_FUNCTIONS
  152. };
  153. // fill info
  154. typedef struct _tagFillInfo
  155. {
  156. LPSTR lpFillHandler; // pointer to fill handler
  157. LPWORD lpDMAFillCount; // pointer to dma count
  158. LPSTR lpSampleList; // pointer to sample list
  159. LPWORD lpDMAMasterVolume; // pointer to dma count
  160. } _SOS_FILL_INFO;
  161. // caps info structure
  162. typedef struct _tagCapsInfo
  163. {
  164. LPSTR lpPortList; // pointer to port list
  165. LPSTR lpDMAList; // pointer to DMA list
  166. LPSTR lpIRQList; // pointer to IRQ list
  167. LPSTR lpRateList; // pointer to rate list
  168. } _SOS_CAPS_INFO;
  169. // maximum number of available voice
  170. #define _MAX_VOICES 32
  171. // structure definition
  172. typedef struct _tagSAMPLE
  173. {
  174. LPSTR samplePtr; // pointer to data buffer
  175. LPSTR sampleData; // pointer to active data
  176. LPSTR sampleLoopPtr; // pointer for loop back
  177. WORD sampleLength; // length of sample
  178. WORD sampleIndex; // index into sample
  179. WORD sampleLoopLength; // length of loop
  180. WORD sampleBytesLeft; // bytes left to play in sample
  181. WORD sampleLoopPoint; // byte count for loop point
  182. WORD sampleLoopEndLength; // length of remaining chunk
  183. short sampleFlags; // control sample
  184. short sampleVolume; // volume control
  185. short sampleID; // sample ID
  186. short sampleChannel; // channel to play sample on
  187. short sampleLoopCount; // loop count
  188. short sampleLastFill; // last fill position
  189. VOID ( far __cdecl * sampleCallback )( WORD, WORD, WORD ); // callback function for sample
  190. WORD samplePitchAdd;
  191. short samplePitchFraction;
  192. short samplePort; // port to use for non-dma digitized
  193. WORD sampleTotalBytes;
  194. WORD sampleByteLength;
  195. short samplePanLocation;
  196. short samplePanSpeed;
  197. short samplePanDirection;
  198. short samplePanStart;
  199. short samplePanEnd;
  200. short sampleDelayBytes;
  201. short sampleDelayRepeat;
  202. WORD sampleADPCMPredicted;
  203. short sampleADPCMIndex;
  204. short sampleRootNoteMIDI;
  205. WORD sampleTemp1;
  206. } _SOS_SAMPLE;
  207. // enumeration for left or right channel
  208. enum
  209. {
  210. _LEFT_CHANNEL,
  211. _RIGHT_CHANNEL,
  212. _CENTER_CHANNEL,
  213. _INTERLEAVED
  214. };
  215. // enumeration for foreground and background
  216. enum
  217. {
  218. _FOREGROUND,
  219. _BACKGROUND
  220. };
  221. // defines for the sample flags
  222. #define _ACTIVE 0x8000
  223. #define _LOOPING 0x4000
  224. #define _FIRST_TIME 0x2000
  225. #define _PENDING_RELEASE 0x1000
  226. #define _CONTINUE_BLOCK 0x0800
  227. #define _PITCH_SHIFT 0x0400
  228. #define _PANNING 0x0200
  229. #define _VOLUME 0x0100
  230. #define _TRANSLATE16TO8 0x0080
  231. #define _STAGE_LOOP 0x0040
  232. #define _TRANSLATE8TO16 0x0020
  233. #define _STEREOTOMONO 0x0010
  234. // defines for the wParam flags
  235. #define _SINGLE_SAMPLE 0x01
  236. #define _SOS_DCAPS_AUTO_REINIT 0x01
  237. #define _SOS_DCAPS_MPU_401 0x02
  238. #define _SOS_DCAPS_OPL2 0x04
  239. #define _SOS_DCAPS_OPL3 0x08
  240. #define _SOS_DCAPS_OPL4 0x10
  241. #define _SOS_DCAPS_WAVETABLE 0x20
  242. #define _SOS_DCAPS_DL_SAMPLES 0x40
  243. #define _SOS_DCAPS_FIFO_DEVICE 0x80
  244. #define _SOS_DCAPS_ENV_NEEDED 0x100
  245. #define _SOS_DCAPS_PSEUDO_DMA1 0x200
  246. #define _SOS_DCAPS_SIGNED_DATA 0x8000
  247. // file header structure
  248. typedef struct
  249. {
  250. // name ID
  251. BYTE szName[ 32 ];
  252. // number of drivers in the file
  253. WORD wDrivers;
  254. // offset of first driver
  255. WORD lOffset;
  256. // size of the file
  257. WORD lFileSize;
  258. } _FILEHEADER;
  259. // driver header structure
  260. typedef struct
  261. {
  262. // name ID
  263. BYTE szName[ 32 ];
  264. // offset of next driver
  265. WORD lNextDriver;
  266. // size of current driver
  267. WORD wSize;
  268. // id for the current device
  269. WORD wDeviceID;
  270. // id for the type of DOS extender
  271. WORD wExtenderType;
  272. } _DRIVERHEADER;
  273. // device hardware information
  274. typedef struct
  275. {
  276. // port to be used
  277. WORD wPort;
  278. // irq to use
  279. WORD wIRQ;
  280. // dma channel to se
  281. WORD wDMA;
  282. // extra parameter
  283. WORD wParam;
  284. } _SOS_HARDWARE;
  285. // structure definition for start sample
  286. typedef struct
  287. {
  288. // pointer to sample
  289. LPSTR lpSamplePtr;
  290. // size of the sample
  291. WORD dwSampleSize;
  292. // number of times to loop the sample -1 is infinite
  293. WORD wLoopCount;
  294. // channel to play sample on
  295. WORD wChannel;
  296. // volume to play sample at
  297. WORD wVolume;
  298. // id for the sample
  299. WORD wSampleID;
  300. // far pointer to the callback function
  301. VOID ( far __cdecl *lpCallback )( WORD, WORD, WORD );
  302. // port to use if driver is a non-dma background driver
  303. WORD wSamplePort;
  304. // flags field
  305. WORD wSampleFlags;
  306. // total length of sample including loops, etc..
  307. WORD dwSampleByteLength;
  308. // loop point for the sample
  309. WORD dwSampleLoopPoint;
  310. WORD dwSampleLoopLength;
  311. // pitch shifting components
  312. WORD dwSamplePitchAdd;
  313. WORD wSamplePitchFraction;
  314. // pan components
  315. WORD wSamplePanLocation;
  316. WORD wSamplePanSpeed;
  317. WORD wSamplePanDirection;
  318. WORD wSamplePanStart;
  319. WORD wSamplePanEnd;
  320. // delay parts
  321. WORD wSampleDelayBytes;
  322. WORD wSampleDelayRepeat;
  323. // compression components
  324. WORD dwSampleADPCMPredicted;
  325. WORD wSampleADPCMIndex;
  326. // root note for pitch shifting
  327. WORD wSampleRootNoteMIDI;
  328. // filler for future upgrades
  329. WORD dwSampleTemp1;
  330. WORD dwSampleTemp2;
  331. WORD dwSampleTemp3;
  332. } _SOS_START_SAMPLE;
  333. // structure for initializing a driver
  334. typedef struct
  335. {
  336. WORD wBufferSize;
  337. LPSTR lpBuffer;
  338. BOOL wAllocateBuffer;
  339. WORD wSampleRate;
  340. WORD wParam;
  341. LONG dwParam;
  342. VOID ( far *lpFillHandler )( VOID );
  343. LPSTR lpDriverMemory;
  344. LPSTR lpDriverMemoryCS;
  345. LPSTR lpTimerMemory;
  346. LPSTR lpTimerMemoryCS;
  347. WORD wTimerID;
  348. WORD wPhysical;
  349. } _SOS_INIT_DRIVER;
  350. // define for the timer types to use
  351. #define _SOS_NORMAL_TIMER 0x00
  352. // enumeration for the timer types
  353. enum
  354. {
  355. _TIMER_8_MONO = 0x1000,
  356. _TIMER_8_ST,
  357. _TIMER_16_MONO,
  358. _TIMER_16_ST,
  359. _TIMER_8_MONO_ULAW,
  360. _TIMER_8_ST_ULAW,
  361. _TIMER_16_MONO_ULAW,
  362. _TIMER_16_ST_ULAW,
  363. _TIMER_8_MONO_REC,
  364. _TIMER_8_MONO_ULAW_REC,
  365. _TIMER_UNDEFINED_1,
  366. _TIMER_UNDEFINED_2,
  367. _TIMER_UNDEFINED_3,
  368. _TIMER_UNDEFINED_4,
  369. _TIMER_UNDEFINED_5,
  370. _TIMER_UNDEFINED_6,
  371. _TIMER_UNDEFINED_7,
  372. _TIMER_UNDEFINED_8,
  373. _TIMER_UNDEFINED_9,
  374. _TIMER_UNDEFINED_A,
  375. _TIMER_UNDEFINED_B,
  376. _TIMER_UNDEFINED_C,
  377. _TIMER_UNDEFINED_D,
  378. _TIMER_UNDEFINED_E,
  379. _TIMER_UNDEFINED_F,
  380. _TIMER_UNDEFINED_10,
  381. _TIMER_UNDEFINED_11,
  382. _TIMER_UNDEFINED_12,
  383. _TIMER_UNDEFINED_13,
  384. _TIMER_UNDEFINED_14,
  385. _TIMER_UNDEFINED_15,
  386. _TIMER_UNDEFINED_16,
  387. _TIMER_8_SOUND_SOURCE,
  388. _TIMER_8_SOUND_SOURCE_TANDY,
  389. _TIMER_8_GENERAL_PORT,
  390. _TIMER_8_GENERAL_PORT_REC
  391. };
  392. // define for no slots available
  393. #define _ERR_NO_SLOTS ( WORD )-1
  394. // error codes for the system
  395. enum
  396. {
  397. _ERR_NO_ERROR,
  398. _ERR_DRIVER_NOT_LOADED,
  399. _ERR_INVALID_POINTER,
  400. _ERR_DETECT_INITIALIZED,
  401. _ERR_FAIL_ON_FILE_OPEN,
  402. _ERR_MEMORY_FAIL,
  403. _ERR_INVALID_DRIVER_ID,
  404. _ERR_NO_DRIVER_FOUND,
  405. _ERR_DETECTION_FAILURE,
  406. _ERR_DRIVER_LOADED,
  407. _ERR_INVALID_HANDLE,
  408. _ERR_NO_HANDLES,
  409. _ERR_PAUSED,
  410. _ERR_NOT_PAUSED,
  411. _ERR_INVALID_DATA,
  412. _ERR_DRV_FILE_FAIL,
  413. _ERR_INVALID_PORT,
  414. _ERR_INVALID_IRQ,
  415. _ERR_INVALID_DMA,
  416. _ERR_INVALID_DMA_IRQ
  417. };
  418. // maximum number of timer events that can be registered
  419. #define _TIMER_MAX_EVENTS 0x10
  420. // flags for the debugging system
  421. #define _SOS_DEBUG_NORMAL 0x0000
  422. #define _SOS_DEBUG_NO_TIMER 0x0001
  423. #define _SOS_TIMER_DPMI 0x0002
  424. // define for types of DOS extenders
  425. #define _SOS_RATIONAL 0x8000
  426. #define _SOS_FLASHTECK 0x4000
  427. // defines for the types of timers for different
  428. // dos extenders
  429. #define _SOS_TIMER_NEAR 0x8000
  430. #define _SOS_TIMER_FAR 0x4000
  431. // values for callback information
  432. enum
  433. {
  434. _SAMPLE_PROCESSED,
  435. _SAMPLE_LOOPING,
  436. _SAMPLE_DONE
  437. };
  438. // define for special 18.2 callback rate to dos
  439. #define _TIMER_DOS_RATE 0xff00
  440. #pragma pack()
  441. #pragma aux int_3 = "int 3"
  442. #pragma pack( 1 )
  443. typedef struct
  444. {
  445. unsigned region_size;
  446. unsigned offset;
  447. unsigned segment;
  448. unsigned short number_available;
  449. unsigned short number_used;
  450. unsigned page0;
  451. } EVDS_STRUCT;
  452. typedef struct
  453. {
  454. unsigned region_size;
  455. unsigned offset;
  456. unsigned short segment;
  457. unsigned short ID;
  458. unsigned physical;
  459. } VDS_STRUCT;
  460. #pragma pack()
  461. #include "sosdata.h"
  462. #include "sosfnct.h"
  463. #endif