[PATCH 1/2] ALSA: seq: ump: Don't drop MIDI 2.0 RPN and NRPN for MIDI 1.0 clients
From: HyeongJun An
Date: Sun Nov 22 2026 - 05:36:32 EST
The cvt_ump_midi2_to_midi1() converts MIDI 2.0 channel voice messages
for a UMP MIDI 1.0 client. It has no case for the RPN and NRPN
messages, so they fall into the default case and are dropped. A pitch
bend range or a tuning set by a MIDI 2.0 client never reaches a MIDI 1.0
client.
The core converter, cvt_ump_midi2_to_legacy(), turns the same messages
into CC 101 and 100 (99 and 98 for NRPN) followed by CC 6 and 38. The
program change case here already sends the bank select CCs ahead of the
program in the same way.
To fix this, deliver the four CCs that cvt_ump_midi2_to_legacy()
produces.
Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: HyeongJun An <sammiee5311@xxxxxxxxx>
---
sound/core/seq/seq_ump_convert.c | 36 ++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
index b42a7ffbf31e..e76fdb54df17 100644
--- a/sound/core/seq/seq_ump_convert.c
+++ b/sound/core/seq/seq_ump_convert.c
@@ -432,6 +432,38 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
atomic, hop);
}
+/* send a MIDI 2.0 RPN/NRPN as the four MIDI 1.0 CCs that select and set it */
+static int cvt_ump_midi2_rpn_to_midi1(struct snd_seq_client *dest,
+ struct snd_seq_client_port *dest_port,
+ struct snd_seq_ump_event *ev_cvt,
+ const union snd_ump_midi2_msg *midi2,
+ int atomic, int hop)
+{
+ union snd_ump_midi1_msg *midi1 = (union snd_ump_midi1_msg *)ev_cvt->ump;
+ bool rpn = midi2->rpn.status == UMP_MSG_STATUS_RPN;
+ u16 v = downscale_32_to_14bit(midi2->rpn.data);
+ const unsigned char cc[4][2] = {
+ { rpn ? UMP_CC_RPN_MSB : UMP_CC_NRPN_MSB, midi2->rpn.bank },
+ { rpn ? UMP_CC_RPN_LSB : UMP_CC_NRPN_LSB, midi2->rpn.index },
+ { UMP_CC_DATA, v >> 7 },
+ { UMP_CC_DATA_LSB, v & 0x7f },
+ };
+ int i, err = 0;
+
+ midi1->cc.status = UMP_MSG_STATUS_CC;
+ for (i = 0; i < ARRAY_SIZE(cc); i++) {
+ midi1->cc.index = cc[i][0];
+ midi1->cc.data = cc[i][1];
+ err = __snd_seq_deliver_single_event(dest, dest_port,
+ (struct snd_seq_event *)ev_cvt,
+ atomic, hop);
+ if (err < 0)
+ return err;
+ }
+
+ return err;
+}
+
/* convert UMP packet from MIDI 2.0 to MIDI 1.0 and deliver it */
static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
struct snd_seq_client_port *dest_port,
@@ -499,6 +531,10 @@ static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
midi1->pb.data_msb = v >> 7;
midi1->pb.data_lsb = v & 0x7f;
break;
+ case UMP_MSG_STATUS_RPN:
+ case UMP_MSG_STATUS_NRPN:
+ return cvt_ump_midi2_rpn_to_midi1(dest, dest_port, &ev_cvt,
+ midi2, atomic, hop);
default:
return 0;
}
--
2.43.0