def key_signature(data: Union[FileIO, BufferedReader]) -> Tuple[int, Tuple[int, int], bytearray]:
length_bytes = bytearray(data.read(1))
length = int.from_bytes(length_bytes, "big")
if length != 0x02:
raise EventLengthError("Key Signature event has invalid length. Should be 2, value was {}".format(length))
data_bytes = bytearray(data.read(2))
signature_index = data_bytes[0]
minor_major = data_bytes[1]
return length, (signature_index, minor_major), data_bytes
评论列表
文章目录