Arduino MIDI Library Version 3.2
Public Member Functions | Static Public Member Functions
MIDI_Class Class Reference

The main class for MIDI handling.
See member descriptions to know how to use it, or check out the examples supplied with the library. More...

#include <MIDI.h>

List of all members.

Public Member Functions

 MIDI_Class ()
 Default constructor for MIDI_Class.
 ~MIDI_Class ()
 Default destructor for MIDI_Class.
void begin (const byte inChannel=1)
 Call the begin method in the setup() function of the Arduino.
void sendNoteOn (byte NoteNumber, byte Velocity, byte Channel)
 Send a Note On message.
void sendNoteOff (byte NoteNumber, byte Velocity, byte Channel)
 Send a Note Off message (a real Note Off, not a Note On with null velocity)
void sendProgramChange (byte ProgramNumber, byte Channel)
 Send a Program Change message.
void sendControlChange (byte ControlNumber, byte ControlValue, byte Channel)
 Send a Control Change message.
void sendPitchBend (int PitchValue, byte Channel)
 Send a Pitch Bend message using a signed integer value.
void sendPitchBend (unsigned int PitchValue, byte Channel)
 Send a Pitch Bend message using an unsigned integer value.
void sendPitchBend (double PitchValue, byte Channel)
 Send a Pitch Bend message using a floating point value.
void sendPolyPressure (byte NoteNumber, byte Pressure, byte Channel)
 Send a Polyphonic AfterTouch message (applies to only one specified note)
void sendAfterTouch (byte Pressure, byte Channel)
 Send a MonoPhonic AfterTouch message (applies to all notes)
void sendSysEx (int length, const byte *const array, bool ArrayContainsBoundaries=false)
 Generate and send a System Exclusive frame.
void sendTimeCodeQuarterFrame (byte TypeNibble, byte ValuesNibble)
 Send a MIDI Time Code Quarter Frame.
void sendTimeCodeQuarterFrame (byte data)
 Send a MIDI Time Code Quarter Frame.
void sendSongPosition (unsigned int Beats)
 Send a Song Position Pointer message.
void sendSongSelect (byte SongNumber)
 Send a Song Select message.
void sendTuneRequest ()
 Send a Tune Request message.
void sendRealTime (kMIDIType Type)
 Send a Real Time (one byte) message.
void send (kMIDIType type, byte param1, byte param2, byte channel)
 Generate and send a MIDI message from the values given.
bool read ()
 Read a MIDI message from the serial port using the main input channel (see setInputChannel() for reference).
bool read (const byte Channel)
 Reading/thru-ing method, the same as read() with a given input channel to read on.
kMIDIType getType () const
 Get the last received message's type.
byte getChannel () const
 Get the channel of the message stored in the structure.
byte getData1 () const
 Get the first data byte of the last received message.
byte getData2 () const
 Get the second data byte of the last received message.
const bytegetSysExArray () const
 Get the System Exclusive byte array.
unsigned int getSysExArrayLength () const
 Get the lenght of the System Exclusive array.
bool check () const
 Check if a valid message is stored in the structure.
byte getInputChannel () const
void setInputChannel (const byte Channel)
 Set the value for the input MIDI channel.
void setHandleNoteOff (void(*fptr)(byte channel, byte note, byte velocity))
void setHandleNoteOn (void(*fptr)(byte channel, byte note, byte velocity))
void setHandleAfterTouchPoly (void(*fptr)(byte channel, byte note, byte pressure))
void setHandleControlChange (void(*fptr)(byte channel, byte number, byte value))
void setHandleProgramChange (void(*fptr)(byte channel, byte number))
void setHandleAfterTouchChannel (void(*fptr)(byte channel, byte pressure))
void setHandlePitchBend (void(*fptr)(byte channel, int bend))
void setHandleSystemExclusive (void(*fptr)(byte *array, byte size))
void setHandleTimeCodeQuarterFrame (void(*fptr)(byte data))
void setHandleSongPosition (void(*fptr)(unsigned int beats))
void setHandleSongSelect (void(*fptr)(byte songnumber))
void setHandleTuneRequest (void(*fptr)(void))
void setHandleClock (void(*fptr)(void))
void setHandleStart (void(*fptr)(void))
void setHandleContinue (void(*fptr)(void))
void setHandleStop (void(*fptr)(void))
void setHandleActiveSensing (void(*fptr)(void))
void setHandleSystemReset (void(*fptr)(void))
void disconnectCallbackFromType (kMIDIType Type)
 Detach an external function from the given type.
kThruFilterMode getFilterMode () const
bool getThruState () const
void turnThruOn (kThruFilterMode inThruFilterMode=Full)
 Setter method: turn message mirroring on.
void turnThruOff ()
 Setter method: turn message mirroring off.
void setThruFilterMode (const kThruFilterMode inThruFilterMode)
 Set the filter for thru mirroring.

Static Public Member Functions

static const kMIDIType getTypeFromStatusByte (const byte inStatus)
 Extract an enumerated MIDI type from a status byte.

Detailed Description

The main class for MIDI handling.
See member descriptions to know how to use it, or check out the examples supplied with the library.

Definition at line 122 of file MIDI.h.


Constructor & Destructor Documentation

MIDI_Class::MIDI_Class ( )

Default constructor for MIDI_Class.

Definition at line 22 of file MIDI.cpp.

{ 
    
#if USE_CALLBACKS
    
    // Initialise callbacks to NULL pointer
    mNoteOffCallback                = NULL;
    mNoteOnCallback                 = NULL;
    mAfterTouchPolyCallback         = NULL;
    mControlChangeCallback          = NULL;
    mProgramChangeCallback          = NULL;
    mAfterTouchChannelCallback      = NULL;
    mPitchBendCallback              = NULL;
    mSystemExclusiveCallback        = NULL;
    mTimeCodeQuarterFrameCallback   = NULL;
    mSongPositionCallback           = NULL;
    mSongSelectCallback             = NULL;
    mTuneRequestCallback            = NULL;
    mClockCallback                  = NULL;
    mStartCallback                  = NULL;
    mContinueCallback               = NULL;
    mStopCallback                   = NULL;
    mActiveSensingCallback          = NULL;
    mSystemResetCallback            = NULL;
    
#endif
    
}
MIDI_Class::~MIDI_Class ( )

Default destructor for MIDI_Class.

This is not really useful for the Arduino, as it is never called...

Definition at line 56 of file MIDI.cpp.

{

}

Member Function Documentation

void MIDI_Class::begin ( const byte  inChannel = 1)

Call the begin method in the setup() function of the Arduino.

All parameters are set to their default values:

  • Input channel set to 1 if no value is specified
  • Full thru mirroring

Definition at line 68 of file MIDI.cpp.

{
    
    // Initialise the Serial port
    USE_SERIAL_PORT.begin(MIDI_BAUDRATE);
    
    
#if COMPILE_MIDI_OUT
    
#if USE_RUNNING_STATUS
    
    mRunningStatus_TX = InvalidType;
    
#endif // USE_RUNNING_STATUS
    
#endif // COMPILE_MIDI_OUT
    
    
#if COMPILE_MIDI_IN
    
    mInputChannel = inChannel;
    mRunningStatus_RX = InvalidType;
    mPendingMessageIndex = 0;
    mPendingMessageExpectedLenght = 0;
    
    mMessage.valid = false;
    mMessage.type = InvalidType;
    mMessage.channel = 0;
    mMessage.data1 = 0;
    mMessage.data2 = 0;
    
#endif // COMPILE_MIDI_IN
    
    
#if (COMPILE_MIDI_IN && COMPILE_MIDI_OUT && COMPILE_MIDI_THRU) // Thru
    
    mThruFilterMode = Full;
    mThruActivated = true;
    
#endif // Thru
    
}
bool MIDI_Class::check ( ) const

Check if a valid message is stored in the structure.

Definition at line 901 of file MIDI.cpp.

{ 
    
    return mMessage.valid;

}
void MIDI_Class::disconnectCallbackFromType ( kMIDIType  Type)

Detach an external function from the given type.

Use this method to cancel the effects of setHandle********.

Parameters:
TypeThe type of message to unbind. When a message of this type is received, no function will be called.

