A newer version of Max is available. Click here to access the latest version of the Max documentation

crosspatch Reference

Patching Editor for Matrix Objects

crosspatch

Description

Connect a crosspatch to a client object (including matrix~, mcs.matrix~, mc.matrix~, matrix, gate~, mc.gate~, mcs.gate~, gate, selector, mc.selector~, mcs.selector~, and switch) to use a patching interface to edit connections between inputs and outputs.

Discussion

When crosspatch is connected to a single client object, it operates in two-way mode . In this mode, crosspatch can change the client object and changes to the connected object are reflected in the visual state of crosspatch. In two-way mode , you cannot change the number of inputs or outputs of crosspatch; it will always show the number of inputs and outputs of the connected object. When crosspatch is connected to two or more matrix objects, it operates in one-way mode . In this mode, changes to the matrix objects other by the UI of crosspatch are not reflected in the visual state, and you can change the number of inputs and outputs freely. This means the UI and the underlying state of the objects it is controlling could get out of sync. To avoid this, use crosspatch in two-way mode only.
When you connect crosspatch to an mc.matrix object (which is multiple instances of matrix~ in the MC Wrapper), the state of all contained matrix~ instances will change together. You cannot use crosspatch to edit individual matrix~ objects within an mc.matrix.

Arguments

None.

Attributes

allowdisabled [int] (default: 0)

Sets whether connections can be made to disabled inputs or outputs.

bgcolor [4 floats]

Sets the object's background color.

candycane [int] (default: 1)

Sets the number of colors to cycle through when displaying connections and labels. The default value of 1 shows only the linecolor; values above 1 show one or more of the candycane colors.

candycane2 [4 floats]

Candycane Color 1

candycane3 [4 floats]

Candycane Color 2

candycane4 [4 floats]

Candycane Color 3

candycane5 [4 floats]

Candycane Color 4

candycane6 [4 floats]

Candycane Color 5

candycane7 [4 floats]

Candycane Color 6

candycane8 [4 floats]

Candycane Color 7

candymode [int] (default: 0)

Controls whether inputs our output positions determine the color of a connection. Possible values:

0 = 'Using Input' ( Input position will determine connection color )
1 = 'Using Output' ( Output position will determine connection color )

colorlabels [int] (default: 0)

When colorlabels is enabled, the connection color is also used to display corresponding input and output labels according to the setting of the candymode attribute.

connectacrossdividers [int] (default: 1)

Sets whether connections can cross any visual dividers (set via the dividers attribute) that are currently showing.

dimmedconnectionalpha [float] (default: 1.)

Sets an alpha value to use for dimming patch lines not connected to the current input or output under the mouse cursor. A value of 0 would erase the lines completely, and a value of 1 (the default) would not perform any dimming. A suggested value of dimmedconnectionalpha to see the highlighting effect is 0.5.

dividercolor [4 floats]

Sets the color used to draw visual dividers.

dividers [atom]

To group inputs or outputs visually you can draw horizontal lines across the crosspatch object with the dividers attribute. Dividers are defined using either the word in or out followed by an index. The resulting vertical position of the line will be after the specified input or output. Note that divider lines are always horizontal so if the number of inputs and outputs is not equal, a divider defined by an input may cross an output or vice versa. You can prevent connections across the horizontal divider lines by enabling the connectacrossdividers attribute.

embed [int] (default: 1)

If embed is true, connections are saved with the patcher and restored when reloading it. All attributes (including embed) are always saved with the object.

exclusive [int] (default: 0)

The exclusive attribute controls whether multiple connections from a single input or to a single output are permitted. When connecting crosspatch to a gate~ or selector~, exclusive is automatically turned on. When connecting crosspatch to a matrix object, exclusive is turned off. Possible values:

0 = 'Off' ( No connection restrictions )
1 = 'Inputs' ( Multiple connections from the same input are prevented )
2 = 'Outputs' ( Multiple connections to the same output are prevented )
3 = 'Inputs + Outputs' ( Multiple connections from the same input and multiple connections to the same outlet are prevented. )

gaincaption [int] (default: 0)

The gaincaption attribute enables showing the numerical value of the gain control as it is changed. Possible values:

0 = 'Off' ( No value display )
1 = 'dB' ( Display value in dB )
2 = 'Amplitude' ( Display numerical value )

gaindragmode [int] (default: 0)

Sets how vertical mouse movement translates into changes in gain, particularly at the low end of the amplitude range. Possible values:

0 = 'Linear' ( Linear gain control )
This setting maintains a constant relationship between the vertical mouse position when dragging and the amplitude value.

1 = 'dB' ( dB gain control )
This setting increments or decrements the gain value by a proportion of the mouse position in dB when dragging. This mode provides slightly coarser resolution at the top end of the amplitude range and slightly finer resolution at the bottom of the amplitude range, which is more perceptually linear in most cases.

gainradius [float] (default: 7.)

Sets the size of the circle used for the connection gain control.

gainstyle [int] (default: 0)

Sets the visual appearance of the circular gain control Possible values:

0 = 'Dial' ( 270 degree arc )
When the gainstyle attribute is set to Dial (0), a value of 1.0 is a 270-degree arc similar to the pie segement mode of the Max dial.

1 = 'Full Circle' ( (Almost) 360 degree arc )
When the gainstyle attribute is set to Full Circle (1), a value of 1.0 is a 360-degree arc.

incolormap [atom]

The incolormap attribute maps specific colors to inputs. The linecolor is index 1 and the candycane colors are indices 2 - 8. Example: incolormap 1 5 4 2 assigns linecolor to the first input, candycane5 to the second input, candycane4 to input 3, and candycane2 to input 4. Any inputs not included in the incolormap retain their default color assignment according to the candycane attribute.

initialgain [float] (default: 1.)

Sets the initial gain used when making connections. Since a zero gain means "disconnect" to the matrix~ object, the initialgain cannot be zero, but can be very close to zero -- a minimum of -70 dB)

inlabels [atom]

Use inlabels to override some or all of the default "In N" labels displayed for connection inputs.

labelheight [float] (default: 20.)

Sets the minimum height of one input or output in the UI.

labelwidth [float] (default: 80.)

Sets the minimum width for input and output labels used when laying out the UI of crosspatch.

linecolor [4 floats]

Sets the color used for connections.

maxgain [float] (default: 1.)

The maxgain attribute sets the maximum permitted gain using circular gain controls on connection patch cords. Note that maxgain does not affect gain values set via the list message.

numins [int] (default: 4)

The numouts attribute set the number of outputs shown. In two-way mode, this attribute is set by the client object and cannot be changed.

numouts [int] (default: 4)

The numouts attribute sets the number of outputs shown. In two-way mode, this attribute is set by the client object and cannot be changed.

outcolormap [atom]

The outcolormap attribute maps specific colors to outputs. The linecolor is index 1 and the candycane colors are indices 2 - 8. Example: outcolormap 3 5 1 2 assigns candycane3 to the first output, candycane5 to the second output, linecolor to input 3, and candycane2 to output 4. Any outputs not included in the outcolormap retain their default color assignment according to the candycane attribute.

outlabels [atom]

Use outlabels to override some or all of the default "Out N" labels displayed for connection outputs.

overgaincolor [4 floats]

When the maxgain is above 1, you can set the gain for any connection above unity. Use the overgaincolor attribute to set color to for any gain values above 1.0.

parameter_enable [int]

Enables parameter mode

parameter_mappable [int] (default: 1)

Visible to Mapping

preservegain [int] (default: 0)

When exclusive is set to Outputs (2) or Inputs + Outputs (3), any connection to an output will delete an existing connection to the same output. If preservegain is enabled, the gain of the now deleted connection will be transferred to the new connection.

showgain [int] (default: 1)

Use the showgain attribute to control the display of circular gain controls on patch cords. Possible values:

0 = 'Off' ( Never show gain controls )
1 = 'Only if Not Unity Gain' ( Show a gain control only if the gain of the connection is not 1.0 (unity) )
2 = 'Always' ( Always show a gain control regardless of value )

showlabels [int] (default: 1)

Sets whether input and output labels are shown (1) or hidden (0).

style [symbol] (default: )

Sets the style to be applied to the object. Styles can be set using the Format palette.

textcolor [4 floats]

Sets the default color of the input and output labels. When the colorlabels attribute is enabled, connection colors are used for the text labels.

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.

Parameter Attributes

Order

Typeint

Sets the order of recall of this parameter. Lower numbers are recalled first. The order of recall of parameters with the same order number is undefined.

Parameter Mode Enable

Typeint

Parameter Mode Enable (not available from Parameters window)

Link to Scripting Name

Typeint

When checked, the Scripting Name is linked to the Long Name attribute.

Long Name

Typesymbol

The long name of the parameter. This name must be unique per patcher hierarchy.

Short Name

Typesymbol

Sets the short name for the object's visual display. The maximum length varies according to letter width, but is generally in a range of 5 to 7 characters.

Type

Typeint

Specifies the data type. The data types used in Max for Live are:

Float
Int
Enum (enumerated list)
Blob

Note: By convention, the Live application uses floating point numbers for its calculations; the native integer representation is limited to 256 values, with a default range of 0-255 (similar to the char data type used in Jitter). When working with Live UI objects whose integer values will exceed this range, the Type attribute should be set to Float, and the Unit Style attribute should be set to Int.

Range/Enum

Typelist

When used with an integer or floating point data type, this field is used to specify the minimum and maximum values of the parameter.
When used with an enumerated list (Enum) data type, this field contains a space-delimited list of the enumerated values (if list items contain a space or special characters, the name should be enclosed in double quotes).

Clip Modulation Mode

Typeint

Sets the Clip Modulation Mode used by the Live application. The modulation modes are:

None
Unipolar
Bipolar
Additive
Absolute

Clip Modulation Range

Typelist

This parameter is only used with the Absolute modulation mode. It specifies defines the range of values used.

Initial Enable

Typeint

When checked (set to 1), the UI object can store an initialization value. The value is set using the Initial attribute (see below).

Initial

Typelist

Sets the initial value to be stored and used when the Initial Enable attribute is checked.

Unit Style

Typeint

Sets the unit style to be used when displaying values. The unit style values are: Int: displays integer values
Float: displays floating point values
Time: displays time values in milliseconds (ms)
Hertz: displays frequency values (Hz/kHz).
deciBel: displays loudness (dB)
%: Percentage
Pan: displays Left and Right values
Semitones: displays steps (st)
MIDI: displays pitch corresponding to the MIDI note number
Custom: displays custom data type
Native: defaults to floating point values

Custom Units

Typesymbol

Sets the units to be used with the 'Custom' unit style (see "Unit Style", above). Custom unit strings may be simple symbols (e.g. "Harmonic(s)"), in which case the parameter's value will be displayed in its 'Native' display mode, followed by the symbol (e.g. "12 Harmonic(s)" for an Int-typed parameter or "12.54 Harmonic(s)" for a Float-typed parameter). For additional control over the numerical component displayed, a sprintf-style string may be used (e.g. "%0.2f Bogon(s)", which would display a value such as ".87 Bogons").

Exponent

Typefloat

When set to a value other than 1., the parameter's input and output values will be exponentially scaled according to the factor entered in this column.

Steps

Typeint

The number of steps available between the minimum and maximum values of a parameter. For instance, if the parameter has a range from 0.-64., with Steps set to 4, the user can only set the parameter to 0, 21.33, 42.66 and 64.

Parameter Visibility

Typeint

For automatable parameters (Int, Float, Enum), 'Stored Only' disables automation, although parameter values are stored in presets. 'Hidden' causes the parameter's value to be ignored when storing and recalling data. Non-automatable parameters (Blob) are 'Stored Only' by default, and can be set to 'Hidden', if desired.

Update Limit (ms)

Typeint

Speed limits values triggered by automation.

Defer Automation Output

Typeint

Defers values triggered by automation.

Messages

bang

The bang message will copy the current connection state to any objects connected to the left outlet. A dictionary with the current state is sent out the left outlet if any there are any connected objects that aren't compatible with the crosspatch connection protocol. The dump message sends a similar dictionary out the right outlet.

list

Arguments

input-index [int]
output-index [int]
gain-or-zero [float]
A list of numbers adds or deletes a connection and updates connected clients. The first number is the input (always zero relative), the second number is the output (always zero relative), and the third number is a gain value. If the gain value is zero, the connection is removed, otherwise it is associated with the connection.

clear

The clear message clears all current connections and updates any connected clients.

dictionary

Arguments

dictionary-name [symbol]
When crosspatch receives a dictionary containing connection information, it clears its existing connections and replaces them with those contained in the dictionary, updating connected clients. Connections for inputs or outputs greater than the current input and output size are ignored.

dump

The dump message outputs a dictionary out the right outlet containing the current connections.

dumpconnections

The dumpconnections message outputs a dictionary out the right outlet containing the current connections.

indisable

Arguments

input-index [int]
disable [int]
The word indisable, followed by an input index starting at 0, visually disables the input if the second argument is non-zero and enables it if the second argument is 0. Example: indisable 1 1 will disable the second input, and indisable 1 0 will re-enable it. When you disable an input, any connections to it will be removed if allowdisabled is not enabled. Moreover, you cannot connect anything to a disabled input unless allowdisabled is enabled. The disabled state of inputs is not saved in the patcher.

(mouse)

To make a connection between an input and output , click on a white circle on either the input or output side of the object and either move or drag to the desired destination circle. The destination will highlight when the mouse is over it. If you released the mouse to start the connection, click again to complete the connection. If you dragged the mouse, release the button.
To delete an existing connection click once on the line to select it, then press the delete or backspace key.
To edit the gain of a connection, click on the line and drag upwards or downwards. A dial will indicates the current gain as you drag.
As you edit connections with crosspatch, any connected matrix objects will update to reflect changes in gain or connection state.

outdisable

Arguments

output-index [int]
disable [int]
The word outdisable, followed by an output index starting at 0, visually disables the input if the second argument is non-zero and enables it if the second argument is 0. Example: outdisable 1 1 will disable the second output, and outdisable 1 0 will re-enable it. When you disable an output, any connections to it will be removed if allowdisabled is not enabled. Moreover, you cannot connect anything to a disabled output unless allowdisabled is enabled. The disabled state of outputs is not saved in the patcher.

See Also

Name Description
gate~ Route a signal to one of several outlets
matrix Event routing matrix
matrix~ Signal routing and mixing matrix
matrixctrl Matrix switch control
selector~ Assign one of several inputs to an outlet