com.softsynth.jmsl
Interface MusicClock

All Known Implementing Classes:
DefaultMusicClock, NonRealTimeMusicClock, SynthClock

public interface MusicClock

Interface to real time clock

Author:
Phil Burk and Nick Didkovsky

Method Summary
 double getAdvance()
           
 double getNativeRate()
          Return rate of underlying native clock.
 long getNativeTicks()
          Override this method to support other integer based clocks like JSyn's.
 double getRate()
           
 double now()
           
 double realTime()
           
 void setAdvance(double duration)
          Set amount of time to wake up early.
 void setRate(double rate)
          Set clock rate.
 void sleepUntil(double time)
          Sleep until the specified time minus the advance time.
 void sleepUntilNative(long wakeupTicks)
          Sleep until the specified native time.
 long timeToNative(double time)
          Convert JMSL time to underlying native timer ticks.
 

Method Detail

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.InterruptedException
Sleep 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.InterruptedException
Sleep until the specified native time.

Throws:
java.lang.InterruptedException - thrown if Thread.interrupt() called.