Starting quake.
This commit is contained in:
parent
c87a6c7bb5
commit
5a42cb006d
|
|
@ -12,7 +12,8 @@
|
||||||
#define LIB_MIDI_H_
|
#define LIB_MIDI_H_
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include "midi_Settings.h"
|
||||||
|
#include "midi_Defs.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,176 @@
|
||||||
|
/*!
|
||||||
|
* @file midi_Defs.h
|
||||||
|
* Project Arduino MIDI Library
|
||||||
|
* @brief MIDI Library for the Arduino - Definitions
|
||||||
|
* @version 3.5
|
||||||
|
* @author Francois Best
|
||||||
|
* @date 24/02/11
|
||||||
|
* license GPL Forty Seven Effects - 2011
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include "midi_Namespace.h"
|
||||||
|
|
||||||
|
BEGIN_MIDI_NAMESPACE
|
||||||
|
|
||||||
|
#define MIDI_CHANNEL_OMNI 0
|
||||||
|
#define MIDI_CHANNEL_OFF 17 // and over
|
||||||
|
|
||||||
|
#define MIDI_PITCHBEND_MIN -8192
|
||||||
|
#define MIDI_PITCHBEND_MAX 8191
|
||||||
|
|
||||||
|
|
||||||
|
/*! Type definition for practical use
|
||||||
|
(because "unsigned char" is a bit long to write.. )
|
||||||
|
*/
|
||||||
|
typedef uint8_t byte;
|
||||||
|
typedef uint16_t word;
|
||||||
|
|
||||||
|
|
||||||
|
/*! Enumeration of MIDI types */
|
||||||
|
enum kMIDIType
|
||||||
|
{
|
||||||
|
NoteOff = 0x80, ///< Note Off
|
||||||
|
NoteOn = 0x90, ///< Note On
|
||||||
|
AfterTouchPoly = 0xA0, ///< Polyphonic AfterTouch
|
||||||
|
ControlChange = 0xB0, ///< Control Change / Channel Mode
|
||||||
|
ProgramChange = 0xC0, ///< Program Change
|
||||||
|
AfterTouchChannel = 0xD0, ///< Channel (monophonic) AfterTouch
|
||||||
|
PitchBend = 0xE0, ///< Pitch Bend
|
||||||
|
SystemExclusive = 0xF0, ///< System Exclusive
|
||||||
|
TimeCodeQuarterFrame = 0xF1, ///< System Common - MIDI Time Code Quarter Frame
|
||||||
|
SongPosition = 0xF2, ///< System Common - Song Position Pointer
|
||||||
|
SongSelect = 0xF3, ///< System Common - Song Select
|
||||||
|
TuneRequest = 0xF6, ///< System Common - Tune Request
|
||||||
|
Clock = 0xF8, ///< System Real Time - Timing Clock
|
||||||
|
Start = 0xFA, ///< System Real Time - Start
|
||||||
|
Continue = 0xFB, ///< System Real Time - Continue
|
||||||
|
Stop = 0xFC, ///< System Real Time - Stop
|
||||||
|
ActiveSensing = 0xFE, ///< System Real Time - Active Sensing
|
||||||
|
SystemReset = 0xFF, ///< System Real Time - System Reset
|
||||||
|
InvalidType = 0x00 ///< For notifying errors
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! Enumeration of Thru filter modes */
|
||||||
|
enum kThruFilterMode {
|
||||||
|
Off = 0, ///< Thru disabled (nothing passes through).
|
||||||
|
Full = 1, ///< Fully enabled Thru (every incoming message is sent back).
|
||||||
|
SameChannel = 2, ///< Only the messages on the Input Channel will be sent back.
|
||||||
|
DifferentChannel = 3 ///< All the messages but the ones on the Input Channel will be sent back.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum eMIDICCNumber
|
||||||
|
{
|
||||||
|
// High resolution Continuous Controllers MSB (+32 for LSB) ----------------
|
||||||
|
BankSelect = 0,
|
||||||
|
ModulationWheel = 1,
|
||||||
|
BreathController = 2,
|
||||||
|
// CC3 undefined
|
||||||
|
FootController = 4,
|
||||||
|
PortamentoTime = 5,
|
||||||
|
DataEntry = 6,
|
||||||
|
ChannelVolume = 7,
|
||||||
|
Balance = 8,
|
||||||
|
// CC9 undefined
|
||||||
|
Pan = 10,
|
||||||
|
ExpressionController = 11,
|
||||||
|
EffectControl1 = 12,
|
||||||
|
EffectControl2 = 13,
|
||||||
|
// CC14 undefined
|
||||||
|
// CC15 undefined
|
||||||
|
GeneralPurposeController1 = 16,
|
||||||
|
GeneralPurposeController2 = 17,
|
||||||
|
GeneralPurposeController3 = 18,
|
||||||
|
GeneralPurposeController4 = 19,
|
||||||
|
|
||||||
|
// Switches ----------------------------------------------------------------
|
||||||
|
Sustain = 64,
|
||||||
|
Portamento = 65,
|
||||||
|
Sostenuto = 66,
|
||||||
|
SoftPedal = 67,
|
||||||
|
Legato = 68,
|
||||||
|
Hold2 = 69,
|
||||||
|
|
||||||
|
// Low resolution continuous controllers -----------------------------------
|
||||||
|
SoundController1 = 70, ///< Synth: Sound Variation FX: Exciter On/Off
|
||||||
|
SoundController2 = 71, ///< Synth: Harmonic Content FX: Compressor On/Off
|
||||||
|
SoundController3 = 72, ///< Synth: Release Time FX: Distortion On/Off
|
||||||
|
SoundController4 = 73, ///< Synth: Attack Time FX: EQ On/Off
|
||||||
|
SoundController5 = 74, ///< Synth: Brightness FX: Expander On/Off
|
||||||
|
SoundController6 = 75, ///< Synth: Decay Time FX: Reverb On/Off
|
||||||
|
SoundController7 = 76, ///< Synth: Vibrato Rate FX: Delay On/Off
|
||||||
|
SoundController8 = 77, ///< Synth: Vibrato Depth FX: Pitch Transpose On/Off
|
||||||
|
SoundController9 = 78, ///< Synth: Vibrato Delay FX: Flange/Chorus On/Off
|
||||||
|
SoundController10 = 79, ///< Synth: Undefined FX: Special Effects On/Off
|
||||||
|
GeneralPurposeController5 = 80,
|
||||||
|
GeneralPurposeController6 = 81,
|
||||||
|
GeneralPurposeController7 = 82,
|
||||||
|
GeneralPurposeController8 = 83,
|
||||||
|
PortamentoControl = 84,
|
||||||
|
// CC85 to CC90 undefined
|
||||||
|
Effects1 = 91, ///< Reverb send level
|
||||||
|
Effects2 = 92, ///< Tremolo depth
|
||||||
|
Effects3 = 93, ///< Chorus send level
|
||||||
|
Effects4 = 94, ///< Celeste depth
|
||||||
|
Effects5 = 95, ///< Phaser depth
|
||||||
|
|
||||||
|
// Channel Mode messages ---------------------------------------------------
|
||||||
|
AllSoundOff = 120,
|
||||||
|
ResetAllControllers = 121,
|
||||||
|
LocalControl = 122,
|
||||||
|
AllNotesOff = 123,
|
||||||
|
OmniModeOff = 124,
|
||||||
|
OmniModeOn = 125,
|
||||||
|
MonoModeOn = 126,
|
||||||
|
PolyModeOn = 127
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*! The midimsg structure contains decoded data
|
||||||
|
of a MIDI message read from the serial port
|
||||||
|
with read() or thru().
|
||||||
|
*/
|
||||||
|
struct midimsg
|
||||||
|
{
|
||||||
|
|
||||||
|
/*! The MIDI channel on which the message was recieved.
|
||||||
|
\n Value goes from 1 to 16.
|
||||||
|
*/
|
||||||
|
byte channel;
|
||||||
|
|
||||||
|
/*! The type of the message
|
||||||
|
(see the define section for types reference)
|
||||||
|
*/
|
||||||
|
kMIDIType type;
|
||||||
|
|
||||||
|
/*! The first data byte.
|
||||||
|
\n Value goes from 0 to 127.
|
||||||
|
*/
|
||||||
|
byte data1;
|
||||||
|
|
||||||
|
/*! The second data byte.
|
||||||
|
If the message is only 2 bytes long, this one is null.
|
||||||
|
\n Value goes from 0 to 127.
|
||||||
|
*/
|
||||||
|
byte data2;
|
||||||
|
|
||||||
|
/*! System Exclusive dedicated byte array.
|
||||||
|
\n Array length is stocked on 16 bits,
|
||||||
|
in data1 (LSB) and data2 (MSB)
|
||||||
|
*/
|
||||||
|
byte sysex_array[MIDI_SYSEX_ARRAY_SIZE];
|
||||||
|
|
||||||
|
/*! This boolean indicates if the message is valid or not.
|
||||||
|
There is no channel consideration here,
|
||||||
|
validity means the message respects the MIDI norm.
|
||||||
|
*/
|
||||||
|
bool valid;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
END_MIDI_NAMESPACE
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*!
|
||||||
|
* @file midi_Namespace.h
|
||||||
|
* Project Arduino MIDI Library
|
||||||
|
* @brief MIDI Library for the Arduino - Namespace declaration
|
||||||
|
* @version 3.5
|
||||||
|
* @author Francois Best
|
||||||
|
* @date 24/02/11
|
||||||
|
* license GPL Forty Seven Effects - 2011
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define MIDI_NAMESPACE midi
|
||||||
|
#define BEGIN_MIDI_NAMESPACE namespace MIDI_NAMESPACE {
|
||||||
|
#define END_MIDI_NAMESPACE }
|
||||||
|
|
||||||
|
#define USING_NAMESPACE_MIDI using namespace MIDI_NAMESPACE;
|
||||||
|
|
||||||
|
BEGIN_MIDI_NAMESPACE
|
||||||
|
|
||||||
|
END_MIDI_NAMESPACE
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*!
|
||||||
|
* @file midi_Settings.h
|
||||||
|
* Project Arduino MIDI Library
|
||||||
|
* @brief MIDI Library for the Arduino - Settings
|
||||||
|
* @version 3.5
|
||||||
|
* @author Francois Best
|
||||||
|
* @date 24/02/11
|
||||||
|
* license GPL Forty Seven Effects - 2011
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "midi_Namespace.h"
|
||||||
|
|
||||||
|
BEGIN_MIDI_NAMESPACE
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Here are a few settings you can change to customize
|
||||||
|
// the library for your own project. You can for example
|
||||||
|
// choose to compile only parts of it so you gain flash
|
||||||
|
// space and optimise the speed of your sketch.
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Compilation flags. Set them to 1 to build the associated feature
|
||||||
|
// (MIDI in, out, thru), or to 0 to disable the feature and save space.
|
||||||
|
// Note that the Thru can only work if in and out are enabled.
|
||||||
|
|
||||||
|
#define MIDI_BUILD_INPUT 1
|
||||||
|
#define MIDI_BUILD_OUTPUT 1
|
||||||
|
#define MIDI_BUILD_THRU 1
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Serial port configuration
|
||||||
|
|
||||||
|
// Change the number (to Serial1 for example)
|
||||||
|
// if you want to use a different serial port for MIDI I/O.
|
||||||
|
#define MIDI_SERIAL_PORT Serial
|
||||||
|
|
||||||
|
// Software serial options
|
||||||
|
#define MIDI_USE_SOFTWARE_SERIAL 0
|
||||||
|
|
||||||
|
#if MIDI_USE_SOFTWARE_SERIAL
|
||||||
|
#define MIDI_SOFTSERIAL_RX_PIN 1 // Pin number to use for MIDI Input
|
||||||
|
#define MIDI_SOFTSERIAL_TX_PIN 2 // Pin number to use for MIDI Output.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Misc. options
|
||||||
|
|
||||||
|
// Running status enables short messages when sending multiple values
|
||||||
|
// of the same type and channel.
|
||||||
|
// Set to 0 if you have troubles controlling your hardware.
|
||||||
|
#define MIDI_USE_RUNNING_STATUS 1
|
||||||
|
#define MIDI_USE_1BYTE_PARSING 1
|
||||||
|
|
||||||
|
|
||||||
|
#define MIDI_BAUDRATE 31250
|
||||||
|
#define MIDI_SYSEX_ARRAY_SIZE 255 // Maximum size is 65535 bytes.
|
||||||
|
|
||||||
|
END_MIDI_NAMESPACE
|
||||||
Loading…
Reference in New Issue