diff options
Diffstat (limited to 'src/java/com/cycling74/msp/MSPPerformer.java')
-rw-r--r-- | src/java/com/cycling74/msp/MSPPerformer.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/java/com/cycling74/msp/MSPPerformer.java b/src/java/com/cycling74/msp/MSPPerformer.java new file mode 100644 index 0000000..2201d82 --- /dev/null +++ b/src/java/com/cycling74/msp/MSPPerformer.java @@ -0,0 +1,36 @@ +package com.cycling74.msp; + +import java.lang.reflect.Method; + +/** + * Process signals with a single method. Like MSPObject except that + * the performer method will always be "perform" (and you override it). + */ +public abstract class MSPPerformer extends MSPObject implements MSPPerformable { + + /** + * Called by PD with the dsp message is sended. This method will then + * call dspsetup and map the method "perform" has the performer method. + * You don't have to override this method, use dspsetup if initialization + * needs to be done before the signals starts processing. + */ + public Method dsp(MSPSignal[] in, MSPSignal[] out) { + dspsetup(in, out); + return getPerformMethod("perform"); + } + + /** + * Initialize the dsp state of the MSPPerformable. Override this if + * you have to initalize something before the signal starts + * processing. + */ + public void dspsetup(MSPSignal[] in, MSPSignal[] out) { + } + + /** + * Process signal inlets/outlets. You must override this since it is + * the main processing method. + */ + public abstract void perform(MSPSignal[] in, MSPSignal[] out); + +} |