1 /*
2     TiMidity++ -- MIDI to WAVE converter and player
3     Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
4     Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 
20     remote_def.c - written by Masanao Izumo <mo@goice.co.jp>
21     Define some macros
22     */
23 
24 /*
25  * TiMidity server interface uses on OSSv3's midi sequencer definitions,
26  * so this file does not have to be the one included to define the
27  * interface's macros -
28  * sys/soundcard.h or (on netBSD/openBSD) sys/midiio.h should do.
29  */
30 
31 #ifndef ___REMOTE_DEFS_H_
32 #define ___REMOTE_DEFS_H_
33 
34 
35 
36 
37 /*
38  * /dev/sequencer input events.
39  *
40  * The data written to the /dev/sequencer is a stream of events. Events
41  * are records of 4 or 8 bytes. The first byte defines the size.
42  * Any number of events can be written with a write call. There
43  * is a set of macros for sending these events. Use these macros if you
44  * want to maximize portability of your program.
45  *
46  * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
47  * (All input events are currently 4 bytes long. Be prepared to support
48  * 8 byte events also. If you receive any event having first byte >= 128,
49  * it's a 8 byte event.
50  *
51  * The events are documented at the end of this file.
52  *
53  * Normal events (4 bytes)
54  * There is also a 8 byte version of most of the 4 byte events. The
55  * 8 byte one is recommended.
56  */
57 #define SEQ_NOTEOFF		0
58 #define SEQ_NOTEON		1
59 #define SEQ_WAIT		TMR_WAIT_ABS
60 #define SEQ_PGMCHANGE		3
61 #define SEQ_SYNCTIMER		TMR_START
62 #define SEQ_MIDIPUTC		5
63 #define SEQ_DRUMON		6	/*** OBSOLETE ***/
64 #define SEQ_DRUMOFF		7	/*** OBSOLETE ***/
65 #define SEQ_ECHO		TMR_ECHO	/* For synching programs with output */
66 #define SEQ_AFTERTOUCH		9
67 #define SEQ_CONTROLLER		10
68 #define SEQ_FULLSIZE		0xfd
69 #define SEQ_PRIVATE		0xfe
70 #define SEQ_EXTENDED		0xff
71 
72 /*******************************************
73  *	Midi controller numbers
74  *******************************************
75  * Controllers 0 to 31 (0x00 to 0x1f) and
76  * 32 to 63 (0x20 to 0x3f) are continuous
77  * controllers.
78  * In the MIDI 1.0 these controllers are sent using
79  * two messages. Controller numbers 0 to 31 are used
80  * to send the MSB and the controller numbers 32 to 63
81  * are for the LSB. Note that just 7 bits are used in MIDI bytes.
82  */
83 
84 #define	   CTL_BANK_SELECT		0x00
85 #define	   CTL_MODWHEEL			0x01
86 #define    CTL_BREATH			0x02
87 /*		undefined		0x03 */
88 #define    CTL_FOOT			0x04
89 #define    CTL_PORTAMENTO_TIME		0x05
90 #define    CTL_DATA_ENTRY		0x06
91 #define    CTL_MAIN_VOLUME		0x07
92 #define    CTL_BALANCE			0x08
93 /*		undefined		0x09 */
94 #define    CTL_PAN			0x0a
95 #define    CTL_EXPRESSION		0x0b
96 /*		undefined		0x0c */
97 /*		undefined		0x0d */
98 /*		undefined		0x0e */
99 /*		undefined		0x0f */
100 #define    CTL_GENERAL_PURPOSE1	0x10
101 #define    CTL_GENERAL_PURPOSE2	0x11
102 #define    CTL_GENERAL_PURPOSE3	0x12
103 #define    CTL_GENERAL_PURPOSE4	0x13
104 /*		undefined		0x14 - 0x1f */
105 
106 /*		undefined		0x20 */
107 /* The controller numbers 0x21 to 0x3f are reserved for the */
108 /* least significant bytes of the controllers 0x00 to 0x1f. */
109 /* These controllers are not recognised by the driver. */
110 
111 /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
112 /* 0=OFF and 127=ON (intermediate values are possible) */
113 #define    CTL_DAMPER_PEDAL		0x40
114 #define    CTL_SUSTAIN			0x40	/* Alias */
115 #define    CTL_HOLD			0x40	/* Alias */
116 #define    CTL_PORTAMENTO		0x41
117 #define    CTL_SOSTENUTO		0x42
118 #define    CTL_SOFT_PEDAL		0x43
119 /*		undefined		0x44 */
120 #define    CTL_HOLD2			0x45
121 /*		undefined		0x46 - 0x4f */
122 
123 #define    CTL_GENERAL_PURPOSE5	0x50
124 #define    CTL_GENERAL_PURPOSE6	0x51
125 #define    CTL_GENERAL_PURPOSE7	0x52
126 #define    CTL_GENERAL_PURPOSE8	0x53
127 /*		undefined		0x54 - 0x5a */
128 #define    CTL_EXT_EFF_DEPTH		0x5b
129 #define    CTL_TREMOLO_DEPTH		0x5c
130 #define    CTL_CHORUS_DEPTH		0x5d
131 #define    CTL_DETUNE_DEPTH		0x5e
132 #define    CTL_CELESTE_DEPTH		0x5e	/* Alias for the above one */
133 #define    CTL_PHASER_DEPTH		0x5f
134 #define    CTL_DATA_INCREMENT		0x60
135 #define    CTL_DATA_DECREMENT		0x61
136 #define    CTL_NONREG_PARM_NUM_LSB	0x62
137 #define    CTL_NONREG_PARM_NUM_MSB	0x63
138 #define    CTL_REGIST_PARM_NUM_LSB	0x64
139 #define    CTL_REGIST_PARM_NUM_MSB	0x65
140 /*		undefined		0x66 - 0x78 */
141 /*		reserved		0x79 - 0x7f */
142 
143 /* Pseudo controllers (not midi compatible) */
144 #define    CTRL_PITCH_BENDER		255
145 #define    CTRL_PITCH_BENDER_RANGE	254
146 #define    CTRL_EXPRESSION		253	/* Obsolete */
147 #define    CTRL_MAIN_VOLUME		252	/* Obsolete */
148 #define SEQ_BALANCE		11
149 #define SEQ_VOLMODE             12
150 
151 
152 
153 
154 
155 
156 
157 /*
158  * Level 2 event types for /dev/sequencer
159  */
160 
161 /*
162  * The 4 most significant bits of byte 0 specify the class of
163  * the event:
164  *
165  *	0x8X = system level events,
166  *	0x9X = device/port specific events, event[1] = device/port,
167  *		The last 4 bits give the subtype:
168  *			0x02	= Channel event (event[3] = chn).
169  *			0x01	= note event (event[4] = note).
170  *			(0x01 is not used alone but always with bit 0x02).
171  *	       event[2] = MIDI message code (0x80=note off etc.)
172  *
173  */
174 
175 #define EV_SEQ_LOCAL		0x80
176 #define EV_TIMING		0x81
177 #define EV_CHN_COMMON		0x92
178 #define EV_CHN_VOICE		0x93
179 #define EV_SYSEX		0x94
180 /*
181  * Event types 200 to 220 are reserved for application use.
182  * These numbers will not be used by the driver.
183  */
184 
185 /*
186  * Events for event type EV_CHN_VOICE
187  */
188 
189 #define MIDI_NOTEOFF		0x80
190 #define MIDI_NOTEON		0x90
191 #define MIDI_KEY_PRESSURE	0xA0
192 
193 /*
194  * Events for event type EV_CHN_COMMON
195  */
196 
197 #define MIDI_CTL_CHANGE		0xB0
198 #define MIDI_PGM_CHANGE		0xC0
199 #define MIDI_CHN_PRESSURE	0xD0
200 #define MIDI_PITCH_BEND		0xE0
201 
202 #define MIDI_SYSTEM_PREFIX	0xF0
203 
204 /*
205  * Timer event types
206  */
207 #define TMR_WAIT_REL		1	/* Time relative to the prev time */
208 #define TMR_WAIT_ABS		2	/* Absolute time since TMR_START */
209 #define TMR_STOP		3
210 #define TMR_START		4
211 #define TMR_CONTINUE		5
212 #define TMR_TEMPO		6
213 #define TMR_ECHO		8
214 #define TMR_CLOCK		9	/* MIDI clock */
215 #define TMR_SPP			10	/* Song position pointer */
216 #define TMR_TIMESIG		11	/* Time signature */
217 
218 
219 #endif /* ___REMOTE_DEFS_H_ */
220