Skip to content

v5.0.0 #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3396ec9
fixed some warnings when compiling with -Wconversion and -Wsign-conve…
LnnrtS Jul 17, 2017
9b9905f
chore: Bump version to 4.4.0
Mar 10, 2018
1c01eff
feat: Handle Korg-style of flipping SysEx data header bits
Mar 10, 2018
064c9d9
fix: Issue link in documentation
Mar 10, 2018
d9cad60
chore: Upgrade Google Test to release-1.8.0
Mar 10, 2018
c583321
feat: Increase warning level for sources
Mar 10, 2018
33bd77d
fix: Fix more sign / implicit type conversion warnings
Mar 10, 2018
561def7
Merge pull request #81 from LnnrtS/fixedWarnings
Mar 10, 2018
1cd6383
chore: Update VSCode C++ helper file
Mar 10, 2018
ba6e164
Merge master into feat/4.4.0
Mar 10, 2018
83ad031
fix: Add tests and fix RingBuffer implementation
franky47 Oct 11, 2018
04ae12d
chore: Add VSCode config files & editor settings
franky47 Oct 11, 2018
42b98a7
refactor: Avoid redundant call
franky47 Oct 11, 2018
db0f65a
fix: Unnamed namespace macro is not available here
franky47 Oct 11, 2018
b939733
doc: Update links
franky47 Oct 11, 2018
9a0907e
chore: Point MIDI-USB submodule to own fork for unit testing
franky47 Nov 3, 2018
a34087c
feat: Add peek and pop methods
franky47 Nov 3, 2018
3f15b73
feat: Get CIN from status byte
franky47 Nov 3, 2018
5b96487
feat: Compose TX USB MIDI packets from serial buffer
franky47 Nov 3, 2018
1ccd7c3
feat: Add SysEx support for USB MIDI
franky47 Nov 3, 2018
5ccf015
feat: Serialise USB MIDI packets into the serial RX buffer
franky47 Nov 4, 2018
67a13be
fix: Use USB packet interface in the transport layer
franky47 Nov 4, 2018
0e9e505
doc: Note the importance of Running Status being disabled for USB
franky47 Nov 4, 2018
347b67a
fix: Point back to original MIDIUSB repo
franky47 Nov 6, 2018
5835806
fix: Constify
franky47 Nov 6, 2018
39d13e8
feat: Add MIDI USB test sketches
franky47 Nov 6, 2018
a9e0db5
fix: Test examples in CI
franky47 Nov 6, 2018
faa7bad
cleanup: Dedupe RingBuffer implementation in mocks
franky47 Nov 7, 2018
b3ab309
doc: Update Readme
franky47 Nov 7, 2018
96b7fd4
chore: Config file update
franky47 Nov 7, 2018
f067883
changed default size of enums (int) to a smaller type
lathoub Aug 18, 2019
cab564b
Merge pull request #125 from lathoub/patch-1
franky47 Aug 29, 2019
2c657a3
Added support for Active Sensing and SysEx command segments (v4.4.0) …
lathoub Apr 8, 2020
7a96fec
chore: Update Google Test & remove USBMIDI
franky47 Apr 17, 2020
a9664ef
fix: Use SysEx size in Settings
franky47 Apr 17, 2020
f8707ed
chore: Add all Teensy boards to CI
franky47 Apr 17, 2020
23c53ca
fix: Remove USB-based Teensys from CI
franky47 Apr 17, 2020
be85c7b
SerialUSB is of type Serial_, not HardwareSerial
lathoub Apr 17, 2020
b457f6d
added USB Migration and other Transport mechanisms
lathoub Apr 17, 2020
9d43a83
added AltPinSerial example
lathoub Apr 19, 2020
1e14162
rewrote AltPinSerial to use SoftwareSerial
lathoub Apr 20, 2020
c533094
Delete altPinSerialMIDI.h
lathoub Apr 20, 2020
e06e367
bug fix: HardwareSerial => SoftwareSerial
lathoub Apr 20, 2020
05487c5
Example not relevant for Due and ZERO as they lack support for Softwa…
lathoub Apr 20, 2020
45fb2df
listen on channel 1 by default
lathoub Apr 20, 2020
c1d2f47
Update unit-tests_MidiInput.cpp
lathoub Apr 20, 2020
c2d17ec
chore: Update lcov to latest available version
franky47 Apr 20, 2020
2d6bdd6
doc: Move Documentation section up
franky47 Apr 20, 2020
ae49d30
chore: Ignore external coverage
franky47 Apr 20, 2020
b384278
chore: Ignore edge cases for coverage
franky47 Apr 20, 2020
fc360d6
chore: Remove Google test coverage
franky47 Apr 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
logs/
build/
.vscode/.cmaketools.json
src/.DS_Store
examples/.DS_Store
.DS_Store
test/xcode
.development
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "external/google-test"]
path = external/google-test
url = https://github.com/google/googletest.git
[submodule "external/midi-usb"]
path = external/midi-usb
url = https://github.com/arduino-libraries/MIDIUSB.git
23 changes: 16 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ env:
- PLATFORMIO_CI_SRC=examples/Bench
- PLATFORMIO_CI_SRC=examples/Callbacks
- PLATFORMIO_CI_SRC=examples/DualMerger
- PLATFORMIO_CI_SRC=examples/ErrorCallback
- PLATFORMIO_CI_SRC=examples/Input
- PLATFORMIO_CI_SRC=examples/MidiUSB REQUIRES_USB=1
- PLATFORMIO_CI_SRC=examples/RPN_NRPN
- PLATFORMIO_CI_SRC=examples/SimpleSynth
- PLATFORMIO_CI_SRC=examples/AltPinSerial

