diff --git a/src/MIDI.h b/src/MIDI.h index 9ba6296..ea54251 100644 --- a/src/MIDI.h +++ b/src/MIDI.h @@ -93,7 +93,6 @@ private: #endif // MIDI_BUILD_OUTPUT - // ------------------------------------------------------------------------- // MIDI Input @@ -126,14 +125,12 @@ private: void resetInput(); private: - StatusByte mRunningStatus_RX; - Channel mInputChannel; - - byte mPendingMessage[3]; // SysEx are dumped into mMessage directly. - unsigned mPendingMessageExpectedLenght; - unsigned mPendingMessageIndex; // Extended to unsigned for larger SysEx payloads. - Message mMessage; - + StatusByte mRunningStatus_RX; + Channel mInputChannel; + byte mPendingMessage[3]; + unsigned mPendingMessageExpectedLenght; + unsigned mPendingMessageIndex; + Message mMessage; // ------------------------------------------------------------------------- // Input Callbacks @@ -163,7 +160,6 @@ public: inline void disconnectCallbackFromType(MidiType inType); private: - void launchCallback(); void (*mNoteOffCallback)(byte channel, byte note, byte velocity); @@ -186,10 +182,8 @@ private: void (*mSystemResetCallback)(void); #endif // MIDI_USE_CALLBACKS - #endif // MIDI_BUILD_INPUT - // ------------------------------------------------------------------------- // MIDI Soft Thru @@ -215,11 +209,9 @@ private: #if MIDI_USE_RUNNING_STATUS - private: StatusByte mRunningStatus_TX; - -#endif // MIDI_USE_RUNNING_STATUS +#endif private: SerialPort& mSerial; @@ -236,7 +228,7 @@ END_MIDI_NAMESPACE #if MIDI_AUTO_INSTANCIATE && defined(ARDUINO) extern MIDI_NAMESPACE::MidiInterface MIDI; -#endif // MIDI_AUTO_INSTANCIATE +#endif // ----------------------------------------------------------------------------- diff --git a/src/MIDI.hpp b/src/MIDI.hpp index f126251..27ca377 100644 --- a/src/MIDI.hpp +++ b/src/MIDI.hpp @@ -12,7 +12,7 @@ BEGIN_MIDI_NAMESPACE -/*! \brief Constructor for MidiInterface. */ +/// \brief Constructor for MidiInterface. template MidiInterface::MidiInterface(SerialPort& inSerial) : mSerial(inSerial) @@ -1092,9 +1092,9 @@ void MidiInterface::turnThruOff() // This method is called upon reception of a message // and takes care of Thru filtering and sending. -// - All system messages (System Exclusive, Common and Real Time) are passed +// - All system messages (System Exclusive, Common and Real Time) are passed // to output unless filter is set to Off. -// - Channel messages are passed to the output whether their channel +// - Channel messages are passed to the output whether their channel // is matching the input channel and the filter setting template void MidiInterface::thruFilter(Channel inChannel) diff --git a/src/midi_Defs.h b/src/midi_Defs.h index 2f69a05..6739e1d 100644 --- a/src/midi_Defs.h +++ b/src/midi_Defs.h @@ -3,7 +3,7 @@ * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Definitions * @version 4.0 - * @author Francois Best + * @author Francois Best * @date 24/02/11 * license GPL Forty Seven Effects - 2011 */ @@ -36,7 +36,7 @@ typedef byte FilterMode; // ----------------------------------------------------------------------------- /*! Enumeration of MIDI types */ -enum MidiType +enum MidiType { InvalidType = 0x00, ///< For notifying errors NoteOff = 0x80, ///< Note Off @@ -62,7 +62,7 @@ enum MidiType // ----------------------------------------------------------------------------- /*! Enumeration of Thru filter modes */ -enum MidiFilterMode +enum MidiFilterMode { Off = 0, ///< Thru disabled (nothing passes through). Full = 1, ///< Fully enabled Thru (every incoming message is sent back). @@ -73,7 +73,7 @@ enum MidiFilterMode // ----------------------------------------------------------------------------- /*! \brief Enumeration of Control Change command numbers. - See the detailed controllers numbers & description here: + See the detailed controllers numbers & description here: http://www.somascape.org/midi/tech/spec.html#ctrlnums */ enum MidiControlChangeNumber @@ -99,7 +99,7 @@ enum MidiControlChangeNumber GeneralPurposeController2 = 17, GeneralPurposeController3 = 18, GeneralPurposeController4 = 19, - + // Switches ---------------------------------------------------------------- Sustain = 64, Portamento = 65, @@ -107,7 +107,7 @@ enum MidiControlChangeNumber SoftPedal = 67, Legato = 68, Hold = 69, - + // Low resolution continuous controllers ----------------------------------- SoundController1 = 70, ///< Synth: Sound Variation FX: Exciter On/Off SoundController2 = 71, ///< Synth: Harmonic Content FX: Compressor On/Off @@ -130,7 +130,7 @@ enum MidiControlChangeNumber Effects3 = 93, ///< Chorus send level Effects4 = 94, ///< Celeste depth Effects5 = 95, ///< Phaser depth - + // Channel Mode messages --------------------------------------------------- AllSoundOff = 120, ResetAllControllers = 121, @@ -145,45 +145,45 @@ enum MidiControlChangeNumber // ----------------------------------------------------------------------------- -/*! The midimsg structure contains decoded data of a MIDI message +/*! The midimsg structure contains decoded data of a MIDI message read from the serial port with read() */ struct Message { - + /*! The MIDI channel on which the message was recieved. - \n Value goes from 1 to 16. + \n Value goes from 1 to 16. */ - Channel channel; - - /*! The type of the message + Channel channel; + + /*! The type of the message (see the MidiType enum for types reference) */ MidiType type; - + /*! The first data byte. \n Value goes from 0 to 127. */ DataByte data1; - - /*! The second data byte. + + /*! The second data byte. If the message is only 2 bytes long, this one is null. \n Value goes from 0 to 127. */ DataByte data2; - + /*! System Exclusive dedicated byte array. - \n Array length is stocked on 16 bits, + \n Array length is stocked on 16 bits, in data1 (LSB) and data2 (MSB) */ DataByte sysexArray[MIDI_SYSEX_ARRAY_SIZE]; - + /*! This boolean indicates if the message is valid or not. - There is no channel consideration here, + There is no channel consideration here, validity means the message respects the MIDI norm. */ bool valid; - + }; // ----------------------------------------------------------------------------- @@ -195,7 +195,7 @@ struct Message midi::MidiInterface Name((Type&)SerialPort); /*! \brief Shortcut for MIDI Interface class with template argument. - The class name for a MIDI object using the hardware UART would be + The class name for a MIDI object using the hardware UART would be midi::MidiInterface, when the macro is MIDI_CLASS(HardwareSerial). */ #define MIDI_CLASS(Type) \ diff --git a/src/midi_Namespace.h b/src/midi_Namespace.h index 0867ab7..c72e334 100644 --- a/src/midi_Namespace.h +++ b/src/midi_Namespace.h @@ -3,7 +3,7 @@ * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Namespace declaration * @version 4.0 - * @author Francois Best + * @author Francois Best * @date 24/02/11 * license GPL Forty Seven Effects - 2011 */ diff --git a/src/midi_Settings.h b/src/midi_Settings.h index 16e2504..e85a2ba 100644 --- a/src/midi_Settings.h +++ b/src/midi_Settings.h @@ -3,7 +3,7 @@ * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Settings * @version 4.0 - * @author Francois Best + * @author Francois Best * @date 24/02/11 * license GPL Forty Seven Effects - 2011 */ @@ -34,8 +34,6 @@ // ----------------------------------------------------------------------------- // Create a MIDI object automatically on the port defined with MIDI_SERIAL_PORT. -// You can turn this off by adding #define MIDI_AUTO_INSTANCIATE 0 just before -// including in your sketch. #ifndef MIDI_AUTO_INSTANCIATE # ifdef ARDUINO # define MIDI_AUTO_INSTANCIATE 1 @@ -72,7 +70,7 @@ #define MIDI_USE_RUNNING_STATUS 1 // Setting this to 1 will make MIDI.read parse only one byte of data for each -// call when data is available. This can speed up your application if receiving +// call when data is available. This can speed up your application if receiving // a lot of traffic, but might induce MIDI Thru and treatment latency. #define MIDI_USE_1BYTE_PARSING 1