2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
21 typedef DWORD SMFRESULT;
23 typedef TICKS FAR *PTICKS;
24 typedef BYTE HUGE *HPBYTE;
26 #define MAX_TICKS ((TICKS)0xFFFFFFFFL)
28 #define SMF_SUCCESS (0L)
29 #define SMF_INVALID_FILE (1L)
30 #define SMF_NO_MEMORY (2L)
31 #define SMF_OPEN_FAILED (3L)
32 #define SMF_INVALID_TRACK (4L)
33 #define SMF_META_PENDING (5L)
34 #define SMF_ALREADY_OPEN (6L)
35 #define SMF_END_OF_TRACK (7L)
36 #define SMF_NO_META (8L)
37 #define SMF_INVALID_PARM (9L)
38 #define SMF_INVALID_BUFFER (10L)
39 #define SMF_END_OF_FILE (11L)
40 #define SMF_REACHED_TKMAX (12L)
44 typedef struct tag_smfopenstruct
50 FAR *PSMFOPENFILESTRUCT;
52 extern SMFRESULT FNLOCAL smfOpenFile(
53 BYTE *data, UINT length, HSMF *pph);
55 extern SMFRESULT FNLOCAL smfCloseFile(
58 typedef struct tag_smffileinfo
67 extern SMFRESULT FNLOCAL smfGetFileInfo(
71 extern DWORD FNLOCAL smfTicksToMillisecs(
75 extern DWORD FNLOCAL smfMillisecsToTicks(
79 extern SMFRESULT FNLOCAL smfReadEvents(
84 extern SMFRESULT FNLOCAL smfSeek(
89 extern DWORD FNLOCAL smfGetStateMaxSize(
92 /* Buffer described by LPMIDIHDR is in polymsg format, except that it
93 ** can contain meta-events (which will be ignored during playback by
94 ** the current system). This means we can use the pack functions, etc.
96 #define PMSG_META ((BYTE)0xC0)
101 /*****************************************************************************/
102 /*****************************************************************************/
105 /* Handle structure for HSMF
108 #define SMF_TF_EOT 0x00000001L
109 #define SMF_TF_INVALID 0x00000002L
111 typedef struct tag_tempomapentry
119 typedef struct tag_smf *PSMF;
121 typedef struct tag_track
144 #define SMF_F_EOF 0x00000001L
145 #define SMF_F_INSERTSYSEX 0x00000002L
147 #define C_TEMPO_MAP_CHK 16
148 typedef struct tag_smf
159 DWORD dwTimeDivision;
163 DWORD cTempoMapAlloc;
165 PTEMPOMAPENTRY pTempoMap;
167 DWORD dwPendingUserEvent;
168 DWORD cbPendingUserEvent;
169 HPBYTE hpbPendingUserEvent;
174 typedef struct tagEVENT
186 #define EVENT_TYPE(event) ((event).abEvent[0])
187 #define EVENT_CH_B1(event) ((event).abEvent[1])
188 #define EVENT_CH_B2(event) ((event).abEvent[2])
190 #define EVENT_META_TYPE(event) ((event).abEvent[1])
192 SMFRESULT FNLOCAL smfBuildFileIndex(
193 PSMF BSTACK * ppsmf);
195 DWORD FNLOCAL smfGetVDword(
200 SMFRESULT FNLOCAL smfGetNextEvent(
206 ** Useful macros when dealing with hi-lo format integers
208 #define DWORDSWAP(dw) \
209 ((((dw)>>24)&0x000000FFL)|\
210 (((dw)>>8)&0x0000FF00L)|\
211 (((dw)<<8)&0x00FF0000L)|\
212 (((dw)<<24)&0xFF000000L))
214 #define WORDSWAP(w) \
218 #define FOURCC_RMID mmioFOURCC('R','M','I','D')
219 #define FOURCC_data mmioFOURCC('d','a','t','a')
220 #define FOURCC_MThd mmioFOURCC('M','T','h','d')
221 #define FOURCC_MTrk mmioFOURCC('M','T','r','k')
223 typedef struct tag_chunkhdr
230 #pragma pack(1) // override cl32 default packing, to match disk file.
231 typedef struct tag_filehdr
240 /* NOTE: This is arbitrary and only used if there is a tempo map but no
243 #define MIDI_DEFAULT_TEMPO (500000L)
245 #define MIDI_MSG ((BYTE)0x80)
246 #define MIDI_NOTEOFF ((BYTE)0x80)
247 #define MIDI_NOTEON ((BYTE)0x90)
248 #define MIDI_POLYPRESSURE ((BYTE)0xA0)
249 #define MIDI_CONTROLCHANGE ((BYTE)0xB0)
250 #define MIDI_PROGRAMCHANGE ((BYTE)0xC0)
251 #define MIDI_CHANPRESSURE ((BYTE)0xD0)
252 #define MIDI_PITCHBEND ((BYTE)0xE0)
253 #define MIDI_META ((BYTE)0xFF)
254 #define MIDI_SYSEX ((BYTE)0xF0)
255 #define MIDI_SYSEXEND ((BYTE)0xF7)
257 #define MIDI_META_TRACKNAME ((BYTE)0x03)
258 #define MIDI_META_EOT ((BYTE)0x2F)
259 #define MIDI_META_TEMPO ((BYTE)0x51)
260 #define MIDI_META_TIMESIG ((BYTE)0x58)
261 #define MIDI_META_KEYSIG ((BYTE)0x59)
262 #define MIDI_META_SEQSPECIFIC ((BYTE)0x7F)