Package com.softsynth.jmsl
Interface MusicClock
- All Known Implementing Classes:
DefaultMusicClock,JSyn2SynthClock,NonRealTimeMusicClock,SynthClock
public interface MusicClock
Interface to real time clock
- Author:
- Phil Burk and Nick Didkovsky
-
Method Summary
Modifier and Type Method Description doublegetAdvance()doublegetNativeRate()Return rate of underlying native clock.longgetNativeTicks()Override this method to support other integer based clocks like JSyn's.doublegetRate()doublenow()doublerealTime()voidsetAdvance(double duration)Set amount of time to wake up early.voidsetRate(double rate)Set clock rate.voidsleepUntil(double time)Sleep until the specified time minus the advance time.voidsleepUntilNative(long wakeupTicks)Sleep until the specified native time.longtimeToNative(double time)Convert JMSL time to underlying native timer ticks.
-
Method Details
-
now
double now()- Returns:
- Current time = realTime + timeAdvance.
-
realTime
double realTime()- Returns:
- underlying system time with out timeadvance.
-
setAdvance
void setAdvance(double duration)Set amount of time to wake up early. -
getAdvance
double getAdvance()- Returns:
- Amount of time to wake up early.
-
sleepUntil
void sleepUntil(double time) throws java.lang.InterruptedExceptionSleep until the specified time minus the advance time.- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-
setRate
void setRate(double rate)Set clock rate. -
getRate
double getRate()- Returns:
- Clock rate in HZ. Normally 1.0.
-
getNativeTicks
long getNativeTicks()Override this method to support other integer based clocks like JSyn's. -
getNativeRate
double getNativeRate()Return rate of underlying native clock. -
timeToNative
long timeToNative(double time)Convert JMSL time to underlying native timer ticks. -
sleepUntilNative
void sleepUntilNative(long wakeupTicks) throws java.lang.InterruptedExceptionSleep until the specified native time.- Throws:
java.lang.InterruptedException- thrown if Thread.interrupt() called.
-