[ALSA] seq_midi_event: prevent running status after system messages
authorClemens Ladisch <clemens@ladisch.de>
Fri, 10 Aug 2007 07:39:14 +0000 (09:39 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:58:36 +0000 (15:58 +0200)
Reset the event type after encoding a system message to prevent any
following data bytes from being interpreted as data for a running status
system message, which is not allowed in MIDI.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/core/seq/seq_midi_event.c

index cb38ff33f628b8b5249090ca6892d5a626213b78..45ba6fc4646ad06454455eb54afe11d50984392d 100644 (file)
@@ -283,6 +283,8 @@ int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c,
                ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED;
                if (status_event[dev->type].encode) /* set data values */
                        status_event[dev->type].encode(dev, ev);
+               if (dev->type >= ST_SPECIAL)
+                       dev->type = ST_INVALID;
                rc = 1;
        } else  if (dev->type == ST_SYSEX) {
                if (c == MIDI_CMD_COMMON_SYSEX_END ||