|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.cycling74.max.MaxObject
public abstract class MaxObject
Base class for a Java Max object. Subclass this directly or indirectly to create your own Java objects for use in Max.
Field Summary | |
---|---|
static java.lang.String[] |
EMPTY_STRING_ARRAY
A convenience constant; use this empty String
array instead of creating a new one. |
static int[] |
NO_INLETS
A convenience constant; use it in a call to declareInlets to declare that an object has no inlets. |
static int[] |
NO_OUTLETS
A convenience constant; use it in a call to declareOutlets to declare that an object has no outlets. |
Constructor Summary | |
---|---|
protected |
MaxObject()
This allows subclasses to avoid calling super(args) in their constructors. |
Method Summary | |
---|---|
protected void |
anything(java.lang.String message,
Atom[] args)
Called by Max: inlet has received a message. |
protected static void |
bail(java.lang.String errormsg)
If called during your constructor bail will cause no instance of the class to be instantiated within max and the mxj box will show up in the patcher as invalid. |
protected void |
bang()
Called by Max: inlet has received a bang value. |
protected void |
createInfoOutlet(boolean b)
Determine whether or not an info outlet is created. |
protected void |
dblclick()
Called by Max when the user double-clicks on the object box. |
protected void |
declareAttribute(java.lang.String name)
Declare an attribute with default getter and setter methods. |
protected void |
declareAttribute(java.lang.String name,
java.lang.String getter,
java.lang.String setter)
Declare an attribute with specific getter and setter methods. |
protected void |
declareInlets(int[] types)
Declare typed inlets. |
protected void |
declareIO(int ins,
int outs)
Declare untyped inlets and outlets. |
protected void |
declareOutlets(int[] types)
Declare typed outlets. |
protected void |
declareReadOnlyAttribute(java.lang.String name)
Declare an attribute with default getter method. |
protected void |
declareReadOnlyAttribute(java.lang.String name,
java.lang.String getter)
Declare a readonly attribute with a specific getter method. |
protected void |
declareTypedIO(java.lang.String ins,
java.lang.String outs)
Declare typed inlets and outlets. |
protected void |
embedMessage(java.lang.String msg,
Atom[] args)
Embed messages in a patcher file for initialization purposes. |
static void |
error(java.lang.String message)
Post an error message to the Max console. |
void |
gc()
Invoke garbage collection via System.gc(). |
java.lang.Object |
getAttr(java.lang.String name)
Get the current value of a declared attribute as a java.lang.Object. |
Atom[] |
getAttrAtomArray(java.lang.String name)
Get the current value of a declared Atom array attribute. |
boolean |
getAttrBool(java.lang.String name)
Get the current value of a declared boolean attribute. |
boolean[] |
getAttrBoolArray(java.lang.String name)
Get the current value of a declared boolean array attribute. |
float |
getAttrByte(java.lang.String name)
Get the current value of a declared byte attribute. |
byte[] |
getAttrByteArray(java.lang.String name)
Get the current value of a declared byte array attribute. |
char |
getAttrChar(java.lang.String name)
Get the current value of a declared char attribute. |
char[] |
getAttrCharArray(java.lang.String name)
Get the current value of a declared char array attribute. |
double |
getAttrDouble(java.lang.String name)
Get the current value of a declared double attribute. |
double[] |
getAttrDoubleArray(java.lang.String name)
Get the current value of a declared double array attribute. |
float |
getAttrFloat(java.lang.String name)
Get the current value of a declared float attribute. |
float[] |
getAttrFloatArray(java.lang.String name)
Get the current value of a declared float array attribute. |
AttributeInfo[] |
getAttributeInfo()
Get the array of AttributeInfo objects. |
int |
getAttrInt(java.lang.String name)
Get the current value of a declared int attribute. |
int[] |
getAttrIntArray(java.lang.String name)
Get the current value of a declared int array attribute. |
long[] |
getAttrLongArray(java.lang.String name)
Get the current value of a declared long array attribute. |
short |
getAttrShort(java.lang.String name)
Get the current value of a declared short attribute. |
short[] |
getAttrShortArray(java.lang.String name)
Get the current value of a declared short array attribute. |
java.lang.String |
getAttrString(java.lang.String name)
Get the current value of a declared String attribute. |
java.lang.String[] |
getAttrStringArray(java.lang.String name)
Get the current value of a declared String array attribute. |
java.lang.String |
getCodeSourcePath()
This method returns the native filesystem path of the class file or jar archive from which this class was loaded. |
static MaxContext |
getContext()
Get the context in which we are running. |
static com.cycling74.io.ErrorStream |
getErrorStream()
Get the global ErrorStream. |
int |
getInfoIdx()
Returns the index of the info outlet. |
protected int |
getInlet()
Returns the inlet of the last received message. |
java.lang.String |
getInletAssist(int inletIdx)
Describes what inlet inletIdx does. |
int |
getInletType(int idx)
Returns an inlet type. |
long |
getLongAttr(java.lang.String name)
Get the current value of a declared long attribute. |
MaxBox |
getMaxBox()
Gets the MaxBox peer of this mxj instance. |
java.lang.String |
getName()
Get the MaxContext name of this instance. |
int |
getNumInlets()
Return the number of inlets. |
int |
getNumOutlets()
Returns the number of outlets. |
java.lang.String |
getOutletAssist(int outletIdx)
Describes what outlet outletIdx does. |
int |
getOutletType(int idx)
Returns an outlet type. |
MaxPatcher |
getParentPatcher()
Gets the parent MaxPatcher . |
static com.cycling74.io.PostStream |
getPostStream()
Get the global PostStream. |
protected void |
inlet(float value)
Called by Max: inlet has received a float value. |
protected void |
inlet(int value)
Called by Max: inlet has received an int value. |
protected void |
list(Atom[] atomArray)
Called by Max: inlet has received a list. |
protected void |
list(float[] f)
Called by Max: inlet has received a list of floats. |
protected void |
list(int[] i)
Called by Max: inlet has received a list of ints. |
protected void |
loadbang()
Called by Max at loadbang time (ie, when the enclosing patch has finished loading). |
protected void |
notifyDeleted()
Notification that the corresponding mxj object peer was deleted. |
static void |
ouch(java.lang.String message)
Put up an error window. |
boolean |
outlet(int outletIdx,
Atom value)
Sends the contents of the Atom out. |
boolean |
outlet(int outletIdx,
Atom[] array)
Sends an array of Atom s. |
boolean |
outlet(int outletIdx,
boolean value)
Sends a 0 or a 1. |
boolean |
outlet(int outletIdx,
boolean[] array)
Sends an array of boolean s. |
boolean |
outlet(int outletIdx,
byte value)
Sends a byte . |
boolean |
outlet(int outletIdx,
byte[] value)
Sends a list of byte s. |
boolean |
outlet(int outletIdx,
char c)
Sends a char as a message with no arguments. |
boolean |
outlet(int outletIdx,
char[] value)
Sends an array of char s. |
boolean |
outlet(int outletIdx,
double value)
Sends a double . |
boolean |
outlet(int outletIdx,
double[] value)
Sends a list of double s. |
boolean |
outlet(int outletIdx,
float value)
Sends a float . |
boolean |
outlet(int outletIdx,
float[] value)
Sends a list of float s. |
boolean |
outlet(int outletIdx,
int value)
Sends an int . |
boolean |
outlet(int outletIdx,
int[] value)
Sends a list of int s. |
boolean |
outlet(int outletIdx,
long value)
Sends a long . |
boolean |
outlet(int outletIdx,
long[] value)
Sends a list of long s. |
boolean |
outlet(int outletIdx,
short value)
Sends a short . |
boolean |
outlet(int outletIdx,
short[] value)
Sends a list of short s. |
boolean |
outlet(int outletIdx,
java.lang.String message)
Sends a message with no arguments. |
boolean |
outlet(int outletIdx,
java.lang.String[] value)
Sends an array of String s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
Atom value)
Sends a message with an Atom arg. |
boolean |
outlet(int outletIdx,
java.lang.String message,
Atom[] args)
Sends a message. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
boolean value)
Sends a message with a boolean arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
boolean[] array)
Sends a message followed by an array of boolean s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
byte value)
Sends a message with a byte arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
byte[] value)
Sends a message followed by an array of byte s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
char c)
Sends a message with a char arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
char[] value)
Sends a message followed by an array of char s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
double value)
Sends a message with a double arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
double[] value)
Sends a message followed by an array of double s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
float value)
Sends a message with a float arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
float[] value)
Sends a message followed by an array of float s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
int value)
Sends a message with an int arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
int[] value)
Sends a message followed by an array of int s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
long value)
Sends a message with an long arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
long[] value)
Sends a message followed by an array of long s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
short value)
Sends a message with an short arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
short[] value)
Sends a message followed by an array of short s. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
java.lang.String value)
Sends a message with a String arg. |
boolean |
outlet(int outletIdx,
java.lang.String msg,
java.lang.String[] value)
Sends a message followed by an array of String s. |
boolean |
outletBang(int outletIdx)
Sends a bang. |
boolean |
outletBangHigh(int outletIdx)
Sends a bang out an outlet in the timer thread if overdrive is on. |
boolean |
outletHigh(int outletIdx,
Atom[] value)
Sends a list out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
double value)
Sends a double out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
float value)
Sends a float out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
float[] values)
Sends a list out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
int value)
Sends an int out an outlet in the timer thread if overdrive is on. |
boolean |
outletHigh(int outletIdx,
int[] values)
Sends a list out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
java.lang.String message)
Sends a message with no arguments out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
java.lang.String message,
Atom[] args)
Sends a message and arguments out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
java.lang.String message,
float[] values)
Sends a message and arguments out an outlet in the timer thread. |
boolean |
outletHigh(int outletIdx,
java.lang.String message,
int[] values)
Sends a message and arguments out an outlet in the timer thread. |
static void |
post(java.lang.String message)
Post a message to the Max console. |
void |
postCodePath()
|
protected void |
save()
Called by Max when the user saves the patch. |
void |
setAttr(java.lang.String name,
Atom[] val)
Set the current value of a declared Atom array attribute. |
void |
setAttr(java.lang.String name,
boolean val)
Set the current value of a declared boolean attribute. |
void |
setAttr(java.lang.String name,
boolean[] val)
Set the current value of a declared boolean array attribute. |
void |
setAttr(java.lang.String name,
byte val)
Set the current value of a declared byte attribute. |
void |
setAttr(java.lang.String name,
byte[] val)
Set the current value of a declared byte array attribute. |
void |
setAttr(java.lang.String name,
char val)
Set the current value of a declared char attribute. |
void |
setAttr(java.lang.String name,
char[] val)
Set the current value of a declared char array attribute. |
void |
setAttr(java.lang.String name,
double val)
Set the current value of a declared double attribute. |
void |
setAttr(java.lang.String name,
double[] val)
Set the current value of a declared double array attribute. |
void |
setAttr(java.lang.String name,
float val)
Set the current value of a declared float attribute. |
void |
setAttr(java.lang.String name,
float[] val)
Set the current value of a declared float array attribute. |
void |
setAttr(java.lang.String name,
int val)
Set the current value of a declared int attribute. |
void |
setAttr(java.lang.String name,
int[] val)
Set the current value of a declared int array attribute. |
void |
setAttr(java.lang.String name,
long val)
Set the current value of a declared long attribute. |
void |
setAttr(java.lang.String name,
long[] val)
Set the current value of a declared long array attribute. |
void |
setAttr(java.lang.String name,
java.lang.Object val)
Set the current value of a declared attribute. |
void |
setAttr(java.lang.String name,
java.lang.Object[] args)
|
void |
setAttr(java.lang.String name,
short val)
Set the current value of a declared short attribute. |
void |
setAttr(java.lang.String name,
short[] val)
Set the current value of a declared short array attribute. |
void |
setAttr(java.lang.String name,
java.lang.String val)
Set the current value of a declared String attribute. |
void |
setAttr(java.lang.String name,
java.lang.String[] val)
Set the current value of a declared String array attribute. |
protected void |
setInletAssist(int index,
java.lang.String message)
Set one inlet assistance string. |
protected void |
setInletAssist(java.lang.String[] messages)
Set the inlet assistance strings. |
void |
setName(java.lang.String name)
Set the name of this instance used by MaxContext. |
protected void |
setOutletAssist(int index,
java.lang.String message)
Set one outlet assistance string. |
protected void |
setOutletAssist(java.lang.String[] messages)
Set the outlet assistance strings. |
static void |
showException(java.lang.String message,
java.lang.Throwable t)
Display an exception or other Throwable in a convenient way with an accompanying message. |
static void |
showException(java.lang.Throwable t)
Display an exception or other Throwable in a convenient way. |
java.lang.String |
toString()
Return a human-readable version of this object. |
void |
viewsource()
Brings up the source code for the java class in an editor. |
void |
zap()
Force the next class to be loaded by mxj to be loaded with a new MXJClassLoader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int[] NO_INLETS
declareInlets(int[])
public static final int[] NO_OUTLETS
declareOutlets(int[])
public static final java.lang.String[] EMPTY_STRING_ARRAY
String
array instead of creating a new one.
Constructor Detail |
---|
protected MaxObject()
Method Detail |
---|
protected void notifyDeleted()
public void setName(java.lang.String name)
name
- the new name.public java.lang.String getName()
String
that contains the instance's name.public static MaxContext getContext()
MaxContext
.public static void post(java.lang.String message)
message
- the String
to post in the Max console.public static void error(java.lang.String message)
message
- the String
to post as an error to the Max console.public static void ouch(java.lang.String message)
message
- the text to display in the error window.public static com.cycling74.io.PostStream getPostStream()
PostStream
.public static void showException(java.lang.Throwable t)
t
- the exception to display.public static void showException(java.lang.String message, java.lang.Throwable t)
message
- the accompanying message.t
- the exception to display.public static com.cycling74.io.ErrorStream getErrorStream()
ErrorStream
.public MaxPatcher getParentPatcher()
MaxPatcher
.
MaxPatcher
public MaxBox getMaxBox()
MaxBox
for this MaxObjectprotected void declareInlets(int[] types)
DataTypes.ALL
). To have
any effect, this method must be called in your class's constructor.
For example, the following call ensures that an object of
this class will have an int inlet and a float inlet.
declareInlets(DataTypes.INT, DataTypes.FLOAT);
types
- array of ints that represent the type of data that
will be accepted in the corresponding inlet.com.cycling74.max
protected void declareOutlets(int[] types)
DataTypes.ALL
). To have
any effect, this method must be called in your class's constructor.
For example, the following call ensures that an object of
this class will have an int outlet and a float outlet.
declareOutlets(DataTypes.INT, DataTypes.FLOAT);
types
- array of ints that represent the type of data that
will be sent out the corresponding inlet.com.cycling74.max
protected void declareIO(int ins, int outs)
DataTypes.ALL
.
ins
- the number of untyped inlets.outs
- the number of untyped outlets.protected void declareTypedIO(java.lang.String ins, java.lang.String outs)
String
s determine the number and type of inlets and outlets.
For instance, the following call declares that an object will have
two int inlets, a float inlet, then another int
inlet, and one LIST outlet.
declareTypedIO("iifi","L");
DataTypes.FLOAT
DataTypes.INT
DataTypes.MESSAGE
DataTypes.LIST
DataTypes.ALL
ins
- a String
whose length and content determines the
number and type of the inlets.outs
- a String
whose length and content determines the
number and type of the outlets.protected void setInletAssist(java.lang.String[] messages)
messages
- an array of String
s that will be displayed
as assistance when the mouse is held over the corresponding inlet.protected void setInletAssist(int index, java.lang.String message)
index
- the index of the inlet to setmessage
- a String
that will be displayed
as assistance when the mouse is held over the corresponding inlet.protected void setOutletAssist(java.lang.String[] messages)
messages
- an array of String
s that will be displayed
as assistance when the mouse is held over the corresponding outlet.protected void setOutletAssist(int index, java.lang.String message)
index
- the index of the outlet to setmessage
- a String
that will be displayed
as assistance when the mouse is held over the corresponding outlet.protected void createInfoOutlet(boolean b)
createInfoOutlet(false)
in the class's constructor. This method is only valid in the constructor.
b
- boolean that determines whether or not the info outlet will be created.public int getInfoIdx()
public int getNumInlets()
public int getInletType(int idx)
idx
- the index of the inlet to query
com.cycling74.max
public int getNumOutlets()
public int getOutletType(int idx)
idx
- the index of the outlet to query
com.cycling74.max
public java.lang.String getInletAssist(int inletIdx)
inletIdx
- the index of the inlet for
which assistance has been requested
String
that describes what the inlet doesprotected void bang()
getInlet()
protected void inlet(int value)
int
value.
Override this method in your subclass of MaxObject
if you want it to do something specific in response to an integer message.
If you do not override it, but you have defined your own
inlet(float)
method, this default method
will cast the incoming int
to float
and
call inlet(float)
.
If your subclass does not have either inlet(int)
or
inlet(float)
, this default method will call
list(Atom[])
if it exists. If none of those methods
exist it will call anything(String, Atom[])
with
a message of "int"
and a single-element in the Atom
array with the value of the incoming int
.
To determine which inlet an int message arrived at in a multi inlet MaxObject
call getInlet(). This will always contain the index of the inlet which
last received a message.
value
- the int
value that the object has receivedgetInlet()
protected void inlet(float value)
float
value.
Override this method in your subclass of MaxObject
if you want it to do something specific.
If you do not override it, but you have defined your own
inlet(int)
method, this default method
will cast the incoming float
to int
and
call inlet(float)
.
If your subclass does not have either inlet(float)
or
inlet(int)
, this default method will call
list(Atom[])
if it exists. If none of those methods
exist it will call anything(String, Atom[])
with
a message of "float"
and a single-element in the Atom
array with the value of the incoming float
.
To determine which inlet a float message arrived at in a multi inlet MaxObject
call getInlet(). This will always contain the index of the inlet which
last received a message.
value
- the float
value that the object has receivedgetInlet()
protected void list(Atom[] atomArray)
MaxObject
if you want it to do something specific.
If you do not override it, but you have defined your own
anything(String, Atom[])
method, this default method
will pass the array to anything
with
a message of "list"
. If you have not defined your own
anything
method, this default method attempts to map the
first element of the list to a matching inlet
method. For example,
if the first Atom represents an int
it will call
inlet(int)
if you have it defined.
atomArray
- the array of Atom
s received by the objectprotected void list(float[] f)
MaxObject
if you want it to do something specific.
If you do not override it, this default method will pass the array to
list(Atom[])
.
f
- the array of float
s received by the object.protected void list(int[] i)
MaxObject
if you want it to do something specific.
If you do not override it,
this default method will pass the array to list(Atom[])
.
i
- the array of int
s received by the object.protected void anything(java.lang.String message, Atom[] args)
MaxObject
if you want it to do something specific.
If there is a public method whose name and signature
is identical to the incoming message,
this method will not be called.
message
- the incoming messageargs
- the Atom
arguments attached to the incoming messagepublic java.lang.String getCodeSourcePath()
public void postCodePath()
public void viewsource()
protected int getInlet()
public inlet(int i) { int index = getInlet(); post("int received in inlet "+index); }
public java.lang.String getOutletAssist(int outletIdx)
outletIdx
- the index of the outlet for
which assistance has been requested
String
that describes what the outlet doespublic final boolean outletBang(int outletIdx)
outletIdx
- the outlet index of the outlet to send the bang from.
public final boolean outlet(int outletIdx, int value)
int
.
outletIdx
- outlet number to send fromvalue
- int
to send
public final boolean outlet(int outletIdx, byte value)
byte
.
outletIdx
- outlet number to send fromvalue
- byte
to send
public final boolean outlet(int outletIdx, short value)
short
.
outletIdx
- outlet number to send fromvalue
- short
to send
public final boolean outlet(int outletIdx, long value)
long
.
Warning, information can be lost in the conversion from long
to int
!
outletIdx
- outlet number to send fromvalue
- long
to send
public final boolean outlet(int outletIdx, float value)
float
.
outletIdx
- outlet number to send fromvalue
- float
to send
public final boolean outlet(int outletIdx, double value)
double
.
Warning, since the Max float atom type is a 32 bit floating point number
information can be lost in the conversion from a java double
to a native float
!
outletIdx
- outlet number to send fromvalue
- double
to send
public final boolean outlet(int outletIdx, java.lang.String message)
outlet(outletIdx, message, Atom.emptyArray)
.
outletIdx
- outlet number to send frommessage
- message to send
public final boolean outlet(int outletIdx, char c)
char
as a message with no arguments.
The char is output as a symbol as opposed to its integer value.
outletIdx
- outlet number to send fromc
- char to send
- Returns:
- true if successful.
public final boolean outlet(int outletIdx, boolean value)
outletIdx
- outlet number to send fromvalue
- boolean
value to send - true sends a 1, false sends a 0
public final boolean outlet(int outletIdx, java.lang.String message, Atom[] args)
outletIdx
- outlet number to send frommessage
- message to sendargs
- Atom
array to append as arguments to the message.
java.lang.NullPointerException
- if message or args
is null or if args contains nullpublic final boolean outlet(int outletIdx, Atom value)
outlet(int, int)
,
outlet(int, float)
,
or outlet(int, String)
depending on the content of the Atom
.
outletIdx
- outlet number to send fromvalue
- the Atom
to send
java.lang.NullPointerException
- if a
equals or contains nullpublic final boolean outlet(int outletIdx, Atom[] array)
Atom
s.
If the output array begins with an Atom
that represents an int
or a float
,
the array is output as a list.
If the output array begins with an Atom
that represents a String
,
the array is output as a message and arguments.
If the output array contains only one item, the
single item is output by calling
outlet(int, Atom)
.
outletIdx
- outlet number to send fromarray
- the array of Atom
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, int[] value)
int
s.
outletIdx
- outlet number to send fromvalue
- list of int
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, byte[] value)
byte
s.
outletIdx
- outlet number to send fromvalue
- list of byte
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, short[] value)
short
s.
outletIdx
- outlet number to send fromvalue
- list of short
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, long[] value)
long
s.
Warning, information can be lost in the conversion from long
to int!
outletIdx
- outlet number to send fromvalue
- list of long
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, float[] value)
float
s.
outletIdx
- outlet number to send fromvalue
- list of float
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, double[] value)
double
s.
Warning, information can be lost in the conversion from java double
to native float!
outletIdx
- outlet number to send fromvalue
- list of double
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, java.lang.String[] value)
String
s.
The array will be sent as message (the first Atom) and arguments.
outletIdx
- outlet number to send fromvalue
- list of String
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, char[] value)
char
s.
The array will be sent as message (the first Atom) and arguments.
outletIdx
- outlet number to send fromvalue
- list of char
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, boolean[] array)
boolean
s.
The array will be sent as a list of 0s and 1s.
outletIdx
- outlet number to send fromarray
- list of boolean
s to send
java.lang.NullPointerException
- if value
equals or contains nullpublic final boolean outlet(int outletIdx, java.lang.String msg, int value)
int
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- int
argument to send
public final boolean outlet(int outletIdx, java.lang.String msg, byte value)
byte
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- byte
argument to send
public final boolean outlet(int outletIdx, java.lang.String msg, short value)
short
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- short
argument to send
public final boolean outlet(int outletIdx, java.lang.String msg, long value)
long
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- long
argument to send(will be truncated to int by Max)
public final boolean outlet(int outletIdx, java.lang.String msg, float value)
float
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- float
argument to send
public final boolean outlet(int outletIdx, java.lang.String msg, double value)
double
arg.
Warning, since the Max float atom type is a 32 bit floating point number
information can be lost in the conversion from a java double
to a native float
!
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- double
to send
public final boolean outlet(int outletIdx, java.lang.String msg, java.lang.String value)
String
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- String
argument to send
public final boolean outlet(int outletIdx, java.lang.String msg, char c)
char
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- char
argument to send
public final boolean outlet(int outletIdx, java.lang.String msg, boolean value)
boolean
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- boolean
value to send - true sends a 1, false sends a 0
public final boolean outlet(int outletIdx, java.lang.String msg, Atom value)
Atom
arg.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- Atom
value to send.
public final boolean outlet(int outletIdx, java.lang.String msg, int[] value)
int
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array ofint
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, byte[] value)
byte
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array ofbyte
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, short[] value)
short
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array ofshort
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, long[] value)
long
s.
!!WARNING: longs will be truncated to ints by Max. This is a convenience method.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array oflong
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, float[] value)
float
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array offloat
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, double[] value)
double
s.
!!WARNING: longs will be truncated to floats by Max. This is a convenience method.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array offloat
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, java.lang.String[] value)
String
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array ofString
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, char[] value)
char
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array ofchar
values to send.
public final boolean outlet(int outletIdx, java.lang.String msg, boolean[] array)
boolean
s.
outletIdx
- outlet number to send frommsg
- Message to sendvalue
- array ofboolean
values to send.true will be sent as 1 and false will be sent as 0.
public final boolean outletBangHigh(int outletIdx)
outletIdx
- the index of the outlet to send through
public final boolean outletHigh(int outletIdx, int value)
outletIdx
- the index of the outlet to send throughvalue
- the value to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, float value)
outletIdx
- the index of the outlet to send throughvalue
- the value to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, double value)
outletIdx
- the index of the outlet to send throughvalue
- the value to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, java.lang.String message)
outletIdx
- the index of the outlet to send throughmessage
- the message to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, java.lang.String message, Atom[] args)
outletIdx
- the index of the outlet to send throughmessage
- the message to sendargs
- the arguments to append to the message
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, java.lang.String message, int[] values)
outletIdx
- the index of the outlet to send throughmessage
- the message to sendargs
- the arguments to append to the message
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, java.lang.String message, float[] values)
outletIdx
- the index of the outlet to send throughmessage
- the message to sendargs
- the arguments to append to the message
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, Atom[] value)
outletIdx
- the index of the outlet to send throughvalue
- the list of Atoms to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, int[] values)
outletIdx
- the index of the outlet to send throughvalue
- the list of Atoms to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic final boolean outletHigh(int outletIdx, float[] values)
outletIdx
- the index of the outlet to send throughvalue
- the list of Atoms to send
java.lang.IndexOutOfBoundsException
- if outletIdx is out of rangepublic java.lang.String toString()
toString
in class java.lang.Object
protected void save()
MaxObject
subclass to make it do
something useful.
embedMessage(java.lang.String, com.cycling74.max.Atom[])
protected void loadbang()
MaxObject
subclass
to make it do something useful.
Your class can respond to the loadbang message in any way
that it wants, but before implementing a method that responds
to loadbang, keep in mind that the user can connect your
object to the outlet of a loadbang object to perform initialization if
necessary. Note that you do not get the loadbang message
when the user creates a new instance of your object in the
Patcher window, only when a Max file containing your class is loaded from disk.
You can assume that all elements of a patch have been loaded and all connections
have been made and are valid when the loadbang message is sent to your object.
protected void dblclick()
MaxObject
subclass
to make it do something useful,for example, opening up a window to display
information about the state of your object.
protected void embedMessage(java.lang.String msg, Atom[] args)
public class saveExample extends MaxObject { private int importantData; public void set(int i) { importantData = i; } public void get() { outlet(0, importantData); } public void save() { Atom[] data = new Atom[] {Atom.newAtom(importantData)}; embedMessage("set", data); } }embedmessage can only be called from within the save method and is valid in no other context.
msg
- the name of the method that will be calledargs
- the arguments to pass to the methodsave()
protected void declareAttribute(java.lang.String name)
name
- the name of the variable to declare as an attributeprotected void declareReadOnlyAttribute(java.lang.String name)
name
- the name of the variable to declare as an attributeprotected void declareAttribute(java.lang.String name, java.lang.String getter, java.lang.String setter)
Atom
array. Tthis array will be appended as arguments
to the name of the attribute and sent
out of the info outlet.
declareAttribute("myAttribute", null, "setMyAttribute");uses a specific setter method and the default getter method.
MaxClock
or
MaxQelem
whose Executable
will interact with the
Max universe has the potential to be similarly disastrous. For instance,
an outlet call could be executed before the outlet is connected to anything
valid.
name
- the name of the variable to declare as an attributegetter
- the name of the getter methodsetter
- the name of the setter methodprotected void declareReadOnlyAttribute(java.lang.String name, java.lang.String getter)
Atom
array. This array will be appended as arguments
to the name of the attribute and sent
out of the info outlet.
name
- the name of the variable to declare as a readonly attributegetter
- the name of the getter methodpublic java.lang.Object getAttr(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, java.lang.Object val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the value you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, java.lang.Object[] args)
public boolean getAttrBool(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public boolean[] getAttrBoolArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public float getAttrByte(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public byte[] getAttrByteArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public char getAttrChar(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public char[] getAttrCharArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public short getAttrShort(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public short[] getAttrShortArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public int getAttrInt(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public int[] getAttrIntArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public long getLongAttr(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public long[] getAttrLongArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public float getAttrFloat(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public float[] getAttrFloatArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public double getAttrDouble(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public double[] getAttrDoubleArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public java.lang.String getAttrString(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public java.lang.String[] getAttrStringArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public Atom[] getAttrAtomArray(java.lang.String name)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, boolean val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, boolean[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, byte val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, byte[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, char val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, char[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, short val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, short[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, int val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, int[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, long val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, long[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, float val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, float[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, double val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, double[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, java.lang.String val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, java.lang.String[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public void setAttr(java.lang.String name, Atom[] val)
declareAttribute
methods of MaxObject.
name
- the name of the previously declared attribute.val
- the valuse you wish to set it to.
MaxRuntimeException
- if attr named name does not exist.public AttributeInfo[] getAttributeInfo()
declareAttribute
methods of MaxObject.
protected static void bail(java.lang.String errormsg)
public class myobject extends MaxObject { private int _arg = 0; //called when someone types [mxj myobject] into a box public myobject() { bail("usage: [mxj myobject required_arg]"); } //called when someone types [mxj myobject 24] into a box public myobject(int required_arg) { _arg = required_arg; } ...blah blah blah }
error
- or usage message you wish printed to the console.public void gc()
public void zap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |