29 #include "../seq_lock.h"
31 #include <linux/slab.h>
37 #define SNDRV_SEQ_OSS_MAX_MIDI_NAME 30
58 static int max_midi_devs;
83 if (! clinfo || ! pinfo) {
90 if (clinfo->
client == client)
93 pinfo->
addr.port = -1;
112 mdev = midi_devs[
dev];
115 spin_unlock_irqrestore(®ister_lock, flags);
130 for (i = 0; i < max_midi_devs; i++) {
132 if (mdev && mdev->
client == client && mdev->
port == port) {
135 spin_unlock_irqrestore(®ister_lock, flags);
139 spin_unlock_irqrestore(®ister_lock, flags);
144 #define PERM_WRITE (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE)
145 #define PERM_READ (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ)
168 if ((mdev = find_slot(pinfo->
addr.client, pinfo->
addr.port)) !=
NULL) {
205 for (i = 0; i < max_midi_devs; i++) {
206 if (midi_devs[i] ==
NULL)
209 if (i >= max_midi_devs) {
211 spin_unlock_irqrestore(®ister_lock, flags);
220 spin_unlock_irqrestore(®ister_lock, flags);
235 if ((mdev = find_slot(client, port)) !=
NULL) {
238 spin_unlock_irqrestore(®ister_lock, flags);
246 for (index = max_midi_devs - 1; index >= 0; index--) {
247 if (midi_devs[index])
250 max_midi_devs = index + 1;
251 spin_unlock_irqrestore(®ister_lock, flags);
267 for (i = 0; i < max_midi_devs; i++) {
268 if ((mdev = midi_devs[i]) !=
NULL) {
276 spin_unlock_irqrestore(®ister_lock, flags);
322 return get_mdev(dev);
336 if ((mdev = get_mididev(dp, dev)) ==
NULL)
357 if ((mdev->
opened & perm) == perm) {
364 memset(&subs, 0,
sizeof(subs));
402 if ((mdev = get_mididev(dp, dev)) ==
NULL)
410 memset(&subs, 0,
sizeof(subs));
440 if ((mdev = get_mididev(dp, dev)) ==
NULL)
462 if ((mdev = get_mididev(dp, dev)) ==
NULL)
474 memset(&ev, 0,
sizeof(ev));
481 snd_seq_oss_dispatch(dp, &ev, 0, 0);
483 for (c = 0; c < 16; c++) {
487 snd_seq_oss_dispatch(dp, &ev, 0, 0);
491 snd_seq_oss_dispatch(dp, &ev, 0, 0);
494 snd_seq_oss_dispatch(dp, &ev, 0, 0);
511 if ((mdev = get_mididev(dp, dev)) ==
NULL)
539 rc = send_synth_event(dp, ev, mdev->
seq_device);
541 rc = send_midi_event(dp, ev, mdev);
555 memset(&ossev, 0,
sizeof(ossev));
584 ossev.v.parm = ev->
data.
note.velocity;
585 ossev.v.chn = ev->
data.
note.channel;
618 if (!dp->
timer->running)
644 if ((mdev = get_mididev(dp, dev)) ==
NULL)
647 snd_seq_oss_fill_addr(dp, ev, mdev->
client, mdev->
port);
663 if ((mdev = get_mididev(dp, dev)) ==
NULL)
674 #ifdef CONFIG_PROC_FS
698 snd_iprintf(buf,
"\nNumber of MIDI devices: %d\n", max_midi_devs);
699 for (i = 0; i < max_midi_devs; i++) {
700 snd_iprintf(buf,
"\nmidi %d: ", i);
703 snd_iprintf(buf,
"*empty*\n");
706 snd_iprintf(buf,
"[%s] ALSA port %d:%d\n", mdev->
name,
708 snd_iprintf(buf,
" capability %s / opened %s\n",
709 capmode_str(mdev->
flags),
710 capmode_str(mdev->
opened));