Changed macro name.
This commit is contained in:
parent
d4ed134040
commit
a1bea899ce
40
src/MIDI.cpp
40
src/MIDI.cpp
|
|
@ -68,7 +68,7 @@ void MIDI_Class::begin(const byte inChannel)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Initialise the Serial port
|
// Initialise the Serial port
|
||||||
USE_SERIAL_PORT.begin(MIDI_BAUDRATE);
|
MIDI_SERIAL_PORT.begin(MIDI_BAUDRATE);
|
||||||
|
|
||||||
|
|
||||||
#if COMPILE_MIDI_OUT
|
#if COMPILE_MIDI_OUT
|
||||||
|
|
@ -158,17 +158,17 @@ void MIDI_Class::send(kMIDIType type,
|
||||||
if (mRunningStatus_TX != statusbyte) {
|
if (mRunningStatus_TX != statusbyte) {
|
||||||
// New message, memorise and send header
|
// New message, memorise and send header
|
||||||
mRunningStatus_TX = statusbyte;
|
mRunningStatus_TX = statusbyte;
|
||||||
USE_SERIAL_PORT.write(mRunningStatus_TX);
|
MIDI_SERIAL_PORT.write(mRunningStatus_TX);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Don't care about running status, send the Control byte.
|
// Don't care about running status, send the Control byte.
|
||||||
USE_SERIAL_PORT.write(statusbyte);
|
MIDI_SERIAL_PORT.write(statusbyte);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Then send data
|
// Then send data
|
||||||
USE_SERIAL_PORT.write(data1);
|
MIDI_SERIAL_PORT.write(data1);
|
||||||
if (type != ProgramChange && type != AfterTouchChannel) {
|
if (type != ProgramChange && type != AfterTouchChannel) {
|
||||||
USE_SERIAL_PORT.write(data2);
|
MIDI_SERIAL_PORT.write(data2);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -321,22 +321,22 @@ void MIDI_Class::sendSysEx(int length,
|
||||||
|
|
||||||
if (ArrayContainsBoundaries == false) {
|
if (ArrayContainsBoundaries == false) {
|
||||||
|
|
||||||
USE_SERIAL_PORT.write(0xF0);
|
MIDI_SERIAL_PORT.write(0xF0);
|
||||||
|
|
||||||
for (int i=0;i<length;++i) {
|
for (int i=0;i<length;++i) {
|
||||||
|
|
||||||
USE_SERIAL_PORT.write(array[i]);
|
MIDI_SERIAL_PORT.write(array[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
USE_SERIAL_PORT.write(0xF7);
|
MIDI_SERIAL_PORT.write(0xF7);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
for (int i=0;i<length;++i) {
|
for (int i=0;i<length;++i) {
|
||||||
|
|
||||||
USE_SERIAL_PORT.write(array[i]);
|
MIDI_SERIAL_PORT.write(array[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,8 +384,8 @@ void MIDI_Class::sendTimeCodeQuarterFrame(byte TypeNibble, byte ValuesNibble)
|
||||||
void MIDI_Class::sendTimeCodeQuarterFrame(byte data)
|
void MIDI_Class::sendTimeCodeQuarterFrame(byte data)
|
||||||
{
|
{
|
||||||
|
|
||||||
USE_SERIAL_PORT.write((byte)TimeCodeQuarterFrame);
|
MIDI_SERIAL_PORT.write((byte)TimeCodeQuarterFrame);
|
||||||
USE_SERIAL_PORT.write(data);
|
MIDI_SERIAL_PORT.write(data);
|
||||||
|
|
||||||
#if USE_RUNNING_STATUS
|
#if USE_RUNNING_STATUS
|
||||||
mRunningStatus_TX = InvalidType;
|
mRunningStatus_TX = InvalidType;
|
||||||
|
|
@ -400,9 +400,9 @@ void MIDI_Class::sendTimeCodeQuarterFrame(byte data)
|
||||||
void MIDI_Class::sendSongPosition(unsigned int Beats)
|
void MIDI_Class::sendSongPosition(unsigned int Beats)
|
||||||
{
|
{
|
||||||
|
|
||||||
USE_SERIAL_PORT.write((byte)SongPosition);
|
MIDI_SERIAL_PORT.write((byte)SongPosition);
|
||||||
USE_SERIAL_PORT.write(Beats & 0x7F);
|
MIDI_SERIAL_PORT.write(Beats & 0x7F);
|
||||||
USE_SERIAL_PORT.write((Beats >> 7) & 0x7F);
|
MIDI_SERIAL_PORT.write((Beats >> 7) & 0x7F);
|
||||||
|
|
||||||
#if USE_RUNNING_STATUS
|
#if USE_RUNNING_STATUS
|
||||||
mRunningStatus_TX = InvalidType;
|
mRunningStatus_TX = InvalidType;
|
||||||
|
|
@ -415,8 +415,8 @@ void MIDI_Class::sendSongPosition(unsigned int Beats)
|
||||||
void MIDI_Class::sendSongSelect(byte SongNumber)
|
void MIDI_Class::sendSongSelect(byte SongNumber)
|
||||||
{
|
{
|
||||||
|
|
||||||
USE_SERIAL_PORT.write((byte)SongSelect);
|
MIDI_SERIAL_PORT.write((byte)SongSelect);
|
||||||
USE_SERIAL_PORT.write(SongNumber & 0x7F);
|
MIDI_SERIAL_PORT.write(SongNumber & 0x7F);
|
||||||
|
|
||||||
#if USE_RUNNING_STATUS
|
#if USE_RUNNING_STATUS
|
||||||
mRunningStatus_TX = InvalidType;
|
mRunningStatus_TX = InvalidType;
|
||||||
|
|
@ -441,7 +441,7 @@ void MIDI_Class::sendRealTime(kMIDIType Type)
|
||||||
case Continue:
|
case Continue:
|
||||||
case ActiveSensing:
|
case ActiveSensing:
|
||||||
case SystemReset:
|
case SystemReset:
|
||||||
USE_SERIAL_PORT.write((byte)Type);
|
MIDI_SERIAL_PORT.write((byte)Type);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Invalid Real Time marker
|
// Invalid Real Time marker
|
||||||
|
|
@ -508,7 +508,7 @@ bool MIDI_Class::read(const byte inChannel)
|
||||||
bool MIDI_Class::parse(byte inChannel)
|
bool MIDI_Class::parse(byte inChannel)
|
||||||
{
|
{
|
||||||
|
|
||||||
const int bytes_available = USE_SERIAL_PORT.available();
|
const int bytes_available = MIDI_SERIAL_PORT.available();
|
||||||
|
|
||||||
if (bytes_available <= 0) {
|
if (bytes_available <= 0) {
|
||||||
// No data available.
|
// No data available.
|
||||||
|
|
@ -517,7 +517,7 @@ bool MIDI_Class::parse(byte inChannel)
|
||||||
|
|
||||||
// If the buffer is full -> Don't Panic! Call the Vogons to destroy it.
|
// If the buffer is full -> Don't Panic! Call the Vogons to destroy it.
|
||||||
if (bytes_available == UART_BUFFER_SIZE) { Serial << "Overflow, call the Vogons!!" << endl;
|
if (bytes_available == UART_BUFFER_SIZE) { Serial << "Overflow, call the Vogons!!" << endl;
|
||||||
USE_SERIAL_PORT.flush();
|
MIDI_SERIAL_PORT.flush();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|
@ -530,7 +530,7 @@ bool MIDI_Class::parse(byte inChannel)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
const byte extracted = USE_SERIAL_PORT.read();
|
const byte extracted = MIDI_SERIAL_PORT.read();
|
||||||
|
|
||||||
if (mPendingMessageIndex == 0) { // Start a new pending message
|
if (mPendingMessageIndex == 0) { // Start a new pending message
|
||||||
mPendingMessage[0] = extracted;
|
mPendingMessage[0] = extracted;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
// Please note that the Thru will work only when both COMPILE_MIDI_IN and COMPILE_MIDI_OUT set to 1.
|
// Please note that the Thru will work only when both COMPILE_MIDI_IN and COMPILE_MIDI_OUT set to 1.
|
||||||
|
|
||||||
|
|
||||||
#define USE_SERIAL_PORT Serial1 // Change the number (to Serial1 for example) if you want
|
#define MIDI_SERIAL_PORT Serial1 // Change the number (to Serial1 for example) if you want
|
||||||
// to use a different serial port for MIDI I/O.
|
// to use a different serial port for MIDI I/O.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue