kernel/sound: Port MIDI support.
[dragonfly.git] / sys / dev / sound / midi / synth_if.m
1 #-
2 # Copyright (c) 2003 Mathew Kanner
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 # 1. Redistributions of source code must retain the above copyright
9 #    notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 #    notice, this list of conditions and the following disclaimer in the
12 #    documentation and/or other materials provided with the distribution.
13 #
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 # SUCH DAMAGE.
25 #
26 # $FreeBSD: head/sys/dev/sound/midi/synth_if.m 166971 2007-02-25 13:51:52Z netchild $
27 #
28
29 INTERFACE synth;
30
31 #include <sys/systm.h>
32
33 CODE {
34
35 synth_killnote_t nokillnote;
36 synth_startnote_t nostartnote;
37 synth_setinstr_t nosetinstr;
38 synth_hwcontrol_t nohwcontrol;
39 synth_aftertouch_t noaftertouch;
40 synth_panning_t nopanning;
41 synth_controller_t nocontroller;
42 synth_volumemethod_t novolumemethod;
43 synth_bender_t nobender;
44 synth_setupvoice_t nosetupvoice;
45 synth_sendsysex_t nosendsysex;
46 synth_allocvoice_t noallocvoice;
47 synth_writeraw_t nowriteraw;
48 synth_reset_t noreset;
49 synth_shortname_t noshortname;
50 synth_open_t noopen;
51 synth_close_t noclose;
52 synth_query_t noquery;
53 synth_insync_t noinsync;
54 synth_alloc_t noalloc;
55
56     int
57         nokillnote(void *_kobj, uint8_t _chn, uint8_t _note, uint8_t _vel)
58         {
59             kprintf("nokillnote\n");
60             return 0;
61         }
62
63     int
64         noopen(void *_kobj, void *_arg, int mode)
65         {
66             kprintf("noopen\n");
67             return 0;
68         }
69
70     int
71         noquery(void *_kboj)
72         {
73             kprintf("noquery\n");
74             return 0;
75         }
76
77     int
78         nostartnote(void *_kb, uint8_t _voice, uint8_t _note, uint8_t _parm)
79         {
80             kprintf("nostartnote\n");
81             return 0;
82         }
83
84     int
85         nosetinstr(void *_kb, uint8_t _chn, uint16_t _patchno)
86         {
87             kprintf("nosetinstr\n");
88             return 0;
89         }
90
91     int
92         nohwcontrol(void *_kb, uint8_t *_event)
93         {
94             kprintf("nohwcontrol\n");
95             return 0;
96         }
97
98     int 
99         noaftertouch ( void /* X */ * _kobj, uint8_t _x1, uint8_t _x2)
100         {
101             kprintf("noaftertouch\n");
102             return 0;
103         }
104
105     int
106         nopanning ( void /* X */ * _kobj, uint8_t _x1, uint8_t _x2)
107         {
108             kprintf("nopanning\n");
109             return 0;
110         }
111
112     int 
113         nocontroller ( void /* X */ * _kobj, uint8_t _x1, uint8_t _x2, uint16_t _x3)
114         {
115             kprintf("nocontroller\n");
116             return 0;
117         }
118
119     int 
120         novolumemethod (
121                 void /* X */ * _kobj,
122                 uint8_t _x1)
123         {
124             kprintf("novolumemethod\n");
125             return 0;
126         }
127
128     int 
129         nobender ( void /* X */ * _kobj, uint8_t _voice, uint16_t _bend)
130         {
131             kprintf("nobender\n");
132             return 0;
133         }
134
135     int 
136         nosetupvoice ( void /* X */ * _kobj, uint8_t _voice, uint8_t _chn)
137         {
138
139             kprintf("nosetupvoice\n");
140             return 0;
141         }
142
143     int 
144         nosendsysex ( void /* X */ * _kobj, void * _buf, size_t _len)
145         {
146             kprintf("nosendsysex\n");
147             return 0;
148         }
149
150     int 
151         noallocvoice ( void /* X */ * _kobj, uint8_t _chn, uint8_t _note, void *_x)
152         {
153             kprintf("noallocvoice\n");
154             return 0;
155         }
156
157     int 
158         nowriteraw ( void /* X */ * _kobjt, uint8_t * _buf, size_t _len)
159         {
160             kprintf("nowriteraw\n");
161             return 1;
162         }
163
164     int 
165         noreset ( void /* X */ * _kobjt)
166         {
167
168             kprintf("noreset\n");
169             return 0;
170         }
171
172     char *
173         noshortname (void /* X */ * _kobjt)
174         {
175             kprintf("noshortname\n");
176             return "noshortname";
177         }
178
179     int 
180         noclose ( void /* X */ * _kobjt)
181         {
182
183             kprintf("noclose\n");
184             return 0;
185         }
186
187     int
188         noinsync (void /* X */ * _kobjt)
189         {
190
191             kprintf("noinsync\n");
192             return 0;
193         }
194
195     int 
196         noalloc ( void /* x */ * _kbojt, uint8_t _chn, uint8_t _note)
197         {
198             kprintf("noalloc\n");
199             return 0;
200         }
201 }
202
203 METHOD int killnote {
204         void /* X */ *_kobj;
205         uint8_t _chan;
206         uint8_t _note;
207         uint8_t _vel;
208 } DEFAULT nokillnote;
209
210 METHOD int startnote {
211         void /* X */ *_kobj;
212         uint8_t _voice;
213         uint8_t _note;
214         uint8_t _parm;
215 } DEFAULT nostartnote;
216
217 METHOD int setinstr {
218         void /* X */ *_kobj;
219         uint8_t _chn;
220         uint16_t _patchno;
221 } DEFAULT nosetinstr;
222
223 METHOD int hwcontrol {
224         void /* X */ *_kobj;
225         uint8_t *_event;
226 } DEFAULT nohwcontrol;
227
228 METHOD int aftertouch {
229         void /* X */ *_kobj;
230         uint8_t _x1;
231         uint8_t _x2;
232 } DEFAULT noaftertouch;
233
234 METHOD int panning {
235         void /* X */ *_kobj;
236         uint8_t _x1;
237         uint8_t _x2;
238 } DEFAULT nopanning;
239
240 METHOD int controller {
241         void /* X */ *_kobj;
242         uint8_t _x1;
243         uint8_t _x2;
244         uint16_t _x3;
245 } DEFAULT nocontroller;
246
247 METHOD int volumemethod {
248         void /* X */ *_kobj;
249         uint8_t _x1;
250 } DEFAULT novolumemethod;
251
252 METHOD int bender {
253         void /* X */ *_kobj;
254         uint8_t _voice;
255         uint16_t _bend;
256 } DEFAULT nobender;
257
258 METHOD int setupvoice {
259         void /* X */ *_kobj;
260         uint8_t _voice;
261         uint8_t _chn;
262 } DEFAULT nosetupvoice;
263
264 METHOD int sendsysex {
265         void /* X */ *_kobj;
266         void   *_buf;
267         size_t  _len;
268 } DEFAULT nosendsysex;
269
270 METHOD int allocvoice {
271         void /* X */ *_kobj;
272         uint8_t _chn;
273         uint8_t _note;
274         void   *_x;
275 } DEFAULT noallocvoice;
276
277 METHOD int writeraw {
278         void /* X */ *_kobjt;
279         uint8_t *_buf;
280         size_t  _len;
281 } DEFAULT nowriteraw;
282
283 METHOD int reset {
284         void /* X */ *_kobjt;
285 } DEFAULT noreset;
286
287 METHOD char * shortname {
288         void /* X */ *_kobjt;
289 } DEFAULT noshortname;
290
291 METHOD int open {
292         void /* X */ *_kobjt;
293         void   *_sythn;
294         int     _mode;
295 } DEFAULT noopen;
296
297 METHOD int close {
298         void /* X */ *_kobjt;
299 } DEFAULT noclose;
300
301 METHOD int query {
302         void /* X */ *_kobjt;
303 } DEFAULT noquery;
304
305 METHOD int insync {
306         void /* X */ *_kobjt;
307 } DEFAULT noinsync;
308
309 METHOD int alloc {
310         void /* x */ *_kbojt;
311         uint8_t _chn;
312         uint8_t _note;
313 } DEFAULT noalloc;