Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/20240731130528.12600-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+14 -5
+14 -5
sound/core/ump_convert.c
··· 287 287 return 4; 288 288 } 289 289 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 + 290 299 static int fill_rpn(struct ump_cvt_to_ump_bank *cc, 291 300 union snd_ump_midi2_msg *midi2, 292 301 bool flush) ··· 321 312 midi2->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) | 322 313 cc->cc_data_lsb); 323 314 324 - cc->rpn_set = 0; 325 - cc->nrpn_set = 0; 326 - cc->cc_rpn_msb = cc->cc_rpn_lsb = 0; 327 - cc->cc_data_msb = cc->cc_data_lsb = 0; 328 - cc->cc_data_msb_set = cc->cc_data_lsb_set = 0; 315 + reset_rpn(cc); 329 316 return 1; 330 317 } 331 318 ··· 379 374 ret = fill_rpn(cc, midi2, true); 380 375 cc->rpn_set = 1; 381 376 cc->cc_rpn_msb = buf[2]; 377 + if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f) 378 + reset_rpn(cc); 382 379 return ret; 383 380 case UMP_CC_RPN_LSB: 384 381 ret = fill_rpn(cc, midi2, true); 385 382 cc->rpn_set = 1; 386 383 cc->cc_rpn_lsb = buf[2]; 384 + if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f) 385 + reset_rpn(cc); 387 386 return ret; 388 387 case UMP_CC_NRPN_MSB: 389 388 ret = fill_rpn(cc, midi2, true);