selector~
Assign one of several inputs to an outlet
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 identical 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]: 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]: 0
When enabled, all whole-number changes to a signal value in the left inlet (either increasing and decreasing) will increment the open inlet by 1, wrapping accross the available inlets. 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]: 0
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, 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'
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]: 0
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile[symbol]
JS Painter File
patching_rect[4 floats]: 0. 0. 100. 0.
Sets the position and size of the object in the patcher window.
position[2 floats]
write-only
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]: 0
Sets whether an object belongs to the patcher's presentation.
presentation_rect[4 floats]: 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]
write-only
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]
write-only
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
message.
int
Select which input to route to the outlet. If the value is 0 or negative, a zero signal is sent out. 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.
- open-inlet
[int]
float
Float input is truncated and, like the
message, is used to select which inlet signal is routed to the outlet.
next
Sending the
message to the left inlet will close the current inlet and open the next one, wrapping accross all inlets. If currently closed (set to 0) or set to the rightmost inlet, inlet 1 will be opened.
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 other inlets: Any signal, to be passed through to the 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 in the "open" inlet, as specified by a number or signal in the left inlet. The output is a zero signal if all signal inlets are shut off.
See Also
Name | Description |
---|---|
gate~ | Route a signal to one of several outlets |
crosspatch | Patching Editor for Matrix Objects |
mcs.selector~ | Assign a channel of a multi-channel signal to an outlet |
switch | Accept messages from a specific inlet |