Definition at line 949 of file MIDI.cpp.

{
    
    switch (Type) {
        case NoteOff:               mNoteOffCallback = NULL;                break;
        case NoteOn:                mNoteOnCallback = NULL;                 break;
        case AfterTouchPoly:        mAfterTouchPolyCallback = NULL;         break;
        case ControlChange:         mControlChangeCallback = NULL;          break;
        case ProgramChange:         mProgramChangeCallback = NULL;          break;
        case AfterTouchChannel:     mAfterTouchChannelCallback = NULL;      break;
        case PitchBend:             mPitchBendCallback = NULL;              break;
        case SystemExclusive:       mSystemExclusiveCallback = NULL;        break;
        case TimeCodeQuarterFrame:  mTimeCodeQuarterFrameCallback = NULL;   break;
        case SongPosition:          mSongPositionCallback = NULL;           break;
        case SongSelect:            mSongSelectCallback = NULL;             break;
        case TuneRequest:           mTuneRequestCallback = NULL;            break;
        case Clock:                 mClockCallback = NULL;                  break;
        case Start:                 mStartCallback = NULL;                  break;
        case Continue:              mContinueCallback = NULL;               break;
        case Stop:                  mStopCallback = NULL;                   break;
        case ActiveSensing:         mActiveSensingCallback = NULL;          break;
        case SystemReset:           mSystemResetCallback = NULL;            break;
        default:
            break;
    }
    
}
byte MIDI_Class::getChannel ( ) const

Get the channel of the message stored in the structure.

Channel range is 1 to 16. For non-channel messages, this will return 0.

Definition at line 848 of file MIDI.cpp.

{
    
    return mMessage.channel;

}
byte MIDI_Class::getData1 ( ) const

Get the first data byte of the last received message.

Definition at line 857 of file MIDI.cpp.

{
    
    return mMessage.data1;

}
byte MIDI_Class::getData2 ( ) const

Get the second data byte of the last received message.

Definition at line 866 of file MIDI.cpp.

{ 
    
    return mMessage.data2;

}
kThruFilterMode MIDI_Class::getFilterMode ( ) const [inline]

Definition at line 292 of file MIDI.h.

{ return mThruFilterMode; }
byte MIDI_Class::getInputChannel ( ) const [inline]

Definition at line 191 of file MIDI.h.

    {
        return mInputChannel;
    }
const byte * MIDI_Class::getSysExArray ( ) const

Get the System Exclusive byte array.

See also:
getSysExArrayLength to get the array's length in bytes.

Definition at line 878 of file MIDI.cpp.

{ 
    
    return mMessage.sysex_array;

}
unsigned int MIDI_Class::getSysExArrayLength ( ) const

Get the lenght of the System Exclusive array.

It is coded using data1 as LSB and data2 as MSB.

Returns:
The array's length, in bytes.

Definition at line 890 of file MIDI.cpp.

{
    
    unsigned int coded_size = ((unsigned int)(mMessage.data2) << 8) | mMessage.data1;
    
    return (coded_size > MIDI_SYSEX_ARRAY_SIZE) ? MIDI_SYSEX_ARRAY_SIZE : coded_size;
    
}
bool MIDI_Class::getThruState ( ) const [inline]

Definition at line 293 of file MIDI.h.

{ return mThruActivated; }
kMIDIType MIDI_Class::getType ( ) const

Get the last received message's type.

Returns an enumerated type.

See also:
kMIDIType

Definition at line 836 of file MIDI.cpp.

{
    
    return mMessage.type;

}
static const kMIDIType MIDI_Class::getTypeFromStatusByte ( const byte  inStatus) [inline, static]

Extract an enumerated MIDI type from a status byte.

This is a utility static method, used internally, made public so you can handle kMIDITypes more easily.

Definition at line 203 of file MIDI.h.

    {
        if ((inStatus < 0x80) 
            || (inStatus == 0xF4) 
            || (inStatus == 0xF5) 
            || (inStatus == 0xF9) 
            || (inStatus == 0xFD)) return InvalidType; // data bytes and undefined.
        if (inStatus < 0xF0) return (kMIDIType)(inStatus & 0xF0);   // Channel message, remove channel nibble.
        else return (kMIDIType)inStatus;
    }
