aseqdump: Align outputs of UMP MIDI 1.0 with legacy MIDI 1.0

The outputs from UMP MIDI 1.0 are slightly differently shown as the
legacy MIDI 1.0 (the velocities and values are in hex), which is
rather confusing.  Let's make them look more similar.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2023-07-04 17:42:44 +02:00
parent c41f3cfb2f
commit 8703c08978

View file

@ -306,6 +306,12 @@ static void dump_event(const snd_seq_event_t *ev)
} }
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION #ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
static int pitchbend_value(u8 msb, u8 lsb)
{
int pb = (msb << 7) | lsb;
return pb - 8192;
}
static void dump_ump_midi1_event(const unsigned int *ump) static void dump_ump_midi1_event(const unsigned int *ump)
{ {
const snd_ump_msg_midi1_t *m = (const snd_ump_msg_midi1_t *)ump; const snd_ump_msg_midi1_t *m = (const snd_ump_msg_midi1_t *)ump;
@ -316,31 +322,32 @@ static void dump_ump_midi1_event(const unsigned int *ump)
printf("Group %2d, ", group); printf("Group %2d, ", group);
switch (status) { switch (status) {
case SND_UMP_MSG_NOTE_OFF: case SND_UMP_MSG_NOTE_OFF:
printf("Note off %2d, note %d, velocity 0x%x", printf("Note off %2d, note %d, velocity %d",
channel, m->note_off.note, m->note_off.velocity); channel, m->note_off.note, m->note_off.velocity);
break; break;
case SND_UMP_MSG_NOTE_ON: case SND_UMP_MSG_NOTE_ON:
printf("Note on %2d, note %d, velocity 0x%x", printf("Note on %2d, note %d, velocity %d",
channel, m->note_off.note, m->note_off.velocity); channel, m->note_off.note, m->note_off.velocity);
break; break;
case SND_UMP_MSG_POLY_PRESSURE: case SND_UMP_MSG_POLY_PRESSURE:
printf("Poly pressure %2d, note %d, value 0x%x", printf("Poly pressure %2d, note %d, value %d",
channel, m->poly_pressure.note, m->poly_pressure.data); channel, m->poly_pressure.note, m->poly_pressure.data);
break; break;
case SND_UMP_MSG_CONTROL_CHANGE: case SND_UMP_MSG_CONTROL_CHANGE:
printf("Control change %2d, controller %d, value 0x%x", printf("Control change %2d, controller %d, value %d",
channel, m->control_change.index, m->control_change.data); channel, m->control_change.index, m->control_change.data);
break; break;
case SND_UMP_MSG_PROGRAM_CHANGE: case SND_UMP_MSG_PROGRAM_CHANGE:
printf("Program change %2d, program %d", printf("Program change %2d, program %d",
channel, m->program_change.program); channel, m->program_change.program);
case SND_UMP_MSG_CHANNEL_PRESSURE: case SND_UMP_MSG_CHANNEL_PRESSURE:
printf("Channel pressure %2d, value 0x%x", printf("Channel pressure %2d, value %d",
channel, m->channel_pressure.data); channel, m->channel_pressure.data);
break; break;
case SND_UMP_MSG_PITCHBEND: case SND_UMP_MSG_PITCHBEND:
printf("Pitchbend %2d, value 0x%x", printf("Pitchbend %2d, value %d",
channel, (m->pitchbend.data_msb << 7) | m->pitchbend.data_lsb); channel, pitchbend_value(m->pitchbend.data_msb,
m->pitchbend.data_lsb));
break; break;
default: default:
printf("UMP MIDI1 event: status = %d, channel = %d, 0x%08x", printf("UMP MIDI1 event: status = %d, channel = %d, 0x%08x",