Merge branch 'Arduino' into avr_core
This commit is contained in:
commit
22218892c0
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Use this script to install the library directy from the git clone.
|
||||||
|
|
||||||
|
|
||||||
if [[ -d /Applications/Arduino.app ]]
|
if [[ -d /Applications/Arduino.app ]]
|
||||||
then
|
then
|
||||||
|
|
@ -31,7 +33,7 @@ then
|
||||||
# Copy doc
|
# Copy doc
|
||||||
mkdir $lib_path/doc
|
mkdir $lib_path/doc
|
||||||
|
|
||||||
cp ../doc/* $lib_path/doc
|
cp -r ../doc/* $lib_path/doc
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Arduino application not found."
|
echo "Arduino application not found."
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# This script installs the Arduino MIDI Library into the Arduino application,
|
||||||
|
# so that every sketch can include it directly, without having to copy anything.
|
||||||
|
#
|
||||||
|
# To install the library, run this script by double-clicking it,
|
||||||
|
# it should be directly executable and seen as such by Mac OS X.
|
||||||
|
# If not, open a terminal, cd to the script location, and run ./install_mac
|
||||||
|
#
|
||||||
|
# Open the Arduino IDE, and you're ready to go!
|
||||||
|
|
||||||
|
# The script assumes the Arduino application
|
||||||
|
# is installed in the default location.
|
||||||
|
|
||||||
if [[ -d /Applications/Arduino.app ]]
|
if [[ -d /Applications/Arduino.app ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
# Define locations
|
# Define locations
|
||||||
|
|
||||||
lib_path=/Applications/Arduino.app/Contents/Resources/Java/libraries/MIDI
|
lib_path=/Applications/Arduino.app/Contents/Resources/Java/libraries/MIDI
|
||||||
|
|
||||||
if [[ -d $lib_path ]]
|
if [[ -d $lib_path ]]
|
||||||
|
|
@ -20,7 +30,7 @@ then
|
||||||
cp -r * $lib_path
|
cp -r * $lib_path
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm $lib_path/install_mac.sh
|
rm $lib_path/install_mac
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Arduino application not found."
|
echo "Arduino application not found."
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Generate an archive with packaged content for easier delivery.
|
||||||
|
# The generated archive contains:
|
||||||
|
# - Source files (MIDI.cpp / MIDI.h)
|
||||||
|
# - Resources (keywords.txt)
|
||||||
|
# - Documentation (Doxygen)
|
||||||
|
# - Examples for Arduino IDE
|
||||||
|
# - Installation scripts
|
||||||
|
|
||||||
|
|
||||||
# Create a temporary destination folder
|
# Create a temporary destination folder
|
||||||
mkdir -p temp/doc
|
mkdir -p temp/doc
|
||||||
|
|
|
||||||
24
src/MIDI.cpp
24
src/MIDI.cpp
|
|
@ -285,31 +285,17 @@ void MIDI_Class::sendAfterTouch(byte Pressure,
|
||||||
|
|
||||||
/*! \brief Send a Pitch Bend message using a signed integer value.
|
/*! \brief Send a Pitch Bend message using a signed integer value.
|
||||||
\param PitchValue The amount of bend to send (in a signed integer format),
|
\param PitchValue The amount of bend to send (in a signed integer format),
|
||||||
between -8192 (maximum downwards bend)
|
between MIDI_PITCHBEND_MIN and MIDI_PITCHBEND_MAX,
|
||||||
and 8191 (max upwards bend), center value is 0.
|
center value is 0.
|
||||||
\param Channel The channel on which the message will be sent (1 to 16).
|
\param Channel The channel on which the message will be sent (1 to 16).
|
||||||
*/
|
*/
|
||||||
void MIDI_Class::sendPitchBend(int PitchValue,
|
void MIDI_Class::sendPitchBend(int PitchValue,
|
||||||
byte Channel)
|
byte Channel)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int bend = PitchValue + 8192;
|
unsigned int bend = PitchValue - MIDI_PITCHBEND_MIN;
|
||||||
sendPitchBend(bend,Channel);
|
|
||||||
|
|
||||||
}
|
send(PitchBend,(bend & 0x7F),(bend >> 7) & 0x7F,Channel);
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Send a Pitch Bend message using an unsigned integer value.
|
|
||||||
\param PitchValue The amount of bend to send (in a signed integer format),
|
|
||||||
between 0 (maximum downwards bend)
|
|
||||||
and 16383 (max upwards bend), center value is 8192.
|
|
||||||
\param Channel The channel on which the message will be sent (1 to 16).
|
|
||||||
*/
|
|
||||||
void MIDI_Class::sendPitchBend(unsigned int PitchValue,
|
|
||||||
byte Channel)
|
|
||||||
{
|
|
||||||
|
|
||||||
send(PitchBend,(PitchValue & 0x7F),(PitchValue >> 7) & 0x7F,Channel);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1032,7 +1018,7 @@ void MIDI_Class::launchCallback()
|
||||||
|
|
||||||
// Continuous controllers
|
// Continuous controllers
|
||||||
case ControlChange: if (mControlChangeCallback != NULL) mControlChangeCallback(mMessage.channel,mMessage.data1,mMessage.data2); break;
|
case ControlChange: if (mControlChangeCallback != NULL) mControlChangeCallback(mMessage.channel,mMessage.data1,mMessage.data2); break;
|
||||||
case PitchBend: if (mPitchBendCallback != NULL) mPitchBendCallback(mMessage.channel,(int)((mMessage.data1 & 0x7F) | ((mMessage.data2 & 0x7F)<< 7)) - 8192); break; // TODO: check this
|
case PitchBend: if (mPitchBendCallback != NULL) mPitchBendCallback(mMessage.channel,(int)((mMessage.data1 & 0x7F) | ((mMessage.data2 & 0x7F)<< 7)) + MIDI_PITCHBEND_MIN); break; // TODO: check this
|
||||||
case AfterTouchPoly: if (mAfterTouchPolyCallback != NULL) mAfterTouchPolyCallback(mMessage.channel,mMessage.data1,mMessage.data2); break;
|
case AfterTouchPoly: if (mAfterTouchPolyCallback != NULL) mAfterTouchPolyCallback(mMessage.channel,mMessage.data1,mMessage.data2); break;
|
||||||
case AfterTouchChannel: if (mAfterTouchChannelCallback != NULL) mAfterTouchChannelCallback(mMessage.channel,mMessage.data1); break;
|
case AfterTouchChannel: if (mAfterTouchChannelCallback != NULL) mAfterTouchChannelCallback(mMessage.channel,mMessage.data1); break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,10 @@
|
||||||
|
|
||||||
#define MIDI_SYSEX_ARRAY_SIZE 255 // Maximum size is 65535 bytes.
|
#define MIDI_SYSEX_ARRAY_SIZE 255 // Maximum size is 65535 bytes.
|
||||||
|
|
||||||
|
#define MIDI_PITCHBEND_MIN -8192
|
||||||
|
#define MIDI_PITCHBEND_MAX 8191
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! Enumeration of MIDI types */
|
/*! Enumeration of MIDI types */
|
||||||
enum kMIDIType {
|
enum kMIDIType {
|
||||||
|
|
@ -168,7 +172,6 @@ public:
|
||||||
void sendProgramChange(byte ProgramNumber,byte Channel);
|
void sendProgramChange(byte ProgramNumber,byte Channel);
|
||||||
void sendControlChange(byte ControlNumber, byte ControlValue,byte Channel);
|
void sendControlChange(byte ControlNumber, byte ControlValue,byte Channel);
|
||||||
void sendPitchBend(int PitchValue,byte Channel);
|
void sendPitchBend(int PitchValue,byte Channel);
|
||||||
void sendPitchBend(unsigned int PitchValue,byte Channel);
|
|
||||||
void sendPitchBend(double PitchValue,byte Channel);
|
void sendPitchBend(double PitchValue,byte Channel);
|
||||||
void sendPolyPressure(byte NoteNumber,byte Pressure,byte Channel);
|
void sendPolyPressure(byte NoteNumber,byte Pressure,byte Channel);
|
||||||
void sendAfterTouch(byte Pressure,byte Channel);
|
void sendAfterTouch(byte Pressure,byte Channel);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue