com.softsynth.jmsl.score
Class NotePropertiesTransform
java.lang.Object
com.softsynth.jmsl.score.NotePropertiesTransform
- Direct Known Subclasses:
- AccidentalPreferenceTransform, AltEnharmonicSpellingToggleTransform, AmplitudeTransform, BeamTransform, CrescTransform, DotTransform, DoubleTransform, DurationTransform, DynamicTransform, HalveTransform, HoldTransform, LyricLevelTransform, MarkTransform, NoteHeadTransform, OctavaTransform, RestToggleTransform, SlurTransform, TieTransform, TranspositionTransform, TupletTransform
public abstract class NotePropertiesTransform
- extends java.lang.Object
Abstract superclass for Transforms that apply to the properties of Notes in
Selection Buffer. Examples include transposition and beaming. Notes are left
in place in their tracks after their properties are altered. You should
provide a constructor that set this.name="something unique" so that this can
be put into a ScoreFrame Menu and show up with a meaningful name.
- Author:
- Nick Didkovsky , copyright 2000 Nick Didkovsky , all rights reserved
Field Summary |
static java.lang.String |
copyright
|
Method Summary |
java.lang.String |
getName()
|
abstract void |
operate(Score score,
SelectionBuffer selectionBuffer)
Implement this method to do something to the Notes in the
SelectionBuffer. |
void |
setName(java.lang.String s)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
copyright
public static final java.lang.String copyright
- See Also:
- Constant Field Values
NotePropertiesTransform
public NotePropertiesTransform()
getName
public java.lang.String getName()
setName
public void setName(java.lang.String s)
operate
public abstract void operate(Score score,
SelectionBuffer selectionBuffer)
- Implement this method to do something to the Notes in the
SelectionBuffer. Operations are upon the Notes themselves, not a clone of
the Notes. Be careful!
Example:
// transpose pitch up an octave
public void operate(SelectionBuffer selectionBuffer) {
for (Enumeration e=selectionBuffer.elements(); e.hasMoreElements(); ) {
Note note = (Note)e.nextElement();
if (!note.isRest()) {
// get pitch data, transpose it, and set it again
note.setPitchData(note.getPitchData()+12);
// Use NoteFactory to recalculate staff level, accidental, and stem direction
NoteFactory.setLevelPitch(note, note.getPitchData());
}
}
}