25 #include "../seq_lock.h"
27 #include <linux/module.h>
28 #include <linux/slab.h>
33 #define SNDRV_SEQ_OSS_MAX_SYNTH_NAME 30
34 #define MAX_SYSEX_BUFLEN 128
70 static int max_synth_devs;
126 for (i = 0; i < max_synth_devs; i++) {
127 if (synth_devs[i] ==
NULL)
130 if (i >= max_synth_devs) {
132 spin_unlock_irqrestore(®ister_lock, flags);
142 spin_unlock_irqrestore(®ister_lock, flags);
144 #ifdef SNDRV_OSS_INFO_DEV_SYNTH
146 snd_oss_info_register(SNDRV_OSS_INFO_DEV_SYNTH, i, rec->
name);
160 for (index = 0; index < max_synth_devs; index++) {
161 if (synth_devs[index] == rec)
164 if (index >= max_synth_devs) {
165 spin_unlock_irqrestore(®ister_lock, flags);
170 if (index == max_synth_devs - 1) {
171 for (index--; index >= 0; index--) {
172 if (synth_devs[index])
175 max_synth_devs = index + 1;
177 spin_unlock_irqrestore(®ister_lock, flags);
178 #ifdef SNDRV_OSS_INFO_DEV_SYNTH
180 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_SYNTH, rec->
seq_device);
199 rec = synth_devs[
dev];
202 spin_unlock_irqrestore(®ister_lock, flags);
230 info->
arg.app_index = dp->
port;
238 if (!try_module_get(rec->
oper.owner)) {
243 module_put(rec->
oper.owner);
253 module_put(rec->
oper.owner);
257 reset_channels(info);
285 info->
arg.app_index = dp->
port;
320 if (midi_synth_dev.
opened > 0) {
331 module_put(rec->
oper.owner);
353 if (dp->
synths[dev].is_midi)
367 if (! dp->
synths[dev].opened)
369 if (dp->
synths[dev].is_midi)
370 return &midi_synth_dev;
371 if ((rec = get_sdev(dev)) ==
NULL)
391 info->
ch[
i].note = -1;
414 info->
sysex->len = 0;
415 reset_channels(info);
417 if (midi_synth_dev.
opened <= 0)
437 if (rec->
oper.reset) {
441 memset(&ev, 0,
sizeof(ev));
442 snd_seq_oss_fill_addr(dp, &ev, info->
arg.addr.client,
443 info->
arg.addr.port);
445 snd_seq_oss_dispatch(dp, &ev, 0, 0);
457 const char __user *
buf,
int p,
int c)
465 if (is_midi_dev(dp, dev))
467 if ((rec = get_synthdev(dp, dev)) ==
NULL)
473 rc = rec->
oper.load_patch(&dp->
synths[dev].arg, fmt, buf, p, c);
485 rec = get_synthdev(dp, dev);
518 dest = sysex->
buf + sysex->
len;
520 for (i = 0; i < 6; i++) {
521 if (buf[i] == 0xff) {
534 if (sysex->
len && send) {
561 snd_seq_oss_fill_addr(dp, ev, dp->
synths[dev].arg.addr.client,
562 dp->
synths[dev].arg.addr.port);
576 if (is_midi_dev(dp, dev))
578 if ((rec = get_synthdev(dp, dev)) ==
NULL)
583 rc = rec->
oper.ioctl(&dp->
synths[dev].arg, cmd, addr);
614 if (dp->
synths[dev].is_midi) {
623 if ((rec = get_synthdev(dp, dev)) ==
NULL)
636 #ifdef CONFIG_PROC_FS
646 snd_iprintf(buf,
"\nNumber of synth devices: %d\n", max_synth_devs);
647 for (i = 0; i < max_synth_devs; i++) {
648 snd_iprintf(buf,
"\nsynth %d: ", i);
651 snd_iprintf(buf,
"*empty*\n");
654 snd_iprintf(buf,
"[%s]\n", rec->
name);
655 snd_iprintf(buf,
" type 0x%x : subtype 0x%x : voices %d\n",
658 snd_iprintf(buf,
" capabilities : ioctl %s / load_patch %s\n",