arduino_midi_library icon indicating copy to clipboard operation
arduino_midi_library copied to clipboard

mod wheel callback

Open Pomax opened this issue 4 years ago • 4 comments

I see there's a pitch bend callback, but there's no mod wheel (cc01) callback. Can one be added?

Pomax avatar Dec 07 '20 23:12 Pomax

You can use the ControlChange callback and check for CC01 there:

void handleControlChange(byte channel, byte controlNumber, byte value)
{
  if (controlNumber == 1)
  {
    // Handle mod wheel here
  }
}

franky47 avatar Dec 08 '20 06:12 franky47

While true, it's such an integral part of {pitch, mod, notes} that it seems worth giving it a dedicated callback for folks who don't need "all CC" but do need the mod wheel =)

Pomax avatar Dec 08 '20 06:12 Pomax

If you don't need the rest of the CC, you don't have any more code to write, whereas having a separate case for the mod wheel opens a can of worms: each new callback adds two bytes of RAM, so folks who only need modwheel would not benefit from such a change overall.

franky47 avatar Dec 08 '20 06:12 franky47

I see. Could I at least ask that gets added as a code example? Mod wheels are pretty essential, so having the callbacks docs explicitly go "there is no dedicated modwheel callback, because you can already do this with the CC handler in the following way" (or something to that effect) would be super useful documentation.

Pomax avatar Dec 08 '20 19:12 Pomax