Skip to content

Commit 1e5d0d2

Browse files
rename: midi2_cpp -> midi2cpp
In deference to starfishmod/MIDI2_CPP (maintained since 2021 by Andrew Mee, MIDI Association TSB Rep), which operates in the same domain (MIDI 2.0 wrappers for embedded). Keeping the namespaces disjoint avoids confusion in package managers and search. Touches across 119 files: - library.properties: name= + includes= - library.json: "name", "headers", repository URL - CMakeLists.txt: project / add_library / alias / install / export - src/midi2_cpp.h -> src/midi2cpp.h - logo_midi2_cpp.png -> logo_midi2cpp.png - Preprocessor macros: MIDI2_CPP_* -> MIDI2CPP_* (MIDI2_CPP_BUILD_TESTS, MIDI2_CPP_ROOT, MIDI2_CPP_MAX_PROFILES, MIDI2_CPP_MAX_PROPERTIES, MIDI2_CPP_MAX_SUBSCRIBERS, MIDI2_CPP_HOST_MAX_DEVICES, MIDI2_CPP_BRIDGE_MAX_SLOTS, ...) - 20 example recipes: CMakeLists.txt / idf/main/CMakeLists.txt / pio/platformio.ini - README, CHANGELOG, every example README - .github/workflows/ci.yml: paths and CMake options Verified locally: cmake configure + build + ctest all green (7/7 host suites, including the m2bridge ASan + UBSan smoke). Follow-up commits will bump the version to v0.3.0, refresh the CHANGELOG with this rationale, and (after the merge) rename the GitHub repo via gh repo rename.
1 parent fe1de7b commit 1e5d0d2

119 files changed

Lines changed: 510 additions & 510 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: 4 additions & 4 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.3) 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

CHANGELOG.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
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

88
## [0.2.0]
99

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

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

2323
### Breaking
2424

25-
- **Vendored `src/midi2.{h,c}` removed.** midi2_cpp now declares
25+
- **Vendored `src/midi2.{h,c}` removed.** midi2cpp now declares
2626
midi2 as an external dependency:
2727
- `library.properties` carries `depends=midi2 (>=0.3.3)`. Arduino
2828
Library Manager auto-installs midi2 when a sketch includes
29-
midi2_cpp.
29+
midi2cpp.
3030
- `library.json` carries `dependencies."sauloverissimo/midi2":
3131
"^0.3.3"`. PlatformIO resolves midi2 from its registry.
3232
- The root `CMakeLists.txt` exposes a three-layer fallback at the
3333
top (`if(NOT TARGET midi2)` -> `find_package(midi2 0.3.3 CONFIG)`
3434
-> `FetchContent_Declare(midi2 GIT_TAG v0.3.3)`), then links
35-
midi2_cpp `PUBLIC midi2::midi2` so downstream targets see the
35+
midi2cpp `PUBLIC midi2::midi2` so downstream targets see the
3636
C99 core transitively.
3737

3838
### Added
@@ -56,23 +56,23 @@ patterns shipped under `examples/`.
5656
- **CMake entry surface for downstream consumers**: the root
5757
`CMakeLists.txt` follows the same `find_package` -> `FetchContent`
5858
fallback pattern that midi2 itself ships. Subprojects pulling
59-
midi2_cpp via `add_subdirectory` or `FetchContent` skip the
59+
midi2cpp via `add_subdirectory` or `FetchContent` skip the
6060
`find_package` step (`if(NOT TARGET midi2)` guard).
6161

6262
### Changed
6363

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

7878
### Examples / Recipes
@@ -81,16 +81,16 @@ patterns shipped under `examples/`.
8181

8282
| Build system | Mechanism | Recipes |
8383
|---|---|---|
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` |
84+
| Pico SDK | `FetchContent_Declare(midi2 GIT_TAG v0.3.3)` 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` |
8585
| TinyUSB native CMake | same FetchContent pattern as Pico SDK | `xiao-samd21-midi2`, `nrf52840-promicro-midi2` |
8686
| 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` |
8787
| 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` |
8888

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
89+
Each recipe drops the `${MIDI2CPP_ROOT}/src/midi2.c` (or `midi2_c99`
90+
helper library) from its source list. Other midi2cpp sources
9191
(`midi2_device.cpp`, `midi2_ci.cpp`, `midi2_host.cpp`,
9292
`midi2_bridge.cpp`) keep being compiled inline from the parent tree
93-
via `${MIDI2_CPP_ROOT}/src` until the host helper-library shape is
93+
via `${MIDI2CPP_ROOT}/src` until the host helper-library shape is
9494
finalised in a future cycle.
9595

9696
#### New recipes since v0.1.0
@@ -178,16 +178,16 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+).
178178
- Profile (M2-101 §7): `addProfile`, `removeProfile`, callbacks for
179179
`onProfileInquiry`, `onProfileEnable`, `onProfileDisable`,
180180
`onProfileAdded`, `onProfileRemoved`, `onProfileDetailsInquiry`,
181-
`onProfileSpecificData`. Storage tunable via `MIDI2_CPP_MAX_PROFILES`
181+
`onProfileSpecificData`. Storage tunable via `MIDI2CPP_MAX_PROFILES`
182182
(default 8).
183183
- Property Exchange (M2-101 §8, M2-103, M2-105):
184184
- Registry: `addProperty(name, getter, setter=nullptr)` (read-only by
185185
default), `addPropertyStatic(name, value)`, `removeProperty`.
186-
Storage tunable via `MIDI2_CPP_MAX_PROPERTIES` (default 8).
186+
Storage tunable via `MIDI2CPP_MAX_PROPERTIES` (default 8).
187187
- Subscribe / Notify state machine:
188188
`setPropertySubscribable(name, true)`, `notifyPropertyChanged(name)`
189189
for fan-out, `subscriberCount()`. Subscriber registry tunable via
190-
`MIDI2_CPP_MAX_SUBSCRIBERS` (default 4).
190+
`MIDI2CPP_MAX_SUBSCRIBERS` (default 4).
191191
- PE callbacks deliver raw bytes (header + body) instead of
192192
NUL-terminated strings, to avoid silent truncation of large JSON
193193
payloads.
@@ -196,7 +196,7 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+).
196196

197197
### `midi2::Host` — USB MIDI 2.0 host shape
198198

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

CMakeLists.txt

Lines changed: 14 additions & 14 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.2.0 LANGUAGES C CXX)
33

44
set(CMAKE_C_STANDARD 99)
55
set(CMAKE_C_STANDARD_REQUIRED ON)
@@ -11,7 +11,7 @@ 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)
1616
find_package(midi2 0.3.3 QUIET CONFIG)
1717
if(NOT midi2_FOUND)
@@ -26,44 +26,44 @@ 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)