- address: The osc address to send this message to.
"""
self._address=address
self._args= []
@property
defaddress(self) ->str:
"""Returns the OSC address this message will be sent to."""
returnself._address
@address.setter
defaddress(self, value: str) ->None:
"""Sets the OSC address this message will be sent to."""
self._address=value
@property
defargs(self) ->List[Tuple[str, Union[str, bytes, bool, int, float, tuple, list]]]: # TODO: Make 'tuple' more specific for it is a MIDI packet
"""Returns the (type, value) arguments list of this message."""
returnself._args
def_valid_type(self, arg_type: str) ->bool:
ifarg_typeinself._SUPPORTED_ARG_TYPES:
returnTrue
elifisinstance(arg_type, list):
forsub_typeinarg_type:
ifnotself._valid_type(sub_type):
returnFalse
returnTrue
returnFalse
defadd_arg(self, arg_value: Union[str, bytes, bool, int, float, tuple, list], arg_type: str=None) ->None: # TODO: Make 'tuple' more specific for it is a MIDI packet
"""Add a typed argument to this message.
Args:
- arg_value: The corresponding value for the argument.
- arg_type: A value in ARG_TYPE_* defined in this class,
if none then the type will be guessed.
Raises:
- ValueError: if the type is not supported.
"""
ifarg_typeandnotself._valid_type(arg_type):
raiseValueError(
'arg_type must be one of {}, or an array of valid types'