From fc9b629a03c6bfe0d0c80b63fb273d64431a2eea Mon Sep 17 00:00:00 2001 From: ZILtoid1991 Date: Sun, 22 Aug 2021 19:10:51 +0200 Subject: [PATCH] Added missing channel property of UMP --- source/midi2/types/structs.d | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/midi2/types/structs.d b/source/midi2/types/structs.d index 344274e..2b9203a 100644 --- a/source/midi2/types/structs.d +++ b/source/midi2/types/structs.d @@ -109,6 +109,20 @@ struct UMP { ushort bend() const { return (cast(ushort)bytes[3])<<7 | bytes[2]; } + /** + * Return the channel number of this packet. + */ + ubyte channel() const { + return bytes[1] & 0xF; + } + /** + * Sets the channel number of this packet. + */ + ubyte channel(ubyte val) { + bytes[1] &= 0xF0; + bytes[1] |= val & 0xF; + return bytes[1] & 0xF; + } } } /**