Skip to content

Commit 6b295e6

Browse files
author
Francois Best
committed
Merge branch 'master' into dev.
2 parents 7aaa7d4 + 2a1e86d commit 6b295e6

Some content is hidden

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

70 files changed

+5348
-401
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.pyc
33
logs/
44
build/
5+
.vscode/.cmaketools.json

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "external/google-test"]
2+
path = external/google-test
3+
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: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Kudos to these guys:
2+
# https://github.com/Return-To-The-Roots/s25client/blob/master/.travis.yml
3+
# http://docs.platformio.org/en/stable/ci/travis.html
4+
5+
sudo: false
6+
language: python
7+
8+
os:
9+
- linux
10+
11+
python:
12+
- "2.7"
13+
14+
# Cache PlatformIO packages using Travis CI container-based infrastructure
15+
cache:
16+
directories:
17+
- "~/.platformio"
18+
19+
env:
20+
global:
21+
- BUILD_TYPE=Debug
22+
matrix:
23+
- BUILD_UNIT_TESTS=1
24+
- PLATFORMIO_CI_SRC=examples/Basic_IO
25+
- PLATFORMIO_CI_SRC=examples/Bench
26+
- PLATFORMIO_CI_SRC=examples/Callbacks
27+
- PLATFORMIO_CI_SRC=examples/DualMerger
28+
- PLATFORMIO_CI_SRC=examples/Input
29+
- PLATFORMIO_CI_SRC=examples/MidiUSB REQUIRES_USB=1
30+
- PLATFORMIO_CI_SRC=examples/RPN_NRPN
31+
- PLATFORMIO_CI_SRC=examples/SimpleSynth
32+
33+
addons:
34+
apt:
35+
sources:
36+
- ubuntu-toolchain-r-test
37+
packages:
38+
- g++-4.8
39+
- cmake
40+
41+
install:
42+
- |
43+
if [ "${BUILD_UNIT_TESTS}" ]; then
44+
# GCov 4.6 cannot handle the file structure
45+
export CXX="g++-4.8"
46+
export GCOV="gcov-4.8"
47+
48+
# Install newer lcov (1.9 seems to fail: http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
49+
export LCOV_ROOT="$HOME/lcov"
50+
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+
tar xf "$LCOV_ROOT/lcov.tar.gz" --strip-components=1 -C $LCOV_ROOT
53+
export PATH="$LCOV_ROOT/bin:$PATH"
54+
which lcov
55+
56+
# Install coveralls tool
57+
gem install coveralls-lcov
58+
export GENERATE_COVERAGE=1
59+
else
60+
# Install PlatformIO
61+
pip install -U platformio
62+
fi
63+
64+
script:
65+
# Build unit tests & generate code coverage
66+
- |
67+
if [ "${BUILD_UNIT_TESTS}" ]; then
68+
mkdir build && cd build
69+
cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDER_ENABLE_PROFILING=${GENERATE_COVERAGE} --generator="Unix Makefiles" ..
70+
make all
71+
ctest --verbose
72+
fi
73+
74+
# Build current example
75+
- |
76+
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
82+
fi
83+
84+
after_success:
85+
- |
86+
if [ "${GENERATE_COVERAGE}" ]; then
87+
# Generate code coverage information & send to Coveralls
88+
lcov --gcov-tool $GCOV --directory . --capture --output-file coverage.info
89+
lcov --gcov-tool $GCOV --remove coverage.info 'test/*' '/usr/*' 'external/*' --output-file coverage.info
90+
lcov --list coverage.info
91+
coveralls-lcov --repo-token ${COVERALLS_TOKEN} coverage.info
92+
fi
93+
94+
notifications:
95+
email: false

.vscode/c_cpp_properties.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Mac",
5+
"includePath": [
6+
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/include",
7+
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino"
8+
],
9+
"browse" : {
10+
"limitSymbolsToIncludedHeaders" : true,
11+
"databaseFilename" : ""
12+
}
13+
},
14+
{
15+
"name": "Linux",
16+
"includePath": ["/usr/include"],
17+
"browse" : {
18+
"limitSymbolsToIncludedHeaders" : true,
19+
"databaseFilename" : ""
20+
}
21+
},
22+
{
23+
"name": "Win32",
24+
"includePath": ["c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include"],
25+
"browse" : {
26+
"limitSymbolsToIncludedHeaders" : true,
27+
"databaseFilename" : ""
28+
}
29+
}
30+
]
31+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"cmake.experimental.enableTargetDebugging": true
4+
}

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cmake_minimum_required(VERSION 2.8.7)
2+
project(arduino_midi_library CXX)
3+
4+
add_subdirectory(builder)
5+
6+
setup_builder()
7+
8+
add_subdirectory(external)
9+
add_subdirectory(src)
10+
add_subdirectory(test)

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Requirements
2+
3+
Requirements to build and run the unit tests:
4+
- CMake 2.8 or later
5+
- GCC / Clang with C++11 support
6+
7+
## Setup
8+
9+
Pull Google Test / Google Mock subrepository:
10+
```
11+
$ git init submodules
12+
```
13+
14+
Create build directory, run CMake, build and run unit tests:
15+
```
16+
$ mkdir build && cd build
17+
$ cmake ..
18+
$ make
19+
$ ctest --verbose
20+
```

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Francois Best
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 36 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,61 @@
1-
#Arduino MIDI Library v4.2
1+
# Arduino MIDI Library
22