bool MIDI_Class::read ( const byte  Channel)

Reading/thru-ing method, the same as read() with a given input channel to read on.

Definition at line 481 of file MIDI.cpp.

{
    
    if (inChannel >= MIDI_CHANNEL_OFF) return false; // MIDI Input disabled.
    
    if (parse(inChannel)) {
        
        if (input_filter(inChannel)) {
            
#if (COMPILE_MIDI_OUT && COMPILE_MIDI_THRU)
            thru_filter(inChannel);
#endif
            
#if USE_CALLBACKS
            launchCallback();
#endif
            
            return true;
        }
        
    }
    
    return false;
    
}
bool MIDI_Class::read ( )

Read a MIDI message from the serial port using the main input channel (see setInputChannel() for reference).

Returned value: true if any valid message has been stored in the structure, false if not. A valid message is a message that matches the input channel.

If the Thru is enabled and the messages matches the filter, it is sent back on the MIDI output.

Definition at line 472 of file MIDI.cpp.

{
    
    return read(mInputChannel);
    
}
void MIDI_Class::send ( kMIDIType  type,
byte  data1,
byte  data2,
byte  channel 
)

Generate and send a MIDI message from the values given.

Parameters:
typeThe message type (see type defines for reference)
data1The first data byte.
data2The second data byte (if the message contains only 1 data byte, set this one to 0).
channelThe output channel on which the message will be sent (values from 1 to 16). Note: you cannot send to OMNI.

This is an internal method, use it only if you need to send raw data from your code, at your own risks.

Definition at line 132 of file MIDI.cpp.

{
    
    // Then test if channel is valid
    if (channel >= MIDI_CHANNEL_OFF || channel == MIDI_CHANNEL_OMNI || type < NoteOff) {
        
#if USE_RUNNING_STATUS  
        mRunningStatus_TX = InvalidType;
#endif 
        
        return; // Don't send anything
    }
    
    if (type <= PitchBend) {
        // Channel messages
        
        // Protection: remove MSBs on data
        data1 &= 0x7F;
        data2 &= 0x7F;
        
        byte statusbyte = genstatus(type,channel);
        
#if USE_RUNNING_STATUS
        // Check Running Status
        if (mRunningStatus_TX != statusbyte) {
            // New message, memorise and send header
            mRunningStatus_TX = statusbyte;
            USE_SERIAL_PORT.write(mRunningStatus_TX);
        }
#else
        // Don't care about running status, send the Control byte.
        USE_SERIAL_PORT.write(statusbyte);
#endif
        
        // Then send data
        USE_SERIAL_PORT.write(data1);
        if (type != ProgramChange && type != AfterTouchChannel) {
            USE_SERIAL_PORT.write(data2);
        }
        return;
    }
    if (type >= TuneRequest && type <= SystemReset) {
        // System Real-time and 1 byte.
        sendRealTime(type);
    }
    
}
void MIDI_Class::sendAfterTouch ( byte  Pressure,
byte  Channel 
)

Send a MonoPhonic AfterTouch message (applies to all notes)

Parameters:
PressureThe amount of AfterTouch to apply to all notes.
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 261 of file MIDI.cpp.

{
    
    send(AfterTouchChannel,Pressure,0,Channel);

}
void MIDI_Class::sendControlChange ( byte  ControlNumber,
byte  ControlValue,
byte  Channel 
)

Send a Control Change message.

Parameters:
ControlNumberThe controller number (0 to 127). See the detailed description here: http://www.somascape.org/midi/tech/spec.html#ctrlnums
ControlValueThe value for the specified controller (0 to 127).
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 232 of file MIDI.cpp.

{
    
    send(ControlChange,ControlNumber,ControlValue,Channel);

}
void MIDI_Class::sendNoteOff ( byte  NoteNumber,
byte  Velocity,
byte  Channel 
)

Send a Note Off message (a real Note Off, not a Note On with null velocity)

