Skip to content

Simplify MIDI code - #1449

Merged
markheath merged 4 commits into
naudio:mainfrom
Seb-stian:simplify-midi
Sep 18, 2026
Merged

markheath merged 4 commits into
naudio:mainfrom
Seb-stian:simplify-midi

Conversation

@Seb-stian

Copy link
Copy Markdown
Contributor

Summary

Simplify code in NAudio.Midi:

  • Replace Array.Empty<T>() with equivalent []
  • Use ArgumentNullException.ThrowIfNull
  • Collapse loops and conditions where possible
  • Use byte strings (""u8) instead of Encoding.UTF8.GetBytes
  • Use static instance of MidiEventComparer instead of allocating it for each use
  • Other small improvements

Release notes

  • I've added a one-line bullet to the ### Unreleased section of RELEASE_NOTES.md
  • This PR doesn't need a release-notes entry (internal refactor, test-only, or docs fix)
  • Leave the release-notes entry for the maintainer to write

Testing

MIDI-related test passing:

  • NAudio.Core.Tests.Midi
  • NAudio.Sampler.Tests.LiveMidiInstrumentTests
  • NAudio.Sampler.Tests.MidiFileRenderTests

Comment thread src/NAudio.Midi/Midi/MidiFile.cs Outdated
@markheath
markheath merged commit 3648ea5 into naudio:main Sep 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants