Hi all,
Not sure if I’m right on this one, but I though I’ll report it just in case.
When sending Pitch Bend through a preset and capturing the sent MIDI, the message seems to be incorrect:
midi.sendPitchBend (PORT_1, 1, 0)
E0 00 64
midi.sendPitchBend (PORT_1, 1, 1)
E0 01 64
Using the firmware repo, I prepared a small test changing MainComponent.cpp
from the outgoingmidi example:
(outgoingmidi/MianComponent.cpp line 11)
MidiMessage pw = MidiMessage::pitchWheel(1, value);
device1.sendMessageNow(pw);
The values that I see in my MIDI monitoring tool are the same as when trying it on a LUA preset.
When going through the source code of the firmware, and after quite some diving, I see that the MIDI message seems to be prepared correctly, but the usb_midi.h
code handles PitchBend via positive and negative values:
(usb_midi.h line 146)
void sendPitchBend (int value, uint8_t channel, uint8_t cable = 0) __attribute__((always_inline))
{
if (value < -8192)
{
value = -8192;
}
else if (value > 8191)
{
value = 8191;
}
value += 8192;
send (0xE0, value, value >> 7, channel, cable);
}
Which I believe does not play well with the way the a PitchBend message is prepared (0 to 16383, which seems to be right based on the MIDI specification).
Commenting out all the data mingling in usb_midi.h
“fixes” the issue, although that might not be the intended solution. Obviously, considering the limits in this code as 0 to 16383 might be the way to go.
MidiMessage pw = MidiMessage::pitchWheel(1, 0);
E0 00 00
MidiMessage pw = MidiMessage::pitchWheel(1, 1);
E0 01 00