Thank you for your interest in contributing to midi2.
Open an issue with:
- What you expected
- What happened
- Minimal code to reproduce
- Platform and compiler version
- Fork the repository
- Create a branch (
git checkout -b fix/description) - Make your changes
- Run tests:
make test - Verify zero warnings with strict flags:
make CC=gcc test make CC=clang test
- Run sanitizers if available:
make CC="gcc -fsanitize=address,undefined" test
- Open a pull request with a clear description
- C99 strict (
-std=c99 -Wall -Wextra -Wpedantic, zero warnings) - No dynamic allocation -- no
malloc,free, or hidden heap usage - Caller-provided storage -- all state in structs the caller allocates
- Error codes -- functions that can fail return
int(0 = success, negative = error) - Naming:
midi2_<module>_<action>()(e.g.,midi2_msg_note_on,midi2_ci_build_discovery) - Every new function needs a test -- no exceptions
- No OS dependencies -- only
stdint.h,stdbool.h,string.h - Comments: explain why, not what. The code should be self-evident.
If adding a new module, follow the established pattern:
- Header-only (
.hwithstatic inline) for stateless construct/parse functions - Compiled (
.h+.c) for stateful logic or dispatch - Add test file:
test/test_midi2_<module>.c - Add to
Makefilebuild and test targets - Add binary to
.gitignore - Add to CI workflow (
.github/workflows/ci.yml) for MSVC and ARM targets
make test # gcc, all 252 tests
make CC=clang test # clang
make CC="gcc -fsanitize=address,undefined" test # sanitizers
make CC="gcc -m32" test # 32-bit verification
make clean # remove binariesCI runs 11 jobs across desktop (gcc, clang, MSVC, macOS, 32-bit, sanitizers) and embedded (ARM Cortex-M, AArch64, RISC-V, ESP32, AVR) targets.
midi2 implements the MIDI Association specifications. When adding or modifying message handling, always reference the spec section:
- UMP messages: M2-104-UM v1.1.2 (table and section numbers in code comments)
- MIDI-CI messages: M2-101-UM v1.2
- Value scaling: M2-115-U v1.0.2
By contributing, you agree that your contributions will be licensed under the MIT License.