Parameters:
NoteNumberPitch value in the MIDI format (0 to 127). Take a look at the values, names and frequencies of notes here: http://www.phys.unsw.edu.au/jw/notes.html
VelocityRelease velocity (0 to 127).
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 204 of file MIDI.cpp.

{
    
    send(NoteOff,NoteNumber,Velocity,Channel);

}
void MIDI_Class::sendNoteOn ( byte  NoteNumber,
byte  Velocity,
byte  Channel 
)

Send a Note On message.

Parameters:
NoteNumberPitch value in the MIDI format (0 to 127). Take a look at the values, names and frequencies of notes here: http://www.phys.unsw.edu.au/jw/notes.html
VelocityNote attack velocity (0 to 127). A NoteOn with 0 velocity is considered as a NoteOff.
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 189 of file MIDI.cpp.

{ 
    
    send(NoteOn,NoteNumber,Velocity,Channel);

}
void MIDI_Class::sendPitchBend ( double  PitchValue,
byte  Channel 
)

Send a Pitch Bend message using a floating point value.

Parameters:
PitchValueThe amount of bend to send (in a floating point format), between -1.0f (maximum downwards bend) and +1.0f (max upwards bend), center value is 0.0f.
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 301 of file MIDI.cpp.

{
    
    unsigned int pitchval = (PitchValue+1.f)*8192;
    if (pitchval > 16383) pitchval = 16383;     // overflow protection
    sendPitchBend(pitchval,Channel);
    
}
void MIDI_Class::sendPitchBend ( int  PitchValue,
byte  Channel 
)

Send a Pitch Bend message using a signed integer value.

Parameters:
PitchValueThe amount of bend to send (in a signed integer format), between -8192 (maximum downwards bend) and 8191 (max upwards bend), center value is 0.
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 274 of file MIDI.cpp.

{
    
    unsigned int bend = PitchValue + 8192;
    sendPitchBend(bend,Channel);
    
}
void MIDI_Class::sendPitchBend ( unsigned int  PitchValue,
byte  Channel 
)

Send a Pitch Bend message using an unsigned integer value.

Parameters:
PitchValueThe amount of bend to send (in a signed integer format), between 0 (maximum downwards bend) and 16383 (max upwards bend), center value is 8192.
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 288 of file MIDI.cpp.

{
    
    send(PitchBend,(PitchValue & 0x7F),(PitchValue >> 7) & 0x7F,Channel);
    
}
void MIDI_Class::sendPolyPressure ( byte  NoteNumber,
byte  Pressure,
byte  Channel 
)

Send a Polyphonic AfterTouch message (applies to only one specified note)

Parameters:
NoteNumberThe note to apply AfterTouch to (0 to 127).
PressureThe amount of AfterTouch to apply (0 to 127).
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 247 of file MIDI.cpp.

{
    
    send(AfterTouchPoly,NoteNumber,Pressure,Channel);

}
void MIDI_Class::sendProgramChange ( byte  ProgramNumber,
byte  Channel 
)

Send a Program Change message.

Parameters:
ProgramNumberThe Program to select (0 to 127).
ChannelThe channel on which the message will be sent (1 to 16).

Definition at line 218 of file MIDI.cpp.

{
    
    send(ProgramChange,ProgramNumber,0,Channel);

}
void MIDI_Class::sendRealTime ( kMIDIType  Type)

Send a Real Time (one byte) message.

Parameters:
TypeThe available Real Time types are: Start, Stop, Continue, Clock, ActiveSensing and SystemReset. You can also send a Tune Request with this method.
See also:
kMIDIType

Definition at line 435 of file MIDI.cpp.

{
    switch (Type) {
        case TuneRequest: // Not really real-time, but one byte anyway.
        case Clock:
        case Start:
        case Stop:  
        case Continue:
        case ActiveSensing:
        case SystemReset:
            USE_SERIAL_PORT.write((byte)Type);
            break;
        default:
            // Invalid Real Time marker
            break;
    }
    
    // Do not cancel Running Status for real-time messages as they can be interleaved within any message.
    // Though, TuneRequest can be sent here, and as it is a System Common message, it must reset Running Status.
#if USE_RUNNING_STATUS
    if (Type == TuneRequest) mRunningStatus_TX = InvalidType;
#endif
    
}
void MIDI_Class::sendSongPosition ( unsigned int  Beats)

