Package com.softsynth.jmsl.score
Class Track
java.lang.Object
com.softsynth.jmsl.MusicJob
com.softsynth.jmsl.MusicList
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
A Track is a MusicList of Note objects
JMSL Notation Project
- Author:
- Nick Didkovsky, copyright 2000 Nick Didkovsky
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
copyright
static double
TOLERABLE_ERROR
Fields inherited from class com.softsynth.jmsl.MusicJob
repeatCount
-
Constructor Summary
Constructors Constructor Description Track(Staff staff, int num)
Track(Staff staff, int num, Instrument ins)
-
Method Summary
Modifier and Type Method Description void
addUserBean(java.lang.Object bean)
Add a bean to a Staff.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.geom.Point2D
getDrawingAnchor()
double
getDuration()
returns duration, duration is used optionallyjava.lang.String
getDurationReport()
double
getEndTimeOfNote(Note note)
Note
getFirstNoteAfterTime(double startTime)
java.lang.String
getHierarchy()
int
getInsertionIndexForTime(double startTime)
Note
getLastNoteBeforeTime(double endTime)
double
getMultitrackRestAdjustmentY()
Note
getNote(int n)
Score
getScore()
Staff
getStaff()
double
getStartTimeOfNote(Note note)
int
getTrackIndex()
java.util.Vector
getUserBeans()
double
getWedgeShiftY()
shift cresc or decrec wedge up or down.boolean
hasElementsLaterThan(double time)
void
insertNote(Note note)
Insert a note at current insertion index, and increment insertion index so next note comes aftervoid
insertNote(Note note, int index)
Insert a note at specified insertion index.boolean
isBottomTrack()
legacy multitrack orientation: tracks numbered 0..numTracks/2 are stem down (bottom) and tracks with indexes greater than numStaves/2 are stem up (top) new way as of 2020-09-15 puts even numbered tracks in the bottom and odd numbered tracks in the top, so 0 and 1 are always interpreted the sameboolean
isEmpty()
void
layoutChildren()
void
layoutChildren(boolean setAnchors)
void
manageAccidentals(AccidentalLevelManager accLevelManager, Note n)
void
removeUserBean(java.lang.Object bean)
void
render(java.awt.Graphics g, double zoom)
AccidentalLevelManager
resetAccidentalLevelManager()
void
setDrawingAnchor(java.awt.geom.Point2D p)
drawingAnchor is the (x,y) point at top left of this Track's staff, equal to Note level 132void
setInsertionIndex(int i)
void
setInstrument(Instrument ins)
Sets Instrument like superclass, also translates DimensionNameSpaces of existing Notes to DimensionNameSpace of Instrumentvoid
setMultitrackRestAdjustmentY(double adjustment)
you may nudge the rests of this track up (-) or down (+) so that they can be repositioned in a multitrack settingvoid
setWedgeShiftY(double wedgeShiftY)
shift cresc or decrec wedge up or downint
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, getRepeatPlayables, getRepeats, getStartDelay, getStartPause, getStartPlayables, getStartTime, getStopDelay, getStopPlayables, 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 Details
-
TOLERABLE_ERROR
public static final double TOLERABLE_ERROR -
copyright
public static final java.lang.String copyright- See Also:
- Constant Field Values
-
-
Constructor Details
-
Track
-
Track
-
-
Method Details
-
getWedgeShiftY
public double getWedgeShiftY()shift cresc or decrec wedge up or down. The track of the first note of the wedge determines this shift- Returns:
- the wedgeShiftY
-
setWedgeShiftY
public void setWedgeShiftY(double wedgeShiftY)shift cresc or decrec wedge up or down- Parameters:
wedgeShiftY
- the wedgeShiftY to set
-
isBottomTrack
public boolean isBottomTrack()legacy multitrack orientation: tracks numbered 0..numTracks/2 are stem down (bottom) and tracks with indexes greater than numStaves/2 are stem up (top) new way as of 2020-09-15 puts even numbered tracks in the bottom and odd numbered tracks in the top, so 0 and 1 are always interpreted the same -
setInstrument
Sets Instrument like superclass, also translates DimensionNameSpaces of existing Notes to DimensionNameSpace of Instrument- Overrides:
setInstrument
in classMusicJob
-
getTrackIndex
public int getTrackIndex()- Returns:
- Track index (first track of a staff is 0, next is 1...
-
getStaff
- Returns:
- the Staff to which this track belongs
-
getScore
-
getNote
-
getUserBeans
public java.util.Vector getUserBeans() -
addUserBean
public void addUserBean(java.lang.Object bean)Add a bean to a Staff. A bean is an object with primitive fields and matching getters and setters. These will be restored when loaded.- Parameters:
bean
- The bean to add.
-
removeUserBean
public void removeUserBean(java.lang.Object bean) -
setDrawingAnchor
public void setDrawingAnchor(java.awt.geom.Point2D p)drawingAnchor is the (x,y) point at top left of this Track's staff, equal to Note level 132 -
getDrawingAnchor
public java.awt.geom.Point2D 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 -
hasElementsLaterThan
public boolean hasElementsLaterThan(double time) -
getDuration
public double getDuration()Description copied from class:MusicJob
returns duration, duration is used optionally- Overrides:
getDuration
in classMusicJob
- Returns:
- sum of getDurationData() of elements in this Track
-
getStartTimeOfNote
- Returns:
- the absolute time in this Track when Note is scheduled to start
-
getEndTimeOfNote
- Returns:
- the absolute time in this Track when Note is scheduled to stop (its startTime + its duration)
-
getFirstNoteAfterTime
- Returns:
- the First Note whose starting time is >= startTime. ie second qtr note if startTime=1.0
-
getInsertionIndexForTime
public int getInsertionIndexForTime(double startTime) -
getLastNoteBeforeTime
- 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() -
layoutChildren
public void layoutChildren(boolean setAnchors) -
setMultitrackRestAdjustmentY
public void setMultitrackRestAdjustmentY(double adjustment)you may nudge the rests of this track up (-) or down (+) so that they can be repositioned in a multitrack setting- Parameters:
adjustmentY
-
-
getMultitrackRestAdjustmentY
public double getMultitrackRestAdjustmentY()- Returns:
- the multiTrackRestAdjustmentY
-
manageAccidentals
-
resetAccidentalLevelManager
-
insertNote
Insert a note at specified insertion index. Note becomes the indexth note in track. -
insertNote
Insert a note at current insertion index, and increment insertion index so next note comes after -
setInsertionIndex
public void setInsertionIndex(int i) -
deleteNote
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 classjava.lang.Object
-
writeXML
public void writeXML(java.io.PrintWriter out) throws java.io.IOException- Specified by:
writeXML
in interfaceXMLWritable
- Throws:
java.io.IOException
-