mcs.selector~ Reference

Assign a channel of a multi-channel signal to an outlet

mcs.selector~

Description

Use the selector~ object to choose between one of several input signals (or none). The selector~ is similar to the Max switch object but for signals, however if no input is chosen, it outputs a signal composed of zero values.
When the selector~ object is created as mcs.selector~ all of its signal inlets are combined into a single multichannel inlet. The behavior of mcs.selector~ is otherwise analogous to selector~ with the exception that mcs.selector~ changes its number of inputs (auto-adapts) as the number of inputs in the multi-channel signal connected to its right inlet change.

Arguments

number-of-inputs [int]

Optional

Number of inputs

initially-open-inlet [int]

Optional

Specify which input is initially selected. If 0, where all signals are shut off and a zero signal is sent out.

Attributes

ramptime [float] (default: 0.)

Sets the ramp time to use for fading connections in milliseconds. When the ramptime attribute is non-zero, selector~ will crossfade between inputs when the acive input is switched, fading out the input that was previous active and fading in the input that is becoming active.

stepmode [int] (default: 0)

When enabled, all whole-number changes to a signal value in the left inlet (either increasing and decreasing) will increment the open input channel by 1, wrapping accross the available channels. A value of zero will stop output.

Common Box Attributes

annotation [symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

background [int] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 removes it. Objects in the background layer are shown behind all objects in the default foreground layer.

color [4 floats]

Sets the color for the object box outline.

fontface [int]

Sets the type style used by the object. The options are:

plain
bold
italic
bold italic

Possible values:

0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'

fontname [symbol]

Sets the object's font.

fontsize [float]

Sets the object's font size (in points).

Possible values:

'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'

hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

hint [symbol]

Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.

ignoreclick [int] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

jspainterfile [symbol]

JS Painter File

patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

position [2 floats]

g/s(set)

Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.

presentation [int] (default: 0)

Sets whether an object belongs to the patcher's presentation.

presentation_rect [4 floats] (default: 0. 0. 0. 0.)

Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.

rect [4 floats]

g/s(set)

Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).

size [2 floats]

g/s(set)

Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.

textcolor [4 floats]

Sets the color for the object's text in RGBA format.

textjustification [int]

Sets the justification for the object's text.

Possible values:

0 = 'left'
1 = 'center'
2 = 'right'

varname [symbol]

Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.

Messages

bang

Same as the next message.

int

Arguments

open-input [int]
Select which input to route to the outlet. If the value is 0 or negative, a zero signal is sent out all outlets. If the value is greater than the number of inputs, the right-most input is used. If a signal is connected to the left inlet, this message is ignored.

float

Float input is truncated and, like the int message, is used to select which input channel is routed to the outlet.

next

Sending the next message to the left inlet will close the current input channel and open the next one, wrapping accross all channels. If currently closed (set to 0) or set to the last channel, the first channel will be routed to the outlet.

signal

In left inlet: If a signal is connected to the left inlet, selector~ operates in a mode that uses signal values to determine which of its input signals is to be passed to its outlet. If the signal coming in the left inlet is 0 or negative, the output is shut off and a zero signal is sent out. If it is 1 but less than 2, the signal coming in the first inlet to the right of the leftmost inlet is passed to the outlet. If the signal is 2 but less than 3, the signal coming into the next inlet to the right is used, and so on.

In right inlets: One channel of a multi-channel signal will be passed to the mcs.selector~ object's outlet depending on the value of the most recently received int or float in the left inlet, or the signal coming into the left inlet. The first signal inlet to the right of the leftmost inlet is considered input 1, the next to the right input 2, and so on.

Output

signal

The output is the signal coming from the selected input channel, as specified by a number or signal in the left inlet. The output is a zero signal if all inputs are shut off.

See Also

Name Description
gate~ Route a signal to one of several outlets
crosspatch Patching Editor for Matrix Objects
selector~ Assign one of several inputs to an outlet
switch Accept messages from a specific inlet