aseqdump: increase verbosity

Include the names of parameters when printing events instead of just
showing the raw values.
This commit is contained in:
Clemens Ladisch 2008-02-21 09:11:58 +01:00
parent 8f017f1618
commit 8497258145

View file

@ -133,71 +133,75 @@ static void dump_event(const snd_seq_event_t *ev)
printf("%3d:%-3d ", ev->source.client, ev->source.port); printf("%3d:%-3d ", ev->source.client, ev->source.port);
switch (ev->type) { switch (ev->type) {
case SND_SEQ_EVENT_NOTEON: case SND_SEQ_EVENT_NOTEON:
printf("Note on %2d %3d %3d\n", if (ev->data.note.velocity)
ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); printf("Note on %2d, note %d, velocity %d\n",
ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
else
printf("Note off %2d, note %d\n",
ev->data.note.channel, ev->data.note.note);
break; break;
case SND_SEQ_EVENT_NOTEOFF: case SND_SEQ_EVENT_NOTEOFF:
printf("Note off %2d %3d %3d\n", printf("Note off %2d, note %d, velocity %d\n",
ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
break; break;
case SND_SEQ_EVENT_KEYPRESS: case SND_SEQ_EVENT_KEYPRESS:
printf("Polyphonic aftertouch %2d %3d %3d\n", printf("Polyphonic aftertouch %2d, note %d, value %d\n",
ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
break; break;
case SND_SEQ_EVENT_CONTROLLER: case SND_SEQ_EVENT_CONTROLLER:
printf("Control change %2d %3d %3d\n", printf("Control change %2d, controller %d, value %d\n",
ev->data.control.channel, ev->data.control.param, ev->data.control.value); ev->data.control.channel, ev->data.control.param, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_PGMCHANGE: case SND_SEQ_EVENT_PGMCHANGE:
printf("Program change %2d %3d\n", printf("Program change %2d, program %d\n",
ev->data.control.channel, ev->data.control.value); ev->data.control.channel, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_CHANPRESS: case SND_SEQ_EVENT_CHANPRESS:
printf("Channel aftertouch %2d %3d\n", printf("Channel aftertouch %2d, value %d\n",
ev->data.control.channel, ev->data.control.value); ev->data.control.channel, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_PITCHBEND: case SND_SEQ_EVENT_PITCHBEND:
printf("Pitch bend %2d %6d\n", printf("Pitch bend %2d, value %d\n",
ev->data.control.channel, ev->data.control.value); ev->data.control.channel, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_CONTROL14: case SND_SEQ_EVENT_CONTROL14:
printf("Control change %2d %3d %5d\n", printf("Control change %2d, controller %d, value %5d\n",
ev->data.control.channel, ev->data.control.param, ev->data.control.value); ev->data.control.channel, ev->data.control.param, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_NONREGPARAM: case SND_SEQ_EVENT_NONREGPARAM:
printf("Non-reg. parameter %2d %5d %5d\n", printf("Non-reg. parameter %2d, parameter %d, value %d\n",
ev->data.control.channel, ev->data.control.param, ev->data.control.value); ev->data.control.channel, ev->data.control.param, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_REGPARAM: case SND_SEQ_EVENT_REGPARAM:
printf("Reg. parameter %2d %5d %5d\n", printf("Reg. parameter %2d, parameter %d, value %d\n",
ev->data.control.channel, ev->data.control.param, ev->data.control.value); ev->data.control.channel, ev->data.control.param, ev->data.control.value);
break; break;
case SND_SEQ_EVENT_SONGPOS: case SND_SEQ_EVENT_SONGPOS:
printf("Song position pointer %5d\n", printf("Song position pointer value %d\n",
ev->data.control.value); ev->data.control.value);
break; break;
case SND_SEQ_EVENT_SONGSEL: case SND_SEQ_EVENT_SONGSEL:
printf("Song select %3d\n", printf("Song select value %d\n",
ev->data.control.value); ev->data.control.value);
break; break;
case SND_SEQ_EVENT_QFRAME: case SND_SEQ_EVENT_QFRAME:
printf("MTC quarter frame %02xh\n", printf("MTC quarter frame %02xh\n",
ev->data.control.value); ev->data.control.value);
break; break;
case SND_SEQ_EVENT_TIMESIGN: case SND_SEQ_EVENT_TIMESIGN:
// XXX how is this encoded? // XXX how is this encoded?
printf("SMF time signature (%#08x)\n", printf("SMF time signature (%#010x)\n",
ev->data.control.value); ev->data.control.value);
break; break;
case SND_SEQ_EVENT_KEYSIGN: case SND_SEQ_EVENT_KEYSIGN:
// XXX how is this encoded? // XXX how is this encoded?
printf("SMF key signature (%#08x)\n", printf("SMF key signature (%#010x)\n",
ev->data.control.value); ev->data.control.value);
break; break;
case SND_SEQ_EVENT_START: case SND_SEQ_EVENT_START:
if (ev->source.client == SND_SEQ_CLIENT_SYSTEM && if (ev->source.client == SND_SEQ_CLIENT_SYSTEM &&
ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER) ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER)
printf("Queue start %d\n", printf("Queue start queue %d\n",
ev->data.queue.queue); ev->data.queue.queue);
else else
printf("Start\n"); printf("Start\n");
@ -205,7 +209,7 @@ static void dump_event(const snd_seq_event_t *ev)
case SND_SEQ_EVENT_CONTINUE: case SND_SEQ_EVENT_CONTINUE:
if (ev->source.client == SND_SEQ_CLIENT_SYSTEM && if (ev->source.client == SND_SEQ_CLIENT_SYSTEM &&
ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER) ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER)
printf("Queue continue %d\n", printf("Queue continue queue %d\n",
ev->data.queue.queue); ev->data.queue.queue);
else else
printf("Continue\n"); printf("Continue\n");
@ -213,19 +217,19 @@ static void dump_event(const snd_seq_event_t *ev)
case SND_SEQ_EVENT_STOP: case SND_SEQ_EVENT_STOP:
if (ev->source.client == SND_SEQ_CLIENT_SYSTEM && if (ev->source.client == SND_SEQ_CLIENT_SYSTEM &&
ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER) ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER)
printf("Queue stop %d\n", printf("Queue stop queue %d\n",
ev->data.queue.queue); ev->data.queue.queue);
else else
printf("Stop\n"); printf("Stop\n");
break; break;
case SND_SEQ_EVENT_SETPOS_TICK: case SND_SEQ_EVENT_SETPOS_TICK:
printf("Set tick queue pos. %d\n", ev->data.queue.queue); printf("Set tick queue pos. queue %d\n", ev->data.queue.queue);
break; break;
case SND_SEQ_EVENT_SETPOS_TIME: case SND_SEQ_EVENT_SETPOS_TIME:
printf("Set rt queue pos. %d\n", ev->data.queue.queue); printf("Set rt queue pos. queue %d\n", ev->data.queue.queue);
break; break;
case SND_SEQ_EVENT_TEMPO: case SND_SEQ_EVENT_TEMPO:
printf("Set queue tempo %d\n", ev->data.queue.queue); printf("Set queue tempo queue %d\n", ev->data.queue.queue);
break; break;
case SND_SEQ_EVENT_CLOCK: case SND_SEQ_EVENT_CLOCK:
printf("Clock\n"); printf("Clock\n");
@ -234,7 +238,7 @@ static void dump_event(const snd_seq_event_t *ev)
printf("Tick\n"); printf("Tick\n");
break; break;
case SND_SEQ_EVENT_QUEUE_SKEW: case SND_SEQ_EVENT_QUEUE_SKEW:
printf("Queue timer skew %d\n", ev->data.queue.queue); printf("Queue timer skew queue %d\n", ev->data.queue.queue);
break; break;
case SND_SEQ_EVENT_TUNE_REQUEST: case SND_SEQ_EVENT_TUNE_REQUEST:
printf("Tune request\n"); printf("Tune request\n");
@ -246,43 +250,43 @@ static void dump_event(const snd_seq_event_t *ev)
printf("Active Sensing\n"); printf("Active Sensing\n");
break; break;
case SND_SEQ_EVENT_CLIENT_START: case SND_SEQ_EVENT_CLIENT_START:
printf("Client start %d\n", printf("Client start client %d\n",
ev->data.addr.client); ev->data.addr.client);
break; break;
case SND_SEQ_EVENT_CLIENT_EXIT: case SND_SEQ_EVENT_CLIENT_EXIT:
printf("Client exit %d\n", printf("Client exit client %d\n",
ev->data.addr.client); ev->data.addr.client);
break; break;
case SND_SEQ_EVENT_CLIENT_CHANGE: case SND_SEQ_EVENT_CLIENT_CHANGE:
printf("Client changed %d\n", printf("Client changed client %d\n",
ev->data.addr.client); ev->data.addr.client);
break; break;
case SND_SEQ_EVENT_PORT_START: case SND_SEQ_EVENT_PORT_START:
printf("Port start %d:%d\n", printf("Port start %d:%d\n",
ev->data.addr.client, ev->data.addr.port); ev->data.addr.client, ev->data.addr.port);
break; break;
case SND_SEQ_EVENT_PORT_EXIT: case SND_SEQ_EVENT_PORT_EXIT:
printf("Port exit %d:%d\n", printf("Port exit %d:%d\n",
ev->data.addr.client, ev->data.addr.port); ev->data.addr.client, ev->data.addr.port);
break; break;
case SND_SEQ_EVENT_PORT_CHANGE: case SND_SEQ_EVENT_PORT_CHANGE:
printf("Port changed %d:%d\n", printf("Port changed %d:%d\n",
ev->data.addr.client, ev->data.addr.port); ev->data.addr.client, ev->data.addr.port);
break; break;
case SND_SEQ_EVENT_PORT_SUBSCRIBED: case SND_SEQ_EVENT_PORT_SUBSCRIBED:
printf("Port subscribed %d:%d -> %d:%d\n", printf("Port subscribed %d:%d -> %d:%d\n",
ev->data.connect.sender.client, ev->data.connect.sender.port, ev->data.connect.sender.client, ev->data.connect.sender.port,
ev->data.connect.dest.client, ev->data.connect.dest.port); ev->data.connect.dest.client, ev->data.connect.dest.port);
break; break;
case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: case SND_SEQ_EVENT_PORT_UNSUBSCRIBED:
printf("Port unsubscribed %d:%d -> %d:%d\n", printf("Port unsubscribed %d:%d -> %d:%d\n",
ev->data.connect.sender.client, ev->data.connect.sender.port, ev->data.connect.sender.client, ev->data.connect.sender.port,
ev->data.connect.dest.client, ev->data.connect.dest.port); ev->data.connect.dest.client, ev->data.connect.dest.port);
break; break;
case SND_SEQ_EVENT_SYSEX: case SND_SEQ_EVENT_SYSEX:
{ {
unsigned int i; unsigned int i;
printf("System exclusive "); printf("System exclusive ");
for (i = 0; i < ev->data.ext.len; ++i) for (i = 0; i < ev->data.ext.len; ++i)
printf(" %02X", ((unsigned char*)ev->data.ext.ptr)[i]); printf(" %02X", ((unsigned char*)ev->data.ext.ptr)[i]);
printf("\n"); printf("\n");
@ -405,7 +409,7 @@ int main(int argc, char *argv[])
printf("Waiting for data at port %d:0.", printf("Waiting for data at port %d:0.",
snd_seq_client_id(seq)); snd_seq_client_id(seq));
printf(" Press Ctrl+C to end.\n"); printf(" Press Ctrl+C to end.\n");
printf("Source_ Event_________________ Ch _Data__\n"); printf("Source Event Ch Data\n");
signal(SIGINT, sighandler); signal(SIGINT, sighandler);
signal(SIGTERM, sighandler); signal(SIGTERM, sighandler);