Commit c4558d8e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

simplified swallowing of SysEx messages and unwanted data bytes. Reordered

2004-06-19  Michael Natterer  <mitch@gimp.org>

	* modules/controller_midi.c (midi_read_event): simplified
	swallowing of SysEx messages and unwanted data bytes. Reordered
	and commented stuff to be more readable.
parent a3c08b8d
2004-06-19 Michael Natterer <mitch@gimp.org>
* modules/controller_midi.c (midi_read_event): simplified
swallowing of SysEx messages and unwanted data bytes. Reordered
and commented stuff to be more readable.
2004-06-19 Michael Natterer <mitch@gimp.org>
* modules/Makefile.am
......
......@@ -409,37 +409,47 @@ midi_read_event (GIOChannel *io,
{
if (buf[pos] >= 0xf8) /* realtime messages */
{
/* nop */
switch (buf[pos])
{
case 0xf8: /* timing clock */
case 0xf9: /* (undefined) */
case 0xfa: /* start */
case 0xfb: /* continue */
case 0xfc: /* stop */
case 0xfd: /* (undefined) */
case 0xfe: /* active sensing */
case 0xff: /* system reset */
/* nop */
#if 0
g_print ("MIDI: realtime message (%02x)\n", buf[pos]);
g_print ("MIDI: realtime message (%02x)\n", buf[pos]);
#endif
break;
}
}
else if (buf[pos] >= 0xf0) /* system messages */
else
{
if (buf[pos] == 0xf0) /* sysex start */
{
midi->swallow = TRUE;
midi->swallow = FALSE; /* any status bytes ends swallowing */
D (g_print ("MIDI: sysex start\n"));
}
else
if (buf[pos] >= 0xf0) /* system messages */
{
midi->swallow = FALSE; /* any status bytes ends swallowing */
switch (buf[pos])
{
case 0xf7: /* sysex end */
D (g_print ("MIDI: sysex end\n"));
case 0xf0: /* sysex start */
midi->swallow = TRUE;
D (g_print ("MIDI: sysex start\n"));
break;
case 0xf6: /* tune request */
D (g_print ("MIDI: tune request\n"));
case 0xf1: /* time code */
midi->swallow = TRUE; /* type + data */
D (g_print ("MIDI: time code\n"));
break;
case 0xf5: /* undefined */
case 0xf4: /* undefined */
D (g_print ("MIDI: undefined system message\n"));
case 0xf2: /* song position */
midi->swallow = TRUE; /* lsb + msb */
D (g_print ("MIDI: song position\n"));
break;
case 0xf3: /* song select */
......@@ -448,32 +458,31 @@ midi_read_event (GIOChannel *io,
D (g_print ("MIDI: song select\n"));
break;
case 0xf2: /* song position */
midi->swallow = TRUE; /* lsb + msb */
D (g_print ("MIDI: song position\n"));
case 0xf4: /* (undefined) */
case 0xf5: /* (undefined) */
D (g_print ("MIDI: undefined system message\n"));
break;
case 0xf1: /* time code */
midi->swallow = TRUE; /* type + data */
case 0xf6: /* tune request */
D (g_print ("MIDI: tune request\n"));
break;
D (g_print ("MIDI: time code\n"));
case 0xf7: /* sysex end */
D (g_print ("MIDI: sysex end\n"));
break;
}
}
}
else /* channel messages */
{
midi->swallow = FALSE; /* any status byte ends swallowing */
midi->command = buf[pos] >> 4;
midi->channel = buf[pos] & 0xf;
/* reset running status */
midi->key = -1;
midi->velocity = -1;
midi->msb = -1;
midi->lsb = -1;
else /* channel messages */
{
midi->command = buf[pos] >> 4;
midi->channel = buf[pos] & 0xf;
/* reset running status */
midi->key = -1;
midi->velocity = -1;
midi->msb = -1;
midi->lsb = -1;
}
}
pos++; /* status byte consumed */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment