uk.org.toot.music
Class TimedCoding

java.lang.Object
  extended by uk.org.toot.music.TimedCoding
Direct Known Subclasses:
Note

public abstract class TimedCoding
extends java.lang.Object

A TimedCoding is the abstract base class for those musical events which have a time relative to a bar. The time is encoded in the 8 most significant bits of a positive int so time-ordering of such ints is simply achieved by sorting. The time is relative to the start of a bar. The resolution is 255 ticks.

Author:
st Format 0ttttttt txxxxxxx xxxxxxxx xxxxxxxx always positive can be sorted by time (t) leaves lower 23 bits for subclass use

Constructor Summary
TimedCoding()
           
 
Method Summary
static int getTime(int coded)
          Return the time, in ticks, of the specified event.
static int setTime(int coded, int time)
          Encode the time into a coded event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedCoding

public TimedCoding()
Method Detail

getTime

public static int getTime(int coded)
Return the time, in ticks, of the specified event.

Parameters:
note - the int which contains the time of the event
Returns:
the time, in ticks, of the event

setTime

public static int setTime(int coded,
                          int time)
Encode the time into a coded event.

Parameters:
coded - the coded event to have the time set
time - the time to encode into the coded event
Returns:
int - the modified coded event


Copyright © 2004, 2005, 2006, 2007 Steve Taylor. All Rights Reserved.