Merge branch 'topic/midi' into for-linus

* topic/midi:
  sound: rawmidi: disable active-sensing-on-close by default
  sound: seq_oss_midi: remove magic numbers
  sound: seq_midi: do not send MIDI reset when closing
  seq-midi: always log message on output overrun
This commit is contained in:
Takashi Iwai 2009-09-10 15:32:56 +02:00
commit 0f23c5cc50
3 changed files with 12 additions and 11 deletions

View file

@ -274,7 +274,7 @@ static int open_substream(struct snd_rawmidi *rmidi,
return err; return err;
substream->opened = 1; substream->opened = 1;
if (substream->use_count++ == 0) if (substream->use_count++ == 0)
substream->active_sensing = 1; substream->active_sensing = 0;
if (mode & SNDRV_RAWMIDI_LFLG_APPEND) if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
substream->append = 1; substream->append = 1;
rmidi->streams[substream->stream].substream_opened++; rmidi->streams[substream->stream].substream_opened++;

View file

@ -20,6 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <sound/asoundef.h>
#include "seq_oss_midi.h" #include "seq_oss_midi.h"
#include "seq_oss_readq.h" #include "seq_oss_readq.h"
#include "seq_oss_timer.h" #include "seq_oss_timer.h"
@ -476,19 +477,20 @@ snd_seq_oss_midi_reset(struct seq_oss_devinfo *dp, int dev)
ev.source.port = dp->port; ev.source.port = dp->port;
if (dp->seq_mode == SNDRV_SEQ_OSS_MODE_SYNTH) { if (dp->seq_mode == SNDRV_SEQ_OSS_MODE_SYNTH) {
ev.type = SNDRV_SEQ_EVENT_SENSING; ev.type = SNDRV_SEQ_EVENT_SENSING;
snd_seq_oss_dispatch(dp, &ev, 0, 0); /* active sensing */ snd_seq_oss_dispatch(dp, &ev, 0, 0);
} }
for (c = 0; c < 16; c++) { for (c = 0; c < 16; c++) {
ev.type = SNDRV_SEQ_EVENT_CONTROLLER; ev.type = SNDRV_SEQ_EVENT_CONTROLLER;
ev.data.control.channel = c; ev.data.control.channel = c;
ev.data.control.param = 123; ev.data.control.param = MIDI_CTL_ALL_NOTES_OFF;
snd_seq_oss_dispatch(dp, &ev, 0, 0); /* all notes off */ snd_seq_oss_dispatch(dp, &ev, 0, 0);
if (dp->seq_mode == SNDRV_SEQ_OSS_MODE_MUSIC) { if (dp->seq_mode == SNDRV_SEQ_OSS_MODE_MUSIC) {
ev.data.control.param = 121; ev.data.control.param =
snd_seq_oss_dispatch(dp, &ev, 0, 0); /* reset all controllers */ MIDI_CTL_RESET_CONTROLLERS;
snd_seq_oss_dispatch(dp, &ev, 0, 0);
ev.type = SNDRV_SEQ_EVENT_PITCHBEND; ev.type = SNDRV_SEQ_EVENT_PITCHBEND;
ev.data.control.value = 0; ev.data.control.value = 0;
snd_seq_oss_dispatch(dp, &ev, 0, 0); /* bender off */ snd_seq_oss_dispatch(dp, &ev, 0, 0);
} }
} }
} }

View file

@ -120,7 +120,8 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, i
return -EINVAL; return -EINVAL;
runtime = substream->runtime; runtime = substream->runtime;
if ((tmp = runtime->avail) < count) { if ((tmp = runtime->avail) < count) {
snd_printd("warning, output event was lost (count = %i, available = %i)\n", count, tmp); if (printk_ratelimit())
snd_printk(KERN_ERR "MIDI output buffer overrun\n");
return -ENOMEM; return -ENOMEM;
} }
if (snd_rawmidi_kernel_write(substream, buf, count) < count) if (snd_rawmidi_kernel_write(substream, buf, count) < count)
@ -236,6 +237,7 @@ static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info
memset(&params, 0, sizeof(params)); memset(&params, 0, sizeof(params));
params.avail_min = 1; params.avail_min = 1;
params.buffer_size = output_buffer_size; params.buffer_size = output_buffer_size;
params.no_active_sensing = 1;
if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, &params)) < 0) { if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, &params)) < 0) {
snd_rawmidi_kernel_release(&msynth->output_rfile); snd_rawmidi_kernel_release(&msynth->output_rfile);
return err; return err;
@ -248,12 +250,9 @@ static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info
static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *info) static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{ {
struct seq_midisynth *msynth = private_data; struct seq_midisynth *msynth = private_data;
unsigned char buf = 0xff; /* MIDI reset */
if (snd_BUG_ON(!msynth->output_rfile.output)) if (snd_BUG_ON(!msynth->output_rfile.output))
return -EINVAL; return -EINVAL;
/* sending single MIDI reset message to shut the device up */
snd_rawmidi_kernel_write(msynth->output_rfile.output, &buf, 1);
snd_rawmidi_drain_output(msynth->output_rfile.output); snd_rawmidi_drain_output(msynth->output_rfile.output);
return snd_rawmidi_kernel_release(&msynth->output_rfile); return snd_rawmidi_kernel_release(&msynth->output_rfile);
} }