SOSM.H 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. /****************************************************************************
  2. File : sosm.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_MIDI_DEFINED
  12. #define _SOS_MIDI_DEFINED
  13. #include "sosdefs.h"
  14. #include "sos.h"
  15. #pragma pack(4)
  16. #define _SOS_MIDI_ERR -1
  17. // number of drivers allowed to be open at one time
  18. #define _SOS_MIDI_MAX_DRIVERS 5
  19. // maximum number of allowed channels
  20. #define _SOS_MIDI_MAX_CHANNELS 0x10
  21. // structure definition for the capabilities
  22. typedef struct
  23. {
  24. BYTE szDeviceName[ 32 ]; // device name
  25. WORD wDeviceVersion; // device version
  26. WORD wFlags; // miscellaneous flags
  27. WORD wProcessData; // process data before sending to driver
  28. short far * lpPortList; // list of usable ports
  29. short far * lpIRQList; // list of usable irq channels
  30. WORD wDeviceID; // ID for the device
  31. } _SOS_MIDI_CAPABILITIES;
  32. #define LPSOSMIDIDEVICECAPS _SOS_MIDI_CAPABILITIES far *
  33. // call indexes for the loadable drivers
  34. enum
  35. {
  36. _DRV_MIDI_GET_CAPS,
  37. _DRV_MIDI_GET_CALL_TABLE,
  38. _DRV_MIDI_SPECIAL1
  39. };
  40. // file header for the driver
  41. typedef struct
  42. {
  43. // name ID
  44. BYTE szName[ 32 ];
  45. // number of drivers in the file
  46. WORD wDrivers;
  47. // offset of first driver
  48. WORD lOffset;
  49. // size of the file
  50. WORD lFileSize;
  51. } _MIDIFILEHEADER;
  52. // driver header structure
  53. typedef struct
  54. {
  55. // name ID
  56. BYTE szName[ 32 ];
  57. // offset of next driver
  58. WORD lNextDriver;
  59. // size of current driver
  60. WORD wSize;
  61. // id for the current device
  62. WORD wDeviceID;
  63. // id for the extender type
  64. WORD wExtenderType;
  65. } _MIDIDRIVERHEADER;
  66. // device hardware information
  67. typedef struct
  68. {
  69. // port to be used
  70. WORD wPort;
  71. // IRQ for the board
  72. WORD wIRQ;
  73. // extra parameter
  74. WORD wParam;
  75. } _SOS_MIDI_HARDWARE;
  76. // structure for initializing a digital driver
  77. typedef struct
  78. {
  79. // ID for the digital driver
  80. WORD wDriverID;
  81. // timer rate to use
  82. WORD wTimerRate;
  83. // timer callback rate to use
  84. WORD wTimerCallbackRate;
  85. // max voices for the driver to use
  86. WORD wMaxVoices;
  87. // velocity sensing flag
  88. WORD wVelocitySensing;
  89. // init driver info
  90. _SOS_INIT_DRIVER far * sDIGIDriverInfo;
  91. // hardware information
  92. _SOS_HARDWARE far * sDIGIHardwareInfo;
  93. } _SOS_MIDI_DIGI_INIT_DRIVER;
  94. // structure for initializing a driver
  95. typedef struct
  96. {
  97. // type of driver to use if using a digital driver
  98. WORD wDIGIDriverID;
  99. // pointer to driver memory
  100. VOID far * lpDriverMemory;
  101. VOID far * lpDriverMemoryCS;
  102. // pointer to digital driver initialization information
  103. _SOS_MIDI_DIGI_INIT_DRIVER far * sDIGIInitInfo;
  104. // miscellaneous WORD parameter for driver
  105. WORD wParam;
  106. // miscellaneous DWORD parameter for driver
  107. DWORD dwParam;
  108. } _SOS_MIDI_INIT_DRIVER;
  109. // structure for starting a song
  110. typedef struct
  111. {
  112. // pointer to song memory
  113. BYTE _huge * lpSongData;
  114. // pointer to callback function for pertinent song information
  115. VOID ( far * lpSongCallback )( WORD );
  116. } _SOS_MIDI_INIT_SONG;
  117. // define to indicate that track mapping can be used
  118. // from the midi file for the song
  119. #define _MIDI_MAP_TRACK 0xff
  120. // MIDI channel to device mapping structure
  121. typedef struct
  122. {
  123. // track to device mapping information
  124. WORD wTrackDevice[ 32 ];
  125. } _SOS_MIDI_TRACK_DEVICE;
  126. // MIDI channel to device mapping structure
  127. typedef struct
  128. {
  129. // track to device mapping information
  130. WORD wTrackDevice[ 32 ][ 5 ];
  131. } _SOS_MIDI_TRACK_DEVICE1;
  132. // NEW
  133. // header for the NDMF format MIDI file
  134. typedef struct
  135. {
  136. // ID for the file
  137. BYTE szFileID[ 32 ];
  138. WORD dwBranchOffset;
  139. WORD temp1;
  140. WORD temp2;
  141. WORD temp3;
  142. // // name of the instrument file to use with the song
  143. // BYTE szInstrumentFile[ 16 ];
  144. // number of tracks in the song
  145. WORD wNDMFTracks;
  146. // ticks/quarter note song is used at
  147. WORD wTicksQuarterNote;
  148. // tempo
  149. WORD wTempo;
  150. // time for song to play at current tempo
  151. WORD wTimeToPlay;
  152. // channel mapping priority information
  153. WORD wChannelPriority[ _SOS_MIDI_MAX_CHANNELS ];
  154. // channel mapping information
  155. _SOS_MIDI_TRACK_DEVICE1 sTrackMap;
  156. // array of flags for which controllers to restore on a loop/branch
  157. BYTE bCtrlRestore[ 128 ];
  158. // pointer to callback function for song to call with
  159. // pertinent information
  160. VOID ( far * lpSongCallback )( WORD );
  161. } _NDMF_FILE_HEADER;
  162. // END
  163. // header for the tracks in the NDMF format MIDI file
  164. typedef struct
  165. {
  166. // track number
  167. WORD wTrackNumber;
  168. // length of the track
  169. WORD wTrackLength;
  170. // channel used on the track
  171. WORD wChannel;
  172. } _NDMF_TRACK_HEADER;
  173. // MIDI event structure
  174. typedef struct
  175. {
  176. // dummy name to access midi data from
  177. BYTE bMidiData[ 256 ];
  178. } _NDMF_MIDI_EVENT;
  179. // maximum number of songs that can be played at any time
  180. #define _SOS_MIDI_MAX_SONGS 8
  181. // maximum number of tracks that can be used
  182. #define _SOS_MIDI_MAX_TRACKS 32
  183. // number of driver functions
  184. #define _SOS_MIDI_DRV_FUNCTIONS 12
  185. // enumeration for all of the drv functions
  186. enum
  187. {
  188. _MIDI_DRV_SEND_DATA,
  189. _MIDI_DRV_INIT,
  190. _MIDI_DRV_UNINIT,
  191. _MIDI_DRV_RESET,
  192. _MIDI_DRV_SET_INST_DATA
  193. };
  194. // defines for the loadable driver ids
  195. #define _MIDI_SOUND_MASTER_II 0xa000
  196. #define _MIDI_MPU_401 0xa001
  197. #define _MIDI_FM 0xa002
  198. #define _MIDI_OPL2 0xa002
  199. #define _MIDI_CALLBACK 0xa003
  200. #define _MIDI_MT_32 0xa004
  201. #define _MIDI_DIGI 0xa005
  202. #define _MIDI_INTERNAL_SPEAKER 0xa006
  203. #define _MIDI_WAVE_TABLE_SYNTH 0xa007
  204. #define _MIDI_AWE32 0xa008
  205. #define _MIDI_OPL3 0xa009
  206. #define _MIDI_GUS 0xa00a
  207. // structure for the hmi instrument file header
  208. typedef struct
  209. {
  210. // file id type
  211. BYTE szFileID[ 32 ];
  212. // file version
  213. WORD wFileVersion;
  214. // size of the file
  215. WORD dwFileSize;
  216. } _HMI_INS_FILE_HEADER;
  217. // define for identifying a drum instrument
  218. #define _SOS_MIDI_DRUM_INS ( short )0x8000
  219. // maximum number of timer events that can be registered
  220. #define _TIMER_MAX_EVENTS 0x10
  221. // structure for digital driver queue element
  222. typedef struct _tagQueueElement
  223. {
  224. // handle for the sample
  225. WORD wSampleHandle;
  226. // id for the sample
  227. WORD wSampleID;
  228. // velocity for the sample
  229. WORD wVelocity;
  230. // channel for the sample
  231. WORD wChannel;
  232. } _DIGI_QUEUE_ELEMENT;
  233. // maximum number of instruments that can be set in the
  234. // digital driver
  235. #define _MAX_INS 128
  236. // define for the maximum number of times a channel can be stolen
  237. #define _SOS_MIDI_MAX_LEVELS 0x04
  238. // structure for MIDI information to be stored on the local stack
  239. // when a channel is stolen
  240. typedef struct
  241. {
  242. // used element
  243. BYTE bUsed;
  244. // last pitch bend information sent
  245. BYTE bPitchBend;
  246. // channel volume
  247. BYTE bChannelVolume;
  248. // instrument information
  249. BYTE bInstrument;
  250. // sustain pedal
  251. BYTE bSustain;
  252. } _SOS_MIDI_CHANNEL_DATA;
  253. // flags for the debugging system
  254. #define _SOS_DEBUG_NORMAL 0x0000
  255. #define _SOS_DEBUG_NO_TIMER 0x0001
  256. // ID for 32 bit MIDI file
  257. #define _SOS_MIDI_FILE_ID "HMIMIDIP"
  258. // structure for branch location controller
  259. typedef struct
  260. {
  261. // offset from start of track data
  262. WORD dwOffset;
  263. // branch ID number
  264. BYTE bBranchID;
  265. // current instrument
  266. BYTE bInstrument;
  267. // current loop count for temporary storage
  268. // so that a track can be looped without
  269. // needing any data from the program
  270. BYTE bLoopCount;
  271. // number of controller messages stored
  272. BYTE bCtrlChangeCount;
  273. // offset of control change information from start of file
  274. WORD lpCtrlChangeData;
  275. WORD lpCtrlChangeDataTemp;
  276. // reserved fields
  277. WORD wReserved1;
  278. WORD wReserved2;
  279. } _SOS_BRANCH_POINT;
  280. #define _SOS_MIDI_FADE_IN 0x01
  281. #define _SOS_MIDI_FADE_OUT 0x02
  282. #define _SOS_MIDI_FADE_OUT_STOP 0x04
  283. // structure for digital drums to use to store midi information
  284. typedef struct
  285. {
  286. // current volume
  287. WORD wVolume;
  288. // current pan position
  289. WORD wPanPosition;
  290. // reserved
  291. DWORD dwReserved;
  292. } _SOS_MIDI_DIGI_CHANNEL;
  293. // instrument file header structure
  294. typedef struct
  295. {
  296. // file ID
  297. BYTE szID[ 32 ];
  298. // file version
  299. WORD wVersion;
  300. // instruments in file
  301. WORD wInstruments;
  302. // list of pointers to start sample structures
  303. _SOS_START_SAMPLE far * lpStartSample[ _MAX_INS ];
  304. DWORD temp1;
  305. DWORD temp2;
  306. } _WAVE_FILE_HEADER;
  307. #pragma pack()
  308. // define for the busy error returned from send data
  309. #define _ERR_DRIVER_BUSY 0xf000
  310. // NEW
  311. // defines for the looping branch controllers
  312. #define _SOS_SET_FLAG 103
  313. #define _SOS_RESET_FLAG 104
  314. #define _SOS_BRANCH1 108
  315. #define _SOS_BRANCH2 109
  316. #define _SOS_BRANCH3 110
  317. #define _SOS_BRANCH4 111
  318. #define _SOS_BRANCH5 112
  319. #define _SOS_BRANCH6 113
  320. #define _SOS_BRANCH7 114
  321. #define _SOS_BRANCH8 115
  322. #define _SOS_BRANCH9 116
  323. #define _SOS_BRANCH10 117
  324. #define _SOS_BRANCH11 118
  325. #define _SOS_BRANCH12 119
  326. #define _SOS_BRANCH13 120
  327. #define _SOS_BRANCH14 121
  328. // define for the program change controller flag
  329. #define _SOS_PROGRAM_CHANGE_FLAG 108
  330. // END
  331. #include "sosmdata.h"
  332. #include "sosmfnct.h"
  333. #endif