This is an example on how to attach your own callbacks for receiving MIDI input. This example has fine-grained callbacks, i.e. one for each message type (Note On, Note Off, Control Change, System Exclusive ...).
None.
None.
Serial << "Note Off: " << channel << ", note " << note << ", velocity "
<< velocity << ", " << cable << endl;
}
Serial << "Note On: " << channel << ", note " << note << ", velocity "
<< velocity << ", " << cable << endl;
}
Serial << "Key Pressure: " << channel << ", note " << note << ", pressure "
<< pressure << ", " << cable << endl;
}
Serial << "Control Change: " << channel << ", controller " << controller
<< ", value " << value << ", " << cable << endl;
}
Serial << "Program Change: " << channel << ", program " << program << ", "
<< cable << endl;
}
Serial << "Channel Pressure: " << channel << ", pressure " << pressure
<< ", " << cable << endl;
}
Serial << "Pitch Bend: " << channel << ", bend " << bend << ", " << cable
<< endl;
}
Serial << F(
"System Exclusive: [") << se.
length <<
"] "
}
Serial << "MTC Quarter Frame: " << data << ", " << cable << endl;
}
Serial << "Song Position Pointer: " << beats << ", " << cable << endl;
}
Serial << "Song Select: " << songnumber << ", " << cable << endl;
}
Serial << "Tune Request: " << cable << endl;
}
void onClock(
Cable cable) { Serial <<
"Timing Clock: " << cable << endl; }
void onStart(
Cable cable) { Serial <<
"Start: " << cable << endl; }
void onStop(
Cable cable) { Serial <<
"Stop: " << cable << endl; }
Serial << "Active Sensing: " << cable << endl;
}
Serial << "System Reset: " << cable << endl;
}
} callback;
void setup() {
Serial.begin(115200);
}
void loop() {
}
The main header file that includes all Control-Surface header files.
A type-safe class for MIDI USB Cable numbers.
A type-safe class for MIDI channels.
void onTimeCodeQuarterFrame(uint8_t data, Cable cable)
void onPitchBend(Channel channel, uint16_t bend, Cable cable)
void onSystemReset(Cable cable)
void onContinue(Cable cable)
void onSystemExclusive(SysExMessage message)
void onActiveSensing(Cable cable)
void onProgramChange(Channel channel, uint8_t program, Cable cable)
void onNoteOff(Channel channel, uint8_t note, uint8_t velocity, Cable cable)
void onStart(Cable cable)
void onNoteOn(Channel channel, uint8_t note, uint8_t velocity, Cable cable)
void onControlChange(Channel channel, uint8_t controller, uint8_t value, Cable cable)
void onSongPosition(uint16_t beats, Cable cable)
void onTuneRequest(Cable cable)
void onSongSelect(uint8_t songnumber, Cable cable)
void onKeyPressure(Channel channel, uint8_t note, uint8_t pressure, Cable cable)
void onChannelPressure(Channel channel, uint8_t pressure, Cable cable)
void onClock(Cable cable)
void update() override
Poll the backend (if necessary) and invoke the callbacks for any received MIDI messages,...
void begin() override
Initialize.
void setCallbacks(MIDI_Callbacks *cb)
Set the callbacks that will be called when a MIDI message is received.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.