SOS.H 15 KB

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