3-
This library enables MIDI I/O communications on the Arduino serial ports.
4-
The purpose of this library is not to make a big synthetizer out of an Arduino board, the application remains yours. However, it will help you interfacing it with other MIDI devices.
3+
[![Build Status](https://travis-ci.org/FortySevenEffects/arduino_midi_library.svg?branch=master)](https://travis-ci.org/FortySevenEffects/arduino_midi_library)
4+
[![Coveralls](https://img.shields.io/coveralls/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](https://coveralls.io/github/FortySevenEffects/arduino_midi_library)
5+
[![GitHub release](https://img.shields.io/github/release/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](https://github.com/FortySevenEffects/arduino_midi_library/releases/latest)
6+
[![License](https://img.shields.io/github/license/FortySevenEffects/arduino_midi_library.svg?maxAge=3600)](LICENSE)
57

6-
Download the latest version [here](https://github.com/FortySevenEffects/arduino_midi_library/releases/latest).
8+
This library enables MIDI I/O communications on the Arduino serial ports.
79

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

21+
### Getting Started
1922

20-
#### Changelog
21-
* 11/06/2014 : Version 4.2 released. Bug fix for SysEx, overridable template settings.
22-
* 16/04/2014 : Version 4.1 released. Bug fixes regarding running status.
23-
* 13/02/2014 : Version 4.0 released. Moved to GitHub, added multiple instances & software serial support, and a few bug fixes.
24-
* 29/01/2012 : Version 3.2 released. Release notes are [here](http://sourceforge.net/news/?group_id=265194)
25-
* 06/05/2011 : Version 3.1 released. Added [callback](http://playground.arduino.cc/Main/MIDILibraryCallbacks) support.
26-
* 06/03/2011 : Version 3.0 released. Project is now hosted on [SourceForge](http://sourceforge.net/projects/arduinomidilib).
27-
* 14/12/2009 : Version 2.5 released.
28-
* 28/07/2009 : Version 2.0 released.
29-
* 28/03/2009 : Simplified version of MIDI.begin, Fast mode is now on by default.
30-
* 08/03/2009 : Thru method operational. Added some features to enable thru.
31-
32-
33-
34-
**__Warning: this library requires Arduino 1.0 or more recent versions.__**
35-
36-
37-
### What do I need to do?
38-
39-
* Download the library ([link](https://github.com/FortySevenEffects/arduino_midi_library/releases/latest))
40-
* Follow the installation instructions there: http://arduino.cc/en/Guide/Libraries
41-
* Include the library in your sketch using the menu in the IDE, or type `#include <MIDI.h>`
42-
* Create the MIDI instance using `MIDI_CREATE_DEFAULT_INSTANCE();` or take a look at the documentation for custom serial port, settings etc..
43-
44-
You are now ready to use the library. Look at the reference page to learn how to use it, or the examples given. Just don't forget to enable the I/O communications with MIDI.begin...
45-
23+
1. Use Arduino's Library Manager to install the library.
24+
2. Start coding:
25+
```c++
26+
#include <MIDI.h>
4627

47-
##Reference
28+
// Created and binds the MIDI interface to the default hardware Serial port
29+
MIDI_CREATE_DEFAULT_INSTANCE();
4830

49-
See the extended reference [here](http://arduinomidilib.fortyseveneffects.com) ([Mirror](http://fortyseveneffects.github.io/arduino_midi_library/)).
31+
void setup()
32+
{
33+
MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages
34+
}
5035

51-
### Using MIDI.begin
36+
void loop()
37+
{
38+
// Send note 42 with velocity 127 on channel 1
39+
MIDI.sendNoteOn(42, 127, 1);
5240

53-
In the `setup()` function of the Arduino, you must call the `MIDI.begin()` method. If you don't give any argument to this method, the input channel for MIDI in will be set to 1 (channels are going from 1 to 16, plus `MIDI_CHANNEL_OMNI to listen to all channels at the same time).
41+
// Read incoming messages
42+
MIDI.read();
43+
}
44+
```
5445

55-
This method will:
56-
* Start the serial port at the MIDI baudrate (31250)
57-
* Set the input channel at the argument given (if any, else 1)
58-
* Enable Soft Thru, without filtering (everything at the input is sent back)
46+
3. Read the [documentation](#documentation) or watch the awesome video tutorials from [Notes & Volts](https://www.youtube.com/playlist?list=PL4_gPbvyebyH2xfPXePHtx8gK5zPBrVkg).
5947

48+
## Documentation
6049

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

62-
### MIDI Thru
63-
64-
The MIDI Thru allows you to redirect your incoming messages to the MIDI output. It replaces the need of a MIDI Thru connector, as it copies every valid incoming message from the input. For good performance, you might want to call read() in a fast loop, for low latency.
65-
66-
Incoming unread bytes/messages are kept in the Arduino serial buffer, in order not to flood it, check regularily with MIDI.read. See the reference for Thru explanations.
67-
68-
Thru is enabled by default, you can turn it off using appropriate methods.
69-
70-
71-
### Hardware
53+
## Contact
7254

73-
Take a look at [the MIDI.org schematic](http://www.midi.org/techspecs/electrispec.php)
55+
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).
7456

57+
You can also get informations about bug fixes and updates on my twitter account: [@fortysevenfx](http://twitter.com/fortysevenfx).
7558

76-
## Contact
77-
if you have any comment or support request to make, feel free to contact me: francois.best@fortyseveneffects.com
59+
## License
7860

79-
You can also get informations about bug fixes and updates on my twitter account: [@fortysevenfx](http://twitter.com/fortysevenfx).
61+
MIT © 2016 [Francois Best](http://fortyseveneffects.com)

ReleaseNotes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#### Changelog
2+
* 11/06/2014 : Version 4.2 released. Bug fix for SysEx, overridable template settings.
3+
* 16/04/2014 : Version 4.1 released. Bug fixes regarding running status.
4+
* 13/02/2014 : Version 4.0 released. Moved to GitHub, added multiple instances & software serial support, and a few bug fixes.
5+
* 29/01/2012 : Version 3.2 released. Release notes are [here](http://sourceforge.net/news/?group_id=265194).
6+
* 06/05/2011 : Version 3.1 released. Added [callback](http://playground.arduino.cc/Main/MIDILibraryCallbacks) support.
7+
* 06/03/2011 : Version 3.0 released. Project is now hosted on [SourceForge](http://sourceforge.net/projects/arduinomidilib).
8+
* 14/12/2009 : Version 2.5 released.
9+
* 28/07/2009 : Version 2.0 released.
10+
* 28/03/2009 : Simplified version of MIDI.begin, Fast mode is now on by default.
11+
* 08/03/2009 : Thru method operational. Added some features to enable thru.

0 commit comments

Comments
 (0)