addons:
apt:
Expand All @@ -48,7 +49,7 @@ install:
# Install newer lcov (1.9 seems to fail: http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
export LCOV_ROOT="$HOME/lcov"
mkdir -p "$LCOV_ROOT"
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.12.orig.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.14.orig.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
tar xf "$LCOV_ROOT/lcov.tar.gz" --strip-components=1 -C $LCOV_ROOT
export PATH="$LCOV_ROOT/bin:$PATH"
which lcov
Expand All @@ -74,17 +75,25 @@ script:
# Build current example
- |
if [ ! "${BUILD_UNIT_TESTS}" ]; then
if [ "${REQUIRES_USB}" ]; then
platformio ci --lib="." --lib=external/midi-usb --board="due" --board="dueUSB" --board="zero" --board="zeroUSB" --board="leonardo"
else
platformio ci --lib="." --board=uno --board="due" --board="zero" --board="leonardo" --board="micro" --board="nanoatmega328" --board="megaatmega2560" --board="teensy20" --board="teensy20pp" --board="teensy30" --board="teensy31"
fi
platformio ci --lib="." \
--board="uno" \
--board="due" \
--board="zero" \
--board="leonardo" \
--board="micro" \
--board="nanoatmega328" \
--board="megaatmega2560" \
--board="teensy2" \
--board="teensy30" \
--board="teensy31" \
--board="teensylc"
fi

