From bf10458604276c457e28ef36030a547672db4b24 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 19 Aug 2025 17:37:40 +0200 Subject: [PATCH] tools: handle both Midi and UMP when recording The midifile can handle both UMP and Midi formats when saving so allow this here. --- src/tools/pw-cat.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index b2e534e00..db96b8c2e 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -1192,14 +1192,20 @@ static int midi_record(struct data *d, void *src, unsigned int n_frames, bool *n while (spa_pod_parser_get_control_body(&parser, &c, &c_body) >= 0) { struct midi_event ev; - if (c.type != SPA_CONTROL_UMP) + switch (c.type) { + case SPA_CONTROL_UMP: + ev.type = MIDI_EVENT_TYPE_UMP; + break; + case SPA_CONTROL_Midi: + ev.type = MIDI_EVENT_TYPE_MIDI1; + break; + default: continue; - + } ev.track = 0; ev.sec = (offset + c.offset) / (float) d->position->clock.rate.denom; ev.data = (uint8_t*)c_body; ev.size = c.value.size; - ev.type = MIDI_EVENT_TYPE_UMP; if (d->verbose) midi_file_dump_event(stderr, &ev);