|
|
1.1 root 1: /****************************************************************************
2:
3: File : sosm.h
4:
5: Programmer(s) : Don Fowler, Nick Skrepetos
6: Date :
7:
8: Purpose : Include Files For Zortech C++ Compiler
9:
10: Last Updated :
11:
12: ****************************************************************************
13: Copyright(c) 1993,1994 Human Machine Interfaces
14: All Rights Reserved
15: ****************************************************************************/
16:
17: #ifndef _SOS_MIDI_DEFINED
18: #define _SOS_MIDI_DEFINED
19:
20: #include "sosdefs.h"
21: #include "sos.h"
22:
23: #pragma pack(4)
24:
25: #define _SOS_MIDI_ERR -1
26:
27: // number of drivers allowed to be open at one time
28: #define _SOS_MIDI_MAX_DRIVERS 5
29:
30: // maximum number of allowed channels
31: #define _SOS_MIDI_MAX_CHANNELS 0x10
32:
33: // structure definition for the capabilities
34: typedef struct
35: {
36: BYTE szDeviceName[ 32 ]; // device name
37: WORD wDeviceVersion; // device version
38: WORD wFlags; // miscellaneous flags
39: WORD wProcessData; // process data before sending to driver
40: short far * lpPortList; // list of usable ports
41: short far * lpIRQList; // list of usable irq channels
42: WORD wDeviceID; // ID for the device
43:
44: } _SOS_MIDI_CAPABILITIES;
45:
46: #define LPSOSMIDIDEVICECAPS _SOS_MIDI_CAPABILITIES far *
47:
48: // call indexes for the loadable drivers
49: enum
50: {
51: _DRV_MIDI_GET_CAPS,
52: _DRV_MIDI_GET_CALL_TABLE,
53: _DRV_MIDI_SPECIAL1
54: };
55:
56: // file header for the driver
57: typedef struct
58: {
59: // name ID
60: BYTE szName[ 32 ];
61:
62: // number of drivers in the file
63: WORD wDrivers;
64:
65: // offset of first driver
66: WORD lOffset;
67:
68: // size of the file
69: WORD lFileSize;
70:
71: } _MIDIFILEHEADER;
72:
73: // driver header structure
74: typedef struct
75: {
76: // name ID
77: BYTE szName[ 32 ];
78:
79: // offset of next driver
80: WORD lNextDriver;
81:
82: // size of current driver
83: WORD wSize;
84:
85: // id for the current device
86: WORD wDeviceID;
87:
88: // id for the extender type
89: WORD wExtenderType;
90:
91: } _MIDIDRIVERHEADER;
92:
93: // device hardware information
94: typedef struct
95: {
96: // port to be used
97: WORD wPort;
98:
99: // IRQ for the board
100: WORD wIRQ;
101:
102: // extra parameter
103: WORD wParam;
104:
105: } _SOS_MIDI_HARDWARE;
106:
107: // structure for initializing a digital driver
108: typedef struct
109: {
110: // ID for the digital driver
111: WORD wDriverID;
112:
113: // timer rate to use
114: WORD wTimerRate;
115:
116: // timer callback rate to use
117: WORD wTimerCallbackRate;
118:
119: // max voices for the driver to use
120: WORD wMaxVoices;
121:
122: // velocity sensing flag
123: WORD wVelocitySensing;
124:
125: // init driver info
126: _SOS_INIT_DRIVER far * sDIGIDriverInfo;
127:
128: // hardware information
129: _SOS_HARDWARE far * sDIGIHardwareInfo;
130:
131: } _SOS_MIDI_DIGI_INIT_DRIVER;
132:
133: // structure for initializing a driver
134: typedef struct
135: {
136: // type of driver to use if using a digital driver
137: WORD wDIGIDriverID;
138:
139: // pointer to driver memory
140: VOID far * lpDriverMemory;
141: VOID far * lpDriverMemoryCS;
142:
143: // pointer to digital driver initialization information
144: _SOS_MIDI_DIGI_INIT_DRIVER far * sDIGIInitInfo;
145:
146: // miscellaneous WORD parameter for driver
147: WORD wParam;
148:
149: // miscellaneous DWORD parameter for driver
150: DWORD dwParam;
151:
152: } _SOS_MIDI_INIT_DRIVER;
153:
154: // structure for starting a song
155: typedef struct
156: {
157: // pointer to song memory
158: BYTE _huge * lpSongData;
159:
160: // pointer to callback function for pertinent song information
161: VOID ( far * lpSongCallback )( WORD );
162:
163: } _SOS_MIDI_INIT_SONG;
164:
165: // define to indicate that track mapping can be used
166: // from the midi file for the song
167: #define _MIDI_MAP_TRACK 0xff
168:
169: // MIDI channel to device mapping structure
170: typedef struct
171: {
172: // track to device mapping information
173: WORD wTrackDevice[ 32 ];
174:
175: } _SOS_MIDI_TRACK_DEVICE;
176:
177: // MIDI channel to device mapping structure
178: typedef struct
179: {
180: // track to device mapping information
181: WORD wTrackDevice[ 32 ][ 5 ];
182:
183: } _SOS_MIDI_TRACK_DEVICE1;
184:
185: // NEW
186: // header for the NDMF format MIDI file
187: typedef struct
188: {
189: // ID for the file
190: BYTE szFileID[ 32 ];
191:
192: WORD dwBranchOffset;
193: WORD temp1;
194: WORD temp2;
195: WORD temp3;
196:
197: // // name of the instrument file to use with the song
198: // BYTE szInstrumentFile[ 16 ];
199:
200: // number of tracks in the song
201: WORD wNDMFTracks;
202:
203: // ticks/quarter note song is used at
204: WORD wTicksQuarterNote;
205:
206: // tempo
207: WORD wTempo;
208:
209: // time for song to play at current tempo
210: WORD wTimeToPlay;
211:
212: // channel mapping priority information
213: WORD wChannelPriority[ _SOS_MIDI_MAX_CHANNELS ];
214:
215: // channel mapping information
216: _SOS_MIDI_TRACK_DEVICE1 sTrackMap;
217:
218: // array of flags for which controllers to restore on a loop/branch
219: BYTE bCtrlRestore[ 128 ];
220:
221: // pointer to callback function for song to call with
222: // pertinent information
223: VOID ( far * lpSongCallback )( WORD );
224:
225: } _NDMF_FILE_HEADER;
226: // END
227:
228: // header for the tracks in the NDMF format MIDI file
229: typedef struct
230: {
231: // track number
232: WORD wTrackNumber;
233:
234: // length of the track
235: WORD wTrackLength;
236:
237: // channel used on the track
238: WORD wChannel;
239:
240: } _NDMF_TRACK_HEADER;
241:
242: // MIDI event structure
243: typedef struct
244: {
245: // dummy name to access midi data from
246: BYTE bMidiData[ 256 ];
247:
248: } _NDMF_MIDI_EVENT;
249:
250: // maximum number of songs that can be played at any time
251: #define _SOS_MIDI_MAX_SONGS 8
252:
253: // maximum number of tracks that can be used
254: #define _SOS_MIDI_MAX_TRACKS 32
255:
256: // number of driver functions
257: #define _SOS_MIDI_DRV_FUNCTIONS 12
258:
259: // enumeration for all of the drv functions
260: enum
261: {
262: _MIDI_DRV_SEND_DATA,
263: _MIDI_DRV_INIT,
264: _MIDI_DRV_UNINIT,
265: _MIDI_DRV_RESET,
266: _MIDI_DRV_SET_INST_DATA
267: };
268:
269: // defines for the loadable driver ids
270: #define _MIDI_SOUND_MASTER_II 0xa000
271: #define _MIDI_MPU_401 0xa001
272: #define _MIDI_FM 0xa002
273: #define _MIDI_OPL2 0xa002
274: #define _MIDI_CALLBACK 0xa003
275: #define _MIDI_MT_32 0xa004
276: #define _MIDI_DIGI 0xa005
277: #define _MIDI_INTERNAL_SPEAKER 0xa006
278: #define _MIDI_WAVE_TABLE_SYNTH 0xa007
279: #define _MIDI_AWE32 0xa008
280: #define _MIDI_OPL3 0xa009
281: #define _MIDI_GUS 0xa00a
282:
283: // structure for the hmi instrument file header
284: typedef struct
285: {
286: // file id type
287: BYTE szFileID[ 32 ];
288:
289: // file version
290: WORD wFileVersion;
291:
292: // size of the file
293: WORD dwFileSize;
294:
295: } _HMI_INS_FILE_HEADER;
296:
297:
298: // define for identifying a drum instrument
299: #define _SOS_MIDI_DRUM_INS ( short )0x8000
300:
301: // maximum number of timer events that can be registered
302: #define _TIMER_MAX_EVENTS 0x10
303:
304: // structure for digital driver queue element
305: typedef struct _tagQueueElement
306: {
307: // handle for the sample
308: WORD wSampleHandle;
309:
310: // id for the sample
311: WORD wSampleID;
312:
313: // velocity for the sample
314: WORD wVelocity;
315:
316: // channel for the sample
317: WORD wChannel;
318:
319: } _DIGI_QUEUE_ELEMENT;
320:
321: // maximum number of instruments that can be set in the
322: // digital driver
323: #define _MAX_INS 128
324:
325: // define for the maximum number of times a channel can be stolen
326: #define _SOS_MIDI_MAX_LEVELS 0x04
327:
328: // structure for MIDI information to be stored on the local stack
329: // when a channel is stolen
330: typedef struct
331: {
332: // used element
333: BYTE bUsed;
334:
335: // last pitch bend information sent
336: BYTE bPitchBend;
337:
338: // channel volume
339: BYTE bChannelVolume;
340:
341: // instrument information
342: BYTE bInstrument;
343:
344: // sustain pedal
345: BYTE bSustain;
346:
347: } _SOS_MIDI_CHANNEL_DATA;
348:
349: // flags for the debugging system
350: #define _SOS_DEBUG_NORMAL 0x0000
351: #define _SOS_DEBUG_NO_TIMER 0x0001
352:
353: // ID for 32 bit MIDI file
354: #define _SOS_MIDI_FILE_ID "HMIMIDIP"
355:
356: // structure for branch location controller
357: typedef struct
358: {
359: // offset from start of track data
360: WORD dwOffset;
361:
362: // branch ID number
363: BYTE bBranchID;
364:
365: // current instrument
366: BYTE bInstrument;
367:
368: // current loop count for temporary storage
369: // so that a track can be looped without
370: // needing any data from the program
371: BYTE bLoopCount;
372:
373: // number of controller messages stored
374: BYTE bCtrlChangeCount;
375:
376: // offset of control change information from start of file
377: WORD lpCtrlChangeData;
378: WORD lpCtrlChangeDataTemp;
379:
380: // reserved fields
381: WORD wReserved1;
382: WORD wReserved2;
383:
384: } _SOS_BRANCH_POINT;
385:
386: #define _SOS_MIDI_FADE_IN 0x01
387: #define _SOS_MIDI_FADE_OUT 0x02
388: #define _SOS_MIDI_FADE_OUT_STOP 0x04
389:
390: // structure for digital drums to use to store midi information
391: typedef struct
392: {
393: // current volume
394: WORD wVolume;
395:
396: // current pan position
397: WORD wPanPosition;
398:
399: // reserved
400: DWORD dwReserved;
401:
402: } _SOS_MIDI_DIGI_CHANNEL;
403:
404: // instrument file header structure
405: typedef struct
406: {
407: // file ID
408: BYTE szID[ 32 ];
409:
410: // file version
411: WORD wVersion;
412:
413: // instruments in file
414: WORD wInstruments;
415:
416: // list of pointers to start sample structures
417: _SOS_START_SAMPLE far * lpStartSample[ _MAX_INS ];
418:
419: DWORD temp1;
420: DWORD temp2;
421:
422: } _WAVE_FILE_HEADER;
423:
424: #pragma pack()
425:
426: // define for the busy error returned from send data
427: #define _ERR_DRIVER_BUSY 0xf000
428:
429: // NEW
430: // defines for the looping branch controllers
431: #define _SOS_SET_FLAG 103
432: #define _SOS_RESET_FLAG 104
433: #define _SOS_BRANCH1 108
434: #define _SOS_BRANCH2 109
435: #define _SOS_BRANCH3 110
436: #define _SOS_BRANCH4 111
437: #define _SOS_BRANCH5 112
438: #define _SOS_BRANCH6 113
439: #define _SOS_BRANCH7 114
440: #define _SOS_BRANCH8 115
441: #define _SOS_BRANCH9 116
442: #define _SOS_BRANCH10 117
443: #define _SOS_BRANCH11 118
444: #define _SOS_BRANCH12 119
445: #define _SOS_BRANCH13 120
446: #define _SOS_BRANCH14 121
447:
448: // define for the program change controller flag
449: #define _SOS_PROGRAM_CHANGE_FLAG 108
450:
451: // END
452: #include "sosmdata.h"
453: #include "sosmfnct.h"
454:
455: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.