diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81d84ce..37c6324 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v4 - name: Configure - run: cmake -B build -DMIDI2_CPP_BUILD_TESTS=ON + run: cmake -B build -DMIDI2CPP_BUILD_TESTS=ON - name: Build run: cmake --build build --parallel @@ -43,7 +43,7 @@ jobs: env: CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} - run: cmake -B build -DMIDI2_CPP_BUILD_TESTS=ON + run: cmake -B build -DMIDI2CPP_BUILD_TESTS=ON - name: Build with -Werror run: cmake --build build --parallel -- CXXFLAGS=-Werror CFLAGS=-Werror @@ -122,10 +122,10 @@ jobs: - name: Symlink lib for arduino-cli sketch resolution run: | mkdir -p ~/Arduino/libraries - ln -s "$GITHUB_WORKSPACE" ~/Arduino/libraries/midi2_cpp + ln -s "$GITHUB_WORKSPACE" ~/Arduino/libraries/midi2cpp - name: Install midi2 dependency from Library Manager - # midi2_cpp depends on midi2 (>=0.3.3) but arduino-cli does not + # midi2cpp depends on midi2 (>=0.3.4) but arduino-cli does not # walk depends= entries automatically. Install it explicitly. # Falls back to the GitHub git URL if the registry index has # not propagated yet (Library Manager indexes within 24h of a @@ -134,7 +134,7 @@ jobs: arduino-cli lib update-index arduino-cli lib install midi2 || \ (arduino-cli config set library.enable_unsafe_install true && \ - arduino-cli lib install --git-url https://github.com/sauloverissimo/midi2.git#v0.3.3) + arduino-cli lib install --git-url https://github.com/sauloverissimo/midi2.git#v0.3.4) - name: Compile Arduino sketches (skip non-sketch dirs) run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cad143..77fc301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,50 @@ # Changelog -All notable changes to `midi2_cpp` are recorded here. Format follows +All notable changes to `midi2cpp` are recorded here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), mirrored from the upstream midi2 C99 policy. +## [0.3.0] + +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. + +This is a **breaking** rename. Every consumer-facing identifier moved: + +### Breaking + +- **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). +- **Header:** `` -> ``. `using namespace midi2;` is unchanged; the C++ API surface (`m2device`, `m2host`, `m2bridge`, `m2ci`, `Bridge`, `Device`, ...) is unchanged. +- **CMake target:** `midi2_cpp` -> `midi2cpp`; alias `midi2_cpp::midi2_cpp` -> `midi2cpp::midi2cpp`. `target_link_libraries(... midi2cpp)` replaces `... midi2_cpp`. +- **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`). +- **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`. + +### Changed + +- **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. + +### Migration + +```diff +-#include ++#include +``` + +CMake: +```diff +-FetchContent_Declare(midi2_cpp ...) +-target_link_libraries(my_target PRIVATE midi2_cpp) ++FetchContent_Declare(midi2cpp ...) ++target_link_libraries(my_target PRIVATE midi2cpp) +``` + +Arduino Library Manager: search `midi2cpp` (the previous `midi2_cpp` entry will be removed once the registry PR lands). + +PlatformIO: `lib_deps = sauloverissimo/midi2cpp @ ^0.3.0`. + ## [0.2.0] -Single source of truth for the MIDI 2.0 stack: midi2_cpp no longer +Single source of truth for the MIDI 2.0 stack: midi2cpp no longer vendors the C99 core and is published as a regular Arduino / PlatformIO library that depends on midi2 explicitly. Every recipe 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 PlatformIO). This is a breaking release. Consumers that previously vendored -`midi2_cpp/src/midi2.{h,c}` directly will break; the migration path +`midi2cpp/src/midi2.{h,c}` directly will break; the migration path is documented in the manifest below and in the per-build-system patterns shipped under `examples/`. ### Breaking -- **Vendored `src/midi2.{h,c}` removed.** midi2_cpp now declares +- **Vendored `src/midi2.{h,c}` removed.** midi2cpp now declares midi2 as an external dependency: - - `library.properties` carries `depends=midi2 (>=0.3.3)`. Arduino + - `library.properties` carries `depends=midi2 (>=0.3.4)`. Arduino Library Manager auto-installs midi2 when a sketch includes - midi2_cpp. + midi2cpp. - `library.json` carries `dependencies."sauloverissimo/midi2": - "^0.3.3"`. PlatformIO resolves midi2 from its registry. + "^0.3.4"`. PlatformIO resolves midi2 from its registry. - The root `CMakeLists.txt` exposes a three-layer fallback at the - top (`if(NOT TARGET midi2)` -> `find_package(midi2 0.3.3 CONFIG)` - -> `FetchContent_Declare(midi2 GIT_TAG v0.3.3)`), then links - midi2_cpp `PUBLIC midi2::midi2` so downstream targets see the + top (`if(NOT TARGET midi2)` -> `find_package(midi2 0.3.4 CONFIG)` + -> `FetchContent_Declare(midi2 GIT_TAG v0.3.4)`), then links + midi2cpp `PUBLIC midi2::midi2` so downstream targets see the C99 core transitively. ### Added @@ -56,23 +93,23 @@ patterns shipped under `examples/`. - **CMake entry surface for downstream consumers**: the root `CMakeLists.txt` follows the same `find_package` -> `FetchContent` fallback pattern that midi2 itself ships. Subprojects pulling - midi2_cpp via `add_subdirectory` or `FetchContent` skip the + midi2cpp via `add_subdirectory` or `FetchContent` skip the `find_package` step (`if(NOT TARGET midi2)` guard). ### Changed -- **README tagline** drops the `zero-allocation` claim. midi2_cpp +- **README tagline** drops the `zero-allocation` claim. midi2cpp allocates in two narrow places (`m2bridge::begin()` slot tables and `std::function` callback storage), so the wrapper is now described as `static-by-default`. The C99 core (midi2) remains strictly zero-allocation. Same shift applied to the logo and to the `.intern/decisoes.md` design heritage notes. - **README "Manual vendor" path** rewritten: pre-v0.2 builds vendored - a single `midi2_cpp/src/midi2.{h,c}` copy; today the consumer + a single `midi2cpp/src/midi2.{h,c}` copy; today the consumer downloads both repositories side by side and adds `midi2/dist/` - plus `midi2_cpp/src/` to its include path. + plus `midi2cpp/src/` to its include path. - **`paragraph` in `library.properties`** rewritten: drops - comparisons with other libraries, focuses on what midi2_cpp itself + comparisons with other libraries, focuses on what midi2cpp itself ships and the embedded targets validated. ### Examples / Recipes @@ -81,16 +118,16 @@ patterns shipped under `examples/`. | Build system | Mechanism | Recipes | |---|---|---| -| 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` | +| 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` | | TinyUSB native CMake | same FetchContent pattern as Pico SDK | `xiao-samd21-midi2`, `nrf52840-promicro-midi2` | -| 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` | -| 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` | +| 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` | +| 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` | -Each recipe drops the `${MIDI2_CPP_ROOT}/src/midi2.c` (or `midi2_c99` -helper library) from its source list. Other midi2_cpp sources +Each recipe drops the `${MIDI2CPP_ROOT}/src/midi2.c` (or `midi2_c99` +helper library) from its source list. Other midi2cpp sources (`midi2_device.cpp`, `midi2_ci.cpp`, `midi2_host.cpp`, `midi2_bridge.cpp`) keep being compiled inline from the parent tree -via `${MIDI2_CPP_ROOT}/src` until the host helper-library shape is +via `${MIDI2CPP_ROOT}/src` until the host helper-library shape is finalised in a future cycle. #### New recipes since v0.1.0 @@ -178,16 +215,16 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+). - Profile (M2-101 §7): `addProfile`, `removeProfile`, callbacks for `onProfileInquiry`, `onProfileEnable`, `onProfileDisable`, `onProfileAdded`, `onProfileRemoved`, `onProfileDetailsInquiry`, - `onProfileSpecificData`. Storage tunable via `MIDI2_CPP_MAX_PROFILES` + `onProfileSpecificData`. Storage tunable via `MIDI2CPP_MAX_PROFILES` (default 8). - Property Exchange (M2-101 §8, M2-103, M2-105): - Registry: `addProperty(name, getter, setter=nullptr)` (read-only by default), `addPropertyStatic(name, value)`, `removeProperty`. - Storage tunable via `MIDI2_CPP_MAX_PROPERTIES` (default 8). + Storage tunable via `MIDI2CPP_MAX_PROPERTIES` (default 8). - Subscribe / Notify state machine: `setPropertySubscribable(name, true)`, `notifyPropertyChanged(name)` for fan-out, `subscriberCount()`. Subscriber registry tunable via - `MIDI2_CPP_MAX_SUBSCRIBERS` (default 4). + `MIDI2CPP_MAX_SUBSCRIBERS` (default 4). - PE callbacks deliver raw bytes (header + body) instead of NUL-terminated strings, to avoid silent truncation of large JSON payloads. @@ -196,7 +233,7 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+). ### `midi2::Host` — USB MIDI 2.0 host shape -- Reactive multi-device host (`MIDI2_CPP_HOST_MAX_DEVICES`, default 4). +- Reactive multi-device host (`MIDI2CPP_HOST_MAX_DEVICES`, default 4). Caller wires `tuh_midi2_*` (or platform-equivalent) into `notifyDeviceMounted/Unmounted`, `feedRx(idx, words, count)` and `setWriteFn(idx, words, count)`. @@ -261,14 +298,14 @@ library (vendored stb-style at `src/midi2.{h,c}` from v0.3.0+). platform-conditional RNG `#if` chain from `midi2_ci.cpp`. The library no longer pulls ``, `pico/time.h`, `esp_timer.h`, or any USB stack header. -- Removed the `MIDI2_CPP_TEST_MODE` build option. Tests now consume the +- Removed the `MIDI2CPP_TEST_MODE` build option. Tests now consume the same public hooks platforms wire. One contract, one code path. - `Device::begin()` no longer claims to call `tusb_init` internally. It initialises the library's own dispatcher and returns; the caller owns the platform USB stack lifecycle. - `Device::task()` drops the commented `tud_task` stubs. - C++17 floor enforced via `static_assert(__cplusplus >= 201703L)` in - `midi2_cpp.h`. + `midi2cpp.h`. - `lib/tinyusb` git submodule and the `.gitmodules` entry removed. The library has zero external dependencies: midi2 C99 stays vendored, every USB stack and clock and RNG source is caller-wired. `git clone` diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e0621..9a943df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(midi2_cpp VERSION 0.2.0 LANGUAGES C CXX) +project(midi2cpp VERSION 0.3.0 LANGUAGES C CXX) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) @@ -11,14 +11,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Three-layer fallback: parent project's target -> system install # (vcpkg / conan / system package) -> FetchContent from GitHub. # This is the same pattern the midi2 README documents for downstream -# consumers, applied to midi2_cpp itself. +# consumers, applied to midi2cpp itself. if(NOT TARGET midi2) - find_package(midi2 0.3.3 QUIET CONFIG) + find_package(midi2 0.3.4 QUIET CONFIG) if(NOT midi2_FOUND) include(FetchContent) FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 ) FetchContent_MakeAvailable(midi2) endif() @@ -26,20 +26,20 @@ endif() # Library target. # -# midi2_cpp ships the C++ wrapper sources only; the C99 core lives in +# midi2cpp ships the C++ wrapper sources only; the C99 core lives in # the external midi2 target this CMakeLists pulls above. Consumers -# linking midi2_cpp transitively see midi2::midi2 because of the +# linking midi2cpp transitively see midi2::midi2 because of the # PUBLIC link below. -add_library(midi2_cpp +add_library(midi2cpp src/midi2_device.cpp src/midi2_ci.cpp src/midi2_host.cpp src/midi2_bridge.cpp ) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) -target_include_directories(midi2_cpp +target_include_directories(midi2cpp PUBLIC $ $ @@ -47,23 +47,23 @@ target_include_directories(midi2_cpp # Warnings if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(midi2_cpp PRIVATE + target_compile_options(midi2cpp PRIVATE -Wall -Wextra -Wpedantic -Wno-unused-parameter # spec uses many unused params in stubs ) endif() -# Exportable alias for consumers: midi2_cpp::midi2_cpp -add_library(midi2_cpp::midi2_cpp ALIAS midi2_cpp) +# Exportable alias for consumers: midi2cpp::midi2cpp +add_library(midi2cpp::midi2cpp ALIAS midi2cpp) # Tests: build only if this is the top-level project or tests explicitly requested if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - set(MIDI2_CPP_BUILD_TESTS_DEFAULT ON) + set(MIDI2CPP_BUILD_TESTS_DEFAULT ON) else() - set(MIDI2_CPP_BUILD_TESTS_DEFAULT OFF) + set(MIDI2CPP_BUILD_TESTS_DEFAULT OFF) endif() -option(MIDI2_CPP_BUILD_TESTS "Build host-side unit tests" ${MIDI2_CPP_BUILD_TESTS_DEFAULT}) -if(MIDI2_CPP_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt") +option(MIDI2CPP_BUILD_TESTS "Build host-side unit tests" ${MIDI2CPP_BUILD_TESTS_DEFAULT}) +if(MIDI2CPP_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt") # Tests use the same public hooks the platforms wire (setWriteFn, # setNowFn, feedRx). No special test mode — the contract is the contract. enable_testing() diff --git a/README.md b/README.md index b97c22b..dcd618e 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# midi2_cpp +# midi2cpp ### MIDI 2.0 engine for embedded systems -![midi2_cpp](logo_midi2_cpp.png) +![midi2cpp](logo_midi2cpp.png) *C++17, callback-first, static-by-default, depends on midi2, MIT.* From DIY to professional products. -[![release](https://img.shields.io/github/v/release/sauloverissimo/midi2_cpp.svg)](https://github.com/sauloverissimo/midi2_cpp/releases/latest) +[![release](https://img.shields.io/github/v/release/sauloverissimo/midi2cpp.svg)](https://github.com/sauloverissimo/midi2cpp/releases/latest) [![C++17](https://img.shields.io/badge/C%2B%2B-17-00599C.svg)](https://en.cppreference.com/cpp/compiler_support) [![MIDI 2.0](https://img.shields.io/badge/MIDI-2.0-blueviolet.svg)](https://midi.org/specifications/midi-2-0-specifications) -[![depends: midi2](https://img.shields.io/badge/depends-midi2_%E2%89%A5_0.3.3-blueviolet.svg)](https://github.com/sauloverissimo/midi2) +[![depends: midi2](https://img.shields.io/badge/depends-midi2_%E2%89%A5_0.3.4-blueviolet.svg)](https://github.com/sauloverissimo/midi2) [![Arduino](https://img.shields.io/badge/Arduino-IDE-00979D.svg)](https://www.arduino.cc/) -[![PlatformIO](https://img.shields.io/badge/PlatformIO-Registry-FF7F00.svg)](https://registry.platformio.org/libraries/sauloverissimo/midi2_cpp) +[![PlatformIO](https://img.shields.io/badge/PlatformIO-Registry-FF7F00.svg)](https://registry.platformio.org/libraries/sauloverissimo/midi2cpp) [![ESP-IDF](https://img.shields.io/badge/ESP--IDF-v5.4-E7352C.svg)](https://docs.espressif.com/projects/esp-idf/en/stable/) [![Pico SDK](https://img.shields.io/badge/Pico_SDK-2.0-C51A4A.svg)](https://github.com/raspberrypi/pico-sdk) [![CMake](https://img.shields.io/badge/CMake-3.16%2B-064F8C.svg)](https://cmake.org/) @@ -21,13 +21,13 @@ ## The library -midi2_cpp is the layer where a sketch meets the protocol. Plug a board into the laptop, write five lines of C++, flash, and the device appears on the bus as a USB MIDI 2.0 endpoint with full Capability Inquiry, Property Exchange, and 32-bit resolution. +midi2cpp is the layer where a sketch meets the protocol. Plug a board into the laptop, write five lines of C++, flash, and the device appears on the bus as a USB MIDI 2.0 endpoint with full Capability Inquiry, Property Exchange, and 32-bit resolution. -Underneath, [midi2](https://github.com/sauloverissimo/midi2) (the portable C99 core) handles parsing, dispatch, and reassembly. midi2_cpp adds the C++ ergonomics: callbacks, board glue, ready-made USB descriptors. The board does the talking; the sketch tells it what to say. +Underneath, [midi2](https://github.com/sauloverissimo/midi2) (the portable C99 core) handles parsing, dispatch, and reassembly. midi2cpp adds the C++ ergonomics: callbacks, board glue, ready-made USB descriptors. The board does the talking; the sketch tells it what to say. ## Contents -- [midi2\_cpp](#midi2_cpp) +- [midi2cpp](#midi2cpp) - [MIDI 2.0 engine for embedded systems](#midi-20-engine-for-embedded-systems) - [The library](#the-library) - [Contents](#contents) @@ -54,19 +54,19 @@ Underneath, [midi2](https://github.com/sauloverissimo/midi2) (the portable C99 c ## Dependencies -midi2_cpp draws a clear line between what the library declares and what stays the caller's job: +midi2cpp draws a clear line between what the library declares and what stays the caller's job: - **Exactly one declared dependency: [midi2](https://github.com/sauloverissimo/midi2).** The C99 core lives in its own repo, is versioned independently, and is resolved by whichever package manager fits the host build: - - Arduino Library Manager: `depends=midi2 (>=0.3.3)` in `library.properties`. - - PlatformIO Registry: `dependencies."sauloverissimo/midi2": "^0.3.3"` in `library.json`. + - Arduino Library Manager: `depends=midi2 (>=0.3.4)` in `library.properties`. + - PlatformIO Registry: `dependencies."sauloverissimo/midi2": "^0.3.4"` in `library.json`. - ESP-IDF Component Manager: `idf_component.yml` declaration plus `midi2` in `REQUIRES`. - - CMake: `find_package(midi2 0.3.3 CONFIG)` first, falls back to `FetchContent_Declare(midi2 GIT_TAG v0.3.3)`. + - CMake: `find_package(midi2 0.3.4 CONFIG)` first, falls back to `FetchContent_Declare(midi2 GIT_TAG v0.3.4)`. - **No submodules.** `git clone` is the install. No `--recurse-submodules`, no half-initialised state. - **No transport library pulled in.** TinyUSB, Teensy native USB, PIO-USB, libDaisy USBMidi: all caller-supplied. The library does not include ``, `pico/time.h`, `esp_timer.h`, or any USB header. - **No clock or RNG dependency.** Caller injects `millis` / `time_us_64` / `esp_timer_get_time` and `random` / `get_rand_32` / `esp_random` through public hooks. Unset hooks degrade silently, no missing-symbol link errors. ```bash -git clone https://github.com/sauloverissimo/midi2_cpp.git +git clone https://github.com/sauloverissimo/midi2cpp.git cmake -B build && cmake --build build && ctest --test-dir build ``` @@ -74,10 +74,10 @@ Three commands. The first `cmake configure` pulls midi2 once via FetchContent (o ## Quickstart -`midi2_cpp` is platform-agnostic: it parses, dispatches, and assembles UMP, and it leaves USB transport, clock, and entropy to the caller. The sketch wires four hooks to its platform's USB MIDI driver; the library does the rest. +`midi2cpp` is platform-agnostic: it parses, dispatches, and assembles UMP, and it leaves USB transport, clock, and entropy to the caller. The sketch wires four hooks to its platform's USB MIDI driver; the library does the rest. ```cpp -#include +#include using namespace midi2; m2device midi; @@ -110,7 +110,7 @@ void setup() { static const uint8_t mfrId[3] = {0x7D, 0x00, 0x00}; // educational prefix ci.begin(mfrId, /*family*/ 0x0001, /*model*/ 0x0001, /*version*/ 0x00010000); ci.addPropertyStatic("DeviceInfo", - "{\"manufacturer\":\"midi2_cpp\",\"model\":\"hello\"}"); + "{\"manufacturer\":\"midi2cpp\",\"model\":\"hello\"}"); midi.onNoteOn([](uint8_t /*g*/, uint8_t ch, uint8_t n, uint16_t v, uint8_t /*at*/, uint16_t /*ad*/) { @@ -152,7 +152,7 @@ Same callback API across the three. `m2bridge` composes `m2device` + `m2ci` + `m ## Boards -Validated on real hardware against forks and PRs maintained internally while the upstream merges are pending. midi2_cpp is one of several integrations of the underlying [`midi2`](https://github.com/sauloverissimo/midi2) C99 core; concrete recipes for boards that use midi2_cpp ship under [`examples/`](examples/), one per role (device, host, bridge). The **Status** column names the override each test required. +Validated on real hardware against forks and PRs maintained internally while the upstream merges are pending. midi2cpp is one of several integrations of the underlying [`midi2`](https://github.com/sauloverissimo/midi2) C99 core; concrete recipes for boards that use midi2cpp ship under [`examples/`](examples/), one per role (device, host, bridge). The **Status** column names the override each test required. | Board | MCU | Device | Host | Bridge | Transport | Status | |-------|-----|:-:|:-:|:-:|-----------|--------| @@ -197,42 +197,42 @@ By role: 10 device, 4 host, 4 bridge, 1 multi-transport (BLE + ESP-NOW, no USB P ### Arduino IDE -Once midi2_cpp is published to the [Arduino Library Manager](https://github.com/arduino/library-registry), the IDE install becomes: search `midi2_cpp`, click Install. The dependency on `midi2` (already on the Library Manager) is resolved automatically. +Once midi2cpp is published to the [Arduino Library Manager](https://github.com/arduino/library-registry), the IDE install becomes: search `midi2cpp`, click Install. The dependency on `midi2` (already on the Library Manager) is resolved automatically. Until then, install manually: ```bash -git clone https://github.com/sauloverissimo/midi2_cpp.git ~/Arduino/libraries/midi2_cpp +git clone https://github.com/sauloverissimo/midi2cpp.git ~/Arduino/libraries/midi2cpp ``` Then install `midi2` via Library Manager (search `midi2`, click Install). ### PlatformIO -Once midi2_cpp is published to the [PlatformIO Registry](https://registry.platformio.org/): +Once midi2cpp is published to the [PlatformIO Registry](https://registry.platformio.org/): ```ini -lib_deps = sauloverissimo/midi2_cpp @ ^0.2.0 +lib_deps = sauloverissimo/midi2cpp @ ^0.2.0 ``` Until then, use the git URL pinned by tag: ```ini lib_deps = - https://github.com/sauloverissimo/midi2_cpp.git#v0.2.0 + https://github.com/sauloverissimo/midi2cpp.git#v0.2.0 ``` Either way, `midi2` is resolved transitively via the manifest declaration in `library.json`. ### ESP-IDF component -Two paths, depending on whether midi2_cpp lives inside the project tree or alongside it: +Two paths, depending on whether midi2cpp lives inside the project tree or alongside it: **As a local component** (current pattern in [`examples/`](examples/)): ```bash # from your IDF project root -git clone https://github.com/sauloverissimo/midi2_cpp.git components/midi2_cpp +git clone https://github.com/sauloverissimo/midi2cpp.git components/midi2cpp ``` Declare midi2 in `main/idf_component.yml` so the Component Manager pulls it next to `managed_components/`: @@ -242,34 +242,34 @@ dependencies: idf: ">=5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: ">=0.3.4" ``` -`main/CMakeLists.txt` lists `midi2` (and any of `midi2_cpp`'s wrapper sources you use) in its `idf_component_register(...)` block. The seven ESP-IDF recipes under [`examples/`](examples/) ship working templates for device, host and bridge roles. +`main/CMakeLists.txt` lists `midi2` (and any of `midi2cpp`'s wrapper sources you use) in its `idf_component_register(...)` block. The seven ESP-IDF recipes under [`examples/`](examples/) ship working templates for device, host and bridge roles. ### CMake FetchContent ```cmake include(FetchContent) FetchContent_Declare( - midi2_cpp - GIT_REPOSITORY https://github.com/sauloverissimo/midi2_cpp.git + midi2cpp + GIT_REPOSITORY https://github.com/sauloverissimo/midi2cpp.git GIT_TAG v0.2.0 ) -FetchContent_MakeAvailable(midi2_cpp) +FetchContent_MakeAvailable(midi2cpp) ``` -`midi2_cpp` cascades the dependency on `midi2` to the parent project: `find_package(midi2 0.3.3 CONFIG)` is tried first, falling back to `FetchContent_Declare(midi2 GIT_TAG v0.3.3)` if no install is found. +`midi2cpp` cascades the dependency on `midi2` to the parent project: `find_package(midi2 0.3.4 CONFIG)` is tried first, falling back to `FetchContent_Declare(midi2 GIT_TAG v0.3.4)` if no install is found. ### Git submodule ```bash -git submodule add https://github.com/sauloverissimo/midi2_cpp.git external/midi2_cpp +git submodule add https://github.com/sauloverissimo/midi2cpp.git external/midi2cpp ``` ### Manual vendor -Download the [midi2_cpp](https://github.com/sauloverissimo/midi2_cpp) and [midi2](https://github.com/sauloverissimo/midi2) repositories side by side. Add `midi2/dist/` and `midi2_cpp/src/` to includes. Compile `midi2/dist/midi2.c`, `midi2_cpp/src/midi2_device.cpp`, `midi2_cpp/src/midi2_ci.cpp`, and the host/bridge `.cpp` files you need alongside the project. No package manager required at build time, but the two repos must travel together. +Download the [midi2cpp](https://github.com/sauloverissimo/midi2cpp) and [midi2](https://github.com/sauloverissimo/midi2) repositories side by side. Add `midi2/dist/` and `midi2cpp/src/` to includes. Compile `midi2/dist/midi2.c`, `midi2cpp/src/midi2_device.cpp`, `midi2cpp/src/midi2_ci.cpp`, and the host/bridge `.cpp` files you need alongside the project. No package manager required at build time, but the two repos must travel together. ## API at a glance @@ -299,9 +299,9 @@ Async, callback-first, copy-paste-ready. Same shape as MIDI 1.0 Arduino librarie ## Architecture -midi2_cpp: platform layer of a 4-layer MIDI 2.0 stack: +midi2cpp: platform layer of a 4-layer MIDI 2.0 stack: -![midi2_cpp](architecture.png) +![midi2cpp](architecture.png) The sketch touches the top. The rest is invisible until needed. @@ -309,18 +309,18 @@ The sketch touches the top. The rest is invisible until needed. The boundary is drawn so the wrapper stays focused. A few things deliberately do not belong here. -- **Not a low-level UMP parser.** That is `midi2`. midi2_cpp wraps it and adds C++ ergonomics; if a project wants zero-overhead C with no callbacks, linking `midi2` directly is the right move. +- **Not a low-level UMP parser.** That is `midi2`. midi2cpp wraps it and adds C++ ergonomics; if a project wants zero-overhead C with no callbacks, linking `midi2` directly is the right move. - **Not a synthesizer.** UMP arrives, callbacks fire, the sketch decides what to play. Sound generation is application territory. - **Not a desktop library.** It targets MCU boards. It compiles on desktop for tests, but the API and memory model assume embedded constraints. -- **Not opinionated about transport.** TinyUSB, native USB (Teensy), PIO-USB (RP2350), STM32 HAL (Daisy), BLE: midi2_cpp does not bring any of them with it. The sketch wires whichever transport its platform already ships. +- **Not opinionated about transport.** TinyUSB, native USB (Teensy), PIO-USB (RP2350), STM32 HAL (Daisy), BLE: midi2cpp does not bring any of them with it. The sketch wires whichever transport its platform already ships. ## Sponsor -You can sponsor midi2_cpp at [GitHub Sponsors](https://github.com/sponsors/sauloverissimo). Sponsorship funds boards for cross-platform validation, spec access, and continued maintenance. +You can sponsor midi2cpp at [GitHub Sponsors](https://github.com/sponsors/sauloverissimo). Sponsorship funds boards for cross-platform validation, spec access, and continued maintenance. ## About -midi2_cpp is created and maintained by [Saulo Veríssimo](https://github.com/sauloverissimo). It is the C++17 sibling of midi2, originally extracted from USBMIDI2 work in arduino-esp32-uac and validated across the boards listed above. +midi2cpp is created and maintained by [Saulo Veríssimo](https://github.com/sauloverissimo). It is the C++17 sibling of midi2, originally extracted from USBMIDI2 work in arduino-esp32-uac and validated across the boards listed above. ## Specifications and trademarks diff --git a/examples/HelloMIDI2/HelloMIDI2.ino b/examples/HelloMIDI2/HelloMIDI2.ino index 078e35a..a515fdd 100644 --- a/examples/HelloMIDI2/HelloMIDI2.ino +++ b/examples/HelloMIDI2/HelloMIDI2.ino @@ -1,5 +1,5 @@ /* - * midi2_cpp HelloMIDI2 example, Arduino sketch. + * midi2cpp HelloMIDI2 example, Arduino sketch. * * Minimal demo that builds the m2device + m2ci pair, wires the four * platform hooks (write, now, mount/alt, RNG), and prints to Serial @@ -15,11 +15,11 @@ * - ESP32_Host_MIDI USBMIDI2Connection: connection.write(...) * * Reference platform recipes (Pico SDK, ESP-IDF, TinyUSB CMake, - * PlatformIO) live under midi2_cpp/examples/ — see the README's + * PlatformIO) live under midi2cpp/examples/ — see the README's * Boards table. */ -#include +#include using namespace midi2; @@ -42,7 +42,7 @@ void setup() { Serial.begin(115200); while (!Serial && millis() < 3000) {} - Serial.println("=== midi2_cpp HelloMIDI2 ==="); + Serial.println("=== midi2cpp HelloMIDI2 ==="); midi.setWriteFn(plat_write); midi.setNowFn(plat_now); diff --git a/examples/adafruit-feather-rp2040-bridge-midi2/CMakeLists.txt b/examples/adafruit-feather-rp2040-bridge-midi2/CMakeLists.txt index ce73d47..05e5d59 100644 --- a/examples/adafruit-feather-rp2040-bridge-midi2/CMakeLists.txt +++ b/examples/adafruit-feather-rp2040-bridge-midi2/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # GP16/GP17) and TinyUSB device (native USB-C) in the same firmware, # forwards UMP between them, and shows live traffic on a 128x64 SSD1306 # OLED over I2C1 (STEMMA QT). Lives at -# midi2_cpp/examples/adafruit-feather-rp2040-bridge-midi2; consumes the +# midi2cpp/examples/adafruit-feather-rp2040-bridge-midi2; consumes the # parent library directly from ../../src. set(PICO_BOARD adafruit_feather_rp2040_usb_host CACHE STRING "Board type") @@ -70,7 +70,7 @@ pico_sdk_init() # midi2 (C99), only midi2_msg_word_count is used by the router. Pull # the single .c from the parent library tree to keep the binary lean. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -82,7 +82,7 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() @@ -122,10 +122,10 @@ target_compile_definitions(adafruit-feather-rp2040-bridge-midi2-showcase PRIVATE ) # Hot-swap watchdog window (ms). 0 disables. Default 3000 matches the -# README; override with -DMIDI2_CPP_BRIDGE_WATCHDOG_MS=N. -if(DEFINED MIDI2_CPP_BRIDGE_WATCHDOG_MS) +# README; override with -DMIDI2CPP_BRIDGE_WATCHDOG_MS=N. +if(DEFINED MIDI2CPP_BRIDGE_WATCHDOG_MS) target_compile_definitions(adafruit-feather-rp2040-bridge-midi2-showcase - PRIVATE MIDI2_CPP_BRIDGE_WATCHDOG_MS=${MIDI2_CPP_BRIDGE_WATCHDOG_MS}) + PRIVATE MIDI2CPP_BRIDGE_WATCHDOG_MS=${MIDI2CPP_BRIDGE_WATCHDOG_MS}) endif() # Disable USB CDC stdio (the USB-C interface is dedicated to MIDI 2.0). diff --git a/examples/adafruit-feather-rp2040-bridge-midi2/README.md b/examples/adafruit-feather-rp2040-bridge-midi2/README.md index 02f011a..f455d4d 100644 --- a/examples/adafruit-feather-rp2040-bridge-midi2/README.md +++ b/examples/adafruit-feather-rp2040-bridge-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Bridge MIDI 2.0 +# [midi2cpp](../..) | Bridge MIDI 2.0 ## Adafruit Feather RP2040 USB Bridge Transparent USB MIDI 2.0 bridge on the **Adafruit Feather RP2040 USB Host**. Runs TinyUSB host on USB-A (PIO-USB GP16 / GP17) and TinyUSB device on USB-C (native USB) in the same firmware, forwarding UMP between them so any MIDI 2.0 device plugged into USB-A appears on the PC as a 16-group MIDI 2.0 endpoint named `rp2040-midi2 bridge`. Pico SDK build, no Arduino IDE. @@ -120,13 +120,13 @@ UART debug on GP0 mirrors mount events. ## Hot-swap caveat -A 3 s watchdog in `feather_bridge::task` resets the host side (`tuh_deinit` + `tusb_init`) after the upstream device has been gone for `MIDI2_CPP_BRIDGE_WATCHDOG_MS`. Tune at compile time: +A 3 s watchdog in `feather_bridge::task` resets the host side (`tuh_deinit` + `tusb_init`) after the upstream device has been gone for `MIDI2CPP_BRIDGE_WATCHDOG_MS`. Tune at compile time: ```bash -cmake -B build -DMIDI2_CPP_BRIDGE_WATCHDOG_MS=5000 # 5 s -cmake -B build -DMIDI2_CPP_BRIDGE_WATCHDOG_MS=0 # disable +cmake -B build -DMIDI2CPP_BRIDGE_WATCHDOG_MS=5000 # 5 s +cmake -B build -DMIDI2CPP_BRIDGE_WATCHDOG_MS=0 # disable ``` ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). Pico-PIO-USB is MIT. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). Pico-PIO-USB is MIT. diff --git a/examples/adafruit-feather-rp2040-bridge-midi2/src/feather_bridge.cpp b/examples/adafruit-feather-rp2040-bridge-midi2/src/feather_bridge.cpp index 1961ade..663a539 100644 --- a/examples/adafruit-feather-rp2040-bridge-midi2/src/feather_bridge.cpp +++ b/examples/adafruit-feather-rp2040-bridge-midi2/src/feather_bridge.cpp @@ -11,7 +11,7 @@ * becomes a UMP MT 0x2 carrying the same group/status/data. * * Hot-swap watchdog mirrors feather_host.cpp: tuh_deinit + tusb_init - * after the upstream device has been gone for MIDI2_CPP_BRIDGE_WATCHDOG_MS. + * after the upstream device has been gone for MIDI2CPP_BRIDGE_WATCHDOG_MS. */ #include "feather_bridge.h" @@ -26,8 +26,8 @@ extern "C" { #include "midi2.h" /* midi2_msg_word_count */ } -#ifndef MIDI2_CPP_BRIDGE_WATCHDOG_MS -#define MIDI2_CPP_BRIDGE_WATCHDOG_MS 3000 +#ifndef MIDI2CPP_BRIDGE_WATCHDOG_MS +#define MIDI2CPP_BRIDGE_WATCHDOG_MS 3000 #endif namespace feather_bridge { @@ -52,7 +52,7 @@ DropFn g_on_drop; uint32_t g_last_drops_host = 0; uint32_t g_last_drops_device = 0; -#if MIDI2_CPP_BRIDGE_WATCHDOG_MS > 0 +#if MIDI2CPP_BRIDGE_WATCHDOG_MS > 0 bool g_had_device = false; uint32_t g_devices_lost_ms = 0; #endif @@ -192,7 +192,7 @@ void surface_drops() { } } -#if MIDI2_CPP_BRIDGE_WATCHDOG_MS > 0 +#if MIDI2CPP_BRIDGE_WATCHDOG_MS > 0 void watchdog_tick(uint32_t t_ms) { bool any = false; for (uint8_t i = 0; i < MAX_HOST_DEVICES; ++i) { @@ -208,7 +208,7 @@ void watchdog_tick(uint32_t t_ms) { g_devices_lost_ms = t_ms; return; } - if (t_ms - g_devices_lost_ms < MIDI2_CPP_BRIDGE_WATCHDOG_MS) return; + if (t_ms - g_devices_lost_ms < MIDI2CPP_BRIDGE_WATCHDOG_MS) return; tuh_deinit(BOARD_TUH_RHPORT); tusb_rhport_init_t host_init = { @@ -269,7 +269,7 @@ void task() { surface_drops(); -#if MIDI2_CPP_BRIDGE_WATCHDOG_MS > 0 +#if MIDI2CPP_BRIDGE_WATCHDOG_MS > 0 watchdog_tick(now_ms()); #endif } diff --git a/examples/adafruit-feather-rp2040-host-midi2/CMakeLists.txt b/examples/adafruit-feather-rp2040-host-midi2/CMakeLists.txt index 1c532de..831463f 100644 --- a/examples/adafruit-feather-rp2040-host-midi2/CMakeLists.txt +++ b/examples/adafruit-feather-rp2040-host-midi2/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # adafruit-feather-rp2040-host-midi2, full-spec USB MIDI 2.0 host # example with SSD1306 display, on the Adafruit Feather RP2040 USB Host. -# Lives at midi2_cpp/examples/adafruit-feather-rp2040-host-midi2; +# Lives at midi2cpp/examples/adafruit-feather-rp2040-host-midi2; # consumes the parent library directly from ../../src. Builds standalone # with the Pico SDK toolchain + PIO-USB. @@ -73,11 +73,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) pico_sdk_init() # --------------------------------------------------------------------------- -# midi2_cpp, built from the parent library tree (this example lives at -# midi2_cpp/examples/adafruit-feather-rp2040-host-midi2). No vendored +# midi2cpp, built from the parent library tree (this example lives at +# midi2cpp/examples/adafruit-feather-rp2040-host-midi2). No vendored # copy needed. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -89,20 +89,20 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp - ${MIDI2_CPP_ROOT}/src/midi2_host.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp + ${MIDI2CPP_ROOT}/src/midi2_host.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) # --------------------------------------------------------------------------- # Pico-PIO-USB sources compiled into our target. The library doesn't @@ -123,7 +123,7 @@ target_include_directories(adafruit-feather-rp2040-host-midi2-showcase PRIVATE s target_link_libraries(adafruit-feather-rp2040-host-midi2-showcase PRIVATE - midi2_cpp + midi2cpp pico_stdlib pico_rand # get_rand_32, host MUID entropy hardware_i2c # SSD1306 over I2C1 @@ -142,10 +142,10 @@ target_compile_definitions(adafruit-feather-rp2040-host-midi2-showcase PRIVATE ) # Hot-swap watchdog window (ms). 0 disables the watchdog. Default of -# 3000 matches the README; override with -DMIDI2_CPP_HOST_WATCHDOG_MS=N. -if(DEFINED MIDI2_CPP_HOST_WATCHDOG_MS) +# 3000 matches the README; override with -DMIDI2CPP_HOST_WATCHDOG_MS=N. +if(DEFINED MIDI2CPP_HOST_WATCHDOG_MS) target_compile_definitions(adafruit-feather-rp2040-host-midi2-showcase - PRIVATE MIDI2_CPP_HOST_WATCHDOG_MS=${MIDI2_CPP_HOST_WATCHDOG_MS}) + PRIVATE MIDI2CPP_HOST_WATCHDOG_MS=${MIDI2CPP_HOST_WATCHDOG_MS}) endif() # Disable USB CDC stdio. Use UART on default GP0/GP1 @ 115200 for debug. diff --git a/examples/adafruit-feather-rp2040-host-midi2/README.md b/examples/adafruit-feather-rp2040-host-midi2/README.md index deb7e82..2b0059a 100644 --- a/examples/adafruit-feather-rp2040-host-midi2/README.md +++ b/examples/adafruit-feather-rp2040-host-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Host MIDI 2.0 +# [midi2cpp](../..) | Host MIDI 2.0 ## Adafruit Feather RP2040 USB Host USB MIDI 2.0 host on the **Adafruit Feather RP2040 USB Host**. Plug an upstream MIDI 2.0 device into the USB-A port (PIO-USB on GP16 / GP17), routes UMP through `m2host`, renders device topology + live UMP stream on a 128x64 SSD1306 OLED over I2C1 (STEMMA QT). Pico SDK build, no Arduino IDE. @@ -56,7 +56,7 @@ Plug any USB MIDI 2.0 device (full-spec showcase, Daisy Seed with MIDI 2.0 firmw ## Spec coverage -**Tier A** host. The RP2040's 264 KB SRAM affords up to `MIDI2_CPP_HOST_MAX_DEVICES` (default 4) connected MIDI 2.0 devices simultaneously, addressed by `idx`. +**Tier A** host. The RP2040's 264 KB SRAM affords up to `MIDI2CPP_HOST_MAX_DEVICES` (default 4) connected MIDI 2.0 devices simultaneously, addressed by `idx`. | UMP MT | Direction | Spec | Notes | |---|---|---|---| @@ -91,10 +91,10 @@ UART debug on GP0 mirrors most events for headless monitoring. A 3 s watchdog in `feather_host::task` resets the TinyUSB host stack (`tuh_deinit` + `tusb_init`) when `deviceCount()` drops to zero and stays there for 3 s. Tune at compile time: ```bash -cmake -B build -DMIDI2_CPP_HOST_WATCHDOG_MS=5000 # 5 s -cmake -B build -DMIDI2_CPP_HOST_WATCHDOG_MS=0 # disable +cmake -B build -DMIDI2CPP_HOST_WATCHDOG_MS=5000 # 5 s +cmake -B build -DMIDI2CPP_HOST_WATCHDOG_MS=0 # disable ``` ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). Pico-PIO-USB is MIT. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). Pico-PIO-USB is MIT. diff --git a/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.cpp b/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.cpp index 93e2ce9..034ebc0 100644 --- a/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.cpp +++ b/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.cpp @@ -20,8 +20,8 @@ // RP2040 occasionally fails to re-enumerate the next plug. If we // observe "no devices for N ms" with N > 0 we reset the host stack // (tuh_deinit + tusb_init). Set to 0 at compile time to disable. -#ifndef MIDI2_CPP_HOST_WATCHDOG_MS -#define MIDI2_CPP_HOST_WATCHDOG_MS 3000 +#ifndef MIDI2CPP_HOST_WATCHDOG_MS +#define MIDI2CPP_HOST_WATCHDOG_MS 3000 #endif namespace feather_host { @@ -65,7 +65,7 @@ uint32_t platform_rng_fn() { return get_rand_32(); } -#if MIDI2_CPP_HOST_WATCHDOG_MS > 0 +#if MIDI2CPP_HOST_WATCHDOG_MS > 0 // Watchdog state, only walked from feather_host::task (single-threaded // main loop), so plain globals are safe. bool g_had_device = false; @@ -86,7 +86,7 @@ void watchdog_tick(uint32_t now_ms) { g_devices_lost_ms = now_ms; return; } - if (now_ms - g_devices_lost_ms < MIDI2_CPP_HOST_WATCHDOG_MS) return; + if (now_ms - g_devices_lost_ms < MIDI2CPP_HOST_WATCHDOG_MS) return; // Stack reset. tuh_deinit drops endpoints + frees the device pool; // tusb_init rebuilds it. PIO-USB state machines are restarted by @@ -178,7 +178,7 @@ void task(midi2::m2host& midi) { // Library housekeeping (CI Discovery timeout sweep). midi.task(); -#if MIDI2_CPP_HOST_WATCHDOG_MS > 0 +#if MIDI2CPP_HOST_WATCHDOG_MS > 0 watchdog_tick(platform_now_fn()); #endif } diff --git a/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.h b/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.h index b44718b..261be25 100644 --- a/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.h +++ b/examples/adafruit-feather-rp2040-host-midi2/src/feather_host.h @@ -12,7 +12,7 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace feather_host { diff --git a/examples/adafruit-feather-rp2040-host-midi2/src/tusb_config.h b/examples/adafruit-feather-rp2040-host-midi2/src/tusb_config.h index 94ca156..e73e3e6 100644 --- a/examples/adafruit-feather-rp2040-host-midi2/src/tusb_config.h +++ b/examples/adafruit-feather-rp2040-host-midi2/src/tusb_config.h @@ -79,7 +79,7 @@ extern "C" { // Hub + 4 device slots so an off-board USB-A hub can fan out to several // MIDI 2.0 devices (matches the bridge sibling at // ../../adafruit-feather-rp2040-bridge-midi2 and the m2host slot count -// MIDI2_CPP_HOST_MAX_DEVICES = 4). +// MIDI2CPP_HOST_MAX_DEVICES = 4). #define CFG_TUH_HUB 1 #define CFG_TUH_DEVICE_MAX 4 diff --git a/examples/arduino-nano-esp32-midi2/README.md b/examples/arduino-nano-esp32-midi2/README.md index 5375754..b89a4f0 100644 --- a/examples/arduino-nano-esp32-midi2/README.md +++ b/examples/arduino-nano-esp32-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Arduino Nano ESP32 ![arduino-esp32](board/banner.png) @@ -95,4 +95,4 @@ Every scene logs via the ESP-IDF console (default UART monitor). ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/arduino-nano-esp32-midi2/idf/CMakeLists.txt b/examples/arduino-nano-esp32-midi2/idf/CMakeLists.txt index 67007c9..714ef18 100644 --- a/examples/arduino-nano-esp32-midi2/idf/CMakeLists.txt +++ b/examples/arduino-nano-esp32-midi2/idf/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16) # arduino-nano-esp32-midi2, full-spec USB MIDI 2.0 device showcase on # the Arduino Nano ESP32 (ESP32-S3, native USB-OTG). Mirrors the Pico # SDK rp2040-midi2 22 s scene cycle. Lives at -# midi2_cpp/examples/arduino-nano-esp32-midi2; consumes the parent +# midi2cpp/examples/arduino-nano-esp32-midi2; consumes the parent # library directly from ../../../src. # # Build: diff --git a/examples/arduino-nano-esp32-midi2/idf/main/CMakeLists.txt b/examples/arduino-nano-esp32-midi2/idf/main/CMakeLists.txt index f266e25..aecd95a 100644 --- a/examples/arduino-nano-esp32-midi2/idf/main/CMakeLists.txt +++ b/examples/arduino-nano-esp32-midi2/idf/main/CMakeLists.txt @@ -1,21 +1,21 @@ # main component for arduino-nano-esp32-midi2. # -# Pulls midi2_cpp directly from ../../../../src (parent library, not +# Pulls midi2cpp directly from ../../../../src (parent library, not # vendored). The TinyUSB PR #3571 fork is expected to live at # ../components/tinyusb after running ./scripts/fetch_tinyusb.sh; ESP-IDF # resolves local components ahead of the built-in path, so the fork wins. -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") idf_component_register( SRCS "main.cpp" "arduino_nano_esp32_midi2.cpp" - "${MIDI2_CPP_ROOT}/midi2_device.cpp" - "${MIDI2_CPP_ROOT}/midi2_ci.cpp" + "${MIDI2CPP_ROOT}/midi2_device.cpp" + "${MIDI2CPP_ROOT}/midi2_ci.cpp" INCLUDE_DIRS "." - "${MIDI2_CPP_ROOT}" + "${MIDI2CPP_ROOT}" REQUIRES midi2 tinyusb diff --git a/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.cpp b/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.cpp index 3ca4b2e..042fc6d 100644 --- a/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.cpp +++ b/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.cpp @@ -3,7 +3,7 @@ * * Owns: ESP32-S3 USB-OTG PHY init (USB_PHY_TARGET_INT), TinyUSB device * driver install (with MIDI 2.0 class driver from PR #3571), the wiring - * between TinyUSB and midi2_cpp via the five public hooks, and a single + * between TinyUSB and midi2cpp via the five public hooks, and a single * GPIO LED indicator (LED_BUILTIN on most Arduino Nano ESP32 / Pro * Micro ESP32-S3 form factors). The application layer only sees * `midi2::m2device` + `midi2::m2ci` objects that are already alive. diff --git a/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.h b/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.h index da1fbba..facb9d9 100644 --- a/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.h +++ b/examples/arduino-nano-esp32-midi2/idf/main/arduino_nano_esp32_midi2.h @@ -5,18 +5,18 @@ * The application layer (showcase) consumes this header and never * touches tud_*, esp_*, or any USB symbol directly. After init, the * m2device + m2ci instances are wired to the platform USB stack through - * midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the FreeRTOS loop. */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace arduino_nano_esp32_midi2 { // Boots USB-OTG PHY, installs TinyUSB device task, sets up the MIDI 2.0 -// device class, and wires the five midi2_cpp platform hooks into the +// device class, and wires the five midi2cpp platform hooks into the // supplied m2device / m2ci. After this returns, the app can register // callbacks, send UMPs, and call task() in its main loop. void init(midi2::m2device& midi, midi2::m2ci& ci); diff --git a/examples/arduino-nano-esp32-midi2/idf/main/idf_component.yml b/examples/arduino-nano-esp32-midi2/idf/main/idf_component.yml index ed7cd23..acc5b14 100644 --- a/examples/arduino-nano-esp32-midi2/idf/main/idf_component.yml +++ b/examples/arduino-nano-esp32-midi2/idf/main/idf_component.yml @@ -7,4 +7,4 @@ dependencies: idf: ">=5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/arduino-nano-esp32-midi2/idf/sdkconfig.defaults b/examples/arduino-nano-esp32-midi2/idf/sdkconfig.defaults index c29d4de..9c73ac5 100644 --- a/examples/arduino-nano-esp32-midi2/idf/sdkconfig.defaults +++ b/examples/arduino-nano-esp32-midi2/idf/sdkconfig.defaults @@ -12,7 +12,7 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Compiler: C++17 to match the parent library and Pico SDK recipes. -# midi2_cpp uses std::function callbacks; exceptions stay off. +# midi2cpp uses std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/esp32-c6-devkitc-multi-midi2/README.md b/examples/esp32-c6-devkitc-multi-midi2/README.md index fbc53d5..bf7c301 100644 --- a/examples/esp32-c6-devkitc-multi-midi2/README.md +++ b/examples/esp32-c6-devkitc-multi-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## ESP32-C6-DevKitC-1 (BLE + ESP-NOW) Wireless MIDI 2.0 device on the **ESP32-C6-DevKitC-1**, exposing two transports in parallel: **BLE-MIDI 1.0** (standard Apple / MIDI Association service UUID) and **ESP-NOW** (peer-to-peer, broadcast on WiFi channel 1). The C6 has no USB-OTG hardware (only USB-Serial-JTAG), so the canonical USB MIDI 2.0 device interface is unavailable on this chip; this recipe demonstrates the wireless path instead. Built on [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) v6.0.0 + arduino-esp32 v3.x. PlatformIO build. @@ -131,4 +131,4 @@ Velocity / value widths reflect the 7-bit to 16-bit / 32-bit upscale done by the ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) is also MIT. Board reference images and PDFs under `board/` are © Espressif Systems, redistributed for documentation purposes. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) is also MIT. Board reference images and PDFs under `board/` are © Espressif Systems, redistributed for documentation purposes. diff --git a/examples/esp32-c6-devkitc-multi-midi2/pio/platformio.ini b/examples/esp32-c6-devkitc-multi-midi2/pio/platformio.ini index 97cc8bb..edd4346 100644 --- a/examples/esp32-c6-devkitc-multi-midi2/pio/platformio.ini +++ b/examples/esp32-c6-devkitc-multi-midi2/pio/platformio.ini @@ -1,4 +1,4 @@ -; midi2_cpp | esp32-c6-devkitc-multi-midi2 +; midi2cpp | esp32-c6-devkitc-multi-midi2 ; ; ESP32-C6-DevKitC-1 as a wireless MIDI 2.0 endpoint over BLE + ESP-NOW. ; The C6 has no USB-OTG (only USB-Serial-JTAG), so the canonical USB MIDI @@ -45,7 +45,7 @@ build_flags = -std=gnu++17 -DCORE_DEBUG_LEVEL=3 -; Pull midi2_cpp from the parent of this recipe via lib_extra_dirs. +; Pull midi2cpp from the parent of this recipe via lib_extra_dirs. ; ESP32_Host_MIDI is pinned to the v6.0.1 GitHub tag (no library.json in ; the release, so PlatformIO uses the URL form). v6.0.1 carries the BLE ; fix that always adds BLE2902 and enables scan response, required for @@ -53,7 +53,7 @@ build_flags = lib_extra_dirs = ../../.. lib_deps = - sauloverissimo/midi2 @ ^0.3.3 + sauloverissimo/midi2 @ ^0.3.4 https://github.com/sauloverissimo/ESP32_Host_MIDI.git#v6.0.1 ; Pre-build patch: ESP32_Host_MIDI v6.0.0 ships USB Host transport sources diff --git a/examples/esp32-c6-devkitc-multi-midi2/pio/src/main.cpp b/examples/esp32-c6-devkitc-multi-midi2/pio/src/main.cpp index 6c6b109..6c843ee 100644 --- a/examples/esp32-c6-devkitc-multi-midi2/pio/src/main.cpp +++ b/examples/esp32-c6-devkitc-multi-midi2/pio/src/main.cpp @@ -1,4 +1,4 @@ -// midi2_cpp | esp32-c6-devkitc-multi-midi2 +// midi2cpp | esp32-c6-devkitc-multi-midi2 // // ESP32-C6-DevKitC-1 wireless MIDI 2.0 endpoint over BLE + ESP-NOW. // @@ -230,10 +230,10 @@ void setup() { delay(400); Serial.println(); Serial.println("====================================================="); - Serial.println(" midi2_cpp | ESP32-C6-DevKitC-1 | BLE + ESP-NOW"); + Serial.println(" midi2cpp | ESP32-C6-DevKitC-1 | BLE + ESP-NOW"); Serial.println("====================================================="); Serial.println(" ESP32_Host_MIDI v6.0.0 (BLE + ESP-NOW transports)"); - Serial.println(" midi2_cpp Device (typed UMP dispatch, MT 0x2 path)"); + Serial.println(" midi2cpp Device (typed UMP dispatch, MT 0x2 path)"); Serial.println(); g_device.setWriteFn(onUmpFromDevice); diff --git a/examples/esp32-p4-devkit-bridge-midi2/README.md b/examples/esp32-p4-devkit-bridge-midi2/README.md index 574dca1..f4842ed 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/README.md +++ b/examples/esp32-p4-devkit-bridge-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Bridge MIDI 2.0 +# [midi2cpp](../..) | Bridge MIDI 2.0 ## Waveshare ESP32-P4-WIFI6-DEV-KIT Dual-stack USB MIDI 2.0 bridge on the **Waveshare ESP32-P4-WIFI6-DEV-KIT**. Runs TinyUSB host on the USB-A jacks (UTMI PHY, OTG_HS controller at 480 Mbps, rhport 1) and TinyUSB device on the **USB-Device** USB-C jack (INT PHY, OTG_FS controller, rhport 0) in the same firmware, forwarding MIDI 2.0 channel-voice traffic from any upstream device into the host PC's view of `ESP32P4Bridge`. Mixed-protocol bus: MIDI 1.0 controllers (Arturia, M-Audio, generic synths) coexist with MIDI 2.0 devices on the same USB-A hub, each routed through its own class driver. ESP-IDF v5.4 build, no Arduino IDE. @@ -132,4 +132,4 @@ Channel Pressure, Poly Pressure, Per-Note Pitch Bend, and Program Change with ba ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/CMakeLists.txt b/examples/esp32-p4-devkit-bridge-midi2/idf/CMakeLists.txt index ba0afcb..e639f96 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/CMakeLists.txt +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.16) # rhport 1 (UTMI PHY, USB-A jacks). Forwards UMP between any device # plugged into a USB-A jack and the host PC connected to the USB-Device # USB-C jack, so the PC sees the upstream device(s) through this -# bridge. Lives at midi2_cpp/examples/esp32-p4-devkit-bridge-midi2; +# bridge. Lives at midi2cpp/examples/esp32-p4-devkit-bridge-midi2; # consumes the parent library directly from ../../../src. # # Build: diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/main/CMakeLists.txt b/examples/esp32-p4-devkit-bridge-midi2/idf/main/CMakeLists.txt index f945133..9234090 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/main/CMakeLists.txt +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/main/CMakeLists.txt @@ -2,24 +2,24 @@ # # Dual-stack: USB MIDI 2.0 device on rhport 0 (INT PHY, USB-Device USB-C # jack) AND USB MIDI 2.0 host on rhport 1 (UTMI PHY, USB-A jacks). -# Pulls midi2_cpp directly from ../../../../src (parent library, not +# Pulls midi2cpp directly from ../../../../src (parent library, not # vendored). The TinyUSB PR #3571 fork is expected to live at # ../external/tinyusb after running ./scripts/fetch_tinyusb.sh; the # shim at ../components/tinyusb wires its device + host sources into # the build. -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") idf_component_register( SRCS "main.cpp" "esp32_p4_devkit_bridge.cpp" - "${MIDI2_CPP_ROOT}/midi2_device.cpp" - "${MIDI2_CPP_ROOT}/midi2_ci.cpp" - "${MIDI2_CPP_ROOT}/midi2_host.cpp" + "${MIDI2CPP_ROOT}/midi2_device.cpp" + "${MIDI2CPP_ROOT}/midi2_ci.cpp" + "${MIDI2CPP_ROOT}/midi2_host.cpp" INCLUDE_DIRS "." - "${MIDI2_CPP_ROOT}" + "${MIDI2CPP_ROOT}" REQUIRES midi2 tinyusb diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.cpp b/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.cpp index 312e7c0..f6279fb 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.cpp +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.cpp @@ -7,7 +7,7 @@ * - The LP_SYS.usb_ctrl PHY swap on the device side (mandatory on * the Waveshare WIFI6 dev kit, see esp32-p4-devkit-usb-midi2 D-024) * - TinyUSB device + host driver install - * - Wiring between TinyUSB and midi2_cpp via m2device, m2ci, m2host + * - Wiring between TinyUSB and midi2cpp via m2device, m2ci, m2host * hooks * * The application layer only sees the three m2 objects after init(). diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.h b/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.h index a55400a..06b3777 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.h +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/main/esp32_p4_devkit_bridge.h @@ -10,7 +10,7 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace esp32_p4_devkit_bridge { diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/main/idf_component.yml b/examples/esp32-p4-devkit-bridge-midi2/idf/main/idf_component.yml index 33c624c..60b5482 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/main/idf_component.yml +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/main/idf_component.yml @@ -7,4 +7,4 @@ dependencies: idf: ">=5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/main/tusb_config.h b/examples/esp32-p4-devkit-bridge-midi2/idf/main/tusb_config.h index f476401..50fd8ee 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/main/tusb_config.h +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/main/tusb_config.h @@ -76,7 +76,7 @@ extern "C" { // responder hardcodes one window per FB and never sends FB Names. // Local fork patch (see external/tinyusb/src/class/midi/midi2_device.c) // lets MT 0xF Stream messages flow through to the app via -// tud_midi2_n_ump_read so midi2_cpp's m2device dispatcher fires +// tud_midi2_n_ump_read so midi2cpp's m2device dispatcher fires // onEndpointDiscovery / onFbDiscovery callbacks. #define CFG_TUD_MIDI2_USER_RESPONDER 1 @@ -92,8 +92,8 @@ extern "C" { // callback set (tuh_midi_* for legacy, tuh_midi2_* for MIDI 2.0). // // See https://github.com/sauloverissimo/tinyusb/tree/experiment/midi-coexistence -// Up to 4 upstream devices per driver (matches MIDI2_CPP_HOST_MAX_DEVICES -// in midi2_cpp). With CFG_TUH_MIDI=4 + CFG_TUH_MIDI2=4 the bridge can +// Up to 4 upstream devices per driver (matches MIDI2CPP_HOST_MAX_DEVICES +// in midi2cpp). With CFG_TUH_MIDI=4 + CFG_TUH_MIDI2=4 the bridge can // host 4 legacy MIDI 1.0 + 4 MIDI 2.0 devices simultaneously, each // driver claiming only its matching protocol via the alt-walk defer // (experiment/midi-coexistence branch). diff --git a/examples/esp32-p4-devkit-bridge-midi2/idf/sdkconfig.defaults b/examples/esp32-p4-devkit-bridge-midi2/idf/sdkconfig.defaults index cdd7306..2d420de 100644 --- a/examples/esp32-p4-devkit-bridge-midi2/idf/sdkconfig.defaults +++ b/examples/esp32-p4-devkit-bridge-midi2/idf/sdkconfig.defaults @@ -22,7 +22,7 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 # does not depend on an option that may rename across IDF versions. # Compiler: C++17 to match the parent library and Pico SDK recipes. -# midi2_cpp uses std::function callbacks; exceptions stay off. +# midi2cpp uses std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/esp32-p4-devkit-bridge2-midi2/README.md b/examples/esp32-p4-devkit-bridge2-midi2/README.md index 489391f..88f3bca 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/README.md +++ b/examples/esp32-p4-devkit-bridge2-midi2/README.md @@ -1,7 +1,7 @@ -# [midi2_cpp](../..) | Bridge MIDI 2.0 +# [midi2cpp](../..) | Bridge MIDI 2.0 ## Waveshare ESP32-P4-WIFI6-DEV-KIT (m2bridge variant) -Dual-stack USB MIDI 2.0 bridge on the **Waveshare ESP32-P4-WIFI6-DEV-KIT**, identical wire role to the v1 sibling at [`esp32-p4-devkit-bridge-midi2`](../esp32-p4-devkit-bridge-midi2/) but built on top of the reusable `midi2::m2bridge` class. The slot table, multi-FB Stream Discovery responder, per-FB group rewrite, dynamic FB Names, and MIDI 1.0 alt 0 byte uplift all live inside `midi2_cpp/src/midi2_bridge.cpp`; the recipe carries only the platform layer (PHY init, TinyUSB tasks, write callbacks, mount-event forwarding into the bridge slot table). PC sees PID `0x4095` / `ESP32P4Bridge2`, distinct from the v1 sibling's `0x4092` / `ESP32P4Bridge`, so both firmwares can coexist on the same host for A/B comparison. +Dual-stack USB MIDI 2.0 bridge on the **Waveshare ESP32-P4-WIFI6-DEV-KIT**, identical wire role to the v1 sibling at [`esp32-p4-devkit-bridge-midi2`](../esp32-p4-devkit-bridge-midi2/) but built on top of the reusable `midi2::m2bridge` class. The slot table, multi-FB Stream Discovery responder, per-FB group rewrite, dynamic FB Names, and MIDI 1.0 alt 0 byte uplift all live inside `midi2cpp/src/midi2_bridge.cpp`; the recipe carries only the platform layer (PHY init, TinyUSB tasks, write callbacks, mount-event forwarding into the bridge slot table). PC sees PID `0x4095` / `ESP32P4Bridge2`, distinct from the v1 sibling's `0x4092` / `ESP32P4Bridge`, so both firmwares can coexist on the same host for A/B comparison. ![esp32-p4-devkit-bridge2-midi2 banner](board/banner.png) @@ -135,7 +135,7 @@ MIDI-CI: Discovery + Process Inquiry are answered locally by the bridge's `m2ci` ## What lives where ``` -midi2_cpp/examples/esp32-p4-devkit-bridge2-midi2/ +midi2cpp/examples/esp32-p4-devkit-bridge2-midi2/ ├── README.md ├── board/ board photos / pinout (TBD) └── idf/ @@ -148,7 +148,7 @@ midi2_cpp/examples/esp32-p4-devkit-bridge2-midi2/ │ ├── CMakeLists.txt shim: registers the fork's selected sources (device + host) │ └── usb_descriptors.c PID 0x4095, Product "ESP32P4Bridge2" └── main/ - ├── CMakeLists.txt idf_component_register, pulls midi2_cpp + midi2_bridge from ../../../../src + ├── CMakeLists.txt idf_component_register, pulls midi2cpp + midi2_bridge from ../../../../src ├── idf_component.yml managed deps (none beyond ESP-IDF >=5.4) ├── tusb_config.h 16 groups, 4 function blocks, FS device + HS host, USER_RESPONDER on ├── esp32_p4_devkit_bridge2.h public API of the platform glue @@ -158,4 +158,4 @@ midi2_cpp/examples/esp32-p4-devkit-bridge2-midi2/ ## License -MIT, inherits the parent [`midi2_cpp` LICENSE](../../LICENSE). The TinyUSB fork (cloned on demand into `idf/external/tinyusb`) is MIT (upstream by hathach, fork by sauloverissimo carrying the MIDI 2.0 class drivers from the still-open [PR #3571](https://github.com/hathach/tinyusb/pull/3571) plus the experiment/midi-coexistence follow-ups). +MIT, inherits the parent [`midi2cpp` LICENSE](../../LICENSE). The TinyUSB fork (cloned on demand into `idf/external/tinyusb`) is MIT (upstream by hathach, fork by sauloverissimo carrying the MIDI 2.0 class drivers from the still-open [PR #3571](https://github.com/hathach/tinyusb/pull/3571) plus the experiment/midi-coexistence follow-ups). diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/CMakeLists.txt b/examples/esp32-p4-devkit-bridge2-midi2/idf/CMakeLists.txt index 8e4352c..750a4df 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/CMakeLists.txt +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.16) # ../esp32-p4-devkit-bridge-midi2/ (USB device on rhport 0 + USB host on # rhport 1, multi-FB topology, per-slot group window, MIDI 1.0 alt 0 # uplift), but the slot table + Stream Discovery responder + UMP forward -# path live inside midi2_cpp/src/midi2_bridge.cpp instead of being +# path live inside midi2cpp/src/midi2_bridge.cpp instead of being # carried inline by the recipe. # # PC sees PID 0x4095 / "ESP32P4Bridge2", distinct from the v1 sibling's diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/CMakeLists.txt b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/CMakeLists.txt index 2e9c476..301b212 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/CMakeLists.txt +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/CMakeLists.txt @@ -2,7 +2,7 @@ # # Dual-stack: USB MIDI 2.0 device on rhport 0 (INT PHY, USB-Device USB-C # jack) AND USB MIDI 2.0 host on rhport 1 (UTMI PHY, USB-A jacks). -# Pulls midi2_cpp directly from ../../../../src (parent library, not +# Pulls midi2cpp directly from ../../../../src (parent library, not # vendored). Includes midi2_bridge so the recipe consumes the reusable # m2bridge class instead of carrying the slot table + Stream Discovery # responder + UMP forward path inline. The TinyUSB PR #3571 fork is @@ -10,19 +10,19 @@ # ./scripts/fetch_tinyusb.sh; the shim at ../components/tinyusb wires # its device + host sources into the build. -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") idf_component_register( SRCS "main.cpp" "esp32_p4_devkit_bridge2.cpp" - "${MIDI2_CPP_ROOT}/midi2_device.cpp" - "${MIDI2_CPP_ROOT}/midi2_ci.cpp" - "${MIDI2_CPP_ROOT}/midi2_host.cpp" - "${MIDI2_CPP_ROOT}/midi2_bridge.cpp" + "${MIDI2CPP_ROOT}/midi2_device.cpp" + "${MIDI2CPP_ROOT}/midi2_ci.cpp" + "${MIDI2CPP_ROOT}/midi2_host.cpp" + "${MIDI2CPP_ROOT}/midi2_bridge.cpp" INCLUDE_DIRS "." - "${MIDI2_CPP_ROOT}" + "${MIDI2CPP_ROOT}" REQUIRES midi2 tinyusb diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.cpp b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.cpp index 50f552e..f3c17c2 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.cpp +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.cpp @@ -18,7 +18,7 @@ * Compared to the v1 sibling at ../../esp32-p4-devkit-bridge-midi2, * this file shrinks substantially: every shared invariant (slot table, * group rewrite, multi-FB Stream Discovery responder, ByteStreamConverter - * wiring) lives inside midi2_cpp/src/midi2_bridge.cpp now. + * wiring) lives inside midi2cpp/src/midi2_bridge.cpp now. */ #include "esp32_p4_devkit_bridge2.h" diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.h b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.h index 4cc3b52..d2c4322 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.h +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/esp32_p4_devkit_bridge2.h @@ -9,7 +9,7 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace esp32_p4_devkit_bridge2 { diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/idf_component.yml b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/idf_component.yml index 33c624c..60b5482 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/idf_component.yml +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/idf_component.yml @@ -7,4 +7,4 @@ dependencies: idf: ">=5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/main.cpp b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/main.cpp index 7c2bdf8..d8747b1 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/main.cpp +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/main.cpp @@ -5,7 +5,7 @@ * class. The application here is just identity setup + the main loop; * everything that used to live inline in main.cpp / esp32_p4_devkit_bridge.cpp * (slot table, group rewrite, FB Name dispatch, MIDI 1.0 byte uplift, - * Stream Discovery responder) now lives in midi2_cpp/src/midi2_bridge.cpp. + * Stream Discovery responder) now lives in midi2cpp/src/midi2_bridge.cpp. * * USB-A jacks (UTMI host, rhport 1) * up to MAX_SLOTS upstream MIDI 2.0 devices, plus legacy MIDI 1.0 diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/tusb_config.h b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/tusb_config.h index 2f9f92b..13f2c47 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/main/tusb_config.h +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/main/tusb_config.h @@ -79,7 +79,7 @@ extern "C" { // responder hardcodes one window per FB and never sends FB Names. // Local fork patch (see external/tinyusb/src/class/midi/midi2_device.c) // lets MT 0xF Stream messages flow through to the app via -// tud_midi2_n_ump_read so midi2_cpp's m2device dispatcher fires +// tud_midi2_n_ump_read so midi2cpp's m2device dispatcher fires // onEndpointDiscovery / onFbDiscovery callbacks. #define CFG_TUD_MIDI2_USER_RESPONDER 1 @@ -95,8 +95,8 @@ extern "C" { // callback set (tuh_midi_* for legacy, tuh_midi2_* for MIDI 2.0). // // See https://github.com/sauloverissimo/tinyusb/tree/experiment/midi-coexistence -// Up to 4 upstream devices per driver (matches MIDI2_CPP_HOST_MAX_DEVICES -// in midi2_cpp). With CFG_TUH_MIDI=4 + CFG_TUH_MIDI2=4 the bridge can +// Up to 4 upstream devices per driver (matches MIDI2CPP_HOST_MAX_DEVICES +// in midi2cpp). With CFG_TUH_MIDI=4 + CFG_TUH_MIDI2=4 the bridge can // host 4 legacy MIDI 1.0 + 4 MIDI 2.0 devices simultaneously, each // driver claiming only its matching protocol via the alt-walk defer // (experiment/midi-coexistence branch). diff --git a/examples/esp32-p4-devkit-bridge2-midi2/idf/sdkconfig.defaults b/examples/esp32-p4-devkit-bridge2-midi2/idf/sdkconfig.defaults index cdd7306..2d420de 100644 --- a/examples/esp32-p4-devkit-bridge2-midi2/idf/sdkconfig.defaults +++ b/examples/esp32-p4-devkit-bridge2-midi2/idf/sdkconfig.defaults @@ -22,7 +22,7 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 # does not depend on an option that may rename across IDF versions. # Compiler: C++17 to match the parent library and Pico SDK recipes. -# midi2_cpp uses std::function callbacks; exceptions stay off. +# midi2cpp uses std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/esp32-p4-devkit-host-midi2/README.md b/examples/esp32-p4-devkit-host-midi2/README.md index ac53c7c..dbcb39a 100644 --- a/examples/esp32-p4-devkit-host-midi2/README.md +++ b/examples/esp32-p4-devkit-host-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Host MIDI 2.0 +# [midi2cpp](../..) | Host MIDI 2.0 ## Waveshare ESP32-P4-WIFI6-DEV-KIT USB MIDI 2.0 host on the **Waveshare ESP32-P4-WIFI6-DEV-KIT**. Plug an upstream MIDI 2.0 device into either of the two USB-A jacks (UTMI PHY, OTG_HS controller at 480 Mbps, routed through the onboard CH334F USB hub), routes UMP through `m2host`, prints decoded device topology + live UMP stream on the UART console (CH343 USB-Serial-JTAG bridge on the **ToUART** USB-C jack). ESP-IDF v5.4 build, no Arduino IDE. @@ -44,7 +44,7 @@ To override TinyUSB with a local working copy: `ln -sfn /path/to/your/tinyusb id | BOOT button | Hold during reset to enter download mode (rarely needed; CH343 auto-reset handles it) | | RESET button | Reboot | -The CH334F hub allows up to `MIDI2_CPP_HOST_MAX_DEVICES` (default 4) MIDI 2.0 devices simultaneously, addressed by `idx`. +The CH334F hub allows up to `MIDI2CPP_HOST_MAX_DEVICES` (default 4) MIDI 2.0 devices simultaneously, addressed by `idx`. ## Validation @@ -88,4 +88,4 @@ Per device mount, console prints one line per event: ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/esp32-p4-devkit-host-midi2/idf/CMakeLists.txt b/examples/esp32-p4-devkit-host-midi2/idf/CMakeLists.txt index 6973c79..21a1731 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/CMakeLists.txt +++ b/examples/esp32-p4-devkit-host-midi2/idf/CMakeLists.txt @@ -3,9 +3,9 @@ cmake_minimum_required(VERSION 3.16) # esp32-p4-devkit-host-midi2, USB MIDI 2.0 host monitor on the # Waveshare ESP32-P4-WIFI6-DEV-KIT. Receives UMP from any device # plugged into the USB-A jacks (UTMI PHY, rhport 1) and decodes the -# stream live on the UART console. Pair with any midi2_cpp device +# stream live on the UART console. Pair with any midi2cpp device # recipe to validate cross-platform interop. Lives at -# midi2_cpp/examples/esp32-p4-devkit-host-midi2; consumes the parent +# midi2cpp/examples/esp32-p4-devkit-host-midi2; consumes the parent # library directly from ../../../src. # # Build: diff --git a/examples/esp32-p4-devkit-host-midi2/idf/main/CMakeLists.txt b/examples/esp32-p4-devkit-host-midi2/idf/main/CMakeLists.txt index eb04800..9092e8f 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/main/CMakeLists.txt +++ b/examples/esp32-p4-devkit-host-midi2/idf/main/CMakeLists.txt @@ -1,20 +1,20 @@ # main component for esp32-p4-devkit-host-midi2. # -# Pulls midi2_cpp directly from ../../../../src (parent library, not +# Pulls midi2cpp directly from ../../../../src (parent library, not # vendored). The TinyUSB PR #3571 fork is expected to live at # ../external/tinyusb after running ./scripts/fetch_tinyusb.sh; the # shim at ../components/tinyusb wires its host sources into the build. -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") idf_component_register( SRCS "main.cpp" "esp32_p4_devkit_host.cpp" - "${MIDI2_CPP_ROOT}/midi2_host.cpp" + "${MIDI2CPP_ROOT}/midi2_host.cpp" INCLUDE_DIRS "." - "${MIDI2_CPP_ROOT}" + "${MIDI2CPP_ROOT}" REQUIRES midi2 tinyusb diff --git a/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.cpp b/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.cpp index 1c488bc..a3e1e05 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.cpp +++ b/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.cpp @@ -3,7 +3,7 @@ * * Owns: ESP32-P4 USB-OTG UTMI PHY init (host role, high speed), * TinyUSB host driver install (with MIDI 2.0 host class from PR #3571), - * and the wiring between TinyUSB host and midi2_cpp via the m2host + * and the wiring between TinyUSB host and midi2cpp via the m2host * hooks. The application layer only sees `midi2::m2host` after init(). * * The Waveshare ESP32-P4-WIFI6-DEV-KIT routes the UTMI PHY to the two diff --git a/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.h b/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.h index 872e2c1..3773ee7 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.h +++ b/examples/esp32-p4-devkit-host-midi2/idf/main/esp32_p4_devkit_host.h @@ -5,7 +5,7 @@ * The application layer (host monitor) consumes this header and never * touches tuh_*, esp_*, or any USB symbol directly. After init, the * m2host instance is wired to the platform USB stack through - * midi2_cpp's host hooks (setWriteFn, feedRx, setNowFn, setRngFn, + * midi2cpp's host hooks (setWriteFn, feedRx, setNowFn, setRngFn, * setMounted). The app then registers callbacks and calls task() in * the FreeRTOS loop. * @@ -15,12 +15,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace esp32_p4_devkit_host { // Boots the UTMI USB-OTG PHY (host role, high speed), installs the -// TinyUSB host task on rhport 1, and wires the four midi2_cpp host +// TinyUSB host task on rhport 1, and wires the four midi2cpp host // hooks into the supplied m2host instance. After this returns, the // app can register callbacks and call task() in its main loop. // diff --git a/examples/esp32-p4-devkit-host-midi2/idf/main/idf_component.yml b/examples/esp32-p4-devkit-host-midi2/idf/main/idf_component.yml index 8c9186c..2c308a2 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/main/idf_component.yml +++ b/examples/esp32-p4-devkit-host-midi2/idf/main/idf_component.yml @@ -7,4 +7,4 @@ dependencies: idf: ">=5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/esp32-p4-devkit-host-midi2/idf/main/main.cpp b/examples/esp32-p4-devkit-host-midi2/idf/main/main.cpp index 372f5e2..03c15a3 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/main/main.cpp +++ b/examples/esp32-p4-devkit-host-midi2/idf/main/main.cpp @@ -7,7 +7,7 @@ * callbacks, and prints the device topology + live UMP stream on the * UART console (CH343 USB-to-UART bridge on the "ToUART" USB-C jack). * - * Pair this host with any midi2_cpp device recipe (rp2040-midi2, + * Pair this host with any midi2cpp device recipe (rp2040-midi2, * waveshare-rp2040-midi2, esp32-s3-devkitc-usb-midi2, * esp32-p4-devkit-usb-midi2, etc.) plugged into a USB-A jack to see * the full Showcase A-J cycle decoded live on the UART console. diff --git a/examples/esp32-p4-devkit-host-midi2/idf/main/tusb_config.h b/examples/esp32-p4-devkit-host-midi2/idf/main/tusb_config.h index 5169a3d..2c6cc5b 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/main/tusb_config.h +++ b/examples/esp32-p4-devkit-host-midi2/idf/main/tusb_config.h @@ -61,8 +61,8 @@ extern "C" { * also auto-uplifts MIDI 1.0 byte-stream cable events into UMP MT 0x2 * when the upstream device negotiates Alt 0 (legacy USB MIDI 1.0). * - * Up to 4 upstream devices per driver (matches MIDI2_CPP_HOST_MAX_DEVICES - * in midi2_cpp). With CFG_TUH_MIDI=4 + CFG_TUH_MIDI2=4 the host can + * Up to 4 upstream devices per driver (matches MIDI2CPP_HOST_MAX_DEVICES + * in midi2cpp). With CFG_TUH_MIDI=4 + CFG_TUH_MIDI2=4 the host can * pick up 4 legacy MIDI 1.0 + 4 MIDI 2.0 devices simultaneously, each * driver claiming only its matching protocol via the alt-walk defer * (experiment/midi-coexistence branch). */ diff --git a/examples/esp32-p4-devkit-host-midi2/idf/sdkconfig.defaults b/examples/esp32-p4-devkit-host-midi2/idf/sdkconfig.defaults index cdd7306..2d420de 100644 --- a/examples/esp32-p4-devkit-host-midi2/idf/sdkconfig.defaults +++ b/examples/esp32-p4-devkit-host-midi2/idf/sdkconfig.defaults @@ -22,7 +22,7 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 # does not depend on an option that may rename across IDF versions. # Compiler: C++17 to match the parent library and Pico SDK recipes. -# midi2_cpp uses std::function callbacks; exceptions stay off. +# midi2cpp uses std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/esp32-p4-devkit-usb-midi2/README.md b/examples/esp32-p4-devkit-usb-midi2/README.md index b8ca3fd..92a66af 100644 --- a/examples/esp32-p4-devkit-usb-midi2/README.md +++ b/examples/esp32-p4-devkit-usb-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Waveshare ESP32-P4-WIFI6-DEV-KIT Full-spec USB MIDI 2.0 device on the **Waveshare ESP32-P4-WIFI6-DEV-KIT** (RISC-V Cortex-M-class core, USB-OTG internal PHY). Headless single-file showcase of every MIDI 2.0 message category beyond MIDI 1.0. ESP-IDF v5.4 build, no Arduino IDE. @@ -92,4 +92,4 @@ Every scene logs to UART via the CH343 bridge on the **ToUART** jack at 115200 8 ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/esp32-p4-devkit-usb-midi2/idf/CMakeLists.txt b/examples/esp32-p4-devkit-usb-midi2/idf/CMakeLists.txt index cd359dc..ef0ee75 100644 --- a/examples/esp32-p4-devkit-usb-midi2/idf/CMakeLists.txt +++ b/examples/esp32-p4-devkit-usb-midi2/idf/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16) # esp32-p4-devkit-usb-midi2, full-spec USB MIDI 2.0 device showcase on # the ESP32-P4-WIFI6-DEV-KIT. Headless, identity-only USB MIDI 2.0 endpoint # with the same 22 s scene cycle as the Pico SDK rp2040-midi2 example. -# Lives at midi2_cpp/examples/esp32-p4-devkit-usb-midi2; consumes the +# Lives at midi2cpp/examples/esp32-p4-devkit-usb-midi2; consumes the # parent library directly from ../../../src. # # Build: diff --git a/examples/esp32-p4-devkit-usb-midi2/idf/main/CMakeLists.txt b/examples/esp32-p4-devkit-usb-midi2/idf/main/CMakeLists.txt index ecfe576..e9c27d7 100644 --- a/examples/esp32-p4-devkit-usb-midi2/idf/main/CMakeLists.txt +++ b/examples/esp32-p4-devkit-usb-midi2/idf/main/CMakeLists.txt @@ -1,21 +1,21 @@ # main component for esp32-p4-devkit-usb-midi2. # -# Pulls midi2_cpp directly from ../../../../src (parent library, not +# Pulls midi2cpp directly from ../../../../src (parent library, not # vendored). The TinyUSB PR #3571 fork is expected to live at # ../components/tinyusb after running ./scripts/fetch_tinyusb.sh; ESP-IDF # resolves local components ahead of the built-in path, so the fork wins. -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") idf_component_register( SRCS "main.cpp" "esp32_p4_devkit_midi2.cpp" - "${MIDI2_CPP_ROOT}/midi2_device.cpp" - "${MIDI2_CPP_ROOT}/midi2_ci.cpp" + "${MIDI2CPP_ROOT}/midi2_device.cpp" + "${MIDI2CPP_ROOT}/midi2_ci.cpp" INCLUDE_DIRS "." - "${MIDI2_CPP_ROOT}" + "${MIDI2CPP_ROOT}" REQUIRES midi2 tinyusb diff --git a/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.cpp b/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.cpp index f8ad961..7fdea1d 100644 --- a/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.cpp +++ b/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.cpp @@ -3,7 +3,7 @@ * * Owns: ESP32-P4 USB-OTG PHY init (USB_PHY_TARGET_INT, device role), * TinyUSB device driver install (with MIDI 2.0 class driver from PR - * #3571), and the wiring between TinyUSB and midi2_cpp via the five + * #3571), and the wiring between TinyUSB and midi2cpp via the five * public hooks. The application layer only sees `midi2::m2device` and * `midi2::m2ci` objects that are already alive. * @@ -111,7 +111,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { /*core*/ 0); ESP_LOGI(TAG, "TinyUSB device task started"); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.h b/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.h index 59380a1..2f047f4 100644 --- a/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.h +++ b/examples/esp32-p4-devkit-usb-midi2/idf/main/esp32_p4_devkit_midi2.h @@ -5,7 +5,7 @@ * The application layer (showcase) consumes this header and never * touches tud_*, esp_*, or any USB symbol directly. After init, the * m2device + m2ci instances are wired to the platform USB stack through - * midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the FreeRTOS loop. * @@ -15,12 +15,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace esp32_p4_devkit_midi2 { // Boots USB-OTG PHY, installs TinyUSB device task, sets up the MIDI 2.0 -// device class, and wires the five midi2_cpp platform hooks into the +// device class, and wires the five midi2cpp platform hooks into the // supplied m2device / m2ci. After this returns, the app can register // callbacks, send UMPs, and call task() in its main loop. // diff --git a/examples/esp32-p4-devkit-usb-midi2/idf/main/idf_component.yml b/examples/esp32-p4-devkit-usb-midi2/idf/main/idf_component.yml index bc0d27d..a2e5645 100644 --- a/examples/esp32-p4-devkit-usb-midi2/idf/main/idf_component.yml +++ b/examples/esp32-p4-devkit-usb-midi2/idf/main/idf_component.yml @@ -11,4 +11,4 @@ dependencies: idf: ">=5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/esp32-p4-devkit-usb-midi2/idf/sdkconfig.defaults b/examples/esp32-p4-devkit-usb-midi2/idf/sdkconfig.defaults index 79377fb..f7a6902 100644 --- a/examples/esp32-p4-devkit-usb-midi2/idf/sdkconfig.defaults +++ b/examples/esp32-p4-devkit-usb-midi2/idf/sdkconfig.defaults @@ -19,7 +19,7 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" # does not depend on an option that may rename across IDF versions. # Compiler: C++17 to match the parent library and Pico SDK recipes. -# midi2_cpp uses std::function callbacks; exceptions stay off. +# midi2cpp uses std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/esp32-s3-devkitc-host-midi2/README.md b/examples/esp32-s3-devkitc-host-midi2/README.md index 557c5bb..66bc1b9 100644 --- a/examples/esp32-s3-devkitc-host-midi2/README.md +++ b/examples/esp32-s3-devkitc-host-midi2/README.md @@ -1,7 +1,7 @@ -# [midi2_cpp](../..) | Host MIDI 2.0 +# [midi2cpp](../..) | Host MIDI 2.0 ## ESP32-S3-DevKitC-1 -USB MIDI 2.0 host on the **ESP32-S3-DevKitC-1**, built on two released libraries with **no TinyUSB fork and no upstream override**: [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) v6.0.0 owns the wire (alt walk, Endpoint Discovery, UMP RX/TX) on top of ESP-IDF's native USB host stack; `m2host` from `midi2_cpp` owns the high level (typed dispatch, identity tracking, MIDI-CI Initiator). PlatformIO build. +USB MIDI 2.0 host on the **ESP32-S3-DevKitC-1**, built on two released libraries with **no TinyUSB fork and no upstream override**: [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) v6.0.0 owns the wire (alt walk, Endpoint Discovery, UMP RX/TX) on top of ESP-IDF's native USB host stack; `m2host` from `midi2cpp` owns the high level (typed dispatch, identity tracking, MIDI-CI Initiator). PlatformIO build. ![esp32-s3-devkitc-host-midi2 banner, ESP32-S3-DevKitC-1 board photo](board/banner.png) @@ -28,7 +28,7 @@ pio run pio run -t upload -t monitor ``` -Consumes the parent `midi2_cpp` library via `lib_extra_dirs = ../../..`. `ESP32_Host_MIDI` v6.0.0 is pulled by PlatformIO from the GitHub URL pinned in `platformio.ini`. +Consumes the parent `midi2cpp` library via `lib_extra_dirs = ../../..`. `ESP32_Host_MIDI` v6.0.0 is pulled by PlatformIO from the GitHub URL pinned in `platformio.ini`. ### Flash via the left jack (CP2102) @@ -121,4 +121,4 @@ Per device unmount: `[Disconnected]` line, host ready for the next plug-in. Re-p ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) is also MIT. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) is also MIT. diff --git a/examples/esp32-s3-devkitc-host-midi2/pio/platformio.ini b/examples/esp32-s3-devkitc-host-midi2/pio/platformio.ini index 8f973c4..dfb7e37 100644 --- a/examples/esp32-s3-devkitc-host-midi2/pio/platformio.ini +++ b/examples/esp32-s3-devkitc-host-midi2/pio/platformio.ini @@ -1,4 +1,4 @@ -; midi2_cpp | esp32-s3-devkitc-host-midi2 +; midi2cpp | esp32-s3-devkitc-host-midi2 ; ; ESP32-S3-DevKitC-1 as a USB MIDI 2.0 Host using: ; * ESP32_Host_MIDI v6.0.0 (USBMIDI2Connection) for the USB host stack + @@ -6,7 +6,7 @@ ; usb_host_* APIs (no TinyUSB on the host side, no PR override). ; v6.0 makes transports opt-in; only USBMIDI2Connection.h is pulled here, ; no USB Host MIDI 1.0, no BLE, no compile cost for unused transports. -; * midi2_cpp m2host for typed UMP dispatch, identity tracking, and +; * midi2cpp m2host for typed UMP dispatch, identity tracking, and ; MIDI-CI Initiator. Pulled from the parent library via lib_extra_dirs. ; ; No PID is consumed: this recipe is host-only, the S3 does not present @@ -30,11 +30,11 @@ build_flags = -std=gnu++17 -DCORE_DEBUG_LEVEL=3 -; Pull midi2_cpp from the parent of this recipe via lib_extra_dirs. +; Pull midi2cpp from the parent of this recipe via lib_extra_dirs. ; ESP32_Host_MIDI is pinned to the v6.0.0 GitHub tag (no library.json in the ; release, so PlatformIO uses the URL form). lib_extra_dirs = ../../.. lib_deps = - sauloverissimo/midi2 @ ^0.3.3 + sauloverissimo/midi2 @ ^0.3.4 https://github.com/sauloverissimo/ESP32_Host_MIDI.git#v6.0.0 diff --git a/examples/esp32-s3-devkitc-host-midi2/pio/src/main.cpp b/examples/esp32-s3-devkitc-host-midi2/pio/src/main.cpp index 40800ae..b81b503 100644 --- a/examples/esp32-s3-devkitc-host-midi2/pio/src/main.cpp +++ b/examples/esp32-s3-devkitc-host-midi2/pio/src/main.cpp @@ -1,4 +1,4 @@ -// midi2_cpp | esp32-s3-devkitc-host-midi2 +// midi2cpp | esp32-s3-devkitc-host-midi2 // // Showcase of the released-grade USB MIDI 2.0 Host path on ESP32-S3: // @@ -21,7 +21,7 @@ // v FreeRTOS queue (cross-core handover, USB task -> main loop) // | // v -// midi2_cpp m2host +// midi2cpp m2host // * feedRx + task in single-threaded main-loop context // * typed dispatch (NoteOn/Off, CC, PB, ChnPres, Program, ...) // * Endpoint Discovery / Identity tracking per device @@ -123,16 +123,16 @@ void setup() { delay(400); Serial.println(); Serial.println("====================================================="); - Serial.println(" midi2_cpp | ESP32-S3-DevKitC-1 | USB MIDI 2.0 Host"); + Serial.println(" midi2cpp | ESP32-S3-DevKitC-1 | USB MIDI 2.0 Host"); Serial.println("====================================================="); Serial.println(" ESP32_Host_MIDI v6.0.0 (handler optional, no fork)"); - Serial.println(" midi2_cpp m2host (typed dispatch + CI Initiator)"); + Serial.println(" midi2cpp m2host (typed dispatch + CI Initiator)"); Serial.println(" Plug a USB MIDI 2.0 device into the OTG jack (right)."); Serial.println(); s_umpQueue = xQueueCreate(32, sizeof(UMPBatch)); - // ---- midi2_cpp host wiring ---- + // ---- midi2cpp host wiring ---- host.setWriteFn(onUMPToUsb); host.setNowFn([]() -> uint32_t { return (uint32_t)millis(); }); host.setRngFn([]() -> uint32_t { return esp_random(); }); diff --git a/examples/esp32-s3-devkitc-usb-midi2/README.md b/examples/esp32-s3-devkitc-usb-midi2/README.md index ed666bd..1d18d96 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/README.md +++ b/examples/esp32-s3-devkitc-usb-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## ESP32-S3-DevKitC-1 Full-spec USB MIDI 2.0 device on the **ESP32-S3-DevKitC-1** (Xtensa LX7, USB-OTG internal PHY at full-speed 12 Mbps). Headless single-file showcase of every MIDI 2.0 message category beyond MIDI 1.0. ESP-IDF v5.4 build, no Arduino IDE. @@ -110,4 +110,4 @@ Every scene logs to UART (left jack) at 115200 8N1. ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/esp32-s3-devkitc-usb-midi2/idf/CMakeLists.txt b/examples/esp32-s3-devkitc-usb-midi2/idf/CMakeLists.txt index e160c27..ad62908 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/idf/CMakeLists.txt +++ b/examples/esp32-s3-devkitc-usb-midi2/idf/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16) # esp32-s3-devkitc-usb-midi2, full-spec USB MIDI 2.0 device showcase on # the ESP32-S3-DevKitC-1. Headless, identity-only USB MIDI 2.0 endpoint # with the same 22 s scene cycle as the Pico SDK rp2040-midi2 example. -# Lives at midi2_cpp/examples/esp32-s3-devkitc-usb-midi2; consumes the +# Lives at midi2cpp/examples/esp32-s3-devkitc-usb-midi2; consumes the # parent library directly from ../../../src. # # Build: diff --git a/examples/esp32-s3-devkitc-usb-midi2/idf/main/CMakeLists.txt b/examples/esp32-s3-devkitc-usb-midi2/idf/main/CMakeLists.txt index ec1c7a8..624da4d 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/idf/main/CMakeLists.txt +++ b/examples/esp32-s3-devkitc-usb-midi2/idf/main/CMakeLists.txt @@ -1,21 +1,21 @@ # main component for esp32-s3-devkitc-usb-midi2. # -# Pulls midi2_cpp directly from ../../../../src (parent library, not +# Pulls midi2cpp directly from ../../../../src (parent library, not # vendored). The TinyUSB PR #3571 fork is expected to live at # ../components/tinyusb after running ./scripts/fetch_tinyusb.sh; ESP-IDF # resolves local components ahead of the built-in path, so the fork wins. -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../src") idf_component_register( SRCS "main.cpp" "esp32_s3_devkitc_midi2.cpp" - "${MIDI2_CPP_ROOT}/midi2_device.cpp" - "${MIDI2_CPP_ROOT}/midi2_ci.cpp" + "${MIDI2CPP_ROOT}/midi2_device.cpp" + "${MIDI2CPP_ROOT}/midi2_ci.cpp" INCLUDE_DIRS "." - "${MIDI2_CPP_ROOT}" + "${MIDI2CPP_ROOT}" REQUIRES midi2 tinyusb diff --git a/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.cpp b/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.cpp index 51bad29..359ef3d 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.cpp +++ b/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.cpp @@ -3,7 +3,7 @@ * * Owns: ESP32-S3 USB-OTG PHY init (USB_PHY_TARGET_INT), TinyUSB device * driver install (with MIDI 2.0 class driver from PR #3571), the wiring - * between TinyUSB and midi2_cpp via the five public hooks, and the + * between TinyUSB and midi2cpp via the five public hooks, and the * on-board RGB LED indicator on GPIO48. The application layer only sees * `midi2::m2device` + `midi2::m2ci` objects that are already alive. */ @@ -121,7 +121,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { /*core*/ 0); ESP_LOGI(TAG, "TinyUSB device task started"); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.h b/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.h index de82a9d..06265a0 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.h +++ b/examples/esp32-s3-devkitc-usb-midi2/idf/main/esp32_s3_devkitc_midi2.h @@ -5,7 +5,7 @@ * The application layer (showcase) consumes this header and never * touches tud_*, esp_*, or any USB symbol directly. After init, the * m2device + m2ci instances are wired to the platform USB stack through - * midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the FreeRTOS loop. * @@ -15,12 +15,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace esp32_s3_devkitc_midi2 { // Boots USB-OTG PHY, installs TinyUSB device task, sets up the MIDI 2.0 -// device class, and wires the five midi2_cpp platform hooks into the +// device class, and wires the five midi2cpp platform hooks into the // supplied m2device / m2ci. After this returns, the app can register // callbacks, send UMPs, and call task() in its main loop. // diff --git a/examples/esp32-s3-devkitc-usb-midi2/idf/main/idf_component.yml b/examples/esp32-s3-devkitc-usb-midi2/idf/main/idf_component.yml index 1837099..2f753a0 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/idf/main/idf_component.yml +++ b/examples/esp32-s3-devkitc-usb-midi2/idf/main/idf_component.yml @@ -10,4 +10,4 @@ dependencies: espressif/led_strip: "^2.5" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/esp32-s3-devkitc-usb-midi2/idf/sdkconfig.defaults b/examples/esp32-s3-devkitc-usb-midi2/idf/sdkconfig.defaults index c29d4de..9c73ac5 100644 --- a/examples/esp32-s3-devkitc-usb-midi2/idf/sdkconfig.defaults +++ b/examples/esp32-s3-devkitc-usb-midi2/idf/sdkconfig.defaults @@ -12,7 +12,7 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # Compiler: C++17 to match the parent library and Pico SDK recipes. -# midi2_cpp uses std::function callbacks; exceptions stay off. +# midi2cpp uses std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/nrf52840-promicro-midi2/CMakeLists.txt b/examples/nrf52840-promicro-midi2/CMakeLists.txt index 2880f3e..72d17ea 100644 --- a/examples/nrf52840-promicro-midi2/CMakeLists.txt +++ b/examples/nrf52840-promicro-midi2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20) # nrf52840-promicro-midi2, USB MIDI 2.0 device on Pro Micro nRF52840 # class boards (Nice!Nano, BlueMicro840, FYSETC nRF52840 Pro Micro, # generic Pro Micro nRF52840 clones). Lives at -# midi2_cpp/examples/nrf52840-promicro-midi2; consumes the parent +# midi2cpp/examples/nrf52840-promicro-midi2; consumes the parent # library directly from ../../src. # # Build system: TinyUSB native CMake (family_support.cmake) + ARM GNU @@ -70,9 +70,9 @@ project(nrf52840-promicro-midi2 C CXX ASM) family_initialize_project(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}) # ---------------------------------------------------------------------- -# midi2_cpp parent library (consumed via ../../src, not vendored) +# midi2cpp parent library (consumed via ../../src, not vendored) # ---------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -84,21 +84,21 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) -target_compile_features(midi2_cpp PUBLIC cxx_std_17) -target_compile_options(midi2_cpp PRIVATE -fno-rtti -fno-exceptions -fno-use-cxa-atexit) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) +target_compile_features(midi2cpp PUBLIC cxx_std_17) +target_compile_options(midi2cpp PRIVATE -fno-rtti -fno-exceptions -fno-use-cxa-atexit) # ---------------------------------------------------------------------- # Showcase executable @@ -113,11 +113,11 @@ target_sources(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE src) -target_link_libraries(${PROJECT_NAME} PRIVATE midi2_cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE midi2cpp) # C++17 + no exceptions/RTTI for the executable too. nRF52840 has plenty # of flash (1 MB) and SRAM (256 KB), so the constraint is for parity -# with the rest of the midi2_cpp portfolio rather than for size. +# with the rest of the midi2cpp portfolio rather than for size. target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) target_compile_options(${PROJECT_NAME} PRIVATE $<$:-fno-rtti -fno-exceptions -fno-use-cxa-atexit> @@ -138,6 +138,6 @@ family_configure_device_example(${PROJECT_NAME} noos) target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Wno-error> ) -target_compile_options(midi2_cpp PRIVATE +target_compile_options(midi2cpp PRIVATE $<$:-Wno-error> ) diff --git a/examples/nrf52840-promicro-midi2/README.md b/examples/nrf52840-promicro-midi2/README.md index fc6eca3..3e860b5 100644 --- a/examples/nrf52840-promicro-midi2/README.md +++ b/examples/nrf52840-promicro-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Pro Micro nRF52840 (Nice!Nano class) Tier B USB MIDI 2.0 device on **Pro Micro nRF52840** class boards (Nice!Nano, BlueMicro840, FYSETC nRF52840 Pro Micro, generic clones). Cortex-M4F at 64 MHz, 256 KB SRAM. Native CMake build via TinyUSB's `family_support.cmake`, ARM GNU toolchain, no Arduino IDE. @@ -99,4 +99,4 @@ Per cycle (~13 s): ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). Nordic nrfx SDK is BSD-3-Clause. The Adafruit nRF52 UF2 bootloader (referenced, not vendored) is GPL-3.0. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). Nordic nrfx SDK is BSD-3-Clause. The Adafruit nRF52 UF2 bootloader (referenced, not vendored) is GPL-3.0. diff --git a/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.cpp b/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.cpp index 29456da..bb04d82 100644 --- a/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.cpp +++ b/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.cpp @@ -4,7 +4,7 @@ * * Owns: board_init (nRF52840 clocks, USB pins via TinyUSB BSP), TinyUSB * device stack init (with MIDI 2.0 class driver from PR #3571), the - * wiring between TinyUSB and midi2_cpp via the public hooks, and the + * wiring between TinyUSB and midi2cpp via the public hooks, and the * on-board LED via the TinyUSB BSP (P1.15 on Feather Express; not * visible on most generic Pro Micro clones). */ diff --git a/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.h b/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.h index 32afcc5..c2025b4 100644 --- a/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.h +++ b/examples/nrf52840-promicro-midi2/src/nrf52840_promicro_midi2.h @@ -5,13 +5,13 @@ * The application layer (main.cpp showcase) consumes this header and * never touches tud_*, board_*, or any USB symbol directly. After * init, the m2device + m2ci instances are wired to TinyUSB through - * midi2_cpp's public hooks (setWriteFn, feedRx, setNowFn, setMounted, + * midi2cpp's public hooks (setWriteFn, feedRx, setNowFn, setMounted, * setAltSetting, CI::setRngFn). The app then registers callbacks, * sends UMPs, and calls task() in the main loop. */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace nrf52840_promicro_midi2 { diff --git a/examples/rp2040-midi2/CMakeLists.txt b/examples/rp2040-midi2/CMakeLists.txt index 252923d..a1da867 100644 --- a/examples/rp2040-midi2/CMakeLists.txt +++ b/examples/rp2040-midi2/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # rp2040-midi2 — full-spec USB MIDI 2.0 device example for Raspberry Pi -# Pico (RP2040). Lives at midi2_cpp/examples/rp2040-midi2; consumes the +# Pico (RP2040). Lives at midi2cpp/examples/rp2040-midi2; consumes the # parent library directly from ../../src. Builds standalone with the # Pico SDK toolchain. # -# Owns Pico SDK + TinyUSB + midi2_cpp wiring; consumer applications +# Owns Pico SDK + TinyUSB + midi2cpp wiring; consumer applications # (player, bridge, etc.) sit on top via the small public API in # src/rp2040_midi2.h and never touch tud_*, pico_*, or any USB symbol. # The bundled rp2040-midi2-showcase executable is one such application: @@ -49,11 +49,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) pico_sdk_init() # --------------------------------------------------------------------------- -# midi2_cpp — built from the parent library tree (this example lives at -# midi2_cpp/examples/rp2040-midi2, two directories above is the library +# midi2cpp — built from the parent library tree (this example lives at +# midi2cpp/examples/rp2040-midi2, two directories above is the library # root). No vendored copy needed. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -65,19 +65,19 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) # --------------------------------------------------------------------------- # rp2040-midi2 — board core (Pico SDK + TinyUSB glue + 5 hooks wired) @@ -89,7 +89,7 @@ add_library(rp2040-midi2 STATIC target_include_directories(rp2040-midi2 PUBLIC src) target_link_libraries(rp2040-midi2 PUBLIC - midi2_cpp + midi2cpp pico_stdlib pico_rand # get_rand_32 — used by the RNG hook for MUID tinyusb_device diff --git a/examples/rp2040-midi2/README.md b/examples/rp2040-midi2/README.md index e25a85c..a37e492 100644 --- a/examples/rp2040-midi2/README.md +++ b/examples/rp2040-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Raspberry Pi Pico (RP2040) Full-spec USB MIDI 2.0 device on the **Raspberry Pi Pico (RP2040)**. Headless single-file showcase of every MIDI 2.0 message category beyond MIDI 1.0. Pico SDK build, no Arduino IDE. @@ -84,4 +84,4 @@ Every scene logs to UART (GP0). Windows MIDI Services Console captures live in [ ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/rp2040-midi2/src/rp2040_midi2.cpp b/examples/rp2040-midi2/src/rp2040_midi2.cpp index 1c8e279..358e9d0 100644 --- a/examples/rp2040-midi2/src/rp2040_midi2.cpp +++ b/examples/rp2040-midi2/src/rp2040_midi2.cpp @@ -2,7 +2,7 @@ * rp2040_midi2.cpp — board core implementation. * * Owns: Pico SDK board init, TinyUSB device init (with MIDI 2.0 class - * driver from PR #3571), and the wiring between TinyUSB and midi2_cpp + * driver from PR #3571), and the wiring between TinyUSB and midi2cpp * via the five public hooks. The application layer never sees any of * this — it only sees `midi2::m2device` + `midi2::m2ci` objects that * are already alive. @@ -54,7 +54,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { tusb_init(BOARD_TUD_RHPORT, &dev_init); board_init_after_tusb(); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/rp2040-midi2/src/rp2040_midi2.h b/examples/rp2040-midi2/src/rp2040_midi2.h index 0c6f5ad..e581bfe 100644 --- a/examples/rp2040-midi2/src/rp2040_midi2.h +++ b/examples/rp2040-midi2/src/rp2040_midi2.h @@ -4,7 +4,7 @@ * The application layer (player, bridge, etc.) consumes this header and * never touches tud_*, pico_*, or any USB symbol directly. After init, * the m2device + m2ci instances are wired to the platform USB stack - * through midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * through midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the main loop. * @@ -13,12 +13,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace rp2040_midi2 { // Boots board_init + tusb_init, sets up USB MIDI 2.0 device class, and -// wires the five midi2_cpp platform hooks into the supplied m2device / +// wires the five midi2cpp platform hooks into the supplied m2device / // m2ci. After this returns, the app can register callbacks, send UMPs, // and call task() in its main loop. // diff --git a/examples/rp2040-promicro-ump-test-bench/CMakeLists.txt b/examples/rp2040-promicro-ump-test-bench/CMakeLists.txt index 9f7db0a..1e0fa6b 100644 --- a/examples/rp2040-promicro-ump-test-bench/CMakeLists.txt +++ b/examples/rp2040-promicro-ump-test-bench/CMakeLists.txt @@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # rp2040-promicro-ump-test-bench, deterministic UMP test bench for the # Windows MIDI Services consumer side. Targets the generic RP2040 # Pro Micro form factor (USB-C, 25 GPIOs exposed, BOOT + RESET only). -# Lives at midi2_cpp/examples/rp2040-promicro-ump-test-bench; consumes the +# Lives at midi2cpp/examples/rp2040-promicro-ump-test-bench; consumes the # parent library directly from ../../src. Builds standalone with the # Pico SDK toolchain. # -# Owns Pico SDK + TinyUSB + midi2_cpp wiring; the application layer +# Owns Pico SDK + TinyUSB + midi2cpp wiring; the application layer # (catalog + trigger logic) sits on top via the small public API in # src/rp2040_midi2.h and never touches tud_*, pico_*, or any USB # symbol. The bundled rp2040-promicro-ump-test-bench-showcase executable @@ -53,11 +53,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) pico_sdk_init() # --------------------------------------------------------------------------- -# midi2_cpp, built from the parent library tree (this example lives at -# midi2_cpp/examples/rp2040-promicro-ump-test-bench, two directories above is the +# midi2cpp, built from the parent library tree (this example lives at +# midi2cpp/examples/rp2040-promicro-ump-test-bench, two directories above is the # library root). No vendored copy needed. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -69,19 +69,19 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) # --------------------------------------------------------------------------- # rp2040-promicro-ump-test-bench, board core (Pico SDK + TinyUSB glue + 5 hooks @@ -95,7 +95,7 @@ add_library(rp2040-promicro-ump-test-bench STATIC target_include_directories(rp2040-promicro-ump-test-bench PUBLIC src) target_link_libraries(rp2040-promicro-ump-test-bench PUBLIC - midi2_cpp + midi2cpp pico_stdlib pico_rand # get_rand_32, used by the RNG hook for MUID tinyusb_device diff --git a/examples/rp2040-promicro-ump-test-bench/README.md b/examples/rp2040-promicro-ump-test-bench/README.md index 0f8a2c7..261c895 100644 --- a/examples/rp2040-promicro-ump-test-bench/README.md +++ b/examples/rp2040-promicro-ump-test-bench/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Tenstar Robot RP2040 Pro Micro (UMP test bench) USB MIDI 2.0 device on the **Tenstar Robot RP2040 Pro Micro**, configured as a **deterministic UMP catalog emitter**: 101 entries covering every MT category in M2-104-UM v1.1.2 (Flex Data 0x00 / 0x01 / 0x02, MIDI 2.0 + MIDI 1.0 Channel Voice, System Common / Real-Time, SysEx7, SysEx8, UMP Stream, Utility). Pico SDK build, no Arduino IDE. @@ -81,4 +81,4 @@ MIDI-CI: minimum surface (Endpoint Discovery + Device Identity). Profile, PE, an ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/rp2040-promicro-ump-test-bench/src/catalog.cpp b/examples/rp2040-promicro-ump-test-bench/src/catalog.cpp index 9888bcf..761fcb7 100644 --- a/examples/rp2040-promicro-ump-test-bench/src/catalog.cpp +++ b/examples/rp2040-promicro-ump-test-bench/src/catalog.cpp @@ -3,7 +3,7 @@ * * Each entry follows the same shape: * 1. issue the midi.sendXxx() call (or rp2040_midi2::pumpRaw for the - * five entries that have no midi2_cpp sender: Endpoint Discovery, + * five entries that have no midi2cpp sender: Endpoint Discovery, * Stream Config Request, FB Discovery, plus the two intentional * edge cases), * 2. capture the same wire bytes via the corresponding midi2 C99 @@ -700,7 +700,7 @@ bool catalogEmit(uint8_t idx, midi2::m2device& midi) { emit_product_id_text(86, kBenchProductInst, "stream product_instance_id"); } break; case 87: { - // Stream Configuration Request, no midi2_cpp sender (host-side message). + // Stream Configuration Request, no midi2cpp sender (host-side message). uint32_t w[4]; midi2_msg_stream_config_request(w, /*protocol*/ 0x02); rp2040_midi2::pumpRaw(w, 4); log_words(87, "stream config_request protocol=2", w, 4); @@ -711,7 +711,7 @@ bool catalogEmit(uint8_t idx, midi2::m2device& midi) { log_words(88, "stream config_notify protocol=2", w, 4); } break; case 89: { - // FB Discovery, no midi2_cpp sender (host-side message). + // FB Discovery, no midi2cpp sender (host-side message). uint32_t w[4]; midi2_msg_stream_fb_discovery(w, /*fb_num*/ 0xFF, /*filter*/ 0xFF); rp2040_midi2::pumpRaw(w, 4); log_words(89, "stream fb_discovery fb=0xFF filter=0xFF", w, 4); diff --git a/examples/rp2040-promicro-ump-test-bench/src/catalog.h b/examples/rp2040-promicro-ump-test-bench/src/catalog.h index e13170c..3971cef 100644 --- a/examples/rp2040-promicro-ump-test-bench/src/catalog.h +++ b/examples/rp2040-promicro-ump-test-bench/src/catalog.h @@ -29,7 +29,7 @@ #include -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace ump_test_bench { diff --git a/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.cpp b/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.cpp index 926aaad..637c5f8 100644 --- a/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.cpp +++ b/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.cpp @@ -2,7 +2,7 @@ * rp2040_midi2.cpp, board core implementation. * * Owns: Pico SDK board init, TinyUSB device init (with MIDI 2.0 class - * driver from PR #3571), and the wiring between TinyUSB and midi2_cpp + * driver from PR #3571), and the wiring between TinyUSB and midi2cpp * via the five public hooks. The application layer never sees any of * this; it only sees `midi2::m2device` + `midi2::m2ci` objects that * are already alive. @@ -54,7 +54,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { tusb_init(BOARD_TUD_RHPORT, &dev_init); board_init_after_tusb(); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.h b/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.h index 356c8e6..38c4963 100644 --- a/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.h +++ b/examples/rp2040-promicro-ump-test-bench/src/rp2040_midi2.h @@ -5,18 +5,18 @@ * the catalog emitter + trigger handler) consumes this header and * never touches tud_*, pico_*, or any USB symbol directly. After init, * the m2device + m2ci instances are wired to the platform USB stack - * through midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * through midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the main loop. */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace rp2040_midi2 { // Boots board_init + tusb_init, sets up USB MIDI 2.0 device class, and -// wires the five midi2_cpp platform hooks into the supplied m2device / +// wires the five midi2cpp platform hooks into the supplied m2device / // m2ci. After this returns, the app can register callbacks, send UMPs, // and call task() in its main loop. // @@ -28,7 +28,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci); void task(midi2::m2device& midi); // Bench-only: write raw UMP words straight to TinyUSB. Used by the -// catalog for entries that midi2_cpp does not expose a sender for +// catalog for entries that midi2cpp does not expose a sender for // (Endpoint Discovery, Stream Config Request, FB Discovery) and for // the deliberate edge cases (reserved-bit-set, unassigned status). // No-op when the device is not mounted or the alt setting is not 1. diff --git a/examples/sparkfun-promicro-rp2350-midi2/CMakeLists.txt b/examples/sparkfun-promicro-rp2350-midi2/CMakeLists.txt index 183d7a8..4c909cb 100644 --- a/examples/sparkfun-promicro-rp2350-midi2/CMakeLists.txt +++ b/examples/sparkfun-promicro-rp2350-midi2/CMakeLists.txt @@ -4,11 +4,11 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # for the SparkFun Pro Micro RP2350 (RP2350, USB-C, Pro Micro form # factor). Mirrors rp2040-midi2 with the board target swapped to # sparkfun_promicro_rp2350 and the identity strings rebranded to -# RP2350ProMicro. Lives at midi2_cpp/examples/sparkfun-promicro-rp2350-midi2; +# RP2350ProMicro. Lives at midi2cpp/examples/sparkfun-promicro-rp2350-midi2; # consumes the parent library directly from ../../src. Builds standalone # with the Pico SDK toolchain. # -# Owns Pico SDK + TinyUSB + midi2_cpp wiring; consumer applications +# Owns Pico SDK + TinyUSB + midi2cpp wiring; consumer applications # (player, controller, etc.) sit on top via the small public API in # src/rp2040_midi2.h and never touch tud_*, pico_*, or any USB symbol. # The bundled sparkfun-promicro-rp2350-midi2-showcase executable is one @@ -47,9 +47,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) pico_sdk_init() # --------------------------------------------------------------------------- -# midi2_cpp, built from the parent library tree. +# midi2cpp, built from the parent library tree. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -61,19 +61,19 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) # --------------------------------------------------------------------------- # sparkfun-promicro-rp2350-midi2, board core (Pico SDK + TinyUSB glue + @@ -86,7 +86,7 @@ add_library(sparkfun-promicro-rp2350-midi2 STATIC target_include_directories(sparkfun-promicro-rp2350-midi2 PUBLIC src) target_link_libraries(sparkfun-promicro-rp2350-midi2 PUBLIC - midi2_cpp + midi2cpp pico_stdlib pico_rand # get_rand_32, used by the RNG hook for MUID tinyusb_device diff --git a/examples/sparkfun-promicro-rp2350-midi2/README.md b/examples/sparkfun-promicro-rp2350-midi2/README.md index 0ccaba9..2f5255f 100644 --- a/examples/sparkfun-promicro-rp2350-midi2/README.md +++ b/examples/sparkfun-promicro-rp2350-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## SparkFun Pro Micro RP2350 Full-spec USB MIDI 2.0 device on the **SparkFun Pro Micro RP2350** (~33 x 18 mm, RP2350 Cortex-M33, USB-C, Qwiic connector). Headless single-file showcase of every MIDI 2.0 message category beyond MIDI 1.0. Pico SDK build, no Arduino IDE. @@ -87,4 +87,4 @@ Every scene logs to UART (GP0 / `TX` pad). ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.cpp b/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.cpp index 67436d4..4a4cd1c 100644 --- a/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.cpp +++ b/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.cpp @@ -2,7 +2,7 @@ * rp2040_midi2.cpp: board core implementation. * * Owns: Pico SDK board init, TinyUSB device init (with MIDI 2.0 class - * driver from PR #3571), and the wiring between TinyUSB and midi2_cpp + * driver from PR #3571), and the wiring between TinyUSB and midi2cpp * via the five public hooks. The application layer never sees any of * this: it only sees `midi2::m2device` + `midi2::m2ci` objects that * are already alive. @@ -54,7 +54,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { tusb_init(BOARD_TUD_RHPORT, &dev_init); board_init_after_tusb(); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.h b/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.h index 1e81774..77e8984 100644 --- a/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.h +++ b/examples/sparkfun-promicro-rp2350-midi2/src/rp2040_midi2.h @@ -4,7 +4,7 @@ * The application layer (player, bridge, etc.) consumes this header and * never touches tud_*, pico_*, or any USB symbol directly. After init, * the m2device + m2ci instances are wired to the platform USB stack - * through midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * through midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the main loop. * @@ -13,12 +13,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace rp2040_midi2 { // Boots board_init + tusb_init, sets up USB MIDI 2.0 device class, and -// wires the five midi2_cpp platform hooks into the supplied m2device / +// wires the five midi2cpp platform hooks into the supplied m2device / // m2ci. After this returns, the app can register callbacks, send UMPs, // and call task() in its main loop. // diff --git a/examples/t-display-s3-midi2/README.md b/examples/t-display-s3-midi2/README.md index e400cbf..9b44986 100644 --- a/examples/t-display-s3-midi2/README.md +++ b/examples/t-display-s3-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## LilyGo T-Display S3 (receiver, on-board piano roll) USB MIDI 2.0 device receiver on the **LilyGo T-Display S3** (ESP32-S3R8, 8 MB Octal PSRAM, 16 MB flash, ST7789 1.9" 320x170 IPS parallel 8-bit). Headless on the audio side, visual on the display side: the host sends UMP, the on-board piano roll mirrors note activity in real time. ESP-IDF v5.4 build, no Arduino IDE. @@ -125,4 +125,4 @@ Info bar reads `TDisplayS3 MIDI 2.0 RX ` on the top row, then `On =5.4" midi2: git: https://github.com/sauloverissimo/midi2.git - version: ">=0.3.3" + version: "v0.3.4" diff --git a/examples/t-display-s3-midi2/idf/main/main.cpp b/examples/t-display-s3-midi2/idf/main/main.cpp index 330ffef..f8d19b3 100644 --- a/examples/t-display-s3-midi2/idf/main/main.cpp +++ b/examples/t-display-s3-midi2/idf/main/main.cpp @@ -5,7 +5,7 @@ * LilyGo T-Display S3 (ESP32-S3 + ST7789 1.9" 320x170 IPS, parallel 8-bit). * * What this is: - * The host (DAW, OS, another midi2_cpp host recipe) sends UMP, the + * The host (DAW, OS, another midi2cpp host recipe) sends UMP, the * T-Display S3 mirrors the note activity on the on-board piano roll. * The recipe is a receiver showcase: it does NOT emit notes, it does * NOT play sound, it does NOT generate music. It is a visual debugger diff --git a/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.cpp b/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.cpp index 35fa1f6..f12ad3a 100644 --- a/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.cpp +++ b/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.cpp @@ -3,7 +3,7 @@ * * Owns: ESP32-S3 USB-OTG PHY init (USB_PHY_TARGET_INT), TinyUSB device * driver install (with MIDI 2.0 class driver from PR #3571), the wiring - * between TinyUSB and midi2_cpp via the five public hooks, and the + * between TinyUSB and midi2cpp via the five public hooks, and the * ST7789 1.9" 320x170 piano display via the piano_display component. * The application layer only sees `midi2::m2device` + `midi2::m2ci` * objects that are already alive. @@ -116,7 +116,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { /*core*/ 1); ESP_LOGI(TAG, "Piano render task started"); - // Wire the five midi2_cpp platform hooks. + // Wire the five midi2cpp platform hooks. midi.setWriteFn(platform_write_fn); midi.setNowFn(platform_now_fn); midi.setMounted(false); diff --git a/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.h b/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.h index 30e5f10..14460fa 100644 --- a/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.h +++ b/examples/t-display-s3-midi2/idf/main/t_display_s3_midi2.h @@ -3,7 +3,7 @@ * * The application layer consumes this header and never touches tud_*, * esp_*, or any USB symbol directly. After init, the m2device + m2ci - * instances are wired to the platform USB stack through midi2_cpp's + * instances are wired to the platform USB stack through midi2cpp's * five public hooks (setWriteFn, feedRx, setNowFn, setMounted, * CI::setRngFn). The app then registers callbacks (onNoteOn/Off, onCC, * onPitchBend, onPerNotePitchBend), runs the receiver loop, and calls @@ -15,13 +15,13 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace t_display_s3_midi2 { // Boots USB-OTG PHY, installs TinyUSB device task with the MIDI 2.0 // class driver from PR #3571, brings up the ST7789 display + piano UI, -// and wires the five midi2_cpp platform hooks into the supplied +// and wires the five midi2cpp platform hooks into the supplied // m2device / m2ci. After this returns, the app can register callbacks // and call task() in its main loop. // diff --git a/examples/t-display-s3-midi2/idf/sdkconfig.defaults b/examples/t-display-s3-midi2/idf/sdkconfig.defaults index b6fe7d2..5523dd6 100644 --- a/examples/t-display-s3-midi2/idf/sdkconfig.defaults +++ b/examples/t-display-s3-midi2/idf/sdkconfig.defaults @@ -31,7 +31,7 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_CONSOLE_UART_DEFAULT=y CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=n -# Compiler: C++17 to match the parent library. midi2_cpp uses +# Compiler: C++17 to match the parent library. midi2cpp uses # std::function callbacks; exceptions stay off. CONFIG_COMPILER_CXX_EXCEPTIONS=n CONFIG_COMPILER_OPTIMIZATION_PERF=y diff --git a/examples/t-display-s3-shield-host-midi2/README.md b/examples/t-display-s3-shield-host-midi2/README.md index 33e4162..30e731b 100644 --- a/examples/t-display-s3-shield-host-midi2/README.md +++ b/examples/t-display-s3-shield-host-midi2/README.md @@ -1,7 +1,7 @@ -# [midi2_cpp](../..) | Host MIDI 2.0 +# [midi2cpp](../..) | Host MIDI 2.0 ## LilyGo T-Display S3 + LilyGo MIDI Shield V1.1 -USB MIDI 2.0 host on the **LilyGo T-Display S3** docked into the **LilyGo MIDI Shield V1.1**, with on-board ST7789 piano roll visualisation. Plug a USB MIDI 2.0 device into the Shield's USB-A jack; the T-Display lights piano keys in real time. Built on two **released** libraries: [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) v6.0.0 owns the wire on top of ESP-IDF's native USB host stack; `m2host` from `midi2_cpp` owns the high level. PlatformIO build. +USB MIDI 2.0 host on the **LilyGo T-Display S3** docked into the **LilyGo MIDI Shield V1.1**, with on-board ST7789 piano roll visualisation. Plug a USB MIDI 2.0 device into the Shield's USB-A jack; the T-Display lights piano keys in real time. Built on two **released** libraries: [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) v6.0.0 owns the wire on top of ESP-IDF's native USB host stack; `m2host` from `midi2cpp` owns the high level. PlatformIO build. ![t-display-s3-shield-host-midi2 banner](board/banner.png) @@ -22,7 +22,7 @@ USB MIDI 2.0 host on the **LilyGo T-Display S3** docked into the **LilyGo MIDI S ESP32_Host_MIDI v6.0.0 | v - midi2_cpp m2host + midi2cpp m2host | +-------------+-------------+ | | @@ -54,7 +54,7 @@ pio run pio run -t upload ``` -Consumes the parent `midi2_cpp` library via `lib_extra_dirs = ../../..`. PSRAM Octal at 80 MHz is mandatory in `platformio.ini` (`board_build.psram_type = opi` + `-DBOARD_HAS_PSRAM`); the full-screen 320x170 16-bpp sprite is ~108 KB and lives in PSRAM. +Consumes the parent `midi2cpp` library via `lib_extra_dirs = ../../..`. PSRAM Octal at 80 MHz is mandatory in `platformio.ini` (`board_build.psram_type = opi` + `-DBOARD_HAS_PSRAM`); the full-screen 320x170 16-bpp sprite is ~108 KB and lives in PSRAM. ### Flash, USB-Serial-JTAG quirk @@ -146,4 +146,4 @@ Per device unmount: `[Disconnected]` line, info bar resets to `waiting for devic ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) is MIT. [`LovyanGFX`](https://github.com/lovyan03/LovyanGFX) is FreeBSD-style permissive. The LilyGo T-Display-S3 + MIDI Shield V1.1 schematic is published by LilyGO under GPL 3.0. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). [`ESP32_Host_MIDI`](https://github.com/sauloverissimo/ESP32_Host_MIDI) is MIT. [`LovyanGFX`](https://github.com/lovyan03/LovyanGFX) is FreeBSD-style permissive. The LilyGo T-Display-S3 + MIDI Shield V1.1 schematic is published by LilyGO under GPL 3.0. diff --git a/examples/t-display-s3-shield-host-midi2/pio/platformio.ini b/examples/t-display-s3-shield-host-midi2/pio/platformio.ini index fef5fda..fa2b5b6 100644 --- a/examples/t-display-s3-shield-host-midi2/pio/platformio.ini +++ b/examples/t-display-s3-shield-host-midi2/pio/platformio.ini @@ -1,11 +1,11 @@ -; midi2_cpp | t-display-s3-shield-host-midi2 +; midi2cpp | t-display-s3-shield-host-midi2 ; ; LilyGo T-Display S3 + LilyGo MIDI Shield V1.1, USB MIDI 2.0 Host with ; on-board ST7789 piano roll visualisation. Uses: ; * ESP32_Host_MIDI v5.2.1+ (USBMIDI2Connection) for the USB host stack ; on top of ESP-IDF's native usb_host_* APIs (no TinyUSB on the host ; side, no PR override). First-class shippable, "official" status. -; * midi2_cpp m2host for typed UMP dispatch, identity tracking, and +; * midi2cpp m2host for typed UMP dispatch, identity tracking, and ; MIDI-CI Initiator. Pulled from the parent library via lib_extra_dirs. ; * LovyanGFX v1.2.0 for the ST7789 1.9" 320x170 IPS parallel-8-bit ; panel; drives the piano_display module bundled in src/. @@ -47,13 +47,13 @@ build_flags = -DARDUINO_USB_CDC_ON_BOOT=0 -DLGFX_USE_V1 -; Pull midi2_cpp from the parent of this recipe via lib_extra_dirs. +; Pull midi2cpp from the parent of this recipe via lib_extra_dirs. ; ESP32_Host_MIDI is consumed from a local working tree (v6.0 internal, ; not yet published). When v6.0 ships, swap this for the github URL form ; pinned to v6.0.0. lib_extra_dirs = ../../.., /home/shared/workspaces/github lib_deps = - sauloverissimo/midi2 @ ^0.3.3 + sauloverissimo/midi2 @ ^0.3.4 ESP32_Host_MIDI lovyan03/LovyanGFX@^1.2.0 diff --git a/examples/t-display-s3-shield-host-midi2/pio/src/main.cpp b/examples/t-display-s3-shield-host-midi2/pio/src/main.cpp index abcb8f4..a612b00 100644 --- a/examples/t-display-s3-shield-host-midi2/pio/src/main.cpp +++ b/examples/t-display-s3-shield-host-midi2/pio/src/main.cpp @@ -1,4 +1,4 @@ -// midi2_cpp | t-display-s3-shield-host-midi2 +// midi2cpp | t-display-s3-shield-host-midi2 // // USB MIDI 2.0 Host on the LilyGo T-Display S3 + LilyGo MIDI Shield V1.1, // with a didactic on-board ST7789 piano roll + MIDI 2.0 event log. @@ -15,7 +15,7 @@ // v FreeRTOS queue (cross-core handover, USB task -> main loop) // | // v -// midi2_cpp m2host (typed dispatch + MIDI-CI Initiator) +// midi2cpp m2host (typed dispatch + MIDI-CI Initiator) // | // v // piano_display (this recipe, src/piano_display.cpp) @@ -157,7 +157,7 @@ void setup() { delay(400); Serial.println(); Serial.println("====================================================="); - Serial.println(" midi2_cpp | T-Display S3 + MIDI Shield | USB MIDI 2.0 Host"); + Serial.println(" midi2cpp | T-Display S3 + MIDI Shield | USB MIDI 2.0 Host"); Serial.println("====================================================="); piano_display::init(); @@ -172,7 +172,7 @@ void setup() { s_umpQueue = xQueueCreate(32, sizeof(UMPBatch)); - // ---- midi2_cpp host wiring ---- + // ---- midi2cpp host wiring ---- host.setWriteFn(onUMPToUsb); host.setNowFn([]() -> uint32_t { return (uint32_t)millis(); }); host.setRngFn([]() -> uint32_t { return esp_random(); }); diff --git a/examples/waveshare-rp2040-midi2/CMakeLists.txt b/examples/waveshare-rp2040-midi2/CMakeLists.txt index e012815..cb7ac51 100644 --- a/examples/waveshare-rp2040-midi2/CMakeLists.txt +++ b/examples/waveshare-rp2040-midi2/CMakeLists.txt @@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # waveshare-rp2040-midi2, USB MIDI 2.0 device example for the Waveshare # RP2040 Zero (RP2040, USB-C, no display). Mirrors rp2040-midi2 with the # board target swapped to waveshare_rp2040_zero and identification -# strings adjusted. Lives at midi2_cpp/examples/waveshare-rp2040-midi2; +# strings adjusted. Lives at midi2cpp/examples/waveshare-rp2040-midi2; # consumes the parent library directly from ../../src. # -# Owns Pico SDK + TinyUSB + midi2_cpp wiring; consumer applications sit +# Owns Pico SDK + TinyUSB + midi2cpp wiring; consumer applications sit # on top via the small public API in src/rp2040_midi2.h and never touch # tud_*, pico_*, or any USB symbol. The bundled # waveshare-rp2040-midi2-showcase executable is one such application: a @@ -45,9 +45,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) pico_sdk_init() # --------------------------------------------------------------------------- -# midi2_cpp, built from the parent library tree. +# midi2cpp, built from the parent library tree. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -59,19 +59,19 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) # --------------------------------------------------------------------------- # waveshare-rp2040-midi2, board core (Pico SDK + TinyUSB glue + @@ -84,7 +84,7 @@ add_library(waveshare-rp2040-midi2 STATIC target_include_directories(waveshare-rp2040-midi2 PUBLIC src) target_link_libraries(waveshare-rp2040-midi2 PUBLIC - midi2_cpp + midi2cpp pico_stdlib pico_rand # get_rand_32, used by the RNG hook for MUID tinyusb_device diff --git a/examples/waveshare-rp2040-midi2/README.md b/examples/waveshare-rp2040-midi2/README.md index 9988562..7a7e374 100644 --- a/examples/waveshare-rp2040-midi2/README.md +++ b/examples/waveshare-rp2040-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Waveshare RP2040 Pi Zero Full-spec USB MIDI 2.0 device on the **Waveshare RP2040 Pi Zero** (compact 18.0 x 23.5 mm RP2040 board with USB-C). Headless single-file showcase of every MIDI 2.0 message category beyond MIDI 1.0. Pico SDK build, no Arduino IDE. @@ -90,4 +90,4 @@ Every scene logs to UART (GP0). Windows MIDI Services Console captures live in [ ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/waveshare-rp2040-midi2/src/rp2040_midi2.cpp b/examples/waveshare-rp2040-midi2/src/rp2040_midi2.cpp index 67436d4..4a4cd1c 100644 --- a/examples/waveshare-rp2040-midi2/src/rp2040_midi2.cpp +++ b/examples/waveshare-rp2040-midi2/src/rp2040_midi2.cpp @@ -2,7 +2,7 @@ * rp2040_midi2.cpp: board core implementation. * * Owns: Pico SDK board init, TinyUSB device init (with MIDI 2.0 class - * driver from PR #3571), and the wiring between TinyUSB and midi2_cpp + * driver from PR #3571), and the wiring between TinyUSB and midi2cpp * via the five public hooks. The application layer never sees any of * this: it only sees `midi2::m2device` + `midi2::m2ci` objects that * are already alive. @@ -54,7 +54,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { tusb_init(BOARD_TUD_RHPORT, &dev_init); board_init_after_tusb(); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/waveshare-rp2040-midi2/src/rp2040_midi2.h b/examples/waveshare-rp2040-midi2/src/rp2040_midi2.h index 1e81774..77e8984 100644 --- a/examples/waveshare-rp2040-midi2/src/rp2040_midi2.h +++ b/examples/waveshare-rp2040-midi2/src/rp2040_midi2.h @@ -4,7 +4,7 @@ * The application layer (player, bridge, etc.) consumes this header and * never touches tud_*, pico_*, or any USB symbol directly. After init, * the m2device + m2ci instances are wired to the platform USB stack - * through midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * through midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the main loop. * @@ -13,12 +13,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace rp2040_midi2 { // Boots board_init + tusb_init, sets up USB MIDI 2.0 device class, and -// wires the five midi2_cpp platform hooks into the supplied m2device / +// wires the five midi2cpp platform hooks into the supplied m2device / // m2ci. After this returns, the app can register callbacks, send UMPs, // and call task() in its main loop. // diff --git a/examples/waveshare-rp2350-usb-a-bridge-midi2/CMakeLists.txt b/examples/waveshare-rp2350-usb-a-bridge-midi2/CMakeLists.txt index b272f5c..76826a6 100644 --- a/examples/waveshare-rp2350-usb-a-bridge-midi2/CMakeLists.txt +++ b/examples/waveshare-rp2350-usb-a-bridge-midi2/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # GP12/GP13) and TinyUSB device on USB-C (native USB) in the same # firmware, forwards UMP between them, and shows live traffic on an # optional 128x64 SSD1306 OLED over I2C1 (GP2/GP3 by default). Lives at -# midi2_cpp/examples/waveshare-rp2350-usb-a-bridge-midi2; consumes the +# midi2cpp/examples/waveshare-rp2350-usb-a-bridge-midi2; consumes the # parent library directly from ../../src. # # Hardware modification required: desolder R13 (1.5 kOhm pull-up on @@ -67,7 +67,7 @@ pico_sdk_init() # --------------------------------------------------------------------------- # midi2 (C99), only midi2_msg_word_count is used by the router. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -79,7 +79,7 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() @@ -119,10 +119,10 @@ target_compile_definitions(waveshare-rp2350-usb-a-bridge-midi2-showcase PRIVATE ) # Hot-swap watchdog window (ms). 0 disables. Default 3000 matches the -# README; override with -DMIDI2_CPP_BRIDGE_WATCHDOG_MS=N. -if(DEFINED MIDI2_CPP_BRIDGE_WATCHDOG_MS) +# README; override with -DMIDI2CPP_BRIDGE_WATCHDOG_MS=N. +if(DEFINED MIDI2CPP_BRIDGE_WATCHDOG_MS) target_compile_definitions(waveshare-rp2350-usb-a-bridge-midi2-showcase - PRIVATE MIDI2_CPP_BRIDGE_WATCHDOG_MS=${MIDI2_CPP_BRIDGE_WATCHDOG_MS}) + PRIVATE MIDI2CPP_BRIDGE_WATCHDOG_MS=${MIDI2CPP_BRIDGE_WATCHDOG_MS}) endif() # Disable USB CDC stdio (the USB-C interface is dedicated to MIDI 2.0). diff --git a/examples/waveshare-rp2350-usb-a-bridge-midi2/README.md b/examples/waveshare-rp2350-usb-a-bridge-midi2/README.md index 1c24bed..82137f4 100644 --- a/examples/waveshare-rp2350-usb-a-bridge-midi2/README.md +++ b/examples/waveshare-rp2350-usb-a-bridge-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Bridge MIDI 2.0 +# [midi2cpp](../..) | Bridge MIDI 2.0 ## Waveshare RP2350-USB-A Transparent USB MIDI 2.0 bridge on the **Waveshare RP2350-USB-A**. Runs TinyUSB host on USB-A (PIO-USB GP12 / GP13) and TinyUSB device on USB-C (native USB) in the same firmware, forwarding UMP between them so any MIDI 2.0 device plugged into USB-A appears on the PC as a 16-group MIDI 2.0 endpoint named `waveshare-RP2350-USB-A bridge`. Pico SDK build, no Arduino IDE. @@ -129,13 +129,13 @@ UART debug on GP0 mirrors mount events. ## Hot-swap caveat -A 3 s watchdog in `feather_bridge::task` resets the host side (`tuh_deinit` + `tusb_init`) after the upstream device has been gone for `MIDI2_CPP_BRIDGE_WATCHDOG_MS`. Tune at compile time: +A 3 s watchdog in `feather_bridge::task` resets the host side (`tuh_deinit` + `tusb_init`) after the upstream device has been gone for `MIDI2CPP_BRIDGE_WATCHDOG_MS`. Tune at compile time: ```bash -cmake -B build -DMIDI2_CPP_BRIDGE_WATCHDOG_MS=5000 # 5 s -cmake -B build -DMIDI2_CPP_BRIDGE_WATCHDOG_MS=0 # disable +cmake -B build -DMIDI2CPP_BRIDGE_WATCHDOG_MS=5000 # 5 s +cmake -B build -DMIDI2CPP_BRIDGE_WATCHDOG_MS=0 # disable ``` ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). Pico-PIO-USB is MIT. Waveshare hardware reference assets under `board/` (board photo, pinout, schematic) are © Waveshare Electronics. The R13 hardware modification reference and photographs at qsantos.fr are © Quentin Santos. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). Pico-PIO-USB is MIT. Waveshare hardware reference assets under `board/` (board photo, pinout, schematic) are © Waveshare Electronics. The R13 hardware modification reference and photographs at qsantos.fr are © Quentin Santos. diff --git a/examples/waveshare-rp2350-usb-a-bridge-midi2/src/feather_bridge.cpp b/examples/waveshare-rp2350-usb-a-bridge-midi2/src/feather_bridge.cpp index ebd4fc4..699b070 100644 --- a/examples/waveshare-rp2350-usb-a-bridge-midi2/src/feather_bridge.cpp +++ b/examples/waveshare-rp2350-usb-a-bridge-midi2/src/feather_bridge.cpp @@ -11,7 +11,7 @@ * becomes a UMP MT 0x2 carrying the same group/status/data. * * Hot-swap watchdog mirrors feather_host.cpp: tuh_deinit + tusb_init - * after the upstream device has been gone for MIDI2_CPP_BRIDGE_WATCHDOG_MS. + * after the upstream device has been gone for MIDI2CPP_BRIDGE_WATCHDOG_MS. */ #include "feather_bridge.h" @@ -26,8 +26,8 @@ extern "C" { #include "midi2.h" /* midi2_msg_word_count */ } -#ifndef MIDI2_CPP_BRIDGE_WATCHDOG_MS -#define MIDI2_CPP_BRIDGE_WATCHDOG_MS 3000 +#ifndef MIDI2CPP_BRIDGE_WATCHDOG_MS +#define MIDI2CPP_BRIDGE_WATCHDOG_MS 3000 #endif namespace feather_bridge { @@ -52,7 +52,7 @@ DropFn g_on_drop; uint32_t g_last_drops_host = 0; uint32_t g_last_drops_device = 0; -#if MIDI2_CPP_BRIDGE_WATCHDOG_MS > 0 +#if MIDI2CPP_BRIDGE_WATCHDOG_MS > 0 bool g_had_device = false; uint32_t g_devices_lost_ms = 0; #endif @@ -192,7 +192,7 @@ void surface_drops() { } } -#if MIDI2_CPP_BRIDGE_WATCHDOG_MS > 0 +#if MIDI2CPP_BRIDGE_WATCHDOG_MS > 0 void watchdog_tick(uint32_t t_ms) { bool any = false; for (uint8_t i = 0; i < MAX_HOST_DEVICES; ++i) { @@ -208,7 +208,7 @@ void watchdog_tick(uint32_t t_ms) { g_devices_lost_ms = t_ms; return; } - if (t_ms - g_devices_lost_ms < MIDI2_CPP_BRIDGE_WATCHDOG_MS) return; + if (t_ms - g_devices_lost_ms < MIDI2CPP_BRIDGE_WATCHDOG_MS) return; tuh_deinit(BOARD_TUH_RHPORT); tusb_rhport_init_t host_init = { @@ -272,7 +272,7 @@ void task() { surface_drops(); -#if MIDI2_CPP_BRIDGE_WATCHDOG_MS > 0 +#if MIDI2CPP_BRIDGE_WATCHDOG_MS > 0 watchdog_tick(now_ms()); #endif } diff --git a/examples/waveshare-rp2350-usb-a-midi2/CMakeLists.txt b/examples/waveshare-rp2350-usb-a-midi2/CMakeLists.txt index 2def205..af2e349 100644 --- a/examples/waveshare-rp2350-usb-a-midi2/CMakeLists.txt +++ b/examples/waveshare-rp2350-usb-a-midi2/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # host capability of the board is exercised by the sibling # waveshare-rp2350-usb-a-bridge-midi2 recipe. # -# Lives at midi2_cpp/examples/waveshare-rp2350-usb-a-midi2; consumes +# Lives at midi2cpp/examples/waveshare-rp2350-usb-a-midi2; consumes # the parent library directly from ../../src. Mirrors rp2040-midi2 with # PICO_BOARD set to pico2 (the SDK's generic RP2350 target; the # Waveshare board has the same USB IP) and identification strings @@ -49,9 +49,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) pico_sdk_init() # --------------------------------------------------------------------------- -# midi2_cpp, built from the parent library tree. +# midi2cpp, built from the parent library tree. # --------------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -63,19 +63,19 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) # --------------------------------------------------------------------------- # waveshare-rp2350-usb-a-midi2, board core (Pico SDK + TinyUSB glue + @@ -88,7 +88,7 @@ add_library(waveshare-rp2350-usb-a-midi2 STATIC target_include_directories(waveshare-rp2350-usb-a-midi2 PUBLIC src) target_link_libraries(waveshare-rp2350-usb-a-midi2 PUBLIC - midi2_cpp + midi2cpp pico_stdlib pico_rand # get_rand_32, used by the RNG hook for MUID tinyusb_device diff --git a/examples/waveshare-rp2350-usb-a-midi2/README.md b/examples/waveshare-rp2350-usb-a-midi2/README.md index 7a5c405..2f1deca 100644 --- a/examples/waveshare-rp2350-usb-a-midi2/README.md +++ b/examples/waveshare-rp2350-usb-a-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Waveshare RP2350-USB-A Full-spec USB MIDI 2.0 device on the **Waveshare RP2350-USB-A** (21 x 51 mm, USB-C + USB-A receptacle wired to GP12 / GP13 via PIO-USB). Headless single-file showcase of every MIDI 2.0 message category beyond MIDI 1.0. Pico SDK build, no Arduino IDE. @@ -93,4 +93,4 @@ Every scene logs to UART (GP0). ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). Waveshare hardware reference assets under `board/` (board photo, pinout, schematic) are © Waveshare Electronics, redistributed for documentation purposes. +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). Waveshare hardware reference assets under `board/` (board photo, pinout, schematic) are © Waveshare Electronics, redistributed for documentation purposes. diff --git a/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.cpp b/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.cpp index 67436d4..4a4cd1c 100644 --- a/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.cpp +++ b/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.cpp @@ -2,7 +2,7 @@ * rp2040_midi2.cpp: board core implementation. * * Owns: Pico SDK board init, TinyUSB device init (with MIDI 2.0 class - * driver from PR #3571), and the wiring between TinyUSB and midi2_cpp + * driver from PR #3571), and the wiring between TinyUSB and midi2cpp * via the five public hooks. The application layer never sees any of * this: it only sees `midi2::m2device` + `midi2::m2ci` objects that * are already alive. @@ -54,7 +54,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { tusb_init(BOARD_TUD_RHPORT, &dev_init); board_init_after_tusb(); - // Wire the five midi2_cpp platform hooks. From now on, the app + // Wire the five midi2cpp platform hooks. From now on, the app // operates entirely through midi/ci; the platform layer below is // invisible. Mounted/alt state are kept in sync with TinyUSB by the // polling loop in task(), so the initial values here are just diff --git a/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.h b/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.h index 1e81774..77e8984 100644 --- a/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.h +++ b/examples/waveshare-rp2350-usb-a-midi2/src/rp2040_midi2.h @@ -4,7 +4,7 @@ * The application layer (player, bridge, etc.) consumes this header and * never touches tud_*, pico_*, or any USB symbol directly. After init, * the m2device + m2ci instances are wired to the platform USB stack - * through midi2_cpp's five public hooks (setWriteFn, feedRx, setNowFn, + * through midi2cpp's five public hooks (setWriteFn, feedRx, setNowFn, * setMounted, CI::setRngFn). The app then registers callbacks, sends * UMPs, and calls task() in the main loop. * @@ -13,12 +13,12 @@ */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace rp2040_midi2 { // Boots board_init + tusb_init, sets up USB MIDI 2.0 device class, and -// wires the five midi2_cpp platform hooks into the supplied m2device / +// wires the five midi2cpp platform hooks into the supplied m2device / // m2ci. After this returns, the app can register callbacks, send UMPs, // and call task() in its main loop. // diff --git a/examples/xiao-samd21-midi2/CMakeLists.txt b/examples/xiao-samd21-midi2/CMakeLists.txt index 1a951e7..8adfb85 100644 --- a/examples/xiao-samd21-midi2/CMakeLists.txt +++ b/examples/xiao-samd21-midi2/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) # xiao-samd21-midi2, USB MIDI 2.0 device on the Seeed Studio XIAO SAMD21. -# Lives at midi2_cpp/examples/xiao-samd21-midi2; consumes the parent +# Lives at midi2cpp/examples/xiao-samd21-midi2; consumes the parent # library directly from ../../src. # # Build system: TinyUSB native CMake (family_support.cmake) + ARM GNU @@ -60,9 +60,9 @@ project(xiao-samd21-midi2 C CXX ASM) family_initialize_project(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}) # ---------------------------------------------------------------------- -# midi2_cpp parent library (consumed via ../../src, not vendored) +# midi2cpp parent library (consumed via ../../src, not vendored) # ---------------------------------------------------------------------- -set(MIDI2_CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") +set(MIDI2CPP_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..") # midi2 C99 core, pulled externally so the recipe shares one source # of truth with the rest of the ecosystem. Override with @@ -74,23 +74,23 @@ if(NOT TARGET midi2) else() FetchContent_Declare(midi2 GIT_REPOSITORY https://github.com/sauloverissimo/midi2.git - GIT_TAG v0.3.3 + GIT_TAG v0.3.4 GIT_SHALLOW TRUE ) endif() FetchContent_MakeAvailable(midi2) endif() -add_library(midi2_cpp STATIC - ${MIDI2_CPP_ROOT}/src/midi2_device.cpp - ${MIDI2_CPP_ROOT}/src/midi2_ci.cpp +add_library(midi2cpp STATIC + ${MIDI2CPP_ROOT}/src/midi2_device.cpp + ${MIDI2CPP_ROOT}/src/midi2_ci.cpp ) -target_include_directories(midi2_cpp PUBLIC ${MIDI2_CPP_ROOT}/src) -target_link_libraries(midi2_cpp PUBLIC midi2::midi2) -target_compile_features(midi2_cpp PUBLIC cxx_std_17) -# midi2_cpp uses std::function / std::array; exceptions stay off (default +target_include_directories(midi2cpp PUBLIC ${MIDI2CPP_ROOT}/src) +target_link_libraries(midi2cpp PUBLIC midi2::midi2) +target_compile_features(midi2cpp PUBLIC cxx_std_17) +# midi2cpp uses std::function / std::array; exceptions stay off (default # in arm-none-eabi-gcc with -fno-exceptions which TinyUSB build sets). -target_compile_options(midi2_cpp PRIVATE -fno-rtti -fno-exceptions -fno-use-cxa-atexit) +target_compile_options(midi2cpp PRIVATE -fno-rtti -fno-exceptions -fno-use-cxa-atexit) # ---------------------------------------------------------------------- # Showcase executable @@ -105,9 +105,9 @@ target_sources(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE src) -target_link_libraries(${PROJECT_NAME} PRIVATE midi2_cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE midi2cpp) -# C++17 + no exceptions/RTTI for the executable too (matches midi2_cpp +# C++17 + no exceptions/RTTI for the executable too (matches midi2cpp # constraint and saves flash on the 256 KB SAMD21). target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) target_compile_options(${PROJECT_NAME} PRIVATE @@ -123,11 +123,11 @@ family_configure_device_example(${PROJECT_NAME} noos) # -Wmissing-prototypes, -Werror-implicit-function-declaration, and # -Werror, all C-only flags that gcc rejects when compiling C++ # under -Werror. Disable -Werror on C++ files so the "flag not -# applicable" warnings stay non-fatal. midi2_cpp library applies the +# applicable" warnings stay non-fatal. midi2cpp library applies the # same workaround. target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Wno-error> ) -target_compile_options(midi2_cpp PRIVATE +target_compile_options(midi2cpp PRIVATE $<$:-Wno-error> ) diff --git a/examples/xiao-samd21-midi2/README.md b/examples/xiao-samd21-midi2/README.md index dbc3d88..6b6e81a 100644 --- a/examples/xiao-samd21-midi2/README.md +++ b/examples/xiao-samd21-midi2/README.md @@ -1,4 +1,4 @@ -# [midi2_cpp](../..) | Device MIDI 2.0 +# [midi2cpp](../..) | Device MIDI 2.0 ## Seeed Studio XIAO SAMD21 USB MIDI 2.0 device on the [**XIAO SAMD21**](https://wiki.seeedstudio.com/Seeeduino-XIAO/) (Cortex-M0+, 32 KB SRAM). Native CMake build via TinyUSB's `family_support.cmake`, no Arduino IDE. @@ -85,4 +85,4 @@ Per cycle (~6.5 s): ## License -MIT, inherits parent [`midi2_cpp` LICENSE](../../LICENSE). +MIT, inherits parent [`midi2cpp` LICENSE](../../LICENSE). diff --git a/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.cpp b/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.cpp index 2488aba..c00d61d 100644 --- a/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.cpp +++ b/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.cpp @@ -4,7 +4,7 @@ * * Owns: board_init (SAMD21 clocks, USB pins via TinyUSB BSP), TinyUSB * device stack init (with MIDI 2.0 class driver from PR #3571), the - * wiring between TinyUSB and midi2_cpp via the public hooks, and the + * wiring between TinyUSB and midi2cpp via the public hooks, and the * on-board yellow LED on PA17. */ #include "xiao_samd21_midi2.h" @@ -54,7 +54,7 @@ void init(midi2::m2device& midi, midi2::m2ci& ci) { // First call to platform_rng_fn happens on first MUID generation. srand(tusb_time_millis_api() ^ 0xA5A5A5A5u); - // Wire the five midi2_cpp platform hooks. Mounted + alt setting + // Wire the five midi2cpp platform hooks. Mounted + alt setting // are kept in sync with TinyUSB by the polling loop in task(); the // initial values here are bootstrap defaults. midi.setWriteFn(platform_write_fn); diff --git a/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.h b/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.h index 19d35f2..e8d70e4 100644 --- a/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.h +++ b/examples/xiao-samd21-midi2/src/xiao_samd21_midi2.h @@ -4,13 +4,13 @@ * The application layer (main.cpp showcase) consumes this header and * never touches tud_*, board_*, or any USB symbol directly. After * init, the m2device + m2ci instances are wired to TinyUSB through - * midi2_cpp's public hooks (setWriteFn, feedRx, setNowFn, setMounted, + * midi2cpp's public hooks (setWriteFn, feedRx, setNowFn, setMounted, * setAltSetting, CI::setRngFn). The app then registers callbacks, * sends UMPs, and calls task() in the main loop. */ #pragma once -#include "midi2_cpp.h" +#include "midi2cpp.h" namespace xiao_samd21_midi2 { diff --git a/library.json b/library.json index 1f3177f..11c4b1d 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { - "name": "midi2_cpp", - "version": "0.2.0", + "name": "midi2cpp", + "version": "0.3.0", "description": "C++17 Arduino-style wrapper for MIDI 2.0 on embedded devices. Thin wrapper over the portable midi2 C99 library. Covers UMP, MIDI-CI with Appendix E, Profile, PE Subscribe/Notify, Process Inquiry, Flex Data, and Bit Scaling. Targets RP2040, RP2350, Teensy, ESP32 family, nRF52, and SAMD21.", "keywords": "midi, midi2, usb, ump, capability-inquiry, property-exchange, profile", "authors": [ @@ -16,12 +16,12 @@ "platforms": ["raspberrypi", "teensy", "espressif32", "nordicnrf52"], "repository": { "type": "git", - "url": "https://github.com/sauloverissimo/midi2_cpp.git" + "url": "https://github.com/sauloverissimo/midi2cpp.git" }, "dependencies": { - "sauloverissimo/midi2": "^0.3.3" + "sauloverissimo/midi2": "^0.3.4" }, - "headers": "midi2_cpp.h", + "headers": "midi2cpp.h", "export": { "exclude": ["tests/build/*", "build/*", ".github/*", ".intern/*", "scripts/*"] } diff --git a/library.properties b/library.properties index 564db81..6557c43 100644 --- a/library.properties +++ b/library.properties @@ -1,11 +1,11 @@ -name=midi2_cpp -version=0.2.0 +name=midi2cpp +version=0.3.0 author=Saulo Verissimo maintainer=Saulo Verissimo sentence=C++17 Arduino-style wrapper for MIDI 2.0 on embedded devices. paragraph=Thin C++ wrapper over the portable midi2 C99 library. Covers UMP transport (M2-104), MIDI-CI with Appendix E (M2-101), Property Exchange Subscribe/Notify, Profile Configuration, Process Inquiry, Flex Data, and Bit Scaling (M2-115). Targets embedded boards (RP2040, RP2350, Teensy, ESP32 family, nRF52, SAMD21). category=Communication -url=https://github.com/sauloverissimo/midi2_cpp +url=https://github.com/sauloverissimo/midi2cpp architectures=* -includes=midi2_cpp.h -depends=midi2 (>=0.3.3) +includes=midi2cpp.h +depends=midi2 (>=0.3.4) diff --git a/logo_midi2_cpp.png b/logo_midi2_cpp.png deleted file mode 100644 index b7d7b3c..0000000 Binary files a/logo_midi2_cpp.png and /dev/null differ diff --git a/logo_midi2cpp.png b/logo_midi2cpp.png new file mode 100644 index 0000000..e99964c Binary files /dev/null and b/logo_midi2cpp.png differ diff --git a/src/midi2_bridge.cpp b/src/midi2_bridge.cpp index 46c39ab..a4a85ff 100644 --- a/src/midi2_bridge.cpp +++ b/src/midi2_bridge.cpp @@ -63,8 +63,8 @@ struct BridgeState { uint16_t family = 0x0001; uint16_t model = 0x0001; uint32_t version = 0x00010000; - char endpointName[64] = "midi2_cpp Bridge"; - char productInstanceId[64] = "midi2_cpp-bridge-0001"; + char endpointName[64] = "midi2cpp Bridge"; + char productInstanceId[64] = "midi2cpp-bridge-0001"; // Platform write hooks. The Bridge wraps these into Device::WriteFn // and Host::WriteFn during begin() so the inner classes do not need diff --git a/src/midi2_bridge.h b/src/midi2_bridge.h index 56a5928..ab8b9a9 100644 --- a/src/midi2_bridge.h +++ b/src/midi2_bridge.h @@ -66,16 +66,16 @@ namespace midi2 { -// kBridgeMaxSlots mirrors MIDI2_CPP_HOST_MAX_DEVICES (the upstream slot +// kBridgeMaxSlots mirrors MIDI2CPP_HOST_MAX_DEVICES (the upstream slot // limit Host already advertises). Bridges that want a smaller slot // count still pay for the array; the tradeoff is symmetry with Host. -#ifndef MIDI2_CPP_BRIDGE_MAX_SLOTS -# define MIDI2_CPP_BRIDGE_MAX_SLOTS MIDI2_CPP_HOST_MAX_DEVICES +#ifndef MIDI2CPP_BRIDGE_MAX_SLOTS +# define MIDI2CPP_BRIDGE_MAX_SLOTS MIDI2CPP_HOST_MAX_DEVICES #endif class Bridge { public: - static constexpr uint8_t MAX_SLOTS = MIDI2_CPP_BRIDGE_MAX_SLOTS; + static constexpr uint8_t MAX_SLOTS = MIDI2CPP_BRIDGE_MAX_SLOTS; Bridge(); ~Bridge(); diff --git a/src/midi2_ci.cpp b/src/midi2_ci.cpp index a7e252b..ba56eb3 100644 --- a/src/midi2_ci.cpp +++ b/src/midi2_ci.cpp @@ -6,7 +6,7 @@ namespace midi2 { // ============================================================================ // CIState — internal pimpl held behind Device::_state's sibling pointer. // Stores midi2_ci state, the granular dispatch (33 callbacks), caller-provided -// arrays sized by MIDI2_CPP_MAX_*, and ~20 std::function slots for the +// arrays sized by MIDI2CPP_MAX_*, and ~20 std::function slots for the // high-level callbacks the wrapper exposes (Discovery, ACK/NAK, Profile, // PE, PI). The raw 33-callback dispatch is intentionally not all surfaced — // the wrapper picks a coarser, ergonomic subset. @@ -17,14 +17,14 @@ struct CIState { midi2_ci_dispatch dispatch; // Caller-provided storage (compile-time tunables: see midi2_device.h). - uint8_t profile_storage[MIDI2_CPP_MAX_PROFILES][5]; - midi2_ci_property property_storage[MIDI2_CPP_MAX_PROPERTIES]; - midi2_ci_subscriber subscriber_storage[MIDI2_CPP_MAX_SUBSCRIBERS]; + uint8_t profile_storage[MIDI2CPP_MAX_PROFILES][5]; + midi2_ci_property property_storage[MIDI2CPP_MAX_PROPERTIES]; + midi2_ci_subscriber subscriber_storage[MIDI2CPP_MAX_SUBSCRIBERS]; // PE app-side getter/setter handlers parallel to property_storage so // the C trampolines can route Get/Set into std::function lambdas. - CI::PeGetter pe_getters[MIDI2_CPP_MAX_PROPERTIES]; - CI::PeSetter pe_setters[MIDI2_CPP_MAX_PROPERTIES]; + CI::PeGetter pe_getters[MIDI2CPP_MAX_PROPERTIES]; + CI::PeSetter pe_setters[MIDI2CPP_MAX_PROPERTIES]; // PE Getter must return a const char* whose lifetime extends past the // call (midi2_ci copies it into the reply SysEx). User getters typically // return into stack-local buffers, so we cache here. 1 KB covers most @@ -287,9 +287,9 @@ void CI::begin(const uint8_t manufacturerId[3], uint32_t seed = (uint32_t)((uintptr_t)s ^ (manufacturerId ? *manufacturerId : 0)); midi2_ci_init_ex(&s->ci, seed, - s->profile_storage, MIDI2_CPP_MAX_PROFILES, - s->property_storage, MIDI2_CPP_MAX_PROPERTIES, - s->subscriber_storage, MIDI2_CPP_MAX_SUBSCRIBERS); + s->profile_storage, MIDI2CPP_MAX_PROFILES, + s->property_storage, MIDI2CPP_MAX_PROPERTIES, + s->subscriber_storage, MIDI2CPP_MAX_SUBSCRIBERS); // midi2_ci invokes property getter/setter as // getter(name, state->context) / setter(name, value, state->context) diff --git a/src/midi2_device.cpp b/src/midi2_device.cpp index 5c2332a..632831c 100644 --- a/src/midi2_device.cpp +++ b/src/midi2_device.cpp @@ -965,12 +965,12 @@ bool Device::sendEndOfClip() { // (tramp_*) read those slots when dispatch fires; setting a callback after // begin() takes effect on the next inbound message. -#define MIDI2_CPP_SETTER(method, field, type) \ +#define MIDI2CPP_SETTER(method, field, type) \ void Device::method(type cb) { st(_state)->field = std::move(cb); } -MIDI2_CPP_SETTER(onNoop, cb_noop, NoArgCb) -MIDI2_CPP_SETTER(onJRClock, cb_jr_clock, UtilityCb) -MIDI2_CPP_SETTER(onJRTimestamp, cb_jr_timestamp, UtilityCb) +MIDI2CPP_SETTER(onNoop, cb_noop, NoArgCb) +MIDI2CPP_SETTER(onJRClock, cb_jr_clock, UtilityCb) +MIDI2CPP_SETTER(onJRTimestamp, cb_jr_timestamp, UtilityCb) void Device::onDctpq(std::function cb) { st(_state)->cb_dctpq = std::move(cb); } @@ -978,36 +978,36 @@ void Device::onDeltaClockstamp(std::function cb) { st(_state)->cb_delta_clockstamp = std::move(cb); } -MIDI2_CPP_SETTER(onSystem, cb_system, SystemCb) +MIDI2CPP_SETTER(onSystem, cb_system, SystemCb) -MIDI2_CPP_SETTER(onNoteOn1, cb_note_on1, Note1Cb) -MIDI2_CPP_SETTER(onNoteOff1, cb_note_off1, Note1Cb) -MIDI2_CPP_SETTER(onCC1, cb_cc1, Controller1Cb) -MIDI2_CPP_SETTER(onProgram1, cb_program1, Program1Cb) -MIDI2_CPP_SETTER(onPitchBend1, cb_pitch_bend1, PitchBend1Cb) -MIDI2_CPP_SETTER(onChannelPressure1, cb_chan_pressure1, Pressure1Cb) -MIDI2_CPP_SETTER(onPolyPressure1, cb_poly_pressure1, PolyPressure1Cb) +MIDI2CPP_SETTER(onNoteOn1, cb_note_on1, Note1Cb) +MIDI2CPP_SETTER(onNoteOff1, cb_note_off1, Note1Cb) +MIDI2CPP_SETTER(onCC1, cb_cc1, Controller1Cb) +MIDI2CPP_SETTER(onProgram1, cb_program1, Program1Cb) +MIDI2CPP_SETTER(onPitchBend1, cb_pitch_bend1, PitchBend1Cb) +MIDI2CPP_SETTER(onChannelPressure1, cb_chan_pressure1, Pressure1Cb) +MIDI2CPP_SETTER(onPolyPressure1, cb_poly_pressure1, PolyPressure1Cb) void Device::setUpscaleMt2(bool enabled) { st(_state)->dispatch.upscale_mt2 = enabled; } -MIDI2_CPP_SETTER(onSysEx7, cb_sysex7, SysEx7Cb) +MIDI2CPP_SETTER(onSysEx7, cb_sysex7, SysEx7Cb) -MIDI2_CPP_SETTER(onNoteOn, cb_note_on, NoteCb) -MIDI2_CPP_SETTER(onNoteOff, cb_note_off, NoteCb) -MIDI2_CPP_SETTER(onPolyPressure, cb_poly_pressure, PolyPressureCb32) -MIDI2_CPP_SETTER(onCC, cb_cc, ControllerCb32) -MIDI2_CPP_SETTER(onProgram, cb_program, ProgramCb) -MIDI2_CPP_SETTER(onChannelPressure, cb_chan_pressure, PressureCb32) -MIDI2_CPP_SETTER(onPitchBend, cb_pitch_bend, Pb32Cb) -MIDI2_CPP_SETTER(onRpn, cb_rpn, RpnNrpnCb) -MIDI2_CPP_SETTER(onNrpn, cb_nrpn, RpnNrpnCb) -MIDI2_CPP_SETTER(onRelRpn, cb_rel_rpn, RelRpnNrpnCb) -MIDI2_CPP_SETTER(onRelNrpn, cb_rel_nrpn, RelRpnNrpnCb) -MIDI2_CPP_SETTER(onPerNotePitchBend, cb_per_note_pb, PerNotePbCb) -MIDI2_CPP_SETTER(onRegPerNoteController, cb_reg_per_note, PerNoteCtrlCb) -MIDI2_CPP_SETTER(onAsnPerNoteController, cb_asn_per_note, PerNoteCtrlCb) +MIDI2CPP_SETTER(onNoteOn, cb_note_on, NoteCb) +MIDI2CPP_SETTER(onNoteOff, cb_note_off, NoteCb) +MIDI2CPP_SETTER(onPolyPressure, cb_poly_pressure, PolyPressureCb32) +MIDI2CPP_SETTER(onCC, cb_cc, ControllerCb32) +MIDI2CPP_SETTER(onProgram, cb_program, ProgramCb) +MIDI2CPP_SETTER(onChannelPressure, cb_chan_pressure, PressureCb32) +MIDI2CPP_SETTER(onPitchBend, cb_pitch_bend, Pb32Cb) +MIDI2CPP_SETTER(onRpn, cb_rpn, RpnNrpnCb) +MIDI2CPP_SETTER(onNrpn, cb_nrpn, RpnNrpnCb) +MIDI2CPP_SETTER(onRelRpn, cb_rel_rpn, RelRpnNrpnCb) +MIDI2CPP_SETTER(onRelNrpn, cb_rel_nrpn, RelRpnNrpnCb) +MIDI2CPP_SETTER(onPerNotePitchBend, cb_per_note_pb, PerNotePbCb) +MIDI2CPP_SETTER(onRegPerNoteController, cb_reg_per_note, PerNoteCtrlCb) +MIDI2CPP_SETTER(onAsnPerNoteController, cb_asn_per_note, PerNoteCtrlCb) // Arduino-style callback overloads. Each one wraps the simple lambda into // a verbose-shaped one that fits the existing storage slot, so the @@ -1040,29 +1040,29 @@ void Device::onPitchBend(PbSimpleCb cb) { if (cb) cb(ch, val); }; } -MIDI2_CPP_SETTER(onPerNoteManagement, cb_per_note_mgmt, PerNoteMgmtCb) - -MIDI2_CPP_SETTER(onSysEx8, cb_sysex8, SysEx8Cb) - -MIDI2_CPP_SETTER(onTempo, cb_tempo, TempoCb) -MIDI2_CPP_SETTER(onTimeSignature, cb_time_sig, TimeSigCb) -MIDI2_CPP_SETTER(onMetronome, cb_metronome, MetronomeCb) -MIDI2_CPP_SETTER(onKeySignature, cb_key_sig, KeySigCb) -MIDI2_CPP_SETTER(onChord, cb_chord, ChordCb) -MIDI2_CPP_SETTER(onFlexText, cb_flex_text, FlexTextCb) - -MIDI2_CPP_SETTER(onEndpointDiscovery, cb_endpoint_discovery, EndpointDiscoveryCb) -MIDI2_CPP_SETTER(onEndpointInfo, cb_endpoint_info, EndpointInfoCb) -MIDI2_CPP_SETTER(onDeviceIdentity, cb_device_identity, DeviceIdentityCb) -MIDI2_CPP_SETTER(onStreamText, cb_stream_text, StreamTextCb) -MIDI2_CPP_SETTER(onFbName, cb_fb_name, FbNameCb) -MIDI2_CPP_SETTER(onStreamConfigRequest, cb_stream_config_request, StreamConfigCb) -MIDI2_CPP_SETTER(onStreamConfigNotify, cb_stream_config_notify, StreamConfigCb) -MIDI2_CPP_SETTER(onFbDiscovery, cb_fb_discovery, FbDiscoveryCb) -MIDI2_CPP_SETTER(onFbInfo, cb_fb_info, FbInfoCb) -MIDI2_CPP_SETTER(onClip, cb_clip, ClipCb) - -#undef MIDI2_CPP_SETTER +MIDI2CPP_SETTER(onPerNoteManagement, cb_per_note_mgmt, PerNoteMgmtCb) + +MIDI2CPP_SETTER(onSysEx8, cb_sysex8, SysEx8Cb) + +MIDI2CPP_SETTER(onTempo, cb_tempo, TempoCb) +MIDI2CPP_SETTER(onTimeSignature, cb_time_sig, TimeSigCb) +MIDI2CPP_SETTER(onMetronome, cb_metronome, MetronomeCb) +MIDI2CPP_SETTER(onKeySignature, cb_key_sig, KeySigCb) +MIDI2CPP_SETTER(onChord, cb_chord, ChordCb) +MIDI2CPP_SETTER(onFlexText, cb_flex_text, FlexTextCb) + +MIDI2CPP_SETTER(onEndpointDiscovery, cb_endpoint_discovery, EndpointDiscoveryCb) +MIDI2CPP_SETTER(onEndpointInfo, cb_endpoint_info, EndpointInfoCb) +MIDI2CPP_SETTER(onDeviceIdentity, cb_device_identity, DeviceIdentityCb) +MIDI2CPP_SETTER(onStreamText, cb_stream_text, StreamTextCb) +MIDI2CPP_SETTER(onFbName, cb_fb_name, FbNameCb) +MIDI2CPP_SETTER(onStreamConfigRequest, cb_stream_config_request, StreamConfigCb) +MIDI2CPP_SETTER(onStreamConfigNotify, cb_stream_config_notify, StreamConfigCb) +MIDI2CPP_SETTER(onFbDiscovery, cb_fb_discovery, FbDiscoveryCb) +MIDI2CPP_SETTER(onFbInfo, cb_fb_info, FbInfoCb) +MIDI2CPP_SETTER(onClip, cb_clip, ClipCb) + +#undef MIDI2CPP_SETTER void Device::setGroupRemap(const uint8_t map[16]) { if (!map) return; diff --git a/src/midi2_device.h b/src/midi2_device.h index 604b6f9..568752a 100644 --- a/src/midi2_device.h +++ b/src/midi2_device.h @@ -4,16 +4,16 @@ #include #include -#ifndef MIDI2_CPP_MAX_PROFILES -#define MIDI2_CPP_MAX_PROFILES 8 +#ifndef MIDI2CPP_MAX_PROFILES +#define MIDI2CPP_MAX_PROFILES 8 #endif -#ifndef MIDI2_CPP_MAX_PROPERTIES -#define MIDI2_CPP_MAX_PROPERTIES 8 +#ifndef MIDI2CPP_MAX_PROPERTIES +#define MIDI2CPP_MAX_PROPERTIES 8 #endif -#ifndef MIDI2_CPP_MAX_SUBSCRIBERS -#define MIDI2_CPP_MAX_SUBSCRIBERS 4 +#ifndef MIDI2CPP_MAX_SUBSCRIBERS +#define MIDI2CPP_MAX_SUBSCRIBERS 4 #endif namespace midi2 { diff --git a/src/midi2_host.h b/src/midi2_host.h index 9ba9c6f..3839630 100644 --- a/src/midi2_host.h +++ b/src/midi2_host.h @@ -5,8 +5,8 @@ #include #include -#ifndef MIDI2_CPP_HOST_MAX_DEVICES -#define MIDI2_CPP_HOST_MAX_DEVICES 4 +#ifndef MIDI2CPP_HOST_MAX_DEVICES +#define MIDI2CPP_HOST_MAX_DEVICES 4 #endif namespace midi2 { @@ -18,7 +18,7 @@ namespace midi2 { // USB host port enumerates one or more attached MIDI 2.0 devices, queries // their identity via UMP Stream Discovery + MIDI-CI, and routes UMPs to and // from each. Multi-device by design: every API that touches a connected -// device takes an `idx` (0..MIDI2_CPP_HOST_MAX_DEVICES-1) as its first +// device takes an `idx` (0..MIDI2CPP_HOST_MAX_DEVICES-1) as its first // argument. // // Platform contract is the same shape as Device, with idx-prefixed hooks: @@ -66,7 +66,7 @@ namespace midi2 { class Host { public: - static constexpr uint8_t MAX_DEVICES = MIDI2_CPP_HOST_MAX_DEVICES; + static constexpr uint8_t MAX_DEVICES = MIDI2CPP_HOST_MAX_DEVICES; Host(); ~Host(); diff --git a/src/midi2_cpp.h b/src/midi2cpp.h similarity index 91% rename from src/midi2_cpp.h rename to src/midi2cpp.h index 3afe736..0c1589e 100644 --- a/src/midi2_cpp.h +++ b/src/midi2cpp.h @@ -1,9 +1,9 @@ -// midi2_cpp v0.1.0 +// midi2cpp v0.1.0 // C++17 Arduino-style wrapper for MIDI 2.0 on embedded devices. // Built over the portable midi2 C99 library (vendored at src/midi2.h). // // Usage in sketch: -// #include +// #include // using namespace midi2; // Device midi; // void setup() { midi.begin(); } @@ -20,7 +20,7 @@ // Adafruit nRF52 / SAMD (gcc 9+). AVR Uno is out of scope by RAM, not by // language. A clean diagnostic now beats a cryptic template error later. #if __cplusplus < 201703L -# error "midi2_cpp requires C++17 or newer. Set CMAKE_CXX_STANDARD=17 (or pass -std=c++17 to your build)." +# error "midi2cpp requires C++17 or newer. Set CMAKE_CXX_STANDARD=17 (or pass -std=c++17 to your build)." #endif // C99 core (vendored stb-style). User apps can also access midi2_* functions directly. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9415b33..4af696d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,22 +1,22 @@ cmake_minimum_required(VERSION 3.14) # Common helper for tests (TX capture hook, assertions) -add_library(midi2_cpp_test_common INTERFACE) -target_include_directories(midi2_cpp_test_common INTERFACE .) +add_library(midi2cpp_test_common INTERFACE) +target_include_directories(midi2cpp_test_common INTERFACE .) # Test builder: each test_*.cpp compiles to an independent executable. -function(add_midi2_cpp_test name) +function(add_midi2cpp_test name) add_executable(${name} ${name}.cpp) - target_link_libraries(${name} PRIVATE midi2_cpp midi2_cpp_test_common) + target_link_libraries(${name} PRIVATE midi2cpp midi2cpp_test_common) target_compile_options(${name} PRIVATE -Wall -Wextra -g -O0) add_test(NAME ${name} COMMAND ${name}) endfunction() # Individual test files registered as they are created. -add_midi2_cpp_test(test_midi2_device) -add_midi2_cpp_test(test_midi2_scaling) -add_midi2_cpp_test(test_midi2_flex) -add_midi2_cpp_test(test_midi2_conversion) -add_midi2_cpp_test(test_midi2_ci) -add_midi2_cpp_test(test_midi2_host) -add_midi2_cpp_test(test_midi2_bridge) +add_midi2cpp_test(test_midi2_device) +add_midi2cpp_test(test_midi2_scaling) +add_midi2cpp_test(test_midi2_flex) +add_midi2cpp_test(test_midi2_conversion) +add_midi2cpp_test(test_midi2_ci) +add_midi2cpp_test(test_midi2_host) +add_midi2cpp_test(test_midi2_bridge) diff --git a/tests/test_midi2_bridge.cpp b/tests/test_midi2_bridge.cpp index e264128..f1d26b3 100644 --- a/tests/test_midi2_bridge.cpp +++ b/tests/test_midi2_bridge.cpp @@ -1,11 +1,11 @@ // tests/test_midi2_bridge.cpp -- m2bridge smoke + group rewrite + heap balance. // -// Bridge is the only midi2_cpp class that allocates state on the heap +// Bridge is the only midi2cpp class that allocates state on the heap // (BridgeState in begin's predecessor; ByteStreamConverter slots inside // begin). Running this suite under ASan + UBSan is what catches the // allocate-without-free regressions m2bridge could otherwise hide. #include "test_common.h" -#include "midi2_cpp.h" +#include "midi2cpp.h" #include #include diff --git a/tests/test_midi2_ci.cpp b/tests/test_midi2_ci.cpp index bdc9201..a664914 100644 --- a/tests/test_midi2_ci.cpp +++ b/tests/test_midi2_ci.cpp @@ -1,5 +1,5 @@ #include "test_common.h" -#include "midi2_cpp.h" +#include "midi2cpp.h" #include #include @@ -53,11 +53,11 @@ static void test_ci_addProfile_returns_ok(void) { } static void test_ci_addProfile_full_after_max(void) { - TEST("CI::addProfile returns ERR_FULL after MIDI2_CPP_MAX_PROFILES"); + TEST("CI::addProfile returns ERR_FULL after MIDI2CPP_MAX_PROFILES"); Device d; CI ci(d); ci_begin(d, ci); uint8_t pid[5] = {0x7D, 0x00, 0x00, 0x00, 0x00}; - for (int i = 0; i < MIDI2_CPP_MAX_PROFILES; ++i) { + for (int i = 0; i < MIDI2CPP_MAX_PROFILES; ++i) { pid[3] = (uint8_t)i; CHECK_EQ(ci.addProfile(pid), MIDI2_CI_OK, "fill capacity"); } @@ -83,7 +83,7 @@ static void test_ci_addPropertyStatic(void) { TEST("CI::addPropertyStatic returns OK"); Device d; CI ci(d); ci_begin(d, ci); - CHECK_EQ(ci.addPropertyStatic("DeviceInfo", "{\"manufacturer\":\"midi2_cpp\"}"), + CHECK_EQ(ci.addPropertyStatic("DeviceInfo", "{\"manufacturer\":\"midi2cpp\"}"), MIDI2_CI_OK, "addPropertyStatic OK"); PASS(); } diff --git a/tests/test_midi2_flex.cpp b/tests/test_midi2_flex.cpp index 5819cb0..27f917c 100644 --- a/tests/test_midi2_flex.cpp +++ b/tests/test_midi2_flex.cpp @@ -89,7 +89,7 @@ static void test_sendFlexText(void) { capture_reset(); // bank 0x01 = metadata, status 0x04 = composer name - bool ok = d.sendFlexText(/*group*/ 0, /*bank*/ 0x01, /*status*/ 0x04, "midi2_cpp"); + bool ok = d.sendFlexText(/*group*/ 0, /*bank*/ 0x01, /*status*/ 0x04, "midi2cpp"); CHECK(ok, "sendFlexText returned false"); CHECK_EQ(g_captured_tx_len, 4u, "MT 0xD = 4 words"); CHECK_EQ((g_captured_tx[0] >> 28) & 0xFu, 0xDu, "MT = 0xD"); diff --git a/tests/test_midi2_host.cpp b/tests/test_midi2_host.cpp index 2647a5f..de1de71 100644 --- a/tests/test_midi2_host.cpp +++ b/tests/test_midi2_host.cpp @@ -6,7 +6,7 @@ // later commits; this smoke locks the surface shape so subsequent // implementations cannot regress it. #include "test_common.h" -#include "midi2_cpp.h" +#include "midi2cpp.h" #include #include