From: HyeongJun An <sammiee5311@gmail.com>
To: Takashi Iwai <tiwai@suse.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Mark Brown <broonie@kernel.org>,
Shuah Khan <shuah@kernel.org>,
linux-sound@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
HyeongJun An <sammiee5311@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 1/2] ALSA: seq: ump: Don't drop MIDI 2.0 RPN and NRPN for MIDI 1.0 clients
Date: Sun, 22 Nov 2026 19:36:10 +0900 [thread overview]
Message-ID: <20261122103611.3264343-2-sammiee5311@gmail.com> (raw)
In-Reply-To: <20261122103611.3264343-1-sammiee5311@gmail.com>
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@vger.kernel.org
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
---
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
next prev parent reply other threads:[~2026-11-22 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 10:36 [PATCH 0/2] ALSA: seq: ump: Convert " HyeongJun An
2026-11-22 10:36 ` HyeongJun An [this message]
2026-11-22 10:36 ` [PATCH 2/2] selftests/alsa: Test the sequencer UMP MIDI 2.0 RPN conversion HyeongJun An
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261122103611.3264343-2-sammiee5311@gmail.com \
--to=sammiee5311@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®