Send a Song Position Pointer message.

Parameters:
BeatsThe number of beats since the start of the song.

Definition at line 401 of file MIDI.cpp.

{
    
    USE_SERIAL_PORT.write((byte)SongPosition);
    USE_SERIAL_PORT.write(Beats & 0x7F);
    USE_SERIAL_PORT.write((Beats >> 7) & 0x7F);

#if USE_RUNNING_STATUS
    mRunningStatus_TX = InvalidType;
#endif
    
}
void MIDI_Class::sendSongSelect ( byte  SongNumber)

Send a Song Select message.

Definition at line 416 of file MIDI.cpp.

{
    
    USE_SERIAL_PORT.write((byte)SongSelect);
    USE_SERIAL_PORT.write(SongNumber & 0x7F);

#if USE_RUNNING_STATUS
    mRunningStatus_TX = InvalidType;
#endif
    
}
void MIDI_Class::sendSysEx ( int  length,
const byte *const  array,
bool  ArrayContainsBoundaries = false 
)

Generate and send a System Exclusive frame.

Parameters:
lengthThe size of the array to send
arrayThe byte array containing the data to send
ArrayContainsBoundariesWhen set to 'true', 0xF0 & 0xF7 bytes (start & stop SysEx) will NOT be sent (and therefore must be included in the array). default value is set to 'false' for compatibility with previous versions of the library.

Definition at line 318 of file MIDI.cpp.

{
    
    if (ArrayContainsBoundaries == false) {
        
        USE_SERIAL_PORT.write(0xF0);
        
        for (int i=0;i<length;++i) {
            
            USE_SERIAL_PORT.write(array[i]);
            
        }
        
        USE_SERIAL_PORT.write(0xF7);
        
    }
    else {
        
        for (int i=0;i<length;++i) {
            
            USE_SERIAL_PORT.write(array[i]);
            
        }
        
    }
    
#if USE_RUNNING_STATUS
    mRunningStatus_TX = InvalidType;
#endif
    
}
void MIDI_Class::sendTimeCodeQuarterFrame ( byte  data)

Send a MIDI Time Code Quarter Frame.

See MIDI Specification for more information.

Parameters:
dataif you want to encode directly the nibbles in your program, you can send the byte here.

Definition at line 385 of file MIDI.cpp.

{
    
    USE_SERIAL_PORT.write((byte)TimeCodeQuarterFrame);
    USE_SERIAL_PORT.write(data);

#if USE_RUNNING_STATUS
    mRunningStatus_TX = InvalidType;
#endif
    
}
void MIDI_Class::sendTimeCodeQuarterFrame ( byte  TypeNibble,
byte  ValuesNibble 
)

Send a MIDI Time Code Quarter Frame.

See MIDI Specification for more information.

Parameters:
TypeNibbleMTC type
ValuesNibbleMTC data

Definition at line 371 of file MIDI.cpp.

{
    
    byte data = ( ((TypeNibble & 0x07) << 4) | (ValuesNibble & 0x0F) );
    sendTimeCodeQuarterFrame(data);
    
}
void MIDI_Class::sendTuneRequest ( )

Send a Tune Request message.

When a MIDI unit receives this message, it should tune its oscillators (if equipped with any)

Definition at line 357 of file MIDI.cpp.

void MIDI_Class::setHandleActiveSensing ( void(*)(void)  fptr)

Definition at line 940 of file MIDI.cpp.

{ mActiveSensingCallback = fptr; }
void MIDI_Class::setHandleAfterTouchChannel ( void(*)(byte channel, byte pressure)  fptr)

Definition at line 929 of file MIDI.cpp.

{ mAfterTouchChannelCallback = fptr; }
void MIDI_Class::setHandleAfterTouchPoly ( void(*)(byte channel, byte note, byte pressure)  fptr)

Definition at line 926 of file MIDI.cpp.

{ mAfterTouchPolyCallback = fptr; }
void MIDI_Class::setHandleClock ( void(*)(void)  fptr)

Definition at line 936 of file MIDI.cpp.

