see also matrix
Created by Panaiotis
© 2001 by Panaiotis. All rights reserved.
Integrates with matrixctrl
Includes spray feature
new clear message
new LR message
matrixctrl connects almost directly with matrix. Almost, because it needs a [prepend mc] or [prepend mcx n] object between matrixctrl and matrix. This is necessary because matrix uses lists to tag the inlets for its own configuration.
The mc and mcx messages also provides a way to tell matrix which of two orientations you want matrixctrl to effect matrix.
matrix feeds back into matrixctrl (through a connection you make between matrix's control outlet and matrixctrl's left inlet), so any changes made through matrix's command set will update matrixctrl. In this way, you could use matrixctrl simply as a visual representation of the matrix configuration. This can also be handy if you want to control something other than matrix with matrixctrl, but use matrix's configuration commands.
One thing to keep in mind when using matrix with matrixctrl: matrixctrl uses index values to reference columns and rows; by default, matrix uses ordinal numbers to reference inlets and outlets (matrix was modeled after switch and gate). When these two objects are connected together this difference is seamless because matrix translates configuration data between the two objects. However, if you are using direct references to these objects concurrently, this factor must be considered. You can change matrix references to match matrixctrl by sending matrix an <ioref 0> messages.
There are two orientations between matrixctrl and matrix.
The default orientation is columns as inlets.
![]() |
![]() |
[mctop] tells matrix to interpret matrixctrl columns as matrix inlets, and rows as outlets. Since it is the default configuration, it is not necessary to send it an initial [mctop] message before using the matrix configuration commands. |
[mcleft] tells matrix to interpret matrixctrl rows as matrix inlets, and columns as outlets. The initial set of commands begins by telling matrix that matrixctrl is oriented with rows as inlets and columns as outlets. |
The exampe above is obsolete but still possible. The [prepend mctop/mcleft] object should use [prepend mc] instead. However, before configuring matrix or matrixctrl, send the matrix a [mcleft] message once as shown on the right ([mctop] may be used in the left example, but matrix defaults to this orientation).
|
The simplest way to set up matrix with matrixctrl is to:
[prepend mc]
object. [configOnChg]
message.
You may use either matrixctrl or matrix's built-in command messages to configure matrix. Matrixctrl will reflect any changes made to matrix if you use matrix's commands.
matrixctrl does not need to be the full size of matrix. By using the mcoffset
and mcdim
message you can move matrixctrl around the matrix.
There are several new messages related to the integration of matrix with matrixctrl:
configOnChg arg1 [list] |
This message takes one argument: 0 or 1. |
|
getconfig | This tells matrix to output its current configuration. If you reconfigure matrix or matrixctrl while configOnChg is disabled, and need to update matrixctrl, send matrix getconfig . |
|
(if mctop orientation)
mc [arg1 arg2 arg3 ...] |
NB: This is the default orientation. |
|
(if mcleft orientation)
mcleft arg1 arg2 arg3 |
mc takes the three arguments output by the left outlet of matrixctrl and tells matrix to interpret them as:
If you are using this orientation, you must send matrix an mcleft message (with or without arguments) before doing any configuration of matrix. This tells matrix that this orientation is in effect. You can also click matrixctrl to open and close a cell. Once matrix receives any mcleft message it will know the orientation. It will need this before you configure matrix with its own commands if you expect matrix to update matrixctrl correctly. |
|
mcdim arg1 arg2 arg3 arg4 |
If matrixctrl does not cover the entire matrix, use
The first two arguments represent the size of matrixctrl. When initiated, matrix assumes that matrixctrl is the same size as matrix. If this is not the case (which is why you are now using mcdim), then matrix needs to be told the dimensions of matrixctrl. The dimensions are in accordance with matrix, not matrixctrl. The first argument (arg1 of mcdim) is the number of matrix inlets matrixctrl covers; the second (arg2), the outlets. |
|
The second two arguments tell matrix where the first virtual matrixctrl cell is within matrix (top-left for |
||
mcoffset arg1 arg2 arg3 arg4 |
You can also use
The first two arguments tell matrix where the first virtual matrixctrl cell is within matrix (top-left for |
|
The second two arguments represent the size of matrixctrl. When initiated, matrix assumes that matrixctrl is the same size as matrix. If this is not the case (which is why you are now using mcoffset), then matrix needs to be told the dimensions of matrixctrl. The dimensions are in accordance with matrix, not matrixctrl. The first argument (arg3 of mcoffset) is the number of matrix inlets matrixctrl covers; the second (arg4), the outlets. |
||
clear |
If you want to clear the entire matrix, send Matrix ignores (NB: in conjunction with matrixctrl, |
|
When matrixctrl is smaller than matrix you need to be wary of the use of clear . Both matrix and matrixctrl accept this message. If you send matrixctrl a clear message and it is smaller than matrix, matrix will only be cleared in the range of the current position of matrixctrl. In other words, the window that is represented by matrixctrl is cleared. The rest of the matrix is left alone. |
Matrix can be connected to as many as 17 matrixctrls that configure matrix. In this way, you can use several smaller matrixctrls in a visual configuration that may be different than a straightforward matrix. Or, you can have several patchers access the same matrix.
All 17 matrixctrls are independent, yet a change in one will be reflected in any other matrixctrl that overlaps. That is, matrixctrls may overlap regions of matrix nodes. It is possible, for example, to have two patchers that have a matrixctrl that will cover the entire matrix. Updating one matrixctrl will be reflected in the other.
It is also possible to have several non-overlapping matrixctls, or a master control with several smaller controllers that represent portions of the matrix.
To use multiple matrixctrls you need to use modified commands, and also route matrix configuration output to each matrixctrl.
configOnChg arg1 [arg2...] |
Matrixctrls are referenced 0-16. Ctrl 0 is the default and if If Example:
It is important to turn off (or leave off) any matrixctrls that are not being used. Any ctrl that is on will cause matrix to send configuration data out its control outlet whenever a configuration is made. For the most part, matrix is very efficient about this, but it is more efficient if unnecessary controllers are off. |
|
getconfig arg1 |
|
|
mctopx arg1 [arg2 arg3 arg4...] |
|
|
mcleftx arg1 arg2 arg3 |
|
|
mcoffsetx arg1 arg2 arg3 arg4 arg5 |
If a matrixctrl does not cover the entire matrix, use
The second two arguments tell matrix where the first virtual matrixctrl cell is within matrix (top-left for |
|
|
The last two arguments represent the size of matrixctrl. When initiated, matrix assumes that matrixctrl is the same size as matrix. If this is not the case (which is why you are now using mcoffset), then it needs to be told the dimensions of matrixctrl. The dimensions are in accordance with matrix, not matrixctrl. The first argument (arg4 of mcoffsetx) is the number of inlets matrixctrl covers; the second (arg5), the outlets. See mcoffset for diagram. |
Finally, you must route configuration data from matrix to the correct matrixctrl. This is done using a Max route object. A simple list is output for controller zero, matrix prepends to all others, the symbol 'mcN' where 'N' is the controller (1-16) that matrix is trying to update.
If you have a list (numbers or symbols) that you want to distribute to the matrix outlets, one element per outlet, set one or more inlets to spray or unpack. Matrix will treat the inlet as if you were using spray instead of matrix. There are four messages that determine how lists are interpreted by matrix.
spray arg |
If the first item of the list is an int or float (floats are rounded, not truncated), it is used to indicate the first outlet for the 2nd item. Spray always references the first outlet as 0. If the first agument is a symbol, it is distributed like unpack. Matrix outlets are numbered starting from 1 or 0. The first element of the spray list (if numeric), indicates how far to shift the spray elements, not which outlet it will be sent through. The amount of shift is influenced by the distfilt attribute (see below). |
|
distoff |
|
|
unpack arg |
|
|
distfilt arg |
If the argument is 1, then each list element is linked to its corresponding outlet. If an outlet is closed, then the corresponding element is not sent out. Thus if the same three element list were sent with this option on, the first element would be sent out [1], the second would not be sent, and the third element would be sent to outlet [3]. Argument:
|
There are three factors that will determine which outlets the list elements will be sent out: spray/unpack
and diistfilt
options, and the first element of the spray list. Sometimes the resulting output is not intuitive so care must be given when choosing options.
If matrix is set to accept configuation from data inlets, you can temporarily distibute a list through an otherwise non-distribution inlet by prepending the list with either [spray]
or [unpack]
as in spray 2 distribute these elements]
.
Max convention uses right to left as the standard order from which an object sends messages through its outlets. Therefore by default, matrix sends data coming from inlets, to its outlets in reverse numerical order (right to left). There may be times when this order is unsuitable to your application. Therefore, matrix output may be reversed to left-to-right output order. In addition, this behavior is controlled on an inlet-by-inlet basis.
LR arg |
|
Matrix can prepend and append ints floats and sybols to incoming data. The x-pend value is associated with particular inlets and/or outlets. As a result, incoming data can have as many as four elements attached to it as it leaves the matrix.
X-Pends are single element entities (an int, a float, or a symbol). Each inlet can have one pre- and one ap-pend element associated with it. Each outlet can have one pre- and one ap-pend element associated with it. The order of attachment is:
Out_prepend, In_prepend, data, In_append, Out_append
The messages that configure prepends and appends are in the next table
i_prepend a1 |
prepend a1 to current inlets |
|
i_append a1 |
append a1 to current inlets | |
o_prepend a1 @outs [descr] |
prepend a1 to descr outlets |
|
o_append a1 @outs [descr] |
append a1 to descr outlets | |
il_prepend [list] |
prepend list of ints, floats, or symbols to current inlets |
|
il_append [list] |
append list of ints, floats, or symbols to current inlets | |
ol_prepend [list] @outs [descr] |
prepend list of ints, floats, or symbols to descr outlets |
|
ol_append [list] @outs [descr] |
append list of ints, floats, or symbols to descr outlets | |
is_prepend [i,s]r1 r2 |
prepend series of ints, or symbols to current inlets. 'i' is the first value of the series that will then be applied to the range of inlets described by r1 (first inlet) and r2 (last) 's' is a symbol. The series uses the last characher of the series as the basis for the series. The ascii code of the last character is serially incremented. |
|
is_append [i,s]r1 r2 |
append version of is_prepend | |
os_prepend [i,s] r1 r2 |
outlet prepend version |
|
os_append [i,s] r1 r2 |
outlet append version | |