Skip to content

Commit 804e596

Browse files
authored
Merge pull request #95 from FortySevenEffects/feat/4.4.0
v5.0.0
2 parents 4f9e629 + fc360d6 commit 804e596

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1534
-1474
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
logs/
44
build/
55
.vscode/.cmaketools.json
6+
src/.DS_Store
7+
examples/.DS_Store
8+
.DS_Store
9+
test/xcode
10+
.development

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "external/google-test"]
22
path = external/google-test
33
url = https://github.com/google/googletest.git
4-
[submodule "external/midi-usb"]
5-
path = external/midi-usb
6-
url = https://github.com/arduino-libraries/MIDIUSB.git

.travis.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ env:
2525
- PLATFORMIO_CI_SRC=examples/Bench
2626
- PLATFORMIO_CI_SRC=examples/Callbacks
2727
- PLATFORMIO_CI_SRC=examples/DualMerger
28+
- PLATFORMIO_CI_SRC=examples/ErrorCallback
2829
- PLATFORMIO_CI_SRC=examples/Input
29-
- PLATFORMIO_CI_SRC=examples/MidiUSB REQUIRES_USB=1
3030
- PLATFORMIO_CI_SRC=examples/RPN_NRPN
3131
- PLATFORMIO_CI_SRC=examples/SimpleSynth
32+
- PLATFORMIO_CI_SRC=examples/AltPinSerial
3233

3334
addons:
3435
apt:
@@ -48,7 +49,7 @@ install:
4849
# Install newer lcov (1.9 seems to fail: http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
4950
export LCOV_ROOT="$HOME/lcov"
5051
mkdir -p "$LCOV_ROOT"
51-
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.12.orig.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
52+
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.14.orig.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
5253
tar xf "$LCOV_ROOT/lcov.tar.gz" --strip-components=1 -C $LCOV_ROOT
5354
export PATH="$LCOV_ROOT/bin:$PATH"
5455
which lcov
@@ -74,17 +75,25 @@ script:
7475
# Build current example
7576
- |
7677
if [ ! "${BUILD_UNIT_TESTS}" ]; then
77-
if [ "${REQUIRES_USB}" ]; then
78-
platformio ci --lib="." --lib=external/midi-usb --board="due" --board="dueUSB" --board="zero" --board="zeroUSB" --board="leonardo"
79-
else
80-
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"
81-
fi
78+
platformio ci --lib="." \
79+
--board="uno" \
80+
--board="due" \
81+
--board="zero" \
82+
--board="leonardo" \
83+
--board="micro" \
84+
--board="nanoatmega328" \
85+
--board="megaatmega2560" \
86+
--board="teensy2" \
87+
--board="teensy30" \
88+
--board="teensy31" \
89+
--board="teensylc"
8290
fi
8391
8492
after_success:
8593
- |
8694
if [ "${GENERATE_COVERAGE}" ]; then
8795
# Generate code coverage information & send to Coveralls
96+
rm -rf ./external/google-test/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.gcda
8897
lcov --gcov-tool $GCOV --directory . --capture --output-file coverage.info
8998
lcov --gcov-tool $GCOV --remove coverage.info 'test/*' '/usr/*' 'external/*' --output-file coverage.info
9099
lcov --list coverage.info

.vscode/arduino.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"board": "arduino:avr:leonardo"
3+
}

.vscode/c_cpp_properties.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
{
44
"name": "Mac",
55
"includePath": [
6+
"/Applications/Arduino.app/Contents/Java/tools/**",
7+
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/**",
68
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/include",
79
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino",
810
"${workspaceRoot}"
@@ -20,7 +22,11 @@
2022
"macFrameworkPath": [
2123
"/System/Library/Frameworks",
2224
"/Library/Frameworks"
23-
]
25+
],
26+
"forcedInclude": [
27+
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h"
28+
],
29+
"configurationProvider": "vector-of-bool.cmake-tools"
2430
},
2531
{
2632
"name": "Linux",
@@ -55,5 +61,5 @@
5561
"intelliSenseMode": "msvc-x64"
5662
}
5763
],
58-
"version": 3
64+
"version": 4
5965
}

.vscode/settings.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
// Place your settings in this file to overwrite default and user settings.
21
{
3-
"cmake.experimental.enableTargetDebugging": true
4-
}
2+
"files.associations": {
3+
"cstddef": "cpp",
4+
"ostream": "cpp",
5+
"__locale": "cpp",
6+
"functional": "cpp",
7+
"iterator": "cpp",
8+
"string": "cpp",
9+
"string_view": "cpp",
10+
"vector": "cpp",
11+
"istream": "cpp"
12+
}
13+
}

.vscode/tasks.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Build",
8+
"command": "make",
9+
"args": ["all"],
10+
"options": {
11+
"cwd": "${workspaceRoot}/build"
12+
},
13+
"group": {
14+
"kind": "build",
15+
"isDefault": true
16+
}
17+
},
18+
{
19+
"label": "Run Tests",
20+
"command": "${workspaceRoot}/build/test/unit-tests/unit-tests",
21+
"group": {
22+
"kind": "test",
23+
"isDefault": true
24+
},
25+
"dependsOn": ["Build"]
26+
}
27+
]
28+
}

README.md

Lines changed: 86 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,113 @@
55
[![GitHub release](https://img.shields.io/github/release/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](https://github.com/FortySevenEffects/arduino_midi_library/releases/latest)
66
[![License](https://img.shields.io/github/license/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](LICENSE)
77

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

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

2123
### Getting Started
2224

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

2628
2. Start coding:
27-
```c++
28-
#include <MIDI.h>
2929

30-
// Created and binds the MIDI interface to the default hardware Serial port
31-
MIDI_CREATE_DEFAULT_INSTANCE();
30+
```c++
31+
#include <MIDI.h>
32+
33+
// Create and bind the MIDI interface to the default hardware Serial port
34+
MIDI_CREATE_DEFAULT_INSTANCE();
3235

33-
void setup()
34-
{
35-
MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages
36-
}
36+
void setup()
37+
{
38+
MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages
39+
}
3740

38-
void loop()
39-
{
40-
// Send note 42 with velocity 127 on channel 1
41-
MIDI.sendNoteOn(42, 127, 1);
41+
void loop()
42+
{
43+
// Send note 42 with velocity 127 on channel 1
44+
MIDI.sendNoteOn(42, 127, 1);
4245

43-
// Read incoming messages
44-
MIDI.read();
45-
}
46-
```
46+
// Read incoming messages
47+
MIDI.read();
48+
}
49+
```
4750

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

5053
## Documentation
5154

52-
- [Doxygen Extended Documentation](http://fortyseveneffects.github.io/arduino_midi_library/).
53-
- [GitHub wiki](https://github.com/FortySevenEffects/arduino_midi_library/wiki).
55+
- [Doxygen Extended Documentation](https://fortyseveneffects.github.io/arduino_midi_library/).
56+
- [GitHub wiki](https://github.com/FortySevenEffects/arduino_midi_library/wiki).
57+
58+
## USB Migration (4.x to 5.x)
59+
60+
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.
61+
62+
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.
63+
64+
`4.3.1` code:
65+
66+
```c++
67+
#include <MIDI.h>
68+
#include <midi_UsbTransport.h>
69+
70+
static const unsigned sUsbTransportBufferSize = 16;
71+
typedef midi::UsbTransport<sUsbTransportBufferSize> UsbTransport;
72+
73+
UsbTransport sUsbTransport;
74+
75+
MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, MIDI);
76+
77+
// ...
78+
```
79+
80+
now becomes in `5.0.0`:
81+
82+
```c++
83+
#include <USB-MIDI.h>
84+
USBMIDI_CREATE_DEFAULT_INSTANCE();
85+
86+
// ...
87+
```
88+
89+
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.
90+
91+
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.
92+
93+
[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.
94+
95+
## Other Transport mechanisms
96+
97+
Version 5 of this library, allows for other Transport layers than the
98+
original MIDI 1.0 Electrical Specification (hardware serial).
99+
100+
- [USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI)
101+
- [AppleMIDI or rtpMIDI](https://github.com/lathoub/Arduino-AppleMIDI-Library)
102+
- [ipMIDI](https://github.com/lathoub/Arduino-ipMIDI)
103+
- [BLE-MIDI](https://github.com/lathoub/Arduino-BLE-MIDI)
104+
105+
All these Transport layers use this library for all the underlying MIDI
106+
work, making it easy to switch transport protocols or making transport
107+
protocol bridges.
54108

55109
## Contact
56110

57111
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).
58112

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

61115
## License
62116

63-
MIT © 2016 [Francois Best](http://fortyseveneffects.com)
117+
MIT © 2009 - present [Francois Best](https://francoisbest.com)

builder/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,26 @@ macro(setup_builder)
88

99
include_directories(${ROOT_SOURCE_DIR})
1010

11-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual")
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
12+
-Wall \
13+
-W \
14+
-Wshadow \
15+
-Wunused-variable \
16+
-Wunused-parameter \
17+
-Wunused-function \
18+
-Wunused \
19+
-Wno-system-headers \
20+
-Wno-deprecated \
21+
-Woverloaded-virtual \
22+
")
1223
if (BUILDER_ENABLE_PROFILING)
1324
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
1425
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
1526
endif()
1627
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
1728

1829
endmacro()
30+
31+
macro(increase_warning_level)
32+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wsign-conversion")
33+
endmacro()

doc/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "Arduino MIDI Library"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "Version 4.3.1"
41+
PROJECT_NUMBER = "Version 4.4.0"
4242

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

0 commit comments

Comments
 (0)