SOS.H 14 KB

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