From cd654efa6a356be827da26435a7a57c2d87fbc78 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 11 May 2026 13:59:33 +0200 Subject: [PATCH] audioconvert: support Midi control messages as well --- spa/plugins/audioconvert/audioconvert.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index b6086a1d2..4bc51c273 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -1906,16 +1906,23 @@ static int apply_props(struct impl *this, const struct spa_pod *param) return changed; } -static int apply_midi(struct impl *this, const struct spa_pod *value) +static int apply_midi(struct impl *this, uint32_t type, const struct spa_pod *value) { struct props *p = &this->props; - uint8_t ev[8]; + uint8_t evd[8]; + const uint8_t *ev; int ev_size; - const uint32_t *body = SPA_POD_BODY_CONST(value); size_t size = SPA_POD_BODY_SIZE(value); uint64_t state = 0; - ev_size = spa_ump_to_midi(&body, &size, ev, sizeof(ev), &state); + if (type == SPA_CONTROL_UMP) { + const uint32_t *body = SPA_POD_BODY_CONST(value); + ev_size = spa_ump_to_midi(&body, &size, evd, sizeof(evd), &state); + ev = evd; + } else { + ev_size = size; + ev = SPA_POD_BODY_CONST(value); + } if (ev_size < 3) return -EINVAL; @@ -3471,7 +3478,8 @@ static int channelmix_process_apply_sequence(struct impl *this, if (prev) { switch (prev->type) { case SPA_CONTROL_UMP: - apply_midi(this, &prev->value); + case SPA_CONTROL_Midi: + apply_midi(this, prev->type, &prev->value); break; case SPA_CONTROL_Properties: apply_props(this, &prev->value);