[PATCH 2/4] ALSA: seq: ump: Clear stale selectors in sequencer conversion
From: HyeongJun An
Date: Sun Nov 08 2026 - 07:50:27 EST
From: Alyandra Zahran Nadhir <alyandra5b@xxxxxxxxx>
The sequencer MIDI 2.0 converter tracks RPN and NRPN selection flags
separately. When the controller stream switches selector type, the
previous flag remains set; fill_rpn() checks RPN first and can encode
subsequent NRPN data as RPN.
Flush pending parameter data with the old selector, then clear the
opposite selector before recording new state in both CC and Control14
event paths.
Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Alyandra Zahran Nadhir <alyandra5b@xxxxxxxxx>
[HyeongJun An: drop the KUnit test, fix the subject, add Fixes and stable Cc]
Signed-off-by: HyeongJun An <sammiee5311@xxxxxxxxx>
---
sound/core/seq/seq_ump_convert.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
index ff4ee26adad1..bac37d4ef43c 100644
--- a/sound/core/seq/seq_ump_convert.c
+++ b/sound/core/seq/seq_ump_convert.c
@@ -847,6 +847,7 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
switch (index) {
case UMP_CC_RPN_MSB:
ret = fill_rpn(cc, data, channel, true);
+ cc->nrpn_set = 0;
cc->rpn_set = 1;
cc->cc_rpn_msb = val;
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
@@ -854,6 +855,7 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
break;
case UMP_CC_RPN_LSB:
ret = fill_rpn(cc, data, channel, true);
+ cc->nrpn_set = 0;
cc->rpn_set = 1;
cc->cc_rpn_lsb = val;
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
@@ -861,11 +863,13 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
break;
case UMP_CC_NRPN_MSB:
ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 0;
cc->nrpn_set = 1;
cc->cc_nrpn_msb = val;
break;
case UMP_CC_NRPN_LSB:
ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 0;
cc->nrpn_set = 1;
cc->cc_nrpn_lsb = val;
break;
@@ -975,6 +979,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
case UMP_CC_RPN_MSB:
case UMP_CC_RPN_LSB:
ret = fill_rpn(cc, data, channel, true);
+ cc->nrpn_set = 0;
cc->cc_rpn_msb = msb;
cc->cc_rpn_lsb = lsb;
cc->rpn_set = 1;
@@ -984,6 +989,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
case UMP_CC_NRPN_MSB:
case UMP_CC_NRPN_LSB:
ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 0;
cc->cc_nrpn_msb = msb;
cc->nrpn_set = 1;
cc->cc_nrpn_lsb = lsb;
--
2.43.0