after_success:
- |
if [ "${GENERATE_COVERAGE}" ]; then
# Generate code coverage information & send to Coveralls
rm -rf ./external/google-test/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.gcda
lcov --gcov-tool $GCOV --directory . --capture --output-file coverage.info
lcov --gcov-tool $GCOV --remove coverage.info 'test/*' '/usr/*' 'external/*' --output-file coverage.info
lcov --list coverage.info
Expand Down
3 changes: 3 additions & 0 deletions .vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"board": "arduino:avr:leonardo"
}
10 changes: 8 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{
"name": "Mac",
"includePath": [
"/Applications/Arduino.app/Contents/Java/tools/**",
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/**",
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/include",
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino",
"${workspaceRoot}"
Expand All @@ -20,7 +22,11 @@
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
],
"forcedInclude": [
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h"
],
"configurationProvider": "vector-of-bool.cmake-tools"
},
{
"name": "Linux",
Expand Down Expand Up @@ -55,5 +61,5 @@
"intelliSenseMode": "msvc-x64"
}
],
"version": 3
"version": 4
}
15 changes: 12 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"cmake.experimental.enableTargetDebugging": true
}
"files.associations": {
"cstddef": "cpp",
"ostream": "cpp",
"__locale": "cpp",
"functional": "cpp",
"iterator": "cpp",
"string": "cpp",
"string_view": "cpp",
"vector": "cpp",
"istream": "cpp"
}
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"command": "make",
"args": ["all"],
"options": {
"cwd": "${workspaceRoot}/build"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Run Tests",
"command": "${workspaceRoot}/build/test/unit-tests/unit-tests",
"group": {
"kind": "test",
"isDefault": true
},
"dependsOn": ["Build"]
}
]
}
118 changes: 86 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,113 @@
[![GitHub release](https://img.shields.io/github/release/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](https://github.com/FortySevenEffects/arduino_midi_library/releases/latest)
[![License](https://img.shields.io/github/license/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](LICENSE)

This library enables MIDI I/O communications on the Arduino serial ports.
This library adds MIDI I/O communications to an Arduino board.

### Features
* Compatible with all Arduino boards (and clones with an AVR processor).
* Simple and fast way to send and receive every kind of MIDI message (including all System messages, SysEx, Clock, etc..).
* OMNI input reading (read all channels).
* Software Thru, with message filtering.
* [Callbacks](http://playground.arduino.cc/Main/MIDILibraryCallbacks) to handle input messages more easily.
* Last received message is saved until a new one arrives.
* Configurable: [overridable template-based settings](https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-custom-Settings).
* Create more than one MIDI port for mergers/splitters applications.
* Use any serial port, hardware or software.

- **New** : USB MIDI Device support with [`MIDIUSB`](https://github.com/arduino-libraries/MIDIUSB).
- Compatible with all Arduino boards (and clones with an AVR processor).
- Simple and fast way to send and receive every kind of MIDI message (including all System messages, SysEx, Clock, etc..).
- OMNI input reading (read all channels).
- Software Thru, with message filtering.
- [Callbacks](https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-Callbacks) to handle input messages more easily.
- Last received message is saved until a new one arrives.
- Configurable: [overridable template-based settings](https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-custom-Settings).
- Create more than one MIDI interface for mergers/splitters applications.
- Use any serial port, hardware or software.

### Getting Started

1. Use Arduino's Library Manager to install the library.
![Type "MIDI" in the Arduino IDE Library Manager](res/library-manager.jpg)
1. Use the Arduino Library Manager to install the library.
![Type "MIDI" in the Arduino IDE Library Manager](res/library-manager.jpg)

2. Start coding:
```c++
#include <MIDI.h>

// Created and binds the MIDI interface to the default hardware Serial port
MIDI_CREATE_DEFAULT_INSTANCE();
```c++
#include <MIDI.h>

// Create and bind the MIDI interface to the default hardware Serial port
MIDI_CREATE_DEFAULT_INSTANCE();

void setup()
{
MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages
}
void setup()
{
MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages
}

void loop()
{
// Send note 42 with velocity 127 on channel 1
MIDI.sendNoteOn(42, 127, 1);
void loop()
{
// Send note 42 with velocity 127 on channel 1
MIDI.sendNoteOn(42, 127, 1);

// Read incoming messages
MIDI.read();
}
```
// Read incoming messages
MIDI.read();
}
```

3. Read the [documentation](#documentation) or watch the awesome video tutorials from [Notes & Volts](https://www.youtube.com/playlist?list=PL4_gPbvyebyH2xfPXePHtx8gK5zPBrVkg).

## Documentation

- [Doxygen Extended Documentation](http://fortyseveneffects.github.io/arduino_midi_library/).
- [GitHub wiki](https://github.com/FortySevenEffects/arduino_midi_library/wiki).
- [Doxygen Extended Documentation](https://fortyseveneffects.github.io/arduino_midi_library/).
- [GitHub wiki](https://github.com/FortySevenEffects/arduino_midi_library/wiki).

## USB Migration (4.x to 5.x)

All USB related code has been moved into a separate repository [Arduino-USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI), USB MIDI Device support with [`MIDIUSB`](https://github.com/arduino-libraries/MIDIUSB), still using this library to do all the MIDI heavy-lifting.

Migration has been made as easy as possible: only the declaration of the MIDI object has been modified, the rest of your code remains identical.

`4.3.1` code:

```c++
#include <MIDI.h>
#include <midi_UsbTransport.h>

static const unsigned sUsbTransportBufferSize = 16;
typedef midi::UsbTransport<sUsbTransportBufferSize> UsbTransport;

UsbTransport sUsbTransport;

MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, MIDI);

// ...
```

now becomes in `5.0.0`:

```c++
#include <USB-MIDI.h>
USBMIDI_CREATE_DEFAULT_INSTANCE();

// ...
```

Start with the [NoteOnOffEverySec](https://github.com/lathoub/Arduino-USBMIDI/blob/master/examples/NoteOnOffEverySec/NoteOnOffEverySec.ino) example that is based on the original MidiUSB [sketch](https://github.com/lathoub/arduino_midi_library/blob/master/examples/MidiUSB/MidiUSB.ino). Note the only difference is in the declaration.

The [USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI) Arduino library depends on [this library](https://github.com/FortySevenEffects/arduino_midi_library) and the [MIDIUSB](https://github.com/arduino-libraries/MIDIUSB) library.

[USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI) uses the latest Arduino IDE `depends` feature in the `library.properties` file installing all the dependencies automatically when installing from the IDE.

## Other Transport mechanisms

Version 5 of this library, allows for other Transport layers than the
original MIDI 1.0 Electrical Specification (hardware serial).

- [USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI)
- [AppleMIDI or rtpMIDI](https://github.com/lathoub/Arduino-AppleMIDI-Library)
- [ipMIDI](https://github.com/lathoub/Arduino-ipMIDI)
- [BLE-MIDI](https://github.com/lathoub/Arduino-BLE-MIDI)

All these Transport layers use this library for all the underlying MIDI
work, making it easy to switch transport protocols or making transport
protocol bridges.

## Contact

To report a bug, contribute, discuss on usage, or simply request support, please [create an issue here](https://github.com/FortySevenEffects/arduino_midi_library/issues/new).

You can also get informations about bug fixes and updates on my twitter account: [@fortysevenfx](http://twitter.com/fortysevenfx).
You can also contact me on Twitter: [@fortysevenfx](https://twitter.com/fortysevenfx).

## License

MIT © 2016 [Francois Best](http://fortyseveneffects.com)
MIT © 2009 - present [Francois Best](https://francoisbest.com)
17 changes: 16 additions & 1 deletion builder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ macro(setup_builder)

include_directories(${ROOT_SOURCE_DIR})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-Wall \
-W \
-Wshadow \
-Wunused-variable \
-Wunused-parameter \
-Wunused-function \
-Wunused \
-Wno-system-headers \
-Wno-deprecated \
-Woverloaded-virtual \
")
if (BUILDER_ENABLE_PROFILING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

endmacro()

macro(increase_warning_level)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wsign-conversion")
endmacro()
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Arduino MIDI Library"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Version 4.3.1"
PROJECT_NUMBER = "Version 4.4.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Loading