Skip to content

Commit 98ea612

Browse files
committed
ALSA: seq: ump: Explicitly reset RPN with Null RPN
RPN with 127:127 is treated as a Null RPN, just to reset the parameters, and it's not translated to MIDI2. Although the current code can work as is in most cases, better to implement the RPN reset explicitly for Null message. Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent a4ff92f commit 98ea612

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

sound/core/seq/seq_ump_convert.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,15 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,
789789
return 1;
790790
}
791791

792+
static void reset_rpn(struct ump_cvt_to_ump_bank *cc)
793+
{
794+
cc->rpn_set = 0;
795+
cc->nrpn_set = 0;
796+
cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
797+
cc->cc_data_msb = cc->cc_data_lsb = 0;
798+
cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
799+
}
800+
792801
/* set up the MIDI2 RPN/NRPN packet data from the parsed info */
793802
static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
794803
union snd_ump_midi2_msg *data,
@@ -817,11 +826,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
817826
cc->cc_data_lsb);
818827
data->rpn.channel = channel;
819828

820-
cc->rpn_set = 0;
821-
cc->nrpn_set = 0;
822-
cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
823-
cc->cc_data_msb = cc->cc_data_lsb = 0;
824-
cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
829+
reset_rpn(cc);
825830
return 1;
826831
}
827832

@@ -843,11 +848,15 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
843848
ret = fill_rpn(cc, data, channel, true);
844849
cc->rpn_set = 1;
845850
cc->cc_rpn_msb = val;
851+
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
852+
reset_rpn(cc);
846853
return ret;
847854
case UMP_CC_RPN_LSB:
848855
ret = fill_rpn(cc, data, channel, true);
849856
cc->rpn_set = 1;
850857
cc->cc_rpn_lsb = val;
858+
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
859+
reset_rpn(cc);
851860
return ret;
852861
case UMP_CC_NRPN_MSB:
853862
ret = fill_rpn(cc, data, channel, true);
@@ -961,6 +970,8 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
961970
cc->cc_rpn_msb = msb;
962971
cc->cc_rpn_lsb = lsb;
963972
cc->rpn_set = 1;
973+
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
974+
reset_rpn(cc);
964975
return ret;
965976
case UMP_CC_NRPN_MSB:
966977
case UMP_CC_NRPN_LSB:

0 commit comments

Comments
 (0)