initial upload using feat/2.0.0 (not working)

This commit is contained in:
lathoub 2020-03-02 22:14:42 +01:00
parent 8a0619c498
commit 324d0404f5
32 changed files with 3756 additions and 56 deletions

9
.development Normal file
View File

@ -0,0 +1,9 @@
.DS_Store
examples/.DS_Store
src/.DS_Store
test/.vs
test/Debug
examples/ESP32_NoteOnOffEverySec/config.h
src/.vscode
test/x64
.development

View File

@ -1,5 +1,4 @@
#include <MIDI.h>
#define DEBUG 4
#include <midi_bleTransport.h>
#include <Ble_esp32.h>
@ -16,10 +15,7 @@ bool isConnected = false;
void setup()
{
// Serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial);
Serial.println(F("booting"));
DEBUG_BEGIN(115200);
MIDI.begin("Huzzah BLE MIDI", 1);
@ -29,7 +25,7 @@ void setup()
MIDI.setHandleNoteOn(OnBleMidiNoteOn);
MIDI.setHandleNoteOff(OnBleMidiNoteOff);
Serial.println(F("ready"));
N_DEBUG_PRINTLN(F("Ready"));
}
// -----------------------------------------------------------------------------
@ -57,7 +53,7 @@ void loop()
// rtpMIDI session. Device connected
// -----------------------------------------------------------------------------
void OnBleMidiConnected() {
Serial.println(F("Connected"));
N_DEBUG_PRINTLN(F("Connected"));
isConnected = true;
}
@ -73,13 +69,13 @@ void OnBleMidiDisconnected() {
// received note on
// -----------------------------------------------------------------------------
void OnBleMidiNoteOn(byte channel, byte note, byte velocity) {
Serial.print(F("Incoming NoteOn from channel:"));
Serial.print(channel);
Serial.print(F(" note:"));
Serial.print(note);
Serial.print(F(" velocity:"));
Serial.print(velocity);
Serial.println();
N_DEBUG_PRINT(F("Incoming NoteOn from channel:"));
N_DEBUG_PRINT(channel);
N_DEBUG_PRINT(F(" note:"));
N_DEBUG_PRINT(note);
N_DEBUG_PRINT(F(" velocity:"));
N_DEBUG_PRINT(velocity);
N_DEBUG_PRINTLN();
}
@ -87,11 +83,11 @@ void OnBleMidiNoteOn(byte channel, byte note, byte velocity) {
// received note off
// -----------------------------------------------------------------------------
void OnBleMidiNoteOff(byte channel, byte note, byte velocity) {
Serial.print(F("Incoming NoteOff from channel:"));
Serial.print(channel);
Serial.print(F(" note:"));
Serial.print(note);
Serial.print(F(" velocity:"));
Serial.print(velocity);
Serial.println();
}
N_DEBUG_PRINT(F("Incoming NoteOff from channel:"));
N_DEBUG_PRINT(channel);
N_DEBUG_PRINT(F(" note:"));
N_DEBUG_PRINT(note);
N_DEBUG_PRINT(F(" velocity:"));
N_DEBUG_PRINT(velocity);
N_DEBUG_PRINTLN();
}

3
src/midi_bleSettings.h Executable file
View File

@ -0,0 +1,3 @@
#pragma once
#include "midi_bleNamespace.h"

View File

@ -4,10 +4,10 @@
#pragma once
#include "utility/midi_bleSettings.h"
#include "utility/midi_bleDefs.h"
#include "midi_bleSettings.h"
#include "midi_bleDefs.h"
#include <midi_RingBuffer.h>
#include "utility/Deque.h"
BEGIN_BLEMIDI_NAMESPACE
@ -15,7 +15,7 @@ template<class BleClass>
class BleMidiTransport
{
private:
midi::RingBuffer<byte, 44> mRxBuffer;
Deque<byte, 44> mRxBuffer;
byte mTxBuffer[44];
unsigned mTxIndex = 0;

215
src/utility/Deque.h Normal file
View File

@ -0,0 +1,215 @@
#pragma once
template<typename T, size_t Size>
class Deque {
// class iterator;
private:
int _head, _tail;
T _data[Size];
public:
Deque()
{
clear();
};
size_t free();
const size_t size() const;
const size_t max_size() const;
T & front();
const T & front() const;
T & back();
const T & back() const;
void push_front(const T &);
void push_back(const T &);
T pop_front();
T pop_back();
T& operator[](size_t);
const T& operator[](size_t) const;
T& at(size_t);
const T& at(size_t) const;
void clear();
// iterator begin();
// iterator end();
void erase(size_t);
void erase(size_t, size_t);
bool empty() const {
return size() == 0;
}
bool full() const {
return (size() == Size);
}
};
template<typename T, size_t Size>
size_t Deque<T, Size>::free()
{
return Size - size();
}
template<typename T, size_t Size>
const size_t Deque<T, Size>::size() const
{
if (_tail < 0)
return 0; // empty
else if (_head > _tail)
return _head - _tail;
else
return Size - _tail + _head;
}
template<typename T, size_t Size>
const size_t Deque<T, Size>::max_size() const
{
return Size;
}
template<typename T, size_t Size>
T & Deque<T, Size>::front()
{
return _data[_tail];
}
template<typename T, size_t Size>
const T & Deque<T, Size>::front() const
{
return _data[_tail];
}
template<typename T, size_t Size>
T & Deque<T, Size>::back()
{
int idx = _head - 1;
if (idx < 0) idx = Size - 1;
return _data[idx];
}
template<typename T, size_t Size>
const T & Deque<T, Size>::back() const
{
int idx = _head - 1;
if (idx < 0) idx = Size - 1;
return _data[idx];
}
template<typename T, size_t Size>
void Deque<T, Size>::push_front(const T &value)
{
//if container is full, do nothing.
if (free()){
if (--_tail < 0)
_tail = Size - 1;
_data[_tail] = value;
}
}
template<typename T, size_t Size>
void Deque<T, Size>::push_back(const T &value)
{
//if container is full, do nothing.
if (free()){
_data[_head] = value;
if (empty())
_tail = _head;
if (++_head >= Size)
_head %= Size;
}
}
template<typename T, size_t Size>
T Deque<T, Size>::pop_front() {
if (empty()) // if empty, do nothing.
return T();
auto item = front();
if (++_tail >= Size)
_tail %= Size;
if (_tail == _head)
clear();
return item;
}
template<typename T, size_t Size>
T Deque<T, Size>::pop_back() {
if (empty()) // if empty, do nothing.
return T();
auto item = front();
if (--_head < 0)
_head = Size - 1;
if (_head == _tail) //now buffer is empty
clear();
return item;
}
template<typename T, size_t Size>
void Deque<T, Size>::erase(size_t position) {
if (position >= size()) // out-of-range!
return; // do nothing.
for (size_t i = position; i < size() - 1; i++){
at(i) = at(i + 1);
}
pop_back();
}
template<typename T, size_t Size>
void Deque<T, Size>::erase(size_t first, size_t last) {
if (first > last // invalid arguments
|| first >= size()) // out-of-range
return; //do nothing.
size_t tgt = first;
for (size_t i = last + 1; i < size(); i++){
at(tgt++) = at(i);
}
for (size_t i = first; i <= last; i++){
pop_back();
}
}
template<typename T, size_t Size>
T& Deque<T, Size>::operator[](size_t index)
{
auto i = _tail + index;
if (i >= Size)
i %= Size;
return _data[i];
}
template<typename T, size_t Size>
const T& Deque<T, Size>::operator[](size_t index) const
{
auto i = _tail + index;
if (i >= Size)
i %= Size;
return _data[i];
}
template<typename T, size_t Size>
T& Deque<T, Size>::at(size_t index)
{
auto i = _tail + index;
if (i >= Size)
i %= Size;
return _data[i];
}
template<typename T, size_t Size>
const T& Deque<T, Size>::at(size_t index) const
{
auto i = _tail + index;
if (i >= Size)
i %= Size;
return _data[i];
}
template<typename T, size_t Size>
void Deque<T, Size>::clear()
{
_tail = -1;
_head = 0;
}

71
src/utility/Logging.h Normal file
View File

@ -0,0 +1,71 @@
#pragma once
#ifndef DEBUGSTREAM
#define DEBUGSTREAM Serial
#endif
#define LOG_LEVEL_NONE 0
#define LOG_LEVEL_FATAL 1
#define LOG_LEVEL_ERROR 2
#define LOG_LEVEL_WARNING 3
#define LOG_LEVEL_NOTICE 4
#define LOG_LEVEL_TRACE 5
#define LOG_LEVEL_VERBOSE 6
#ifndef DEBUG
#define DEBUG LOG_LEVEL_NONE
#endif
#if DEBUG > LOG_LEVEL_NONE
#define DEBUG_BEGIN(SPEED) \
DEBUGSTREAM.begin(SPEED); \
while (!DEBUGSTREAM) \
; \
DEBUGSTREAM.println(F("Booting..."));
#define F_DEBUG_PRINT(...) DEBUGSTREAM.print(__VA_ARGS__)
#define F_DEBUG_PRINTLN(...) DEBUGSTREAM.println(__VA_ARGS__)
#else
#define DEBUG_BEGIN(SPEED)
#define F_DEBUG_PRINT(...)
#define F_DEBUG_PRINTLN(...)
#endif
#if DEBUG >= LOG_LEVEL_ERROR
#define E_DEBUG_PRINT(...) DEBUGSTREAM.print(__VA_ARGS__)
#define E_DEBUG_PRINTLN(...) DEBUGSTREAM.println(__VA_ARGS__)
#else
#define E_DEBUG_PRINT(...)
#define E_DEBUG_PRINTLN(...)
#endif
#if DEBUG >= LOG_LEVEL_WARNING
#define W_DEBUG_PRINT(...) DEBUGSTREAM.print(__VA_ARGS__)
#define W_DEBUG_PRINTLN(...) DEBUGSTREAM.println(__VA_ARGS__)
#else
#define W_DEBUG_PRINT(...)
#define W_DEBUG_PRINTLN(...)
#endif
#if DEBUG >= LOG_LEVEL_NOTICE
#define N_DEBUG_PRINT(...) DEBUGSTREAM.print(__VA_ARGS__)
#define N_DEBUG_PRINTLN(...) DEBUGSTREAM.println(__VA_ARGS__)
#else
#define N_DEBUG_PRINT(...)
#define N_DEBUG_PRINTLN(...)
#endif
#if DEBUG >= LOG_LEVEL_TRACE
#define T_DEBUG_PRINT(...) DEBUGSTREAM.print(__VA_ARGS__)
#define T_DEBUG_PRINTLN(...) DEBUGSTREAM.println(__VA_ARGS__)
#else
#define T_DEBUG_PRINT(...)
#define T_DEBUG_PRINTLN(...)
#endif
#if DEBUG >= LOG_LEVEL_VERBOSE
#define V_DEBUG_PRINT(...) DEBUGSTREAM.print(__VA_ARGS__)
#define V_DEBUG_PRINTLN(...) DEBUGSTREAM.println(__VA_ARGS__)
#else
#define V_DEBUG_PRINT(...)
#define V_DEBUG_PRINTLN(...)
#endif

139
src/utility/endian.h Normal file
View File

@ -0,0 +1,139 @@
#pragma once
#ifndef BYTE_ORDER
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#define TEST_LITTLE_ENDIAN (((union { unsigned x; unsigned char c; }){1}).c)
#ifdef TEST_LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#undef TEST_LITTLE_ENDIAN
#endif
#include <stdint.h>
#ifndef __bswap16
#define __bswap16(x) ((uint16_t)((((uint16_t)(x)&0xff00) >> 8) | (((uint16_t)(x)&0x00ff) << 8)))
#endif
#ifndef __bswap32
#define __bswap32(x) \
((uint32_t)((((uint32_t)(x)&0xff000000) >> 24) | (((uint32_t)(x)&0x00ff0000) >> 8) | \
(((uint32_t)(x)&0x0000ff00) << 8) | (((uint32_t)(x)&0x000000ff) << 24)))
#endif
#ifndef __bswap64
#define __bswap64(x) \
((uint64_t)((((uint64_t)(x)&0xff00000000000000ULL) >> 56) | \
(((uint64_t)(x)&0x00ff000000000000ULL) >> 40) | \
(((uint64_t)(x)&0x0000ff0000000000ULL) >> 24) | \
(((uint64_t)(x)&0x000000ff00000000ULL) >> 8) | \
(((uint64_t)(x)&0x00000000ff000000ULL) << 8) | \
(((uint64_t)(x)&0x0000000000ff0000ULL) << 24) | \
(((uint64_t)(x)&0x000000000000ff00ULL) << 40) | \
(((uint64_t)(x)&0x00000000000000ffULL) << 56)))
#endif
union conversionBuffer
{
uint8_t value8;
uint16_t value16;
uint32_t value32;
uint64_t value64;
byte buffer[8];
};
#if BYTE_ORDER == LITTLE_ENDIAN
// Definitions from musl libc
#define htobe16(x) __bswap16(x)
#define be16toh(x) __bswap16(x)
#define betoh16(x) __bswap16(x)
#define htobe32(x) __bswap32(x)
#define be32toh(x) __bswap32(x)
#define betoh32(x) __bswap32(x)
#define htobe64(x) __bswap64(x)
#define be64toh(x) __bswap64(x)
#define betoh64(x) __bswap64(x)
#define htole16(x) (uint16_t)(x)
#define le16toh(x) (uint16_t)(x)
#define letoh16(x) (uint16_t)(x)
#define htole32(x) (uint32_t)(x)
#define le32toh(x) (uint32_t)(x)
#define letoh32(x) (uint32_t)(x)
#define htole64(x) (uint64_t)(x)
#define le64toh(x) (uint64_t)(x)
#define letoh64(x) (uint64_t)(x)
// From Apple Open Source Libc
#define ntohs(x) __bswap16(x)
#define htons(x) __bswap16(x)
#define ntohl(x) __bswap32(x)
#define htonl(x) __bswap32(x)
#define ntohll(x) __bswap64(x)
#define htonll(x) __bswap64(x)
#define NTOHL(x) (x) = ntohl((uint32_t)x)
#define NTOHS(x) (x) = ntohs((uint16_t)x)
#define NTOHLL(x) (x) = ntohll((uint64_t)x)
#define HTONL(x) (x) = htonl((uint32_t)x)
#define HTONS(x) (x) = htons((uint16_t)x)
#define HTONLL(x) (x) = htonll((uint64_t)x)
#else // BIG_ENDIAN
// Definitions from musl libc
#define htobe16(x) (uint16_t)(x)
#define be16toh(x) (uint16_t)(x)
#define betoh16(x) (uint16_t)(x)
#define htobe32(x) (uint32_t)(x)
#define be32toh(x) (uint32_t)(x)
#define betoh32(x) (uint32_t)(x)
#define htobe64(x) (uint64_t)(x)
#define be64toh(x) (uint64_t)(x)
#define betoh64(x) (uint64_t)(x)
#define htole16(x) __bswap16(x)
#define le16toh(x) __bswap16(x)
#define letoh16(x) __bswap16(x)
#define htole32(x) __bswap32(x)
#define le32toh(x) __bswap32(x)
#define letoh32(x) __bswap32(x)
#define htole64(x) __bswap64(x)
#define le64toh(x) __bswap64(x)
#define letoh64(x) __bswap64(x)
// From Apple Open Source libc
#define ntohl(x) ((uint32_t)(x))
#define ntohs(x) ((uint16_t)(x))
#define htonl(x) ((uint32_t)(x))
#define htons(x) ((uint16_t)(x))
#define ntohll(x) ((uint64_t)(x))
#define htonll(x) ((uint64_t)(x))
#define NTOHL(x) (x)
#define NTOHS(x) (x)
#define NTOHLL(x) (x)
#define HTONL(x) (x)
#define HTONS(x) (x)
#define HTONLL(x) (x)
void aa(uint64_t value)
{
if ( value >= 10 )
aa(value / 10);
N_DEBUG_PRINT((uint32_t)(value % 10));
}
#endif

View File

@ -1,29 +0,0 @@
#pragma once
#include "midi_bleNamespace.h"
//#define DEBUG
#define RELEASE
#if defined(RELEASE)
#define RELEASE_BUILD
#undef DEBUG_BUILD
#endif
#if defined(DEBUG)
#define DEBUG_BUILD
#undef RELEASE_BUILD
#endif
#if defined(RELEASE_BUILD)
#undef BLEMIDI_DEBUG
#undef BLEMIDI_DEBUG_VERBOSE
#endif
#if defined(DEBUG_BUILD)
#define BLEMIDI_DEBUG 1
#undef BLEMIDI_DEBUG_VERBOSE
#define BLEMIDI_DEBUG_PARSING
#endif

View File

@ -0,0 +1,115 @@
/*!
* @file MIDI.cpp
* Project Arduino MIDI Library
* @brief MIDI Library for the Arduino
* @author Francois Best
* @date 24/02/11
* @license MIT - Copyright (c) 2015 Francois Best
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "MIDI.h"
// -----------------------------------------------------------------------------
BEGIN_MIDI_NAMESPACE
/*! \brief Encode System Exclusive messages.
SysEx messages are encoded to guarantee transmission of data bytes higher than
127 without breaking the MIDI protocol. Use this static method to convert the
data you want to send.
\param inData The data to encode.
\param outSysEx The output buffer where to store the encoded message.
\param inLength The lenght of the input buffer.
\param inFlipHeaderBits True for Korg and other who store MSB in reverse order
\return The lenght of the encoded output buffer.
@see decodeSysEx
Code inspired from Ruin & Wesen's SysEx encoder/decoder - http://ruinwesen.com
*/
unsigned encodeSysEx(const byte* inData,
byte* outSysEx,
unsigned inLength,
bool inFlipHeaderBits)
{
unsigned outLength = 0; // Num bytes in output array.
byte count = 0; // Num 7bytes in a block.
outSysEx[0] = 0;
for (unsigned i = 0; i < inLength; ++i)
{
const byte data = inData[i];
const byte msb = data >> 7;
const byte body = data & 0x7f;
outSysEx[0] |= (msb << (inFlipHeaderBits ? count : (6 - count)));
outSysEx[1 + count] = body;
if (count++ == 6)
{
outSysEx += 8;
outLength += 8;
outSysEx[0] = 0;
count = 0;
}
}
return outLength + count + (count != 0 ? 1 : 0);
}
/*! \brief Decode System Exclusive messages.
SysEx messages are encoded to guarantee transmission of data bytes higher than
127 without breaking the MIDI protocol. Use this static method to reassemble
your received message.
\param inSysEx The SysEx data received from MIDI in.
\param outData The output buffer where to store the decrypted message.
\param inLength The lenght of the input buffer.
\param inFlipHeaderBits True for Korg and other who store MSB in reverse order
\return The lenght of the output buffer.
@see encodeSysEx @see getSysExArrayLength
Code inspired from Ruin & Wesen's SysEx encoder/decoder - http://ruinwesen.com
*/
unsigned decodeSysEx(const byte* inSysEx,
byte* outData,
unsigned inLength,
bool inFlipHeaderBits)
{
unsigned count = 0;
byte msbStorage = 0;
byte byteIndex = 0;
for (unsigned i = 0; i < inLength; ++i)
{
if ((i % 8) == 0)
{
msbStorage = inSysEx[i];
byteIndex = 6;
}
else
{
const byte body = inSysEx[i];
const byte shift = inFlipHeaderBits ? 6 - byteIndex : byteIndex;
const byte msb = byte(((msbStorage >> shift) & 1) << 7);
byteIndex--;
outData[count++] = msb | body;
}
}
return count;
}
END_MIDI_NAMESPACE

View File

@ -0,0 +1,266 @@
/*!
* @file MIDI.h
* Project Arduino MIDI Library
* @brief MIDI Library for the Arduino
* @author Francois Best
* @date 24/02/11
* @license MIT - Copyright (c) 2015 Francois Best
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include "midi_Defs.h"
#include "midi_Settings.h"
#include "midi_Message.h"
// -----------------------------------------------------------------------------
BEGIN_MIDI_NAMESPACE
/*! \brief The main class for MIDI handling.
It is templated over the type of serial port to provide abstraction from
the hardware interface, meaning you can use HardwareSerial, SoftwareSerial
or ak47's Uart classes. The only requirement is that the class implements
the begin, read, write and available methods.
*/
template<class Encoder, class _Settings = DefaultSettings>
class MidiInterface
{
public:
typedef _Settings Settings;
public:
inline MidiInterface(Encoder&);
inline ~MidiInterface();
public:
void begin(Channel inChannel = 1);
// -------------------------------------------------------------------------
// MIDI Output
public:
inline void sendNoteOn(DataByte inNoteNumber,
DataByte inVelocity,
Channel inChannel);
inline void sendNoteOff(DataByte inNoteNumber,
DataByte inVelocity,
Channel inChannel);
inline void sendProgramChange(DataByte inProgramNumber,
Channel inChannel);
inline void sendControlChange(DataByte inControlNumber,
DataByte inControlValue,
Channel inChannel);
inline void sendPitchBend(int inPitchValue, Channel inChannel);
inline void sendPitchBend(double inPitchValue, Channel inChannel);
inline void sendPolyPressure(DataByte inNoteNumber,
DataByte inPressure,
Channel inChannel) __attribute__ ((deprecated));
inline void sendAfterTouch(DataByte inPressure,
Channel inChannel);
inline void sendAfterTouch(DataByte inNoteNumber,
DataByte inPressure,
Channel inChannel);
inline void sendSysEx(unsigned inLength,
const byte* inArray,
bool inArrayContainsBoundaries = false);
inline void sendTimeCodeQuarterFrame(DataByte inTypeNibble,
DataByte inValuesNibble);
inline void sendTimeCodeQuarterFrame(DataByte inData);
inline void sendSongPosition(unsigned inBeats);
inline void sendSongSelect(DataByte inSongNumber);
inline void sendTuneRequest();
inline void sendRealTime(MidiType inType);
inline void beginRpn(unsigned inNumber,
Channel inChannel);
inline void sendRpnValue(unsigned inValue,
Channel inChannel);
inline void sendRpnValue(byte inMsb,
byte inLsb,
Channel inChannel);
inline void sendRpnIncrement(byte inAmount,
Channel inChannel);
inline void sendRpnDecrement(byte inAmount,
Channel inChannel);
inline void endRpn(Channel inChannel);
inline void beginNrpn(unsigned inNumber,
Channel inChannel);
inline void sendNrpnValue(unsigned inValue,
Channel inChannel);
inline void sendNrpnValue(byte inMsb,
byte inLsb,
Channel inChannel);
inline void sendNrpnIncrement(byte inAmount,
Channel inChannel);
inline void sendNrpnDecrement(byte inAmount,
Channel inChannel);
inline void endNrpn(Channel inChannel);
public:
void send(MidiType inType,
DataByte inData1,
DataByte inData2,
Channel inChannel);
// -------------------------------------------------------------------------
// MIDI Input
public:
inline bool read();
inline bool read(Channel inChannel);
public:
inline MidiType getType() const;
inline Channel getChannel() const;
inline DataByte getData1() const;
inline DataByte getData2() const;
inline const byte* getSysExArray() const;
inline unsigned getSysExArrayLength() const;
inline bool check() const;
public:
inline Channel getInputChannel() const;
inline void setInputChannel(Channel inChannel);
public:
static inline MidiType getTypeFromStatusByte(byte inStatus);
static inline Channel getChannelFromStatusByte(byte inStatus);
static inline bool isChannelMessage(MidiType inType);
// -------------------------------------------------------------------------
// Input Callbacks
public:
inline void setHandleNoteOff(void (*fptr)(byte channel, byte note, byte velocity));
inline void setHandleNoteOn(void (*fptr)(byte channel, byte note, byte velocity));
inline void setHandleAfterTouchPoly(void (*fptr)(byte channel, byte note, byte pressure));
inline void setHandleControlChange(void (*fptr)(byte channel, byte number, byte value));
inline void setHandleProgramChange(void (*fptr)(byte channel, byte number));
inline void setHandleAfterTouchChannel(void (*fptr)(byte channel, byte pressure));
inline void setHandlePitchBend(void (*fptr)(byte channel, int bend));
inline void setHandleSystemExclusive(void (*fptr)(byte * array, unsigned size));
inline void setHandleTimeCodeQuarterFrame(void (*fptr)(byte data));
inline void setHandleSongPosition(void (*fptr)(unsigned beats));
inline void setHandleSongSelect(void (*fptr)(byte songnumber));
inline void setHandleTuneRequest(void (*fptr)(void));
inline void setHandleClock(void (*fptr)(void));
inline void setHandleStart(void (*fptr)(void));
inline void setHandleContinue(void (*fptr)(void));
inline void setHandleStop(void (*fptr)(void));
inline void setHandleActiveSensing(void (*fptr)(void));
inline void setHandleSystemReset(void (*fptr)(void));
inline void disconnectCallbackFromType(MidiType inType);
private:
void launchCallback();
void (*mNoteOffCallback)(byte channel, byte note, byte velocity);
void (*mNoteOnCallback)(byte channel, byte note, byte velocity);
void (*mAfterTouchPolyCallback)(byte channel, byte note, byte velocity);
void (*mControlChangeCallback)(byte channel, byte, byte);
void (*mProgramChangeCallback)(byte channel, byte);
void (*mAfterTouchChannelCallback)(byte channel, byte);
void (*mPitchBendCallback)(byte channel, int);
void (*mSystemExclusiveCallback)(byte * array, unsigned size);
void (*mTimeCodeQuarterFrameCallback)(byte data);
void (*mSongPositionCallback)(unsigned beats);
void (*mSongSelectCallback)(byte songnumber);
void (*mTuneRequestCallback)(void);
void (*mClockCallback)(void);
void (*mStartCallback)(void);
void (*mContinueCallback)(void);
void (*mStopCallback)(void);
void (*mActiveSensingCallback)(void);
void (*mSystemResetCallback)(void);
// -------------------------------------------------------------------------
// MIDI Soft Thru
public:
inline Thru::Mode getFilterMode() const;
inline bool getThruState() const;
inline void turnThruOn(Thru::Mode inThruFilterMode = Thru::Full);
inline void turnThruOff();
inline void setThruFilterMode(Thru::Mode inThruFilterMode);
private:
void thruFilter(byte inChannel);
private:
bool parse();
inline void handleNullVelocityNoteOnAsNoteOff();
inline bool inputFilter(Channel inChannel);
inline void resetInput();
private:
typedef Message<Settings::SysExMaxSize> MidiMessage;
private:
Encoder& mEncoder;
private:
Channel mInputChannel;
StatusByte mRunningStatus_RX;
StatusByte mRunningStatus_TX;
byte mPendingMessage[3];
unsigned mPendingMessageExpectedLenght;
unsigned mPendingMessageIndex;
unsigned mCurrentRpnNumber;
unsigned mCurrentNrpnNumber;
bool mThruActivated : 1;
Thru::Mode mThruFilterMode : 7;
MidiMessage mMessage;
unsigned long mLastMessageSentTime;
bool mSenderActiveSensingActivated;
private:
inline StatusByte getStatus(MidiType inType,
Channel inChannel) const;
};
// -----------------------------------------------------------------------------
unsigned encodeSysEx(const byte* inData,
byte* outSysEx,
unsigned inLenght,
bool inFlipHeaderBits = false);
unsigned decodeSysEx(const byte* inSysEx,
byte* outData,
unsigned inLenght,
bool inFlipHeaderBits = false);
END_MIDI_NAMESPACE
#include "MIDI.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,209 @@
/*!
* @file midi_Defs.h
* Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Definitions
* @author Francois Best
* @date 24/02/11
* @license MIT - Copyright (c) 2015 Francois Best
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include "midi_Namespace.h"
#if ARDUINO
#include <Arduino.h>
#else
#include <inttypes.h>
typedef uint8_t byte;
#endif
BEGIN_MIDI_NAMESPACE
#define MIDI_LIBRARY_VERSION 0x040400
#define MIDI_LIBRARY_VERSION_MAJOR 4
#define MIDI_LIBRARY_VERSION_MINOR 4
#define MIDI_LIBRARY_VERSION_PATCH 0
// -----------------------------------------------------------------------------
#define MIDI_CHANNEL_OMNI 0
#define MIDI_CHANNEL_OFF 17 // and over
#define MIDI_PITCHBEND_MIN -8192
#define MIDI_PITCHBEND_MAX 8191
// -----------------------------------------------------------------------------
// Type definitions
typedef byte StatusByte;
typedef byte DataByte;
typedef byte Channel;
typedef byte FilterMode;
// -----------------------------------------------------------------------------
/*! Enumeration of MIDI types */
enum MidiType: uint8_t
{
InvalidType = 0x00, ///< For notifying errors
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
SystemExclusiveStart = SystemExclusive, ///< System Exclusive Start
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
SystemExclusiveEnd = 0xF7, ///< System Exclusive End
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
};
// -----------------------------------------------------------------------------
/*! Enumeration of Thru filter modes */
struct Thru
{
enum Mode
{
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.
};
};
/*! Deprecated: use Thru::Mode instead.
Will be removed in v5.0.
*/
enum __attribute__ ((deprecated)) MidiFilterMode
{
Off = Thru::Off,
Full = Thru::Full,
SameChannel = Thru::SameChannel,
DifferentChannel = Thru::DifferentChannel,
};
// -----------------------------------------------------------------------------
/*! \brief Enumeration of Control Change command numbers.
See the detailed controllers numbers & description here:
http://www.somascape.org/midi/tech/spec.html#ctrlnums
*/
enum MidiControlChangeNumber: uint8_t
{
// High resolution Continuous Controllers MSB (+32 for LSB) ----------------
BankSelect = 0,
ModulationWheel = 1,
BreathController = 2,
// CC3 undefined
FootController = 4,
PortamentoTime = 5,
DataEntryMSB = 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,
DataEntryLSB = 38,
// Switches ----------------------------------------------------------------
Sustain = 64,
Portamento = 65,
Sostenuto = 66,
SoftPedal = 67,
Legato = 68,
Hold = 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
DataIncrement = 96,
DataDecrement = 97,
NRPNLSB = 98, ///< Non-Registered Parameter Number (LSB)
NRPNMSB = 99, ///< Non-Registered Parameter Number (MSB)
RPNLSB = 100, ///< Registered Parameter Number (LSB)
RPNMSB = 101, ///< Registered Parameter Number (MSB)
// Channel Mode messages ---------------------------------------------------
AllSoundOff = 120,
ResetAllControllers = 121,
LocalControl = 122,
AllNotesOff = 123,
OmniModeOff = 124,
OmniModeOn = 125,
MonoModeOn = 126,
PolyModeOn = 127
};
struct RPN
{
enum RegisteredParameterNumbers: uint16_t
{
PitchBendSensitivity = 0x0000,
ChannelFineTuning = 0x0001,
ChannelCoarseTuning = 0x0002,
SelectTuningProgram = 0x0003,
SelectTuningBank = 0x0004,
ModulationDepthRange = 0x0005,
NullFunction = (0x7f << 7) + 0x7f,
};
};
END_MIDI_NAMESPACE

View File

@ -0,0 +1,101 @@
/*!
* @file midi_Message.h
* Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Message struct definition
* @author Francois Best
* @date 11/06/14
* @license MIT - Copyright (c) 2015 Francois Best
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include "midi_Namespace.h"
#include "midi_Defs.h"
#ifndef ARDUINO
#include <string.h>
#endif
BEGIN_MIDI_NAMESPACE
/*! The Message structure contains decoded data of a MIDI message
read from the serial port with read()
*/
template<unsigned SysExMaxSize>
struct Message
{
/*! Default constructor
\n Initializes the attributes with their default values.
*/
inline Message()
: channel(0)
, type(MIDI_NAMESPACE::InvalidType)
, data1(0)
, data2(0)
, valid(false)
{
memset(sysexArray, 0, sSysExMaxSize * sizeof(DataByte));
}
/*! The maximum size for the System Exclusive array.
*/
static const unsigned sSysExMaxSize = SysExMaxSize;
/*! The MIDI channel on which the message was recieved.
\n Value goes from 1 to 16.
*/
Channel channel;
/*! The type of the message
(see the MidiType enum for types reference)
*/
MidiType type;
/*! The first data byte.
\n Value goes from 0 to 127.
*/
DataByte data1;
/*! The second data byte.
If the message is only 2 bytes long, this one is null.
\n Value goes from 0 to 127.
*/
DataByte data2;
/*! System Exclusive dedicated byte array.
\n Array length is stocked on 16 bits,
in data1 (LSB) and data2 (MSB)
*/
DataByte sysexArray[sSysExMaxSize];
/*! 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;
inline unsigned getSysExSize() const
{
const unsigned size = unsigned(data2) << 8 | data1;
return size > sSysExMaxSize ? sSysExMaxSize : size;
}
};
END_MIDI_NAMESPACE

View File

@ -0,0 +1,38 @@
/*!
* @file midi_Namespace.h
* Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Namespace declaration
* @author Francois Best
* @date 24/02/11
* @license MIT - Copyright (c) 2015 Francois Best
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#define MIDI_NAMESPACE midi_v440
#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

View File

@ -0,0 +1,87 @@
/*!
* @file midi_Settings.h
* Project Arduino MIDI Library
* @brief MIDI Library for the Arduino - Settings
* @author Francois Best
* @date 24/02/11
* @license MIT - Copyright (c) 2015 Francois Best
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include "midi_Defs.h"
BEGIN_MIDI_NAMESPACE
/*! \brief Default Settings for the MIDI Library.
To change the default settings, don't edit them there, create a subclass and
override the values in that subclass, then use the MIDI_CREATE_CUSTOM_INSTANCE
macro to create your instance. The settings you don't override will keep their
default value. Eg:
\code{.cpp}
struct MySettings : public MIDI::DefaultSettings
{
static const unsigned SysExMaxSize = 1024; // Accept SysEx messages up to 1024 bytes long.
};
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial2, MIDI, MySettings);
\endcode
*/
struct DefaultSettings
{
/*! Running status enables short messages when sending multiple values
of the same type and channel.\n
Must be disabled to send USB MIDI messages to a computer
Warning: does not work with some hardware, enable with caution.
*/
static const bool UseRunningStatus = false;
/*! NoteOn with 0 velocity should be handled as NoteOf.\n
Set to true to get NoteOff events when receiving null-velocity NoteOn messages.\n
Set to false to get NoteOn events when receiving null-velocity NoteOn messages.
*/
static const bool HandleNullVelocityNoteOnAsNoteOff = true;
/*! Active Sensing is intended to be sent
repeatedly by the sender to tell the receiver that a connection is alive. Use
of this message is optional. When initially received, the
receiver will expect to receive another Active Sensing
message each 300ms (max), and if it does not then it will
assume that the connection has been terminated. At
termination, the receiver will turn off all voices and return to
normal (non- active sensing) operation..
*/
static const bool UseSenderActiveSensing = false;
/*! Setting this to true 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
a lot of traffic, but might induce MIDI Thru and treatment latency.
*/
static const bool Use1ByteParsing = false;
/*! Maximum size of SysEx receivable. Decrease to save RAM if you don't expect
to receive SysEx, or adjust accordingly.
*/
static const unsigned SysExMaxSize = 128;
};
END_MIDI_NAMESPACE

90
test/Arduino.h Normal file
View File

@ -0,0 +1,90 @@
#pragma once
#include <chrono>
#include <iostream>
#include "IPAddress.h"
#define HEX 0
#define DEC 1
class _serial
{
public:
void print(const char a[]) { std::cout << a; };
void print(char a) { std::cout << a; };
void print(unsigned char a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << (int)a; };
void print(int a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a; };
void print(unsigned int a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a; };
void print(long a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a; };
void print(unsigned long a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a; };
void print(double a, int = 2) { std::cout << a; };
void print(struct tm * timeinfo, const char * format = NULL) {};
void print(IPAddress) {};
void println(const char a[]) { std::cout << a << "\n"; };
void println(char a) { std::cout << a << "\n"; };
void println(unsigned char a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << (int)a << "\n"; };
void println(int a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a << "\n"; };
void println(unsigned int a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a << "\n"; };
void println(long a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a << "\n"; };
void println(unsigned long a, int format = DEC) { std::cout << (format == DEC ? std::dec : std::hex) << a << "\n"; };
void println(double a, int format = 2) { std::cout << a << "\n"; };
void println(struct tm * timeinfo, const char * format = NULL) {};
void println(IPAddress) {};
void println(void) { std::cout << "\n"; };
};
_serial Serial;
#include <inttypes.h>
typedef uint8_t byte;
void begin();
void loop();
int main()
{
begin();
while (true)
{
loop();
}
}
// avoid strncpy security warning
#pragma warning(disable:4996)
#define __attribute__(A) /* do nothing */
#include "../src/utility/Deque.h"
#include "../src/utility/midi_feat4_4_0/midi_Defs.h"
float analogRead(int pin)
{
return 0.0f;
}
void randomSeed(float)
{
srand(static_cast<unsigned int>(time(0)));
}
unsigned long millis()
{
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
return (unsigned long)now;
}
int random(int min, int max)
{
return RAND_MAX % std::rand() % (max-min) + min;
}
template <class T> const T& min(const T& a, const T& b) {
return !(b < a) ? a : b; // or: return !comp(b,a)?a:b; for version (2)
}
#define F(x) x

403
test/Ethernet.h Normal file
View File

@ -0,0 +1,403 @@
#pragma once
#include <stdio.h>
#include "Arduino.h"
class EthernetUDP
{
Deque<byte, 4096> _buffer;
uint16_t _port;
public:
EthernetUDP()
{
_port = 0;
}
void begin(uint16_t port)
{
_port = port;
if (port == 5004 && true)
{
// AppleMIDI messages
}
if (port == 5005 && true)
{
// rtp-MIDI and AppleMIDI messages
byte aa[] = {
0x80, 0x61, 0xbf, 0xa2, 0x12, 0xb, 0x5a, 0xf7, 0xaa, 0x34, 0x96, 0x4a,
0xc0, 0x2b,
0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x0, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x0,
0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x0, 0xf8, 0x00, 0xf8, 0xc0, 0xbf, 0x89, 0x90, 0x05, 0xd0, 0x7a, 0xd5 };
byte bb[] = { 0x80, 0x61, 0xD5, 0xE2, 0x18, 0xCC, 0xAD, 0x1D, 0xC5, 0xB1, 0x54, 0x0, 0x41, 0xF8, 0x20, 0xD5, 0x8B, 0x0, 0x9, 0x18, 0x80, 0x40, 0x81, 0xF1, 0x49, 0x40 };
byte lowHighJournalWrong[] = {
0x80, 0x61, 0xcc, 0x73, 0x19, 0xe,
0x4e, 0xd4, 0xc5, 0xb1, 0x54, 0x00, 0x42, 0xd0, 0x30, 0x20, 0xcc, 0x4a, 0x00, 0x0a, 0x18, 0x8,
0x40, 0x81, 0xf1, 0x90, 0x40, 0x2d
};
byte sysexJournalMalformed[] = {
0x80, 0x61, 0x99, 0xc6, 0x1e, 0x90, 0x97, 0xc4, 0xc8, 0x86, 0x76, 0xf9,
0xc0, 0xc2,
0xf0,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x66,
0xf7,
0xc0, 0x99, 0x96, 0x90, 0x05, 0xd0, 0x00, 0x7b };
byte sysexTimingActiveSensingJournal[] = {
0x80, 0x61, 0xae, 0xae, 0x20, 0x7f, 0xd6, 0xe7, 0xc8, 0x86, 0x76, 0xf9,
0xc0, 0xc6,
0xf0,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19,
0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20,
0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x21,
0x19, 0x20, 0x21, 0x19, 0x20, 0x21, 0x19, 0x20, 0x66,
0xf7,
0x00, // time
0xf8, // Timing Clock
0x00, // Time
0xfe, // Active Sensing
0x40, 0xae, 0xa0, 0x10, 0x05, 0x50, 0x00, 0x8f }; // Journal
byte sysexJournal[] = {
0x80, 0x61, 0x85, 0xce, 0x1a, 0x5f, 0x1c, 0xa3, 0xc8, 0x86, 0x76, 0xf9,
0xc1, 0x9a,
0xf0,
0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x66, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x66, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21, 0x19, 0x19, 0x20, 0x21,
0x66,
0xf7,
0x40, 0x85, 0x8b, 0x10, 0x05, 0x50, 0x00, 0x8c };
byte sysexMalformedTimingClock[] = {
0x80, 0x61, 0x85, 0xd9, 0x1a, 0x5f, 0x26, 0xb0, 0xc8, 0x86, 0x76, 0xf9, 0x41, 0xf8, 0xc0, 0x85, 0x8b, 0x90, 0x05, 0xd0, 0x00, 0x95 };
// sysex (command length is xx (or 0x71) in 2 bytes - B-FLAG)
byte sysexSME[] = {
0x80, 0x61, 0x9A, 0xF, 0x0, 0x2A, 0x7D, 0x3D, 0x29, 0xDC, 0x48, 0x99,
0x80, 0x70,
0xF0,
0x41,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
0xF7 };
byte sysexSE[] = {
0x80, 0x61, 0x9A, 0xF, 0x0, 0x2A, 0x7D, 0x3D, 0x29, 0xDC, 0x48, 0x99,
0x80, 0x3f,
0xF0,
0x41,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
0xF7 };
byte sysexF[] = {
0x80, 0x61, 0x7c, 0xbc, 0x0a, 0xff, 0x56, 0xba, 0x0a, 0x1a, 0x2f, 0x43,
0x05,
0xf0,
0x41, 0x19, 0x20,
0xf7 };
// 36 bytes
byte noteOnOff[] = {
0x80, 0x61, 0x27, 0x9e, 0x00, 0x1d, 0xb5, 0x36, 0x36, 0x09, 0x2f, 0x2a, // rtp
// MIDI section
0x46, // flag
0x80, 0x3f, 0x00, // note off 63 on channel 1,
0x00, // delta time
0x3d, 0x00, // note 61
// Journal Section (17 bytes)
0x20, // journal flag
0x27, 0x34, // sequence nr
0x00, 0x0e, 0x08, // channel 1 channel flag
0x02, 0x59, // note on off
0xbd, 0x40, 0xbf, 0x40, // Log list
0x15, 0xad, 0x5a, 0xdf, 0xa8, // offbit octets
};
byte noteOnOff2[] = {
0x80, 0x61, 0x27, 0x9e, 0x00, 0x1d, 0xb5, 0x36, 0x36, 0x09, 0x2f, 0x2a, // rtp
// MIDI section
0x46, // flag
0x80, 0x3f, 0x00, // note off 63 on channel 1,
0x00, // delta time
0x3d, 0x00, // note 61
// Journal Section (17 bytes)
0x20, // journal flag
0x27, 0x34, // sequence nr
0x00, 0x0e, 0x08, // channel 1 channel flag
0x02, 0x59, // note on off
0xbd, 0x40, 0xbf, 0x40, // Log list
0x15, 0xad, 0x5a, 0xdf, 0xa8, // offbit octets
0x80, 0x61, 0x27, 0x9e, 0x00, 0x1d, 0xb5, 0x36, 0x36, 0x09, 0x2f, 0x2a, // rtp
// MIDI section
0x46, // flag
0x80, 0x3f, 0x00, // note off 63 on channel 1,
0x00, // delta time
0x3d, 0x00, // note off note 61 on channel 1 (note the running status)
// Journal Section (17 bytes)
0x20, // journal flag
0x27, 0x34, // sequence nr
0x00, 0x0e, 0x08, // channel 1 channel flag
0x02, 0x59, // note on off
0xbd, 0x40, 0xbf, 0x40, // Log list
0x15, 0xad, 0x5a, 0xdf, 0xa8, // offbit octets
};
byte controlChange[] = {
0x80, 0x61, 0x20, 0xa5, 0x7f, 0xc,
0x73, 0x2d, 0xc5, 0xb1, 0x54, 0x00, 0x80, 0xbf, 0xb0, 0x7b, 0x00, 0x00, 0xb1, 0x7b, 0x00, 0x0,
0xb2, 0x7b, 0x00, 0x00, 0xb3, 0x7b, 0x00, 0x00, 0xb4, 0x7b, 0x00, 0x00, 0xb5, 0x7b, 0x00, 0x0,
0xb6, 0x7b, 0x00, 0x00, 0xb7, 0x7b, 0x00, 0x00, 0xb8, 0x7b, 0x00, 0x00, 0xb9, 0x7b, 0x00, 0x0,
0xba, 0x7b, 0x00, 0x00, 0xbb, 0x7b, 0x00, 0x00, 0xbc, 0x7b, 0x00, 0x00, 0xbd, 0x7b, 0x00, 0x0,
0xbe, 0x7b, 0x00, 0x00, 0xbf, 0x7b, 0x00, 0x00, 0xe0, 0x00, 0x40, 0x00, 0xe1, 0x00, 0x40, 0x0,
0xe2, 0x00, 0x40, 0x00, 0xe3, 0x00, 0x40, 0x00, 0xe4, 0x00, 0x40, 0x00, 0xe5, 0x00, 0x40, 0x0,
0xe6, 0x00, 0x40, 0x00, 0xe7, 0x00, 0x40, 0x00, 0xe8, 0x00, 0x40, 0x00, 0xe9, 0x00, 0x40, 0x0,
0xea, 0x00, 0x40, 0x00, 0xeb, 0x00, 0x40, 0x00, 0xec, 0x00, 0x40, 0x00, 0xed, 0x00, 0x40, 0x0,
0xee, 0x00, 0x40, 0x00, 0xef, 0x00, 0x40, 0x00, 0xb0, 0x40, 0x00, 0x00, 0xb1, 0x40, 0x00, 0x0,
0xb2, 0x40, 0x00, 0x00, 0xb3, 0x40, 0x00, 0x00, 0xb4, 0x40, 0x00, 0x00, 0xb5, 0x40, 0x00, 0x0,
0xb6, 0x40, 0x00, 0x00, 0xb7, 0x40, 0x00, 0x00, 0xb8, 0x40, 0x00, 0x00, 0xb9, 0x40, 0x00, 0x0,
0xba, 0x40, 0x00, 0x00, 0xbb, 0x40, 0x00, 0x00, 0xbc, 0x40, 0x00, 0x00, 0xbd, 0x40, 0x00, 0x0,
0xbe, 0x40, 0x00, 0x00, 0xbf, 0x40, 0x00 };
byte RTStart[] = {
0x80, 0x61, 0x20, 0xa6, 0x7f, 0xc, 0x73, 0x66, 0xc5, 0xb1, 0x54, 0x00, 0x43,
0xfa, 0x00, 0xf8,
0x2f, 0x20, 0xa5,
0x00, 0x0a, 0x5, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x08, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x0, 0x40,
0x10, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x18, 0x0a, 0x50, 0x01, 0x4, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x20, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x28, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x30, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7, 0x00, 0x00, 0x40,
0x38, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x40, 0x0a, 0x5, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x48, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x0, 0x40,
0x50, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x58, 0x0a, 0x50, 0x01, 0x4, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x60, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x68, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40,
0x70, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7, 0x00, 0x00, 0x40,
0x78, 0x0a, 0x50, 0x01, 0x40, 0x00, 0x7b, 0x00, 0x00, 0x40 };
byte TCNote[] = {
0x80, 0x61, 0x4e, 0x24, 0x82, 0x9f, 0xdc, 0x22, 0xc5, 0xb1, 0x54, 0x00,
0xc0, 0x20,
0xf8, 0x00, 0x90, 0x2b, 0x7f, 0x00, 0x34, 0x7f, 0x00, 0x35, 0x7f, 0x00,
0x36, 0x7f, 0x00, 0x37, 0x7f, 0x00, 0x38, 0x7f, 0x00, 0x39, 0x7f, 0x00,
0x3a, 0x7f, 0x00, 0x3b, 0x7f, 0x00, 0x3c, 0x7f,
0x6f, 0x45, 0x85, 0x10, 0x05, 0x50, 0x00, 0x0f,
0x80, 0x0f, 0x58, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0x80, 0x57, 0x10, 0x0f, 0xf8, 0x88,
0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0x90, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb,
0x00, 0x80, 0x40, 0x98, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xa0, 0x0a, 0x50,
0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xa8, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80,
0x40, 0xb0, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xb8, 0x0a, 0x50, 0x81, 0xc0,
0x00, 0xfb, 0x00, 0x80, 0x40, 0xc0, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xc8,
0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xd0, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb,
0x00, 0x80, 0x40, 0xd8, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xe0, 0x0a, 0x50,
0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xe8, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80,
0x40, 0xf0, 0x0a, 0x50, 0x81, 0xc0, 0x00, 0xfb, 0x00, 0x80, 0x40, 0xf8, 0x0a, 0x50, 0x81, 0xc0,
0x00, 0xfb, 0x00, 0x80, 0x40 };
byte aaa[] = {
0x80, 0x61, 0xa5, 0x05, 0x01, 0x08, 0x58, 0x2a, 0x34, 0xc7, 0xab, 0xfd, 0x4e, 0x80, 0x53, 0x00, 0x11, 0x35, 0x00, 0x8f, 0xff, 0xff,
0xff, 0x00, 0x90, 0x4f, 0x40, 0x20, 0xa4, 0xdb, 0x00, 0x13, 0x08, 0x03, 0x3a, 0xb5, 0x7f, 0xcd,
0x40, 0xd3, 0x40, 0x02, 0x10, 0x10, 0x10, 0x08, 0x00, 0xa9, 0x48,
};
byte slecht[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
// write(noteOnOff, sizeof(noteOnOff));
}
if (port == 5005 && true)
{
// rtp-MIDI and AppleMIDI messages
}
};
bool beginPacket(uint32_t, uint16_t)
{
return true;
}
bool beginPacket(IPAddress, uint16_t)
{
return true;
}
size_t parsePacket()
{
return _buffer.size();
};
size_t available()
{
return _buffer.size();
};
size_t read(byte* buffer, size_t size)
{
size = min(size, _buffer.size());
for (size_t i = 0; i < size; i++)
buffer[i] = _buffer.pop_front();
return size;
};
void write(uint8_t buffer)
{
_buffer.push_back(buffer);
};
void write(uint8_t* buffer, size_t size)
{
for (size_t i = 0; i < size; i++)
_buffer.push_back(buffer[i]);
};
void endPacket() { };
void flush()
{
if (_port == 5004)
{
if (_buffer[0] == 0xff && _buffer[1] == 0xff && _buffer[2] == 'I' &&_buffer[3] == 'N')
{
_buffer.clear();
byte u[] = {
0xff, 0xff,
0x4f, 0x4b,
0x00, 0x00, 0x00, 0x02,
0xb7, 0x06, 0x20, 0x30,
0xda, 0x8d, 0xc5, 0x8a,
0x4d, 0x61, 0x63, 0x62, 0x6f, 0x6f, 0x6b, 0x20, 0x50, 0x72, 0x6f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x53, 0x61, 0x6e, 0x64, 0x72, 0x61, 0x20, 0x56, 0x65, 0x72, 0x62, 0x65, 0x6b, 0x65, 0x6e, 0x20, 0x28, 0x32, 0x29, 0x00 };
byte r[] = { 0xff, 0xff,
0x4f, 0x4b,
0x00, 0x0, 0x00, 0x02,
0xb7, 0x06, 0x20, 0x30,
0xda, 0x8d, 0xc5, 0x8a,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6, 0x6e, 0x31, 0x2d, 0x42, 0x00 };
write(u, sizeof(u));
}
}
if (_port == 5005)
{
if (_buffer[0] == 0xff && _buffer[1] == 0xff && _buffer[2] == 'I' &&_buffer[3] == 'N')
{
_buffer.clear();
byte r[] = { 0xff, 0xff,
0x4f, 0x4b,
0x00, 0x0, 0x00, 0x02,
0xb7, 0x06, 0x20, 0x30,
0xda, 0x8d, 0xc5, 0x8a,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6, 0x6e, 0x31, 0x2d, 0x42, 0x00 };
write(r, sizeof(r));
}
else if (_buffer[0] == 0xff && _buffer[1] == 0xff && _buffer[2] == 'C' &&_buffer[3] == 'K')
{
if (_buffer[8] == 0x00)
{
_buffer.clear();
byte r[] = { 0xff, 0xff,
0x43, 0x4b,
0xda, 0x8d, 0xc5, 0x8a,
0x01,
0x65, 0x73, 0x73,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x34,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x6c, 0x83,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
write(r, sizeof(r));
}
else
_buffer.clear();
}
}
};
void stop() { _buffer.clear(); };
uint32_t remoteIP() { return 1; }
uint16_t remotePort() { return _port; }
};

12
test/IPAddress.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
class IPAddress
{
public:
IPAddress(){};
IPAddress(const IPAddress& from){};
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet){};
IPAddress(uint32_t address) { }
IPAddress(int address) { }
IPAddress(const uint8_t *address) {};
};

12
test/NoteOn.cpp Normal file
View File

@ -0,0 +1,12 @@
#define DEBUG 7
#define APPLEMIDI_INITIATOR
#include "../src/midi_bleTransport.h"
void begin()
{
}
void loop()
{
}

31
test/TestParser.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29306.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestParser", "TestParser.vcxproj", "{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Debug|x64.ActiveCfg = Debug|x64
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Debug|x64.Build.0 = Debug|x64
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Debug|x86.ActiveCfg = Debug|Win32
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Debug|x86.Build.0 = Debug|Win32
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Release|x64.ActiveCfg = Release|x64
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Release|x64.Build.0 = Release|x64
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Release|x86.ActiveCfg = Release|Win32
{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E91ABBB5-98C4-4D25-B603-CA43FE39B327}
EndGlobalSection
EndGlobal

138
test/TestParser.vcxproj Normal file
View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{25F82AE6-0CAA-4AF7-A003-BB54DB5EBA5E}</ProjectGuid>
<RootNamespace>TestParser</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<LanguageStandard>Default</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="NoteOn.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Arduino.h" />
<ClInclude Include="Ethernet.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="NoteOn.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Arduino.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Ethernet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -0,0 +1,278 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
CCE329C223C2040200A197D1 /* NoteOn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCE329BF23C2040200A197D1 /* NoteOn.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CCE329B323C2037C00A197D1 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
CC1A7D5F23F9378200206908 /* IPAddress.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IPAddress.h; path = "/Users/bart/Documents/Arduino/libraries/Arduino-AppleMIDI-Library/test/IPAddress.h"; sourceTree = "<absolute>"; };
CCE329B523C2037C00A197D1 /* rtpMidi */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rtpMidi; sourceTree = BUILT_PRODUCTS_DIR; };
CCE329BF23C2040200A197D1 /* NoteOn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NoteOn.cpp; sourceTree = "<group>"; };
CCE329C023C2040200A197D1 /* Arduino.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Arduino.h; sourceTree = "<group>"; };
CCE329C123C2040200A197D1 /* Ethernet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ethernet.h; sourceTree = "<group>"; };
CCE329D623C28E9F00A197D1 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = ../src; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
CCE329B223C2037C00A197D1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
CCE329AC23C2037C00A197D1 = {
isa = PBXGroup;
children = (
CCE329D623C28E9F00A197D1 /* src */,
CCE329C023C2040200A197D1 /* Arduino.h */,
CCE329C123C2040200A197D1 /* Ethernet.h */,
CC1A7D5F23F9378200206908 /* IPAddress.h */,
CCE329BF23C2040200A197D1 /* NoteOn.cpp */,
CCE329B623C2037C00A197D1 /* Products */,
);
sourceTree = "<group>";
};
CCE329B623C2037C00A197D1 /* Products */ = {
isa = PBXGroup;
children = (
CCE329B523C2037C00A197D1 /* rtpMidi */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
CCE329B423C2037C00A197D1 /* rtpMidi */ = {
isa = PBXNativeTarget;
buildConfigurationList = CCE329BC23C2037C00A197D1 /* Build configuration list for PBXNativeTarget "rtpMidi" */;
buildPhases = (
CCE329B123C2037C00A197D1 /* Sources */,
CCE329B223C2037C00A197D1 /* Frameworks */,
CCE329B323C2037C00A197D1 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = rtpMidi;
productName = rtpMidi;
productReference = CCE329B523C2037C00A197D1 /* rtpMidi */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
CCE329AD23C2037C00A197D1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Bart De Lathouwer";
TargetAttributes = {
CCE329B423C2037C00A197D1 = {
CreatedOnToolsVersion = 11.3;
};
};
};
buildConfigurationList = CCE329B023C2037C00A197D1 /* Build configuration list for PBXProject "bleMidi" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = CCE329AC23C2037C00A197D1;
productRefGroup = CCE329B623C2037C00A197D1 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
CCE329B423C2037C00A197D1 /* rtpMidi */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
CCE329B123C2037C00A197D1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CCE329C223C2040200A197D1 /* NoteOn.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
CCE329BA23C2037C00A197D1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
CCE329BB23C2037C00A197D1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
CCE329BD23C2037C00A197D1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
CCE329BE23C2037C00A197D1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
CCE329B023C2037C00A197D1 /* Build configuration list for PBXProject "bleMidi" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CCE329BA23C2037C00A197D1 /* Debug */,
CCE329BB23C2037C00A197D1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CCE329BC23C2037C00A197D1 /* Build configuration list for PBXNativeTarget "rtpMidi" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CCE329BD23C2037C00A197D1 /* Debug */,
CCE329BE23C2037C00A197D1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = CCE329AD23C2037C00A197D1 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:rtpMidi.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "45C4A6EC-3834-450F-AA9C-7BF43DFE5030"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "C520D785-C5C2-4749-89DA-451715741393"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../src/AppleMIDI.h"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "163"
endingLineNumber = "163"
landmarkName = "available()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>rtpMidi.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>