Package com.softsynth.jmsl
Interface Composable
- All Superinterfaces:
Playable,java.lang.Runnable
- All Known Implementing Classes:
ClockTicker,DimensionNameSpaceEditorTest,FMNoodler,HardCodedMusicJob,Measure,MeasureMetronome,MidiNoteRecorder,MusicJob,MusicList,MusicShape,ParallelCollection,Player,PrintingJob,QueueCollection,SabbathBrideMusicShape,ScoreCollection,SeqGenDemo.SeqJob,SequentialCollection,Staff,TestSamplePitchbend,TextJob,Track
public interface Composable extends Playable, java.lang.Runnable
Define the interface for Composable objects for JMSL.
This interface is central to creating classes that can be placed in JMSL hierarchies.
Any object that supports this interface can be placed
in a JMSL hierarchy and scheduled.
See MusicJob, ParallelCollection, SequentialCollection, MusicShape, etc
See MusicJob, ParallelCollection, SequentialCollection, MusicShape, etc
- Author:
- Phil Burk and Nick Didkovsky
-
Method Summary
Modifier and Type Method Description voidfinish()Finish playing ASAP.voidfinishAll()Finish playing ASAP, and tell all children to finish playing ASAP.java.lang.StringgetName()ComposablegetParent()Return composable that is playing this Composable.doublegetTimeStretch()doublegetTransposition()voidhalt()Stop executing immediately.doubleinternalRepeat(double playTime)This will be called N times based on the setRepeat(N) This is overridden internally in JMSL to define classes like SequentialCOllection.java.lang.Threadlaunch(double time, Composable parent)Start executing musical function.voidprintHierarchy(int level)Very helpful printing function: print yourself and print all your children, who in turn print themselves and all THEIR children.doublerepeat(double playTime)This will be called N times based on the setRepeat(N) Override this for custom operation.voidsetName(java.lang.String name)Set name to be used by toString().voidsetTimeStretch(double timeStretch)Set abstract value that can be used to stretch time durations.voidsetTransposition(double transposition)Set abstract value that can be used to transpose pitches.doublestart(double playTime)Setup method called once when run() begins.doublestop(double playTime)Cleanup method called once when run() ends.doubletimeStretch()doubletransposition()doublewaitForDone()Block until execution finished.Methods inherited from interface java.lang.Runnable
run
-
Method Details
-
finish
void finish()Finish playing ASAP. -
finishAll
void finishAll()Finish playing ASAP, and tell all children to finish playing ASAP. -
start
double start(double playTime) throws java.lang.InterruptedExceptionSetup method called once when run() begins. Override this for custom setup.- Returns:
- endTime
- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-
internalRepeat
double internalRepeat(double playTime) throws java.lang.InterruptedExceptionThis will be called N times based on the setRepeat(N) This is overridden internally in JMSL to define classes like SequentialCOllection.- Returns:
- stopTime
- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-
repeat
double repeat(double playTime) throws java.lang.InterruptedExceptionThis will be called N times based on the setRepeat(N) Override this for custom operation. Called immediately after play() called.- Returns:
- stopTime
- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-
stop
double stop(double playTime) throws java.lang.InterruptedExceptionCleanup method called once when run() ends. Override this for custom setup.- Returns:
- endTime
- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-
launch
Start executing musical function. Return immediately.- Returns:
- Thread for the child context.
-
waitForDone
double waitForDone() throws java.lang.InterruptedExceptionBlock until execution finished.- Returns:
- stopTime
- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-
halt
void halt()Stop executing immediately. Halt any children in hierarchy. -
setName
void setName(java.lang.String name)Set name to be used by toString(). -
getName
java.lang.String getName()- Returns:
- name to be used by toString().
-
printHierarchy
void printHierarchy(int level)Very helpful printing function: print yourself and print all your children, who in turn print themselves and all THEIR children. Use indenting to show hierarchy. -
setTimeStretch
void setTimeStretch(double timeStretch)Set abstract value that can be used to stretch time durations. Values above 1.0 will slow things down. -
getTimeStretch
double getTimeStretch() -
timeStretch
double timeStretch()- Returns:
- timeStretch of all parents multiplied together
-
setTransposition
void setTransposition(double transposition)Set abstract value that can be used to transpose pitches. -
getTransposition
double getTransposition() -
transposition
double transposition()- Returns:
- transposition of all parents added together
-
getParent
Composable getParent()Return composable that is playing this Composable.- Returns:
- composable that is playing this Composable or null.
-