Package com.softsynth.jmsl
Class NewEventScheduler
java.lang.Object
com.softsynth.jmsl.NewEventScheduler
- All Implemented Interfaces:
java.lang.Runnable
public class NewEventScheduler
extends java.lang.Object
implements java.lang.Runnable
EventScheduler.java General purpose scheduler for events. This can be used for scheduling note
off events, or other musical events.
Any object that implements ScheduledEvent can be posted to the event scheduler. JMSL has a static shared EventScheduler. Here is an example of posting a custom event.
At futureTime the custom events play() method will be called.
MOD ND build 20060418 IMPORTANT BUG FIX! the timestamp of scheduled events is now compared to JMSL.realTime() not JMSL.now() for scheduling!
MOD ND 20070911, using wait(timeout) instead of thread.sleep() and interrupt
Any object that implements ScheduledEvent can be posted to the event scheduler. JMSL has a static shared EventScheduler. Here is an example of posting a custom event.
JMSL.scheduler.post(new CustomEvent(futureTime, data));
At futureTime the custom events play() method will be called.
MOD ND build 20060418 IMPORTANT BUG FIX! the timestamp of scheduled events is now compared to JMSL.realTime() not JMSL.now() for scheduling!
MOD ND 20070911, using wait(timeout) instead of thread.sleep() and interrupt
- Author:
- Phil Burk and Nick Didkovsky
- See Also:
ScheduledEvent
-
Field Summary
-
Constructor Summary
Constructors Constructor Description NewEventScheduler()
-
Method Summary
Modifier and Type Method Description static void
main(java.lang.String[] args)
void
post(ScheduledEvent sEvent)
Insert the new event into a list of events in time-sorted order.void
printTimes()
static int
qa()
int
qa_1()
int
qa_2()
run 10 events posted in ascending orderint
qa_3()
run 10 events posted in reverse time orderint
qa_4()
run 10 events posted in reverse time order, interrupted by a new time halfway throughvoid
run()
void
start()
Start EventScheduler thread.void
stop()
Stop EventScheduler thread.void
testDebug()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
evLog
public static java.io.PrintWriter evLog -
log
public static boolean log
-
-
Constructor Details
-
NewEventScheduler
public NewEventScheduler()
-
-
Method Details
-
start
public void start()Start EventScheduler thread. To prevent race conditions between threads, this object can only be started and stopped once. You must make a new EventSheduler if you need to restart. -
stop
public void stop()Stop EventScheduler thread. -
run
public void run()- Specified by:
run
in interfacejava.lang.Runnable
-
post
Insert the new event into a list of events in time-sorted order. -
printTimes
public void printTimes() -
qa_1
public int qa_1() -
qa_2
public int qa_2()run 10 events posted in ascending order -
qa_3
public int qa_3()run 10 events posted in reverse time order -
qa_4
public int qa_4()run 10 events posted in reverse time order, interrupted by a new time halfway through -
qa
public static int qa() -
testDebug
public void testDebug() -
main
public static void main(java.lang.String[] args)
-