mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:25:43 +01:00
aseqdump: Support of UMP 8-bit SysEx messages
Add the support to dump UMP 8-bit SysEx messages. A slight code refactoring to share the code snippet between 7bit and 8bit SysEx handling, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
7de3cd3b8d
commit
df736ad67a
1 changed files with 35 additions and 7 deletions
|
@ -668,13 +668,10 @@ static unsigned char ump_sysex7_data(const unsigned int *ump,
|
||||||
return (ump[offset / 4] >> ((3 - (offset & 3)) * 8)) & 0xff;
|
return (ump[offset / 4] >> ((3 - (offset & 3)) * 8)) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_ump_sysex_event(const unsigned int *ump)
|
static void dump_ump_sysex_status(const char *prefix, unsigned int status)
|
||||||
{
|
{
|
||||||
int i, length;
|
printf("%s ", prefix);
|
||||||
|
switch (status) {
|
||||||
printf("Group %2d, ", group_number(snd_ump_msg_group(ump)));
|
|
||||||
printf("SysEx ");
|
|
||||||
switch (snd_ump_sysex_msg_status(ump)) {
|
|
||||||
case SND_UMP_SYSEX_STATUS_SINGLE:
|
case SND_UMP_SYSEX_STATUS_SINGLE:
|
||||||
printf("Single ");
|
printf("Single ");
|
||||||
break;
|
break;
|
||||||
|
@ -688,10 +685,17 @@ static void dump_ump_sysex_event(const unsigned int *ump)
|
||||||
printf("End ");
|
printf("End ");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknown(0x%x)", snd_ump_sysex_msg_status(ump));
|
printf("(0x%04x)", status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_ump_sysex_event(const unsigned int *ump)
|
||||||
|
{
|
||||||
|
int i, length;
|
||||||
|
|
||||||
|
printf("Group %2d, ", group_number(snd_ump_msg_group(ump)));
|
||||||
|
dump_ump_sysex_status("SysEx", snd_ump_sysex_msg_status(ump));
|
||||||
length = snd_ump_sysex_msg_length(ump);
|
length = snd_ump_sysex_msg_length(ump);
|
||||||
printf(" length %d ", length);
|
printf(" length %d ", length);
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
|
@ -699,6 +703,27 @@ static void dump_ump_sysex_event(const unsigned int *ump)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned char ump_sysex8_data(const unsigned int *ump,
|
||||||
|
unsigned int offset)
|
||||||
|
{
|
||||||
|
offset += 3;
|
||||||
|
return (ump[offset / 4] >> ((3 - (offset & 3)) * 8)) & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_ump_sysex8_event(const unsigned int *ump)
|
||||||
|
{
|
||||||
|
int i, length;
|
||||||
|
|
||||||
|
printf("Group %2d, ", group_number(snd_ump_msg_group(ump)));
|
||||||
|
dump_ump_sysex_status("SysEx8", snd_ump_sysex_msg_status(ump));
|
||||||
|
length = snd_ump_sysex_msg_length(ump);
|
||||||
|
printf(" length %d ", length);
|
||||||
|
printf(" stream %d ", (ump[0] >> 8) & 0xff);
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
printf("%s%02x", i ? ":" : "", ump_sysex8_data(ump, i));
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void print_ump_string(const unsigned int *ump, unsigned int fmt,
|
static void print_ump_string(const unsigned int *ump, unsigned int fmt,
|
||||||
unsigned int offset, int maxlen)
|
unsigned int offset, int maxlen)
|
||||||
{
|
{
|
||||||
|
@ -965,6 +990,9 @@ static void dump_ump_event(const snd_seq_ump_event_t *ev)
|
||||||
case SND_UMP_MSG_TYPE_DATA:
|
case SND_UMP_MSG_TYPE_DATA:
|
||||||
dump_ump_sysex_event(ev->ump);
|
dump_ump_sysex_event(ev->ump);
|
||||||
break;
|
break;
|
||||||
|
case SND_UMP_MSG_TYPE_EXTENDED_DATA:
|
||||||
|
dump_ump_sysex8_event(ev->ump);
|
||||||
|
break;
|
||||||
case SND_UMP_MSG_TYPE_FLEX_DATA:
|
case SND_UMP_MSG_TYPE_FLEX_DATA:
|
||||||
dump_ump_flex_data_event(ev->ump);
|
dump_ump_flex_data_event(ev->ump);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue