mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 15:46:31 +01:00
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 <tiwai@suse.de>
This commit is contained in:
parent
506097ebb1
commit
be6356d847
1 changed files with 10 additions and 13 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue