colorPad function

Uint8List colorPad(
  1. int padRow,
  2. int padColumn,
  3. PadColor color
)

turn on and set the colour of a pad button

Implementation

Uint8List colorPad(int padRow, int padColumn, PadColor color) {
  final sysexHeader = Uint8List.fromList([
    0xF0, // System Exclusive
    0x47, // Akai Manufacturer ID
    0x7F, // The All-Call address
    0x43, // “Fire” product
    0x65, // Write LED cmd
    0x00, // mesg length - high byte
    0x04, // mesg length - low byte
  ]);
  final sysexFooter = Uint8List.fromList([
    0xF7, // End of Exclusive
  ]);

  final ledData = Uint8List.fromList([
    (padRow * 16 + padColumn),
    color.r,
    color.g,
    color.b,
  ]);

  final b = BytesBuilder();
  b.add(sysexHeader);
  b.add(ledData);
  b.add(sysexFooter);

  final midiData = b.toBytes();
  return Uint8List.fromList(midiData);
}