com.softsynth.jmsl.score
Class Track

java.lang.Object
  extended by com.softsynth.jmsl.MusicJob
      extended by com.softsynth.jmsl.MusicList
          extended by com.softsynth.jmsl.score.Track
All Implemented Interfaces:
Composable, Playable, XMLWritable, java.lang.Runnable

public class Track
extends MusicList
implements XMLWritable

Track
A Track is a MusicList of Note objects
JMSL Notation Project

Author:
Nick Didkovsky, copyright 2000 Nick Didkovsky

Field Summary
static java.lang.String copyright
           
static double TOLERABLE_ERROR
           
 
Fields inherited from class com.softsynth.jmsl.MusicJob
repeatCount
 
Constructor Summary
Track(Staff staff, int num)
           
Track(Staff staff, int num, Instrument ins)
           
 
Method Summary
 void deleteNote(Note note)
          delete a Note from this track
If isMonoNote, delete with removeElement()
If isInterval, delete it from the chord handle's vector of intervals If isHandle of chord, removeElement, set new handle to first interval and insert that.
 java.awt.Point getDrawingAnchor()
           
 double getDuration()
          returns duration, duration is used optionally
 java.lang.String getDurationReport()
           
 double getEndTimeOfNote(Note note)
           
 Note getFirstNoteAfterTime(double startTime)
           
 java.lang.String getHierarchy()
           
 int getInsertionIndexForTime(double startTime)
           
 Note getLastNoteBeforeTime(double endTime)
           
 Note getNote(int n)
           
 Score getScore()
           
 Staff getStaff()
           
 double getStartTimeOfNote(Note note)
           
 int getTrackIndex()
           
 boolean hasElementsLaterThan(double time)
           
 void insertNote(Note note)
          Insert a note at current insertion index, and increment insertion index so next note comes after
 void insertNote(Note note, int index)
           
 boolean isEmpty()
           
 void layoutChildren()
           
 void render(java.awt.Graphics g, double zoom)
           
 void setDrawingAnchor(java.awt.Point p)
          drawingAnchor is the (x,y) point at top left of this Track's staff, equal to Note level 132
 void setInsertionIndex(int i)
           
 void setInstrument(Instrument ins)
          Sets Instrument like superclass, also translates DimensionNameSpaces of existing Notes to DimensionNameSpace of Instrument
 int size()
          You can add children to a MusicJob with the add(Composable) method.
 java.lang.String toString()
           
 void writeXML(java.io.PrintWriter out)
           
 
Methods inherited from class com.softsynth.jmsl.MusicList
add, finishAll, get, getChildren, internalRepeat, main, start, stop
 
Methods inherited from class com.softsynth.jmsl.MusicJob
add, addPlayLurker, addRepeatPlayable, addStartPlayable, addStopPlayable, advanceCurrentTime, contains, elements, finish, getChild, getCurrentTime, getDataTranslator, getInstrument, getName, getParent, getPlayLurkers, getRepeatCount, getRepeatPause, getRepeats, getStartDelay, getStartPause, getStartTime, getStopDelay, getTimeStretch, getTransposition, halt, indexOf, insert, isRunning, launch, launch, play, play, print, printHierarchy, printHierarchy, remove, remove, removeAll, removeAllPlayLurkers, removeAllRepeatPlayables, removeAllStartPlayables, removeAllStopPlayables, removePlayLurker, removeRepeatPlayable, removeStartPlayable, removeStopPlayable, repeat, run, setCurrentTime, setDataTranslator, setDuration, setName, setParent, setRepeatPause, setRepeats, setStartDelay, setStartPause, setStartTime, setStopDelay, setTimeStretch, setTransposition, timeStretch, transposition, waitForDone
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOLERABLE_ERROR

public static final double TOLERABLE_ERROR

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values
Constructor Detail

Track

public Track(Staff staff,
             int num)

Track

public Track(Staff staff,
             int num,
             Instrument ins)
Method Detail

setInstrument

public void setInstrument(Instrument ins)
Sets Instrument like superclass, also translates DimensionNameSpaces of existing Notes to DimensionNameSpace of Instrument

Overrides:
setInstrument in class MusicJob

getTrackIndex

public int getTrackIndex()
Returns:
Track index (first track of a staff is 0, next is 1...

getStaff

public Staff getStaff()
Returns:
the Staff to which this track belongs

getScore

public Score getScore()

getNote

public Note getNote(int n)

setDrawingAnchor

public void setDrawingAnchor(java.awt.Point p)
drawingAnchor is the (x,y) point at top left of this Track's staff, equal to Note level 132


getDrawingAnchor

public java.awt.Point getDrawingAnchor()

isEmpty

public boolean isEmpty()

size

public int size()
Description copied from class: MusicJob
You can add children to a MusicJob with the add(Composable) method. size() returns the number of children added. Subclasses of MusicJob: MusicShape.size() returns the number of elements added ParallelCollection.size() returns the number of Composable children to be launched in parallel SequentialCollection.size() returns the number of Composable children to be launched in sequence

Overrides:
size in class MusicJob
Returns:
number of children add()'ed

hasElementsLaterThan

public boolean hasElementsLaterThan(double time)

getDuration

public double getDuration()
Description copied from class: MusicJob
returns duration, duration is used optionally

Overrides:
getDuration in class MusicJob
Returns:
sum of getDurationData() of elements in this Track

getStartTimeOfNote

public double getStartTimeOfNote(Note note)
Returns:
the absolute time in this Track when Note is scheduled to start

getEndTimeOfNote

public double getEndTimeOfNote(Note note)
Returns:
the absolute time in this Track when Note is scheduled to stop (its startTime + its duration)

getFirstNoteAfterTime

public Note getFirstNoteAfterTime(double startTime)
Returns:
the First Note whose starting time is >= startTime. ie second qtr note if startTime=1.0

getInsertionIndexForTime

public int getInsertionIndexForTime(double startTime)

getLastNoteBeforeTime

public Note getLastNoteBeforeTime(double endTime)
Returns:
last note whose starttime is <= endTime, returns highest note of chord if last note is a chord root

getDurationReport

public java.lang.String getDurationReport()

layoutChildren

public void layoutChildren()

insertNote

public void insertNote(Note note,
                       int index)

insertNote

public void insertNote(Note note)
Insert a note at current insertion index, and increment insertion index so next note comes after


setInsertionIndex

public void setInsertionIndex(int i)

deleteNote

public void deleteNote(Note note)
delete a Note from this track
If isMonoNote, delete with removeElement()
If isInterval, delete it from the chord handle's vector of intervals If isHandle of chord, removeElement, set new handle to first interval and insert that.


render

public void render(java.awt.Graphics g,
                   double zoom)

getHierarchy

public java.lang.String getHierarchy()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

writeXML

public void writeXML(java.io.PrintWriter out)
              throws java.io.IOException
Specified by:
writeXML in interface XMLWritable
Throws:
java.io.IOException