public abstract class QueueDataCommand extends QueueDataEvent implements ScheduledCommand
// Queue an envelope with a completion callback.
QueueDataCommand command = envelopePlayer.dataQueue.createQueueDataCommand( envelope, 0,
envelope.getNumFrames() );
// Create an object to be called when the queued data is done.
TestQueueCallback callback = new TestQueueCallback();
command.setCallback( callback );
command.setNumLoops( 2 );
envelopePlayer.rate.set( 0.2 );
synth.queueCommand( command );
The callback will be passed QueueDataEvents.
class TestQueueCallback implements UnitDataQueueCallback
{
public void started( QueueDataEvent event )
{
System.out.println("CALLBACK: Envelope started.");
}
public void looped( QueueDataEvent event )
{
System.out.println("CALLBACK: Envelope looped.");
}
public void finished( QueueDataEvent event )
{
System.out.println("CALLBACK: Envelope finished.");
}
}
Modifier and Type | Field and Description |
---|---|
protected com.jsyn.ports.SequentialDataCrossfade |
crossfadeData |
protected SequentialData |
currentData |
autoStop, crossFadeIn, immediate, loopsLeft, numFrames, numLoops, sequentialData, skipIfOthers, startFrame
Constructor and Description |
---|
QueueDataCommand(UnitDataQueuePort port,
SequentialData sequentialData,
int startFrame,
int numFrames) |
Modifier and Type | Method and Description |
---|---|
UnitDataQueueCallback |
getCallback() |
com.jsyn.ports.SequentialDataCrossfade |
getCrossfadeData() |
SequentialData |
getCurrentData() |
abstract void |
run() |
void |
setAutoStop(boolean autoStop)
Stop the unit that contains this port after this command has finished.
|
void |
setCallback(UnitDataQueueCallback callback) |
void |
setCrossfadeData(com.jsyn.ports.SequentialDataCrossfade crossfadeData) |
void |
setCrossFadeIn(int size)
Number of frames to cross fade from the previous block to this block.
|
void |
setCurrentData(SequentialData currentData) |
void |
setImmediate(boolean immediate)
If true then the queue will be cleared and this item will be started immediately.
|
void |
setNumLoops(int numLoops)
Set how many time the block should be repeated after the first time.
|
void |
setSkipIfOthers(boolean skipIfOthers)
If true then this item will be skipped if other items are queued after it.
|
getCrossFadeIn, getLoopsLeft, getNumFrames, getNumLoops, getSequentialData, getStartFrame, isAutoStop, isImmediate, isSkipIfOthers
protected com.jsyn.ports.SequentialDataCrossfade crossfadeData
protected SequentialData currentData
public QueueDataCommand(UnitDataQueuePort port, SequentialData sequentialData, int startFrame, int numFrames)
public abstract void run()
run
in interface ScheduledCommand
public void setSkipIfOthers(boolean skipIfOthers)
skipIfOthers
- public void setImmediate(boolean immediate)
immediate
- public UnitDataQueueCallback getCallback()
public void setCallback(UnitDataQueueCallback callback)
public com.jsyn.ports.SequentialDataCrossfade getCrossfadeData()
public void setCrossfadeData(com.jsyn.ports.SequentialDataCrossfade crossfadeData)
public SequentialData getCurrentData()
public void setCurrentData(SequentialData currentData)
public void setAutoStop(boolean autoStop)
autoStop
- public void setNumLoops(int numLoops)
numLoops
- number of times to loop backpublic void setCrossFadeIn(int size)
size
-