|
arduino-midi
|
Input of Midi Messages from an Arduino Stream (e.g. Serial, Bluetooth Serial or a TCP/IP client). In the constructor you either give a MidiAction (which is used with the default MidiParser) or your own (subclassed) MidiParser to process the midi messages. Messages can be split over multiple reads and running status is supported. More...
#include <MidiStreamIn.h>
Public Member Functions | |
| MidiStreamIn (Stream &stream, MidiAction &action) | |
| Constructor with the input stream and the MidiAction (uses the default MidiParser) | |
| MidiStreamIn (Stream &stream, MidiParser &handler) | |
| Constructor with the input stream and your custom MidiParser (which is not deleted) | |
| ~MidiStreamIn () | |
| Destructor. | |
| virtual void | allNotesOff (int8_t channel=-1) |
| Sends a allNotesOff MIDI command (control change 120) to the output. | |
| virtual void | channelPressure (uint8_t value, int8_t channel=-1) |
| Sends a channelPressure (aftertouch for the whole channel) MIDI command to the output. | |
| virtual void | controlChange (uint8_t msg, uint8_t value, int8_t channel=-1) |
| Sends a control change MIDI command to the output: see MidiControlChange.h for the controller numbers. | |
| virtual ConnectionStatus | getConnectionStatus () |
| Determines the connection status. | |
| virtual void | localControl (bool active, int8_t channel=-1) |
| Sends a localControl MIDI command (control change 122) to the output. | |
| bool | loop () |
| virtual void | noteOff (uint8_t note, uint8_t velocity, int8_t channel=-1) |
| Sends a noteOff MIDI command to the output. | |
| virtual void | noteOn (uint8_t note, uint8_t velocity, int8_t channel=-1) |
| Sends a noteOn MIDI command to the output. | |
| virtual void | pitchBend (uint16_t value, int8_t channel=-1) |
| Sends a pitchBend MIDI command to the output: value 0..16383, center 8192. | |
| virtual void | polyPressure (uint8_t note, uint8_t value, int8_t channel) |
| Sends a polyPressure (polyphonic aftertouch) MIDI command to the output. | |
| virtual void | polyPressure (uint8_t valuePar, int8_t channel=-1) |
| Deprecated: poly pressure needs a note - use polyPressure(note, value, channel) | |
| virtual void | programChange (uint8_t program, int8_t channel=-1) |
| Sends a programChange MIDI command to the output: program 0..127. | |
| virtual void | resetAllControllers (int8_t channel=-1) |
| Sends a resetAllControllers MIDI command (control change 121) to the output. | |
| virtual void | setDefaultSendingChannel (int8_t channel) |
| Sets the default channel (0..15) for the sending commands: the default is 0. | |
| virtual void | setFilterReceivingChannel (int channel) |
| Activates a filter on receiving messages to the indicated channel. | |
| virtual void | setMidiAction (MidiAction &MidiAction) |
| Defines the MidiAction which receives the events of the inbound processing. | |
| void | setup (Stream *stream, MidiParser *handler, bool releaseHandler) |
| Call setup when created with empty constructor. | |
| void | write (MidiMessage *msg, int len) |
| write multiple MidiMessage objects to final output | |
Static Public Member Functions | |
| static uint8_t | frequencyToNote (float freq) |
| Converts a frequency (in Hz) to the nearest MIDI note (limited to 0..127) | |
| static float | noteToFrequency (uint8_t note) |
| Converts a MIDI note to a frequency in Hz (note 69 = A4 = 440 Hz) | |
Protected Member Functions | |
| uint8_t | getChannel (int8_t ch) |
| void | setConnectionStatus (ConnectionStatus status) |
| void | updateTimestamp (MidiMessage *pMsg) |
| virtual void | writeData (MidiMessage *msg, int len) |
Protected Attributes | |
| uint8_t | buffer [BUFFER_LEN] |
| ConnectionStatus | connectionStatus |
| char * | name |
| MidiMessage | outMessage |
| bool | ownsHandler = false |
| MidiParser * | pHandler = nullptr |
| MidiAction * | pMidiAction |
| Stream * | pStream = nullptr |
| int | receivingChannel = -1 |
| uint8_t | sendingChannel = 0 |
| uint8_t | timestampHigh |
| uint8_t | timestampLow |
Input of Midi Messages from an Arduino Stream (e.g. Serial, Bluetooth Serial or a TCP/IP client). In the constructor you either give a MidiAction (which is used with the default MidiParser) or your own (subclassed) MidiParser to process the midi messages. Messages can be split over multiple reads and running status is supported.
You also need to call the loop method in the loop of your Arduino sketch.
by Phil Schatzmann
| bool midi::MidiStreamIn::loop | ( | ) |
Reads all available bytes and processes the contained midi messages: returns true if some data was processed
|
protectedvirtualinherited |
Reimplemented in midi::MidiBleClient, midi::MidiBleServer, and midi::MidiStreamOut.