Ports
IoPort
Bases: Port
Combines Input
and Output ports into a single i/o port.
Parameters:
-
uid(str) –Port's unique ID
-
input_port(Input) –input port to wrap
-
output_port(Output) –output port to wrap
subscribe
subscribe(
*msg_matches_args: None | MatchCondition | Container[Any] | Any,
**msg_matches_kwargs: dict[
str, None | MatchCondition | Container[Any] | Any
]
) -> Callable
Decorator to subscribe a callable to all the wrapped inputs' messages.
Decorator without arguments subscribes a callable to all the input's messages.
Decorator with arguments subscribes a callable to the input's messages
that match conditions set by arguments.
It works the same way as message's matches method:
-
If condition is
Noneor omitted it matches anything. -
If condition equals the message's attribute value it matches the attribute.
-
If condition is a container (list, tuple, range, etc.) and contains the message's attribute value, it matches the attribute.
Examples
- Calls function for all MIDI port's messages:
- Calls function for OSC messages from specific address:
- Call object instance method for MIDI port's "note on" and "note off" messages:
Returns:
-
Callable–Subscribed callable.
send
Input
Bases: Subscribable, Port
Input port base class
subscribe
subscribe(
*msg_matches_args: None | MatchCondition | Any,
**msg_matches_kwargs: dict[str, None | MatchCondition | Any]
) -> Callable
Decorator to subscribe a callable to the input's messages.
Decorator without arguments subscribes a callable to all the input's messages.
Decorator with arguments subscribes a callable to the input's messages
that match conditions set by arguments.
It works the same way as message's matches method:
-
If condition is
Noneor omitted it matches anything. -
If condition equals the message's attribute value it matches the attribute.
-
If condition is a container (list, tuple, range, etc.) and contains the message's attribute value, it matches the attribute.
Examples
- Calls function for all MIDI port's messages:
- Calls function for OSC messages from specific address:
- Call object instance method for MIDI port's "note on" and "note off" messages:
Returns:
-
Callable–Subscribed callable.