Source code for jdxi_editor.midi.data.address.sysex_byte

"""SysEx Byte"""

from enum import IntEnum
from typing import Optional, Type, TypeVar

[docs] T = TypeVar("T", bound="SysExByte")
[docs] class SysExByte(IntEnum): """Base class for SysEx message byte positions.""" @classmethod
[docs] def message_position(cls) -> int: """Return the fixed message position for command bytes.""" raise NotImplementedError("To be subclassed")
@classmethod
[docs] def get_parameter_by_address(cls: Type[T], address: int) -> Optional[T]: """ Get parameter by address :param address: int The address :return: Optional[T] The parameter """ return next( (parameter for parameter in cls if parameter.value == address), None )