|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jmsl.MusicJob
public class MusicJob
Root executable object for JMSL.
Does something repeatedly over time.
Schedule is as follows:
Field Summary | |
---|---|
int |
repeatCount
|
Constructor Summary | |
---|---|
MusicJob()
|
Method Summary | |
---|---|
void |
add(Composable child)
Add child to end of vector containing children. |
void |
addPlayLurker(PlayLurker lurker)
adds a PlayLurker, testing first if it is not already in list. |
void |
addRepeatPlayable(Playable pl)
Add listener to the list to be called when this job repeats. |
void |
addStartPlayable(Playable pl)
Add listener to the list to be called after this job's StartDelay() |
void |
addStopPlayable(Playable pl)
Add listener to the list to be called when this job stops. |
void |
advanceCurrentTime(double deltaTime)
|
boolean |
contains(Composable child)
|
java.util.Enumeration |
elements()
return an Enumeration of children |
void |
finish()
Finish playing ASAP. |
void |
finishAll()
Finish playing ASAP, and tell all children to finish playing ASAP. |
Composable |
getChild(int n)
|
java.util.Vector |
getChildren()
|
double |
getCurrentTime()
|
DataTranslator |
getDataTranslator()
|
double |
getDuration()
returns duration, duration is used optionally |
Instrument |
getInstrument()
|
java.lang.String |
getName()
|
Composable |
getParent()
Return composable that is playing this Composable. |
java.util.Vector |
getPlayLurkers()
|
int |
getRepeatCount()
|
double |
getRepeatPause()
|
int |
getRepeats()
|
double |
getStartDelay()
Delay before starting |
double |
getStartPause()
Get time to pause after start() and startPlayables(), before repeat() |
double |
getStartTime()
|
double |
getStopDelay()
|
double |
getTimeStretch()
|
double |
getTransposition()
|
void |
halt()
Stop immediately. |
int |
indexOf(java.lang.Object child)
|
void |
insert(Composable child,
int index)
Just like Vector.insert, Inserts child at the specified index. |
double |
internalRepeat(double playTime)
This will be called N times based on the setRepeat(N) This is overridden internally in JMSL to define classes like SequentialCOllection. |
boolean |
isRunning()
|
java.lang.Thread |
launch(double startTime)
Execute at a specified time, with no invoker parent. |
java.lang.Thread |
launch(double startTime,
Composable parent)
Start executing musical function. |
static void |
main(java.lang.String[] args)
public static void main(String args[]) { MusicJob j = new MusicJob() { public double start(double playTime) { System.out.println("Welcome to JMSL. |
double |
play(double startTime)
Call start(), N*repeat(), and stop() |
double |
play(double startTime,
Composable parent)
Call start(), N*repeat(), and stop() |
void |
print()
|
void |
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. |
void |
remove(Composable child)
Remove child from vector of children |
void |
remove(int index)
Remove child at specified index |
void |
removeAll()
Remove all children |
void |
removeAllPlayLurkers()
|
void |
removeAllRepeatPlayables()
|
void |
removeAllStartPlayables()
|
void |
removeAllStopPlayables()
|
void |
removePlayLurker(PlayLurker lurker)
|
void |
removeRepeatPlayable(Playable pl)
|
void |
removeStartPlayable(Playable pl)
|
void |
removeStopPlayable(Playable pl)
|
double |
repeat(double playTime)
This will be called N times based on the setRepeat(N) Override this for custom operation. |
void |
run()
Called by thread when launched. |
void |
setCurrentTime(double currentTime)
|
void |
setDataTranslator(DataTranslator translator)
Set a Translator for this MusicJob. |
void |
setDuration(double dur)
set duration, duration is used optionally |
void |
setInstrument(Instrument ins)
Plug in an instrumental |
void |
setName(java.lang.String name)
Set name to be used by toString(). |
void |
setParent(Composable parent)
|
void |
setRepeatPause(double rd)
|
void |
setRepeats(int repeats)
set how many times this MusicJob repeats |
void |
setStartDelay(double sd)
|
void |
setStartPause(double sd)
Set time to pause after start() and startPlayables(), before repeat() |
void |
setStartTime(double startTime)
|
void |
setStopDelay(double sd)
|
void |
setTimeStretch(double timeStretch)
Set abstract value that can be used to stretch time durations. |
void |
setTransposition(double transposition)
Set abstract value that can be used to transpose pitches. |
int |
size()
You can add children to a MusicJob with the add(Composable) method. |
double |
start(double playTime)
Setup method called once when run() begins. |
double |
stop(double playTime)
Cleanup method called once when run() begins. |
double |
timeStretch()
|
double |
transposition()
|
double |
waitForDone()
Block until execution finished. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int repeatCount
Constructor Detail |
---|
public MusicJob()
Method Detail |
---|
public void add(Composable child)
public void remove(Composable child)
public void insert(Composable child, int index)
public Composable getChild(int n)
public int indexOf(java.lang.Object child)
public java.util.Vector getChildren()
public void remove(int index)
public void removeAll()
public int size()
public boolean contains(Composable child)
public java.util.Enumeration elements()
public void setParent(Composable parent)
public Composable getParent()
Composable
getParent
in interface Composable
public void setDuration(double dur)
public double getDuration()
public void setRepeats(int repeats)
public int getRepeats()
public void addStartPlayable(Playable pl)
public void removeStartPlayable(Playable pl)
public void removeAllStartPlayables()
public void addRepeatPlayable(Playable pl)
public void removeRepeatPlayable(Playable pl)
public void removeAllRepeatPlayables()
public void addStopPlayable(Playable pl)
public void removeStopPlayable(Playable pl)
public void removeAllStopPlayables()
public double getStartDelay()
public void setStartDelay(double sd)
public double getStartPause()
public void setStartPause(double sd)
public double getRepeatPause()
public void setRepeatPause(double rd)
public double getStopDelay()
public void setStopDelay(double sd)
public void setTimeStretch(double timeStretch)
setTimeStretch
in interface Composable
public double getTimeStretch()
getTimeStretch
in interface Composable
public double timeStretch()
timeStretch
in interface Composable
public void setTransposition(double transposition)
setTransposition
in interface Composable
public double getTransposition()
getTransposition
in interface Composable
public double transposition()
transposition
in interface Composable
public double start(double playTime) throws java.lang.InterruptedException
start
in interface Composable
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public double internalRepeat(double playTime) throws java.lang.InterruptedException
internalRepeat
in interface Composable
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public double repeat(double playTime) throws java.lang.InterruptedException
repeat
in interface Composable
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public double stop(double playTime) throws java.lang.InterruptedException
stop
in interface Composable
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public double waitForDone() throws java.lang.InterruptedException
waitForDone
in interface Composable
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public boolean isRunning()
public int getRepeatCount()
public void setStartTime(double startTime)
public double getStartTime()
public void setCurrentTime(double currentTime)
public double getCurrentTime()
public void advanceCurrentTime(double deltaTime)
public double play(double startTime) throws java.lang.InterruptedException
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public double play(double startTime, Composable parent) throws java.lang.InterruptedException
play
in interface Playable
java.lang.InterruptedException
- thrown if Thread.interrupt() called.public void run()
run
in interface java.lang.Runnable
public void halt()
halt
in interface Composable
public java.lang.Thread launch(double startTime, Composable parent)
launch
in interface Composable
public java.lang.Thread launch(double startTime)
public void finish()
Composable
finish
in interface Composable
public void finishAll()
Composable
finishAll
in interface Composable
public void setName(java.lang.String name)
setName
in interface Composable
public java.lang.String getName()
getName
in interface Composable
public Instrument getInstrument()
public void setInstrument(Instrument ins)
public void print()
public void printHierarchy(int level)
printHierarchy
in interface Composable
public void printHierarchy()
public java.util.Vector getPlayLurkers()
public void addPlayLurker(PlayLurker lurker)
public void removePlayLurker(PlayLurker lurker)
public void removeAllPlayLurkers()
public static void main(java.lang.String[] args)
public static void main(String args[]) { MusicJob j = new MusicJob() { public double start(double playTime) { System.out.println("Welcome to JMSL. This message was printed by MusicJob.start()"); return playTime; } public double stop(double playTime) { System.out.println("This message was printed by MusicJob.stop()"); System.out.println("stop() will now call System.exit(0). Good-bye."); System.exit(0); return playTime; } public double repeat(double playTime) { System.out.println("MusicJob repeating " + getRepeatCount() + " / " + getRepeats() + ". My playTime is " + playTime); return playTime + 1; } }; j.setRepeats(4); j.launch(JMSL.now()); }
public DataTranslator getDataTranslator()
public void setDataTranslator(DataTranslator translator)
translator
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |