Repository Public
1// ORIX Sonata2// File: Packages/SonataUI/Tests/SonataUITests/MIDIInputTests.swift3// Description: Decoding of Universal MIDI Packet words into note events.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import Testing8@testable import SonataUI910@Test func umpWordsDecodeToNotes() {11 #expect(MIDIVoiceEvent.decode(umpWord: 0x2090_3C64) == .noteOn(key: 60, velocity: 100, channel: 0))12 #expect(MIDIVoiceEvent.decode(umpWord: 0x2093_457F) == .noteOn(key: 69, velocity: 127, channel: 3))13 #expect(MIDIVoiceEvent.decode(umpWord: 0x2090_3C00) == .noteOff(key: 60, channel: 0), "note-on with velocity 0 is a note-off")14 #expect(MIDIVoiceEvent.decode(umpWord: 0x2081_3C40) == .noteOff(key: 60, channel: 1))15 #expect(MIDIVoiceEvent.decode(umpWord: 0x20B0_0740) == nil, "control change")16 #expect(MIDIVoiceEvent.decode(umpWord: 0x1090_3C64) == nil, "system message type")17 #expect(MIDIVoiceEvent.decode(umpWord: 0x4090_3C64) == nil, "MIDI 2.0 channel voice is not decoded")18}19