Skip to content

Releases: leandrodaf/midi

v2.3.0 — WatchDevices hot-plug detection

15 May 19:13
v2.3.0
229a010

Choose a tag to compare

What's new

feat: WatchDevices — MIDI device hot-plug detection

  • WatchDevices(ctx) (<-chan DeviceEvent, error) added to ClientMIDI interface
  • Linux: uses udev via netlink to detect device add/remove events natively
  • macOS: uses CoreMIDI notification callback (zero polling)
  • Windows: polls midiInGetNumDevs every 2 s and diffs against previous list
  • DeviceEvent{Type, Device} with DeviceAdded / DeviceRemoved constants

Bug fixes

  • Windows: stopCapture() function body was floating outside any function declaration — syntax error on Windows CI build
  • macOS: cgo.Handle has no Pointer() method; replaced with unsafe.Pointer(uintptr(h))

v2.1.0 - Native Linux MIDI support (ALSA)

14 May 12:47
v2.1.0
2eaec1a

Choose a tag to compare

What's new

🐧 Native Linux MIDI support via ALSA

Linux is now a fully supported platform alongside macOS and Windows. MIDI events are captured using the ALSA snd_rawmidi API — no external Go libraries, only the standard system header libasound2-dev.

Requirements on Linux:

apt-get install libasound2-dev   # build-time only

CGO_ENABLED=1 (the default) is required. If you build with CGO_ENABLED=0, the client compiles but all methods return ErrCGORequired.

Install:

go get github.com/leandrodaf/midi/v2@v2.1.0

Implementation highlights

  • Device enumeration iterates sound cards via snd_card_next + snd_ctl_rawmidi_next_device, covering all hardware and USB MIDI ports
  • Read loop uses unix.Poll on both the ALSA file descriptor and a cancel pipe — Stop() wakes the goroutine immediately with no busy-waiting
  • Full MIDI byte parser with running-status support and SysEx skip
  • Same context-based lifecycle as the macOS client

CI

All three platforms (macOS, Windows, Linux) now run with CGO_ENABLED=1 and the race detector enabled.

v2.0.2 - Fix Go module path

14 May 12:39
v2.0.2
8efb345

Choose a tag to compare

Bug Fix

🔴 Critical: Go module path corrected

v2.0.0 and v2.0.1 were tagged but the go.mod still declared module github.com/leandrodaf/midi (without /v2). This violated Go module semantics and caused go get to silently resolve to v1 instead of v2, breaking everyone who tried to use the new API.

What changed

  • go.mod: module github.com/leandrodaf/midi/v2
  • All internal imports updated to github.com/leandrodaf/midi/v2/...

Migration from v2.0.0 / v2.0.1

go get github.com/leandrodaf/midi/v2@v2.0.2

Update your imports:

import (
    "github.com/leandrodaf/midi/v2/sdk/midi"
    "github.com/leandrodaf/midi/v2/sdk/contracts"
    "github.com/leandrodaf/midi/v2/sdk/logger"
)

v2.0.1 — dependency cleanup, Go 1.26, and docs fix

14 May 12:30
v2.0.1
cad1d15

Choose a tag to compare

What's Changed

Bug fix

  • sdk/logger package exposed — the example and README incorrectly referenced internal/logger, which external consumers cannot import. A new sdk/logger package now re-exports NewLogger() as the proper public entrypoint.

Dependency cleanup

  • Removed github.com/youpy/go-coremidi — CoreMIDI is now implemented natively in internal/coremidi/ via CGo, with no third-party wrapper.
  • Removed go.uber.org/zap and go.uber.org/multierr — the logger was rewritten without any external dependencies.
  • Only remaining dependency: golang.org/x/sys v0.44.0 (Windows winmm.dll syscalls).

Maintenance

  • Upgraded to Go 1.26.
  • Updated golang.org/x/sys from v0.26.0 to v0.44.0.

Documentation

  • README rewritten: correct imports (sdk/logger instead of internal/logger), options table with defaults, filtering section, custom logger interface example, MockMIDIClient usage, and platform notes table.

Full Changelog: v2.0.0...v2.0.1