From: Takashi Iwai Date: Thu, 27 Jun 2024 11:24:11 +0000 (+0200) Subject: aseqdump: Refactor UMP SysEx dump X-Git-Tag: v1.2.13~58 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=be6356d847a780539431de8afcab40b57a8df9cb;p=alsa-utils.git aseqdump: Refactor UMP SysEx dump A slightly better version. The extraction of a SysEx byte from a UMP packet is more complicated than wished, in anyway. Signed-off-by: Takashi Iwai --- diff --git a/seq/aseqdump/aseqdump.c b/seq/aseqdump/aseqdump.c index e1aea4c..b813711 100644 --- a/seq/aseqdump/aseqdump.c +++ b/seq/aseqdump/aseqdump.c @@ -668,9 +668,16 @@ static void dump_ump_system_event(const unsigned int *ump) } } +static unsigned char ump_sysex7_data(const unsigned int *ump, + unsigned int offset) +{ + offset += 2; + return (ump[offset / 4] >> ((3 - (offset & 3)) * 8)) & 0xff; +} + static void dump_ump_sysex_event(const unsigned int *ump) { - int i, offset, length; + int i, length; printf("Group %2d, ", group_number(snd_ump_msg_group(ump))); switch (snd_ump_sysex_msg_status(ump)) { @@ -693,18 +700,8 @@ static void dump_ump_sysex_event(const unsigned int *ump) length = snd_ump_sysex_msg_length(ump); printf(" length %d ", length); - offset = 24; - for (i = 0; i < length; i++) { - if (i) - printf(":"); - printf("%02x", (*ump >> (32 - offset)) & 0x7f); - if (offset < 32) { - offset += 8; - } else { - ump++; - offset = 8; - } - } + for (i = 0; i < length; i++) + printf("%s%02x", i ? ":" : "", ump_sysex7_data(ump, i)); printf("\n"); }