{ mClockCallback = fptr; }
void MIDI_Class::setHandleContinue ( void(*)(void)  fptr)

Definition at line 938 of file MIDI.cpp.

{ mContinueCallback = fptr; }
void MIDI_Class::setHandleControlChange ( void(*)(byte channel, byte number, byte value)  fptr)

Definition at line 927 of file MIDI.cpp.

{ mControlChangeCallback = fptr; }
void MIDI_Class::setHandleNoteOff ( void(*)(byte channel, byte note, byte velocity)  fptr)

Definition at line 924 of file MIDI.cpp.

{ mNoteOffCallback = fptr; }
void MIDI_Class::setHandleNoteOn ( void(*)(byte channel, byte note, byte velocity)  fptr)

Definition at line 925 of file MIDI.cpp.

{ mNoteOnCallback = fptr; }
void MIDI_Class::setHandlePitchBend ( void(*)(byte channel, int bend)  fptr)

Definition at line 930 of file MIDI.cpp.

{ mPitchBendCallback = fptr; }
void MIDI_Class::setHandleProgramChange ( void(*)(byte channel, byte number)  fptr)

Definition at line 928 of file MIDI.cpp.

{ mProgramChangeCallback = fptr; }
void MIDI_Class::setHandleSongPosition ( void(*)(unsigned int beats)  fptr)

Definition at line 933 of file MIDI.cpp.

{ mSongPositionCallback = fptr; }
void MIDI_Class::setHandleSongSelect ( void(*)(byte songnumber)  fptr)

Definition at line 934 of file MIDI.cpp.

{ mSongSelectCallback = fptr; }
void MIDI_Class::setHandleStart ( void(*)(void)  fptr)

Definition at line 937 of file MIDI.cpp.

{ mStartCallback = fptr; }
void MIDI_Class::setHandleStop ( void(*)(void)  fptr)

Definition at line 939 of file MIDI.cpp.

{ mStopCallback = fptr; }
void MIDI_Class::setHandleSystemExclusive ( void(*)(byte *array, byte size)  fptr)

Definition at line 931 of file MIDI.cpp.

{ mSystemExclusiveCallback = fptr; }
void MIDI_Class::setHandleSystemReset ( void(*)(void)  fptr)

Definition at line 941 of file MIDI.cpp.

{ mSystemResetCallback = fptr; }
void MIDI_Class::setHandleTimeCodeQuarterFrame ( void(*)(byte data)  fptr)

Definition at line 932 of file MIDI.cpp.

{ mTimeCodeQuarterFrameCallback = fptr; }
void MIDI_Class::setHandleTuneRequest ( void(*)(void)  fptr)

Definition at line 935 of file MIDI.cpp.

{ mTuneRequestCallback = fptr; }
void MIDI_Class::setInputChannel ( const byte  Channel)

Set the value for the input MIDI channel.

Parameters:
Channelthe channel value. Valid values are 1 to 16, MIDI_CHANNEL_OMNI if you want to listen to all channels, and MIDI_CHANNEL_OFF to disable MIDI input.

Definition at line 914 of file MIDI.cpp.

{ 
    
    mInputChannel = Channel;
    
}
void MIDI_Class::setThruFilterMode ( const kThruFilterMode  inThruFilterMode)

Set the filter for thru mirroring.

Parameters:
inThruFilterModea filter mode
See also:
kThruFilterMode

Definition at line 1035 of file MIDI.cpp.

{ 
    
    mThruFilterMode = inThruFilterMode;
    if (mThruFilterMode != Off) mThruActivated = true;
    else mThruActivated = false;
    
}
void MIDI_Class::turnThruOff ( )

Setter method: turn message mirroring off.

Definition at line 1056 of file MIDI.cpp.

{
    
    mThruActivated = false; 
    mThruFilterMode = Off;
    
}
void MIDI_Class::turnThruOn ( kThruFilterMode  inThruFilterMode = Full)

Setter method: turn message mirroring on.

Definition at line 1046 of file MIDI.cpp.

{ 
    
    mThruActivated = true;
    mThruFilterMode = inThruFilterMode;
    
}

The documentation for this class was generated from the following files: