|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.cycling74.max.MaxPatcher
public class MaxPatcher
MaxPatcher
can be used in conjunction with MaxBox
to dynamically modify and create patchers on the fly. The interface exposed is
very similar to the functionality exposed by the js javascript external and thus
much of that documentation for that external is applicable well.
public class maxpatchertest extends MaxObject { public void makepatcher() { MaxPatcher p = new MaxPatcher(50,50,200,200); MaxBox b11 = p.newDefault(20,20,"toggle",null); MaxBox b21 = p.newDefault(50,20,"toggle",null); MaxBox b31 = p.newDefault(80,20,"toggle",null); p.getWindow().setVisible(true); p.getWindow().setTitle("TEST PATCH"); } }
Constructor Summary | |
---|---|
|
MaxPatcher(int x1,
int y1,
int x2,
int y2)
creates a MaxPatcher . |
protected |
MaxPatcher(long p_patcher)
|
Method Summary | |
---|---|
void |
connect(MaxBox b1,
int outlet,
MaxBox b2,
int inlet)
Connect a patch line from box b1 to box b2 with default color. |
void |
connect(MaxBox b1,
int outlet,
MaxBox b2,
int inlet,
int color)
Connect a patch line from box b1 to box b2. |
void |
disconnect(MaxBox b1,
int outlet,
MaxBox b2,
int inlet)
Disconnect a patch line from box b1 to box b2. |
boolean |
equals(java.lang.Object o)
|
protected void |
finalize()
|
MaxBox[] |
getAllBoxes()
get a list of all boxes contained in this patcher. |
int |
getCount()
|
java.lang.String |
getFilePath()
|
java.lang.String |
getName()
|
MaxBox |
getNamedBox(java.lang.String name)
get the MaxBox contained in this patcher by name. |
int[] |
getOffset()
|
int[] |
getOrigin()
|
java.lang.String |
getParentMaxClass()
|
java.lang.String |
getPath()
get the absolute filesystem path of the file defining the patcher. |
MaxWindow |
getWindow()
|
int |
hashCode()
|
boolean |
isBPatcher()
|
boolean |
isLocked()
|
MaxBox |
newDefault(int x,
int y,
java.lang.String maxclassname,
Atom[] args)
Create a new MaxBox in this patcher. |
MaxBox |
newObject(java.lang.String msg,
Atom[] args)
Create a new MaxBox in this patcher. |
long |
send(java.lang.String msg,
Atom[] args)
send an arbitrary message to the patcher. |
void |
setBackgroundColor(int r,
int g,
int b)
set the background color. |
void |
setLocked(boolean b)
Set whether or not this patcher is locked. |
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected MaxPatcher(long p_patcher)
public MaxPatcher(int x1, int y1, int x2, int y2)
MaxPatcher
. The patcher is created
in a non visible state. To see the patcher use the setVisible
method on its MaxWindow.
x1
- upper left corner x in absolute screen coordinates.y1
- upper left corner y in absolute screen coordinates.x2
- lower right corner x in absolute screen coordinates.y2
- lower right corner y in absolute screen coordinates.Method Detail |
---|
public java.lang.String getPath()
public long send(java.lang.String msg, Atom[] args)
msg
- the message to send thispatcherargs
- arguments for the message to thispatcher. can be null.public void setBackgroundColor(int r, int g, int b)
r
- red componentg
- green componentb
- blue componentpublic boolean isBPatcher()
public MaxBox getNamedBox(java.lang.String name)
MaxBox
contained in this patcher by name.
The name of max boxes are set via the Object menu of the max application
or programatically using the MaxBox
class.
name
- the scripting name of the box you want a reference to
MaxBox
instance representing the named box
or null if no box named name exists in the patcher.public MaxBox[] getAllBoxes()
MaxBox
isPatcher and getting a reference to it's MaxPatcher
via it's getSubPatcher() method.
MaxBox
instances contained
within this patch.public MaxBox newDefault(int x, int y, java.lang.String maxclassname, Atom[] args)
MaxBox
in this patcher.
Arguments can be passed as well. The example bellow shows how to create a non-UI object.
MaxPatcher p = getParentPatcher(); MaxBox b = p.newDefault(80,20,"newobj",Atom.parse("@text \"makenote 127 4n\" @textcolor 0. 0. 1. 1."));To create a UI object:
MaxPatcher p = getParentPatcher(); MaxBox b = p.newDefault(100,50,"button",Atom.parse("@bgcolor 0. 0. 1. 1. @fgcolor 1. 0. 0. 0.8"));
x
- location of x in patcher relative coordinates.y
- location of y in patcher relative coordinates.maxclassname
- the name of the max class you which to create an instance of in the patcher.args
- arguments to use when instantiating the max class.
public MaxBox newObject(java.lang.String msg, Atom[] args)
MaxBox
in this patcher. Using raw
max patcher file syntax. For Example:
--Create an instance of bpatcher containing noise~.help in patcher p. p.newObject("bpatcher",Atom.parse("10 10 100 100 0 0 noise~.help 0"));
maxclassname
- the name of the max class you which to create an instance of in the patcher.args
- arguments to use when instantiating the max class.
public void connect(MaxBox b1, int outlet, MaxBox b2, int inlet, int color)
b1
- MaxBox sourceoutlet
- outlet of the box b1 from which to originate the connectionb2
- MaxBox destinlet
- inlet of the box b2 to which the connection is terminatedcolor
- int representing the color index of the patchline.public void connect(MaxBox b1, int outlet, MaxBox b2, int inlet)
b1
- MaxBox sourceoutlet
- outlet of the box b1 from which to originate the connectionb2
- MaxBox destinlet
- inlet of the box b2 to which the connection is terminatedpublic void disconnect(MaxBox b1, int outlet, MaxBox b2, int inlet)
b1
- MaxBox sourceoutlet
- outlet of the box b1 from which the connection originatesb2
- MaxBox destinlet
- inlet of the box b2 to which the connection terminatespublic MaxWindow getWindow()
public java.lang.String getName()
public boolean isLocked()
public java.lang.String getParentMaxClass()
public int[] getOffset()
public int[] getOrigin()
public int getCount()
public java.lang.String getFilePath()
public void setLocked(boolean b)
b
- true to lockprotected void finalize()
finalize
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |