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.Stringcopyrightstatic doubleTOLERABLE_ERRORFields 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 voidaddUserBean(java.lang.Object bean)Add a bean to a Staff.voiddeleteNote(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.Point2DgetDrawingAnchor()doublegetDuration()returns duration, duration is used optionallyjava.lang.StringgetDurationReport()doublegetEndTimeOfNote(Note note)NotegetFirstNoteAfterTime(double startTime)java.lang.StringgetHierarchy()intgetInsertionIndexForTime(double startTime)NotegetLastNoteBeforeTime(double endTime)doublegetMultitrackRestAdjustmentY()NotegetNote(int n)ScoregetScore()StaffgetStaff()doublegetStartTimeOfNote(Note note)intgetTrackIndex()java.util.VectorgetUserBeans()doublegetWedgeShiftY()shift cresc or decrec wedge up or down.booleanhasElementsLaterThan(double time)voidinsertNote(Note note)Insert a note at current insertion index, and increment insertion index so next note comes aftervoidinsertNote(Note note, int index)Insert a note at specified insertion index.booleanisBottomTrack()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 samebooleanisEmpty()voidlayoutChildren()voidlayoutChildren(boolean setAnchors)voidmanageAccidentals(AccidentalLevelManager accLevelManager, Note n)voidremoveUserBean(java.lang.Object bean)voidrender(java.awt.Graphics g, double zoom)AccidentalLevelManagerresetAccidentalLevelManager()voidsetDrawingAnchor(java.awt.geom.Point2D p)drawingAnchor is the (x,y) point at top left of this Track's staff, equal to Note level 132voidsetInsertionIndex(int i)voidsetInstrument(Instrument ins)Sets Instrument like superclass, also translates DimensionNameSpaces of existing Notes to DimensionNameSpace of InstrumentvoidsetMultitrackRestAdjustmentY(double adjustment)you may nudge the rests of this track up (-) or down (+) so that they can be repositioned in a multitrack settingvoidsetWedgeShiftY(double wedgeShiftY)shift cresc or decrec wedge up or downintsize()You can add children to a MusicJob with the add(Composable) method.java.lang.StringtoString()voidwriteXML(java.io.PrintWriter out)Methods inherited from class com.softsynth.jmsl.MusicList
add, finishAll, get, getChildren, internalRepeat, main, start, stopMethods 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, waitForDoneMethods 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:
setInstrumentin 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:MusicJobYou 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:MusicJobreturns duration, duration is used optionally- Overrides:
getDurationin 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:
toStringin classjava.lang.Object
-
writeXML
public void writeXML(java.io.PrintWriter out) throws java.io.IOException- Specified by:
writeXMLin interfaceXMLWritable- Throws:
java.io.IOException
-