Skip to content

Commit 50a6dd1

Browse files
committed
ALSA: 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 e6ce8a2 commit 50a6dd1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

sound/core/ump_convert.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,15 @@ static int cvt_legacy_system_to_ump(struct ump_cvt_to_ump *cvt,
287287
return 4;
288288
}
289289

290+
static void reset_rpn(struct ump_cvt_to_ump_bank *cc)
291+
{
292+
cc->rpn_set = 0;
293+
cc->nrpn_set = 0;
294+
cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
295+
cc->cc_data_msb = cc->cc_data_lsb = 0;
296+
cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
297+
}
298+
290299
static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
291300
union snd_ump_midi2_msg *midi2,
292301
bool flush)
@@ -312,11 +321,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
312321
midi2->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) |
313322
cc->cc_data_lsb);
314323

315-
cc->rpn_set = 0;
316-
cc->nrpn_set = 0;
317-
cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
318-
cc->cc_data_msb = cc->cc_data_lsb = 0;
319-
cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
324+
reset_rpn(cc);
320325
return 1;
321326
}
322327

@@ -374,11 +379,15 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
374379
ret = fill_rpn(cc, midi2, true);
375380
cc->rpn_set = 1;
376381
cc->cc_rpn_msb = buf[2];
382+
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
383+
reset_rpn(cc);
377384
return ret;
378385
case UMP_CC_RPN_LSB:
379386
ret = fill_rpn(cc, midi2, true);
380387
cc->rpn_set = 1;
381388
cc->cc_rpn_lsb = buf[2];
389+
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
390+
reset_rpn(cc);
382391
return ret;
383392
case UMP_CC_NRPN_MSB:
384393
ret = fill_rpn(cc, midi2, true);

0 commit comments

Comments
 (0)