Merge branch 'Arduino' into avr_core

This commit is contained in:
Francois Best 2012-05-25 14:33:35 +02:00
commit 22218892c0
5 changed files with 33 additions and 23 deletions

View File

@ -1,4 +1,6 @@
#!/bin/bash
# Use this script to install the library directy from the git clone.
if [[ -d /Applications/Arduino.app ]]
then
@ -31,7 +33,7 @@ then
# Copy doc
mkdir $lib_path/doc
cp ../doc/* $lib_path/doc
cp -r ../doc/* $lib_path/doc
else
echo "Arduino application not found."

View File

@ -1,10 +1,20 @@
#!/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 ]]
then
# Define locations
lib_path=/Applications/Arduino.app/Contents/Resources/Java/libraries/MIDI
if [[ -d $lib_path ]]
@ -20,7 +30,7 @@ then
cp -r * $lib_path
# Cleanup
rm $lib_path/install_mac.sh
rm $lib_path/install_mac
else
echo "Arduino application not found."

View File

@ -1,4 +1,13 @@
#!/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
mkdir -p temp/doc

View File

@ -285,31 +285,17 @@ void MIDI_Class::sendAfterTouch(byte Pressure,
/*! \brief Send a Pitch Bend message using a signed integer value.
\param PitchValue The amount of bend to send (in a signed integer format),
between -8192 (maximum downwards bend)
and 8191 (max upwards bend), center value is 0.
between MIDI_PITCHBEND_MIN and MIDI_PITCHBEND_MAX,
center value is 0.
\param Channel The channel on which the message will be sent (1 to 16).
*/
void MIDI_Class::sendPitchBend(int PitchValue,
byte Channel)
{
unsigned int bend = PitchValue + 8192;
sendPitchBend(bend,Channel);
unsigned int bend = PitchValue - MIDI_PITCHBEND_MIN;
}
/*! \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);
send(PitchBend,(bend & 0x7F),(bend >> 7) & 0x7F,Channel);
}
@ -1032,7 +1018,7 @@ void MIDI_Class::launchCallback()
// Continuous controllers
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 AfterTouchChannel: if (mAfterTouchChannelCallback != NULL) mAfterTouchChannelCallback(mMessage.channel,mMessage.data1); break;

View File

@ -60,6 +60,10 @@
#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 */
enum kMIDIType {
@ -168,7 +172,6 @@ public:
void sendProgramChange(byte ProgramNumber,byte Channel);
void sendControlChange(byte ControlNumber, byte ControlValue,byte Channel);
void sendPitchBend(int PitchValue,byte Channel);
void sendPitchBend(unsigned int PitchValue,byte Channel);
void sendPitchBend(double PitchValue,byte Channel);
void sendPolyPressure(byte NoteNumber,byte Pressure,byte Channel);
void sendAfterTouch(byte Pressure,byte Channel);