Skip to content

Commit 8efab1c

Browse files
fix handling of MIDI controller MSB & LSB values
The MIDI specification makes it quite clear that when a receiver receives the MSB of a 14 bit controller value, it should consider the LSB reset to zero. This has been an error in Ardour for many, many years, though likely of little consequence
1 parent da520ce commit 8efab1c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libs/midi++2/channel.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ Channel::process_controller (Parser & parser, EventTwoBytes *tb)
272272
if (tb->controller_number < 32) { /* unsigned: no test for >= 0 */
273273

274274
/* if this controller is already known to use 14 bits,
275-
then treat this value as the MSB, and combine it
276-
with the existing LSB.
275+
then treat this value as the MSB, and as per MIDI spec, set
276+
LSB to zero.
277277
278278
otherwise, just treat it as a 7 bit value, and set
279279
it directly.
@@ -282,7 +282,7 @@ Channel::process_controller (Parser & parser, EventTwoBytes *tb)
282282
cv = (unsigned short) _controller_val[tb->controller_number];
283283

284284
if (_controller_14bit[tb->controller_number]) {
285-
cv = ((tb->value & 0x7f) << 7) | (cv & 0x7f);
285+
cv = (tb->value & 0x7f) << 7);
286286
} else {
287287
cv = tb->value;
288288
}

0 commit comments

Comments
 (0)