Skip to content

Commit 3177103

Browse files
Merge pull request #2 from sauloverissimo/chore/rename-to-midi2cpp
release: midi2cpp v0.3.0 - rename from midi2_cpp + midi2 v0.3.4 dependency
2 parents fe1de7b + 98b4394 commit 3177103

127 files changed

Lines changed: 585 additions & 548 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v4
1919

2020
- name: Configure
21-
run: cmake -B build -DMIDI2_CPP_BUILD_TESTS=ON
21+
run: cmake -B build -DMIDI2CPP_BUILD_TESTS=ON
2222

2323
- name: Build
2424
run: cmake --build build --parallel
@@ -43,7 +43,7 @@ jobs:
4343
env:
4444
CC: ${{ matrix.compiler.cc }}
4545
CXX: ${{ matrix.compiler.cxx }}
46-
run: cmake -B build -DMIDI2_CPP_BUILD_TESTS=ON
46+
run: cmake -B build -DMIDI2CPP_BUILD_TESTS=ON
4747

4848
- name: Build with -Werror
4949
run: cmake --build build --parallel -- CXXFLAGS=-Werror CFLAGS=-Werror
@@ -122,10 +122,10 @@ jobs:
122122
- name: Symlink lib for arduino-cli sketch resolution
123123
run: |
124124
mkdir -p ~/Arduino/libraries
125-
ln -s "$GITHUB_WORKSPACE" ~/Arduino/libraries/midi2_cpp
125+
ln -s "$GITHUB_WORKSPACE" ~/Arduino/libraries/midi2cpp
126126
127127
- name: Install midi2 dependency from Library Manager
128-
# midi2_cpp depends on midi2 (>=0.3.3) but arduino-cli does not
128+
# midi2cpp depends on midi2 (>=0.3.4) but arduino-cli does not
129129
# walk depends= entries automatically. Install it explicitly.
130130
# Falls back to the GitHub git URL if the registry index has
131131
# not propagated yet (Library Manager indexes within 24h of a
@@ -134,7 +134,7 @@ jobs:
134134
arduino-cli lib update-index
135135
arduino-cli lib install midi2 || \
136136
(arduino-cli config set library.enable_unsafe_install true && \
137-
arduino-cli lib install --git-url https://github.com/sauloverissimo/midi2.git#v0.3.3)
137+
arduino-cli lib install --git-url https://github.com/sauloverissimo/midi2.git#v0.3.4)
138138
139139
- name: Compile Arduino sketches (skip non-sketch dirs)
140140
run: |

CHANGELOG.md

Lines changed: 64 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,50 @@
11
# Changelog
22

3-
All notable changes to `midi2_cpp` are recorded here. Format follows
3+
All notable changes to `midi2cpp` are recorded here. Format follows
44
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
55
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
66
mirrored from the upstream midi2 C99 policy.
77

8+
## [0.3.0]
9+
10+
Renamed from `midi2_cpp` to `midi2cpp` in deference to [`starfishmod/MIDI2_CPP`](https://github.com/starfishmod/MIDI2_CPP) (maintained since 2021 by Andrew Mee, MIDI Association TSB Rep), which operates in the same domain. Keeping the namespaces disjoint avoids confusion in package managers and search.
11+
12+
This is a **breaking** rename. Every consumer-facing identifier moved:
13+
14+
### Breaking
15+
16+
- **Repository:** `github.com/sauloverissimo/midi2_cpp` -> `github.com/sauloverissimo/midi2cpp` (the old URL redirects on the GitHub side, but new code should pin the new name).
17+
- **Header:** `<midi2_cpp.h>` -> `<midi2cpp.h>`. `using namespace midi2;` is unchanged; the C++ API surface (`m2device`, `m2host`, `m2bridge`, `m2ci`, `Bridge`, `Device`, ...) is unchanged.
18+
- **CMake target:** `midi2_cpp` -> `midi2cpp`; alias `midi2_cpp::midi2_cpp` -> `midi2cpp::midi2cpp`. `target_link_libraries(... midi2cpp)` replaces `... midi2_cpp`.
19+
- **Preprocessor macros:** `MIDI2_CPP_*` -> `MIDI2CPP_*` (`MIDI2CPP_BUILD_TESTS`, `MIDI2CPP_MAX_PROFILES`, `MIDI2CPP_MAX_PROPERTIES`, `MIDI2CPP_MAX_SUBSCRIBERS`, `MIDI2CPP_HOST_MAX_DEVICES`, `MIDI2CPP_BRIDGE_MAX_SLOTS`).
20+
- **Manifests:** `library.properties` `name=midi2cpp`, `library.json` `"name": "midi2cpp"`. The Arduino Library Manager and the PlatformIO Registry treat the rename as a new entry; the previous `midi2_cpp` listings will be retired in a follow-up PR to `arduino/library-registry`.
21+
22+
### Changed
23+
24+
- **Dependency on midi2 bumped to v0.3.4** across every install path (Arduino LM `depends=midi2 (>=0.3.4)`, PlatformIO `^0.3.4`, ESP-IDF `version: "v0.3.4"`, CMake `find_package(midi2 0.3.4 CONFIG)` + `FetchContent_Declare(... GIT_TAG v0.3.4)`). midi2 v0.3.4 fixes the ESP-IDF Component Manager gate (`dist/` filtered from the dependency tarball); without it, ESP-IDF recipes failed configure.
25+
26+
### Migration
27+
28+
```diff
29+
-#include <midi2_cpp.h>
30+
+#include <midi2cpp.h>
31+
```
32+
33+
CMake:
34+
```diff
35+
-FetchContent_Declare(midi2_cpp ...)
36+
-target_link_libraries(my_target PRIVATE midi2_cpp)
37+
+FetchContent_Declare(midi2cpp ...)
38+
+target_link_libraries(my_target PRIVATE midi2cpp)
39+
```
40+
41+
Arduino Library Manager: search `midi2cpp` (the previous `midi2_cpp` entry will be removed once the registry PR lands).
42+
43+
PlatformIO: `lib_deps = sauloverissimo/midi2cpp @ ^0.3.0`.
44+
845
## [0.2.0]
946

10-
Single source of truth for the MIDI 2.0 stack: midi2_cpp no longer
47+
Single source of truth for the MIDI 2.0 stack: midi2cpp no longer
1148
vendors the C99 core and is published as a regular Arduino /
1249
PlatformIO library that depends on midi2 explicitly. Every recipe
1350
under `examples/` was migrated to pull midi2 externally through the
@@ -16,23 +53,23 @@ native CMake, IDF Component Manager for ESP-IDF, lib_deps for
1653
PlatformIO).
1754

1855
This is a breaking release. Consumers that previously vendored
19-
`midi2_cpp/src/midi2.{h,c}` directly will break; the migration path
56+
`midi2cpp/src/midi2.{h,c}` directly will break; the migration path
2057
is documented in the manifest below and in the per-build-system
2158
patterns shipped under `examples/`.
2259

2360
### Breaking
2461

25-
- **Vendored `src/midi2.{h,c}` removed.** midi2_cpp now declares
62+
- **Vendored `src/midi2.{h,c}` removed.** midi2cpp now declares
2663
midi2 as an external dependency:
27-
- `library.properties` carries `depends=midi2 (>=0.3.3)`. Arduino
64+
- `library.properties` carries `depends=midi2 (>=0.3.4)`. Arduino
2865
Library Manager auto-installs midi2 when a sketch includes
29-
midi2_cpp.
66+
midi2cpp.
3067
- `library.json` carries `dependencies."sauloverissimo/midi2":
31-
"^0.3.3"`. PlatformIO resolves midi2 from its registry.
68+
"^0.3.4"`. PlatformIO resolves midi2 from its registry.
3269
- The root `CMakeLists.txt` exposes a three-layer fallback at the
33-
top (`if(NOT TARGET midi2)` -> `find_package(midi2 0.3.3 CONFIG)`
34-
-> `FetchContent_Declare(midi2 GIT_TAG v0.3.3)`), then links
35-
midi2_cpp `PUBLIC midi2::midi2` so downstream targets see the
70+
top (`if(NOT TARGET midi2)` -> `find_package(midi2 0.3.4 CONFIG)`
71+
-> `FetchContent_Declare(midi2 GIT_TAG v0.3.4)`), then links
72+
midi2cpp `PUBLIC midi2::midi2` so downstream targets see the
3673
C99 core transitively.
3774

3875
### Added
@@ -56,23 +93,23 @@ patterns shipped under `examples/`.
5693
- **CMake entry surface for downstream consumers**: the root
5794
`CMakeLists.txt` follows the same `find_package` -> `FetchContent`
5895
fallback pattern that midi2 itself ships. Subprojects pulling
59-
midi2_cpp via `add_subdirectory` or `FetchContent` skip the
96+
midi2cpp via `add_subdirectory` or `FetchContent` skip the
6097
`find_package` step (`if(NOT TARGET midi2)` guard).
6198

6299
### Changed
63100

64-
- **README tagline** drops the `zero-allocation` claim. midi2_cpp
101+
- **README tagline** drops the `zero-allocation` claim. midi2cpp
65102
allocates in two narrow places (`m2bridge::begin()` slot tables and
66103
`std::function` callback storage), so the wrapper is now described
67104
as `static-by-default`. The C99 core (midi2) remains strictly
68105
zero-allocation. Same shift applied to the logo and to the
69106
`.intern/decisoes.md` design heritage notes.
70107
- **README "Manual vendor" path** rewritten: pre-v0.2 builds vendored
71-
a single `midi2_cpp/src/midi2.{h,c}` copy; today the consumer
108+
a single `midi2cpp/src/midi2.{h,c}` copy; today the consumer
72109
downloads both repositories side by side and adds `midi2/dist/`
73-
plus `midi2_cpp/src/` to its include path.
110+
plus `midi2cpp/src/` to its include path.
74111
- **`paragraph` in `library.properties`** rewritten: drops
75-
comparisons with other libraries, focuses on what midi2_cpp itself
112+
comparisons with other libraries, focuses on what midi2cpp itself
76113
ships and the embedded targets validated.
77114

78115
### Examples / Recipes
@@ -81,16 +118,16 @@ patterns shipped under `examples/`.
81118

82119
| Build system | Mechanism | Recipes |
83120
|---|---|---|
84-
| Pico SDK | `FetchContent_Declare(midi2 GIT_TAG v0.3.3)` plus `target_link_libraries(midi2_cpp PUBLIC midi2::midi2)` | `rp2040-midi2`, `waveshare-rp2040-midi2`, `sparkfun-promicro-rp2350-midi2`, `waveshare-rp2350-usb-a-midi2`, `waveshare-rp2350-usb-a-bridge-midi2`, `adafruit-feather-rp2040-host-midi2`, `adafruit-feather-rp2040-bridge-midi2`, `rp2040-promicro-ump-test-bench` |
121+
| Pico SDK | `FetchContent_Declare(midi2 GIT_TAG v0.3.4)` plus `target_link_libraries(midi2cpp PUBLIC midi2::midi2)` | `rp2040-midi2`, `waveshare-rp2040-midi2`, `sparkfun-promicro-rp2350-midi2`, `waveshare-rp2350-usb-a-midi2`, `waveshare-rp2350-usb-a-bridge-midi2`, `adafruit-feather-rp2040-host-midi2`, `adafruit-feather-rp2040-bridge-midi2`, `rp2040-promicro-ump-test-bench` |
85122
| TinyUSB native CMake | same FetchContent pattern as Pico SDK | `xiao-samd21-midi2`, `nrf52840-promicro-midi2` |
86-
| ESP-IDF | `idf_component.yml` declares `midi2: { git: ..., version: ">=0.3.3" }` and `idf_component_register` lists `midi2` in `REQUIRES` | `arduino-nano-esp32-midi2`, `esp32-s3-devkitc-usb-midi2`, `esp32-p4-devkit-usb-midi2`, `esp32-p4-devkit-host-midi2`, `esp32-p4-devkit-bridge-midi2`, `esp32-p4-devkit-bridge2-midi2`, `t-display-s3-midi2` |
87-
| PlatformIO + ESP32_Host_MIDI | `lib_deps += sauloverissimo/midi2 @ ^0.3.3` | `esp32-c6-devkitc-multi-midi2`, `esp32-s3-devkitc-host-midi2`, `t-display-s3-shield-host-midi2` |
123+
| ESP-IDF | `idf_component.yml` declares `midi2: { git: ..., version: ">=0.3.4" }` and `idf_component_register` lists `midi2` in `REQUIRES` | `arduino-nano-esp32-midi2`, `esp32-s3-devkitc-usb-midi2`, `esp32-p4-devkit-usb-midi2`, `esp32-p4-devkit-host-midi2`, `esp32-p4-devkit-bridge-midi2`, `esp32-p4-devkit-bridge2-midi2`, `t-display-s3-midi2` |
124+
| PlatformIO + ESP32_Host_MIDI | `lib_deps += sauloverissimo/midi2 @ ^0.3.4` | `esp32-c6-devkitc-multi-midi2`, `esp32-s3-devkitc-host-midi2`, `t-display-s3-shield-host-midi2` |
88125

89-
Each recipe drops the `${MIDI2_CPP_ROOT}/src/midi2.c` (or `midi2_c99`
90-
helper library) from its source list. Other midi2_cpp sources
126+
Each recipe drops the `${MIDI2CPP_ROOT}/src/midi2.c` (or `midi2_c99`
127+
helper library) from its source list. Other midi2cpp sources
91128
(`midi2_device.cpp`, `midi2_ci.cpp`, `midi2_host.cpp`,
92129
`midi2_bridge.cpp`) keep being compiled inline from the parent tree
93-
via `${MIDI2_CPP_ROOT}/src` until the host helper-library shape is
130+
via `${MIDI2CPP_ROOT}/src` until the host helper-library shape is
94131
finalised in a future cycle.
95132

96133
#### New recipes since v0.1.0
@@ -178,16 +215,16 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+).
178215
- Profile (M2-101 §7): `addProfile`, `removeProfile`, callbacks for
179216
`onProfileInquiry`, `onProfileEnable`, `onProfileDisable`,
180217
`onProfileAdded`, `onProfileRemoved`, `onProfileDetailsInquiry`,
181-
`onProfileSpecificData`. Storage tunable via `MIDI2_CPP_MAX_PROFILES`
218+
`onProfileSpecificData`. Storage tunable via `MIDI2CPP_MAX_PROFILES`
182219
(default 8).
183220
- Property Exchange (M2-101 §8, M2-103, M2-105):
184221
- Registry: `addProperty(name, getter, setter=nullptr)` (read-only by
185222
default), `addPropertyStatic(name, value)`, `removeProperty`.
186-
Storage tunable via `MIDI2_CPP_MAX_PROPERTIES` (default 8).
223+
Storage tunable via `MIDI2CPP_MAX_PROPERTIES` (default 8).
187224
- Subscribe / Notify state machine:
188225
`setPropertySubscribable(name, true)`, `notifyPropertyChanged(name)`
189226
for fan-out, `subscriberCount()`. Subscriber registry tunable via
190-
`MIDI2_CPP_MAX_SUBSCRIBERS` (default 4).
227+
`MIDI2CPP_MAX_SUBSCRIBERS` (default 4).
191228
- PE callbacks deliver raw bytes (header + body) instead of
192229
NUL-terminated strings, to avoid silent truncation of large JSON
193230
payloads.
@@ -196,7 +233,7 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+).
196233

197234
### `midi2::Host` — USB MIDI 2.0 host shape
198235

199-
- Reactive multi-device host (`MIDI2_CPP_HOST_MAX_DEVICES`, default 4).
236+
- Reactive multi-device host (`MIDI2CPP_HOST_MAX_DEVICES`, default 4).
200237
Caller wires `tuh_midi2_*` (or platform-equivalent) into
201238
`notifyDeviceMounted/Unmounted`, `feedRx(idx, words, count)` and
202239
`setWriteFn(idx, words, count)`.
@@ -261,14 +298,14 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+).
261298
platform-conditional RNG `#if` chain from `midi2_ci.cpp`. The library
262299
no longer pulls `<Arduino.h>`, `pico/time.h`, `esp_timer.h`, or any
263300
USB stack header.
264-
- Removed the `MIDI2_CPP_TEST_MODE` build option. Tests now consume the
301+
- Removed the `MIDI2CPP_TEST_MODE` build option. Tests now consume the
265302
same public hooks platforms wire. One contract, one code path.
266303
- `Device::begin()` no longer claims to call `tusb_init` internally. It
267304
initialises the library's own dispatcher and returns; the caller owns
268305
the platform USB stack lifecycle.
269306
- `Device::task()` drops the commented `tud_task` stubs.
270307
- C++17 floor enforced via `static_assert(__cplusplus >= 201703L)` in
271-
`midi2_cpp.h`.
308+
`midi2cpp.h`.
272309
- `lib/tinyusb` git submodule and the `.gitmodules` entry removed. The
273310
library has zero external dependencies: midi2 C99 stays vendored,
274311
every USB stack and clock and RNG source is caller-wired. `git clone`

CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project(midi2_cpp VERSION 0.2.0 LANGUAGES C CXX)
2+
project(midi2cpp VERSION 0.3.0 LANGUAGES C CXX)
33

44
set(CMAKE_C_STANDARD 99)
55
set(CMAKE_C_STANDARD_REQUIRED ON)
@@ -11,59 +11,59 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1111
# Three-layer fallback: parent project's target -> system install
1212
# (vcpkg / conan / system package) -> FetchContent from GitHub.
1313
# This is the same pattern the midi2 README documents for downstream
14-
# consumers, applied to midi2_cpp itself.
14+
# consumers, applied to midi2cpp itself.
1515
if(NOT TARGET midi2)
16-
find_package(midi2 0.3.3 QUIET CONFIG)
16+
find_package(midi2 0.3.4 QUIET CONFIG)
1717
if(NOT midi2_FOUND)
1818
include(FetchContent)
1919
FetchContent_Declare(midi2
2020
GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git
21-
GIT_TAG v0.3.3
21+
GIT_TAG v0.3.4
2222
)
2323
FetchContent_MakeAvailable(midi2)
2424
endif()
2525
endif()
2626

2727
# Library target.
2828
#
29-
# midi2_cpp ships the C++ wrapper sources only; the C99 core lives in
29+
# midi2cpp ships the C++ wrapper sources only; the C99 core lives in
3030
# the external midi2 target this CMakeLists pulls above. Consumers
31-
# linking midi2_cpp transitively see midi2::midi2 because of the
31+
# linking midi2cpp transitively see midi2::midi2 because of the
3232
# PUBLIC link below.
33-
add_library(midi2_cpp
33+
add_library(midi2cpp
3434
src/midi2_device.cpp
3535
src/midi2_ci.cpp
3636
src/midi2_host.cpp
3737
src/midi2_bridge.cpp
3838
)
3939

40-
target_link_libraries(midi2_cpp PUBLIC midi2::midi2)
40+
target_link_libraries(midi2cpp PUBLIC midi2::midi2)
4141

42-
target_include_directories(midi2_cpp
42+
target_include_directories(midi2cpp
4343
PUBLIC
4444
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
4545
$<INSTALL_INTERFACE:include>
4646
)
4747

4848
# Warnings
4949
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
50-
target_compile_options(midi2_cpp PRIVATE
50+
target_compile_options(midi2cpp PRIVATE
5151
-Wall -Wextra -Wpedantic
5252
-Wno-unused-parameter # spec uses many unused params in stubs
5353
)
5454
endif()
5555

56-
# Exportable alias for consumers: midi2_cpp::midi2_cpp
57-
add_library(midi2_cpp::midi2_cpp ALIAS midi2_cpp)
56+
# Exportable alias for consumers: midi2cpp::midi2cpp
57+
add_library(midi2cpp::midi2cpp ALIAS midi2cpp)
5858

5959
# Tests: build only if this is the top-level project or tests explicitly requested
6060
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
61-
set(MIDI2_CPP_BUILD_TESTS_DEFAULT ON)
61+
set(MIDI2CPP_BUILD_TESTS_DEFAULT ON)
6262
else()
63-
set(MIDI2_CPP_BUILD_TESTS_DEFAULT OFF)
63+
set(MIDI2CPP_BUILD_TESTS_DEFAULT OFF)
6464
endif()
65-
option(MIDI2_CPP_BUILD_TESTS "Build host-side unit tests" ${MIDI2_CPP_BUILD_TESTS_DEFAULT})
66-
if(MIDI2_CPP_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
65+
option(MIDI2CPP_BUILD_TESTS "Build host-side unit tests" ${MIDI2CPP_BUILD_TESTS_DEFAULT})
66+
if(MIDI2CPP_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
6767
# Tests use the same public hooks the platforms wire (setWriteFn,
6868
# setNowFn, feedRx). No special test mode — the contract is the contract.
6969
enable_testing()

0 commit comments

Comments
 (0)