|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cycling74.max.MaxObject
com.cycling74.msp.MSPObject
public abstract class MSPObject
Main object to extend to use dsp with pd. You will need to use the pdj~ external if you want to process signals. Before the dsp starts processing, the method dsp will be called and it must return the performer method that will process each dsp cycles.
Here is a basic guideline for using the MSPObject:
import com.cycling74.max.*;
import com.cycling74.msp.*;
import java.lang.reflection.Method;
public class panner extends MSPObject {
float left = 1, right = 1;
public panner() {
declareInlets( new int[] { SIGNAL, DataTypes.ANYTHING } );
declareOutlets( new int[] { SIGNAL, SIGNAL } );
}
// From 0..127
public void inlet(float val) {
if ( val > 64 ) {
right = 1;
left = ((127-val) / 64);
} else {
left = 1;
right = val / 64;
}
}
public Method dsp(MSPSignal[] ins, MSPSignal[] outs) {
return getPerformMethod("perform");
}
public void perform(MSPSignal[] ins, MSPSignal[] outs) {
for (int i=0;i<ins[0].n;i++) {
outs[0].vec[i] = ins[0].vec[i] * left;
outs[1].vec[i] = ins[0].vec[i] * right;
}
}
}
| Field Summary | |
|---|---|
static Class |
MSP_SIGNAL_ARRAY_CLZ
|
static int |
SIGNAL
Use this value to indentify a signal intlet/outlet to the method declareInlet/declareOutlet. |
| Fields inherited from class com.cycling74.max.MaxObject |
|---|
EMPTY_STRING_ARRAY, NO_INLETS, NO_OUTLETS |
| Constructor Summary | |
|---|---|
MSPObject()
|
|
| Method Summary | |
|---|---|
protected void |
declareInlets(int[] types)
Declare the inlets used by this object. |
protected void |
declareOutlets(int[] types)
Declare the outlets used by this object. |
abstract Method |
dsp(MSPSignal[] ins,
MSPSignal[] outs)
Initialize the dsp state. |
protected void |
dspstate(boolean dspRunning)
This method is called when the dsp is start/stop. |
protected Method |
getPerformMethod(String methodName)
Quicky method to be used with dsp(MSPSignal[], MSPSignal[]). |
protected void |
setNoInPlace(boolean copyBuffer)
Force to copy of each MSPBuffer when performer is called. |
| Methods inherited from class com.cycling74.max.MaxObject |
|---|
anything, bail, bang, createInfoOutlet, declareAttribute, declareIO, declareReadOnlyAttribute, declareTypedIO, embedMessage, error, gc, getContext, getErrorStream, getInfoIdx, getInlet, getInletType, getName, getNumInlets, getNumOutlets, getOutletType, getParentPatcher, getPostStream, inlet, inlet, list, loadbang, notifyDeleted, ouch, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outletBang, outletBangHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, post, save, setInletAssist, setInletAssist, setName, setOutletAssist, setOutletAssist, showException, showException, viewsource, zap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SIGNAL
public static final Class MSP_SIGNAL_ARRAY_CLZ
| Constructor Detail |
|---|
public MSPObject()
| Method Detail |
|---|
public abstract Method dsp(MSPSignal[] ins,
MSPSignal[] outs)
ins - input signalsouts - output signals
protected Method getPerformMethod(String methodName)
methodName with signature
(MSPSignal[], MSPSignal[]) in the current class.
methodName - the name of the method in the current class
protected void setNoInPlace(boolean copyBuffer)
copyBuffer - true if you need to copyBufferprotected void dspstate(boolean dspRunning)
dspRunning - true if the dsp is runningprotected void declareInlets(int[] types)
declareInlets in class MaxObjecttypes - the type of message that this inlet will use.DataTypesprotected void declareOutlets(int[] types)
declareOutlets in class MaxObjecttypes - the type of message that this inlet will use.DataTypes
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||