1 /*
2 ** mus2midi.h
3 **
4 **---------------------------------------------------------------------------
5 ** Copyright 1998-2006 Randy Heit
6 ** All rights reserved.
7 **
8 ** Redistribution and use in source and binary forms, with or without
9 ** modification, are permitted provided that the following conditions
10 ** are met:
11 **
12 ** 1. Redistributions of source code must retain the above copyright
13 **    notice, this list of conditions and the following disclaimer.
14 ** 2. Redistributions in binary form must reproduce the above copyright
15 **    notice, this list of conditions and the following disclaimer in the
16 **    documentation and/or other materials provided with the distribution.
17 ** 3. The name of the author may not be used to endorse or promote products
18 **    derived from this software without specific prior written permission.
19 **
20 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 **---------------------------------------------------------------------------
31 **
32 */
33 
34 #ifndef __MUS2MIDI_H__
35 #define __MUS2MIDI_H__
36 
37 #ifdef _MSC_VER
38 #pragma once
39 #endif
40 
41 #include <stdio.h>
42 #include "doomtype.h"
43 
44 #define MIDI_SYSEX		((BYTE)0xF0)		 // SysEx begin
45 #define MIDI_SYSEXEND	((BYTE)0xF7)		 // SysEx end
46 #define MIDI_META		((BYTE)0xFF)		 // Meta event begin
47 #define MIDI_META_TEMPO ((BYTE)0x51)
48 #define MIDI_META_EOT	((BYTE)0x2F)		 // End-of-track
49 #define MIDI_META_SSPEC	((BYTE)0x7F)		 // System-specific event
50 
51 #define MIDI_NOTEOFF	((BYTE)0x80)		 // + note + velocity
52 #define MIDI_NOTEON 	((BYTE)0x90)		 // + note + velocity
53 #define MIDI_POLYPRESS	((BYTE)0xA0)		 // + pressure (2 bytes)
54 #define MIDI_CTRLCHANGE ((BYTE)0xB0)		 // + ctrlr + value
55 #define MIDI_PRGMCHANGE ((BYTE)0xC0)		 // + new patch
56 #define MIDI_CHANPRESS	((BYTE)0xD0)		 // + pressure (1 byte)
57 #define MIDI_PITCHBEND	((BYTE)0xE0)		 // + pitch bend (2 bytes)
58 
59 #define MUS_NOTEOFF 	((BYTE)0x00)
60 #define MUS_NOTEON		((BYTE)0x10)
61 #define MUS_PITCHBEND	((BYTE)0x20)
62 #define MUS_SYSEVENT	((BYTE)0x30)
63 #define MUS_CTRLCHANGE	((BYTE)0x40)
64 #define MUS_SCOREEND	((BYTE)0x60)
65 
66 typedef struct
67 {
68 	DWORD Magic;
69 	WORD SongLen;
70 	WORD SongStart;
71 	WORD NumChans;
72 	WORD NumSecondaryChans;
73 	WORD NumInstruments;
74 	WORD Pad;
75 	// WORD UsedInstruments[NumInstruments];
76 } MUSHeader;
77 
78 #endif //__MUS2MIDI_H__
79