Doc & formatting.

This commit is contained in:
Francois Best 2014-02-13 21:58:37 +01:00
parent deb2d27ee8
commit b2800e5fdd
5 changed files with 36 additions and 46 deletions

View File

@ -93,7 +93,6 @@ private:
#endif // MIDI_BUILD_OUTPUT #endif // MIDI_BUILD_OUTPUT
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// MIDI Input // MIDI Input
@ -126,14 +125,12 @@ private:
void resetInput(); void resetInput();
private: private:
StatusByte mRunningStatus_RX; StatusByte mRunningStatus_RX;
Channel mInputChannel; Channel mInputChannel;
byte mPendingMessage[3];
byte mPendingMessage[3]; // SysEx are dumped into mMessage directly. unsigned mPendingMessageExpectedLenght;
unsigned mPendingMessageExpectedLenght; unsigned mPendingMessageIndex;
unsigned mPendingMessageIndex; // Extended to unsigned for larger SysEx payloads. Message mMessage;
Message mMessage;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Input Callbacks // Input Callbacks
@ -163,7 +160,6 @@ public:
inline void disconnectCallbackFromType(MidiType inType); inline void disconnectCallbackFromType(MidiType inType);
private: private:
void launchCallback(); void launchCallback();
void (*mNoteOffCallback)(byte channel, byte note, byte velocity); void (*mNoteOffCallback)(byte channel, byte note, byte velocity);
@ -186,10 +182,8 @@ private:
void (*mSystemResetCallback)(void); void (*mSystemResetCallback)(void);
#endif // MIDI_USE_CALLBACKS #endif // MIDI_USE_CALLBACKS
#endif // MIDI_BUILD_INPUT #endif // MIDI_BUILD_INPUT
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// MIDI Soft Thru // MIDI Soft Thru
@ -215,11 +209,9 @@ private:
#if MIDI_USE_RUNNING_STATUS #if MIDI_USE_RUNNING_STATUS
private: private:
StatusByte mRunningStatus_TX; StatusByte mRunningStatus_TX;
#endif
#endif // MIDI_USE_RUNNING_STATUS
private: private:
SerialPort& mSerial; SerialPort& mSerial;
@ -236,7 +228,7 @@ END_MIDI_NAMESPACE
#if MIDI_AUTO_INSTANCIATE && defined(ARDUINO) #if MIDI_AUTO_INSTANCIATE && defined(ARDUINO)
extern MIDI_NAMESPACE::MidiInterface<MIDI_DEFAULT_SERIAL_CLASS> MIDI; extern MIDI_NAMESPACE::MidiInterface<MIDI_DEFAULT_SERIAL_CLASS> MIDI;
#endif // MIDI_AUTO_INSTANCIATE #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@
BEGIN_MIDI_NAMESPACE BEGIN_MIDI_NAMESPACE
/*! \brief Constructor for MidiInterface. */ /// \brief Constructor for MidiInterface.
template<class SerialPort> template<class SerialPort>
MidiInterface<SerialPort>::MidiInterface(SerialPort& inSerial) MidiInterface<SerialPort>::MidiInterface(SerialPort& inSerial)
: mSerial(inSerial) : mSerial(inSerial)
@ -1092,9 +1092,9 @@ void MidiInterface<SerialPort>::turnThruOff()
// This method is called upon reception of a message // This method is called upon reception of a message
// and takes care of Thru filtering and sending. // 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. // 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 // is matching the input channel and the filter setting
template<class SerialPort> template<class SerialPort>
void MidiInterface<SerialPort>::thruFilter(Channel inChannel) void MidiInterface<SerialPort>::thruFilter(Channel inChannel)

View File

@ -3,7 +3,7 @@
* Project Arduino MIDI Library * Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Definitions * @brief MIDI Library for the Arduino - Definitions
* @version 4.0 * @version 4.0
* @author Francois Best * @author Francois Best
* @date 24/02/11 * @date 24/02/11
* license GPL Forty Seven Effects - 2011 * license GPL Forty Seven Effects - 2011
*/ */
@ -36,7 +36,7 @@ typedef byte FilterMode;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! Enumeration of MIDI types */ /*! Enumeration of MIDI types */
enum MidiType enum MidiType
{ {
InvalidType = 0x00, ///< For notifying errors InvalidType = 0x00, ///< For notifying errors
NoteOff = 0x80, ///< Note Off NoteOff = 0x80, ///< Note Off
@ -62,7 +62,7 @@ enum MidiType
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! Enumeration of Thru filter modes */ /*! Enumeration of Thru filter modes */
enum MidiFilterMode enum MidiFilterMode
{ {
Off = 0, ///< Thru disabled (nothing passes through). Off = 0, ///< Thru disabled (nothing passes through).
Full = 1, ///< Fully enabled Thru (every incoming message is sent back). Full = 1, ///< Fully enabled Thru (every incoming message is sent back).
@ -73,7 +73,7 @@ enum MidiFilterMode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! \brief Enumeration of Control Change command numbers. /*! \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 http://www.somascape.org/midi/tech/spec.html#ctrlnums
*/ */
enum MidiControlChangeNumber enum MidiControlChangeNumber
@ -99,7 +99,7 @@ enum MidiControlChangeNumber
GeneralPurposeController2 = 17, GeneralPurposeController2 = 17,
GeneralPurposeController3 = 18, GeneralPurposeController3 = 18,
GeneralPurposeController4 = 19, GeneralPurposeController4 = 19,
// Switches ---------------------------------------------------------------- // Switches ----------------------------------------------------------------
Sustain = 64, Sustain = 64,
Portamento = 65, Portamento = 65,
@ -107,7 +107,7 @@ enum MidiControlChangeNumber
SoftPedal = 67, SoftPedal = 67,
Legato = 68, Legato = 68,
Hold = 69, Hold = 69,
// Low resolution continuous controllers ----------------------------------- // Low resolution continuous controllers -----------------------------------
SoundController1 = 70, ///< Synth: Sound Variation FX: Exciter On/Off SoundController1 = 70, ///< Synth: Sound Variation FX: Exciter On/Off
SoundController2 = 71, ///< Synth: Harmonic Content FX: Compressor On/Off SoundController2 = 71, ///< Synth: Harmonic Content FX: Compressor On/Off
@ -130,7 +130,7 @@ enum MidiControlChangeNumber
Effects3 = 93, ///< Chorus send level Effects3 = 93, ///< Chorus send level
Effects4 = 94, ///< Celeste depth Effects4 = 94, ///< Celeste depth
Effects5 = 95, ///< Phaser depth Effects5 = 95, ///< Phaser depth
// Channel Mode messages --------------------------------------------------- // Channel Mode messages ---------------------------------------------------
AllSoundOff = 120, AllSoundOff = 120,
ResetAllControllers = 121, 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() read from the serial port with read()
*/ */
struct Message struct Message
{ {
/*! The MIDI channel on which the message was recieved. /*! 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; Channel channel;
/*! The type of the message /*! The type of the message
(see the MidiType enum for types reference) (see the MidiType enum for types reference)
*/ */
MidiType type; MidiType type;
/*! The first data byte. /*! The first data byte.
\n Value goes from 0 to 127. \n Value goes from 0 to 127.
*/ */
DataByte data1; DataByte data1;
/*! The second data byte. /*! The second data byte.
If the message is only 2 bytes long, this one is null. If the message is only 2 bytes long, this one is null.
\n Value goes from 0 to 127. \n Value goes from 0 to 127.
*/ */
DataByte data2; DataByte data2;
/*! System Exclusive dedicated byte array. /*! 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) in data1 (LSB) and data2 (MSB)
*/ */
DataByte sysexArray[MIDI_SYSEX_ARRAY_SIZE]; DataByte sysexArray[MIDI_SYSEX_ARRAY_SIZE];
/*! This boolean indicates if the message is valid or not. /*! 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. validity means the message respects the MIDI norm.
*/ */
bool valid; bool valid;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -195,7 +195,7 @@ struct Message
midi::MidiInterface<Type> Name((Type&)SerialPort); midi::MidiInterface<Type> Name((Type&)SerialPort);
/*! \brief Shortcut for MIDI Interface class with template argument. /*! \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<HardwareSerial>, when the macro is MIDI_CLASS(HardwareSerial). midi::MidiInterface<HardwareSerial>, when the macro is MIDI_CLASS(HardwareSerial).
*/ */
#define MIDI_CLASS(Type) \ #define MIDI_CLASS(Type) \

View File

@ -3,7 +3,7 @@
* Project Arduino MIDI Library * Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Namespace declaration * @brief MIDI Library for the Arduino - Namespace declaration
* @version 4.0 * @version 4.0
* @author Francois Best * @author Francois Best
* @date 24/02/11 * @date 24/02/11
* license GPL Forty Seven Effects - 2011 * license GPL Forty Seven Effects - 2011
*/ */

View File

@ -3,7 +3,7 @@
* Project Arduino MIDI Library * Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Settings * @brief MIDI Library for the Arduino - Settings
* @version 4.0 * @version 4.0
* @author Francois Best * @author Francois Best
* @date 24/02/11 * @date 24/02/11
* license GPL Forty Seven Effects - 2011 * license GPL Forty Seven Effects - 2011
*/ */
@ -34,8 +34,6 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Create a MIDI object automatically on the port defined with MIDI_SERIAL_PORT. // 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 <MIDI.h> in your sketch.
#ifndef MIDI_AUTO_INSTANCIATE #ifndef MIDI_AUTO_INSTANCIATE
# ifdef ARDUINO # ifdef ARDUINO
# define MIDI_AUTO_INSTANCIATE 1 # define MIDI_AUTO_INSTANCIATE 1
@ -72,7 +70,7 @@
#define MIDI_USE_RUNNING_STATUS 1 #define MIDI_USE_RUNNING_STATUS 1
// Setting this to 1 will make MIDI.read parse only one byte of data for each // 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. // a lot of traffic, but might induce MIDI Thru and treatment latency.
#define MIDI_USE_1BYTE_PARSING 1 #define MIDI_USE_1BYTE_PARSING 1