switch Reference

Accept messages from a specific inlet

switch

Examples

'Listen' to only one inlet at a time, or ignore all inlets

Arguments

inlets [int]

Optional

Specifies the number of inlets, in addition to the leftmost inlet. If there is no argument, there are two additional inlets.

initial [int]

Optional

An optional second argument can be used to specify which inlet is initially open. The default is 0 (i.e., none).

Attributes

Common Box Attributes

Messages

bang

In left inlet: Sends out the number of the open inlet, or 0 if all inlets are closed.

int

Arguments

inlet [int]
In left inlet: The number specifies an open inlet for receiving subsequent messages to be sent out the outlet. All inlets other than the designated open one are closed. If the number is 0, all inlets are closed.

float

Arguments

inlet [float]
In left inlet: Converted to int.

Output

anything

If the number in the left inlet is less than 0, its absolute value is used to determine which inlet to open. (-1 opens inlet 1, -2 opens inlet 2, etc.) If the absolute value of the number is greater than the number of existing inlets, messages are received in the rightmost inlet.

See Also

Name Description
forward
funnel
gate
ggate
gswitch
receive
router
send
Max Basic Tutorial 21: Controlling Data Flow Max Basic Tutorial 21: Controlling Data Flow