com.softsynth.jmsl.score
Class TranspositionTransform

java.lang.Object
  extended bycom.softsynth.jmsl.score.NotePropertiesTransform
      extended bycom.softsynth.jmsl.score.TranspositionTransform

public class TranspositionTransform
extends NotePropertiesTransform

Transpose pitch of Notes in Selection Buffer.

Author:
Nick Didkovsky, copyright 2000 Nick Didkovsky, all rights reserved

Field Summary
static java.lang.String copyright
           
 
Constructor Summary
TranspositionTransform(int interval)
          Constructor gives unique name, this.name = "Transpose: " + interval;
 
Method Summary
 void operate(Score score, SelectionBuffer selectionBuffer)
          Implement this method to do whatever you want to the Vector of Note accessible at selectionBuffer
 
Methods inherited from class com.softsynth.jmsl.score.NotePropertiesTransform
getName, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

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

TranspositionTransform

public TranspositionTransform(int interval)
Constructor gives unique name, this.name = "Transpose: " + interval;

Method Detail

operate

public void operate(Score score,
                    SelectionBuffer selectionBuffer)
Implement this method to do whatever you want to the Vector of Note accessible at selectionBuffer
 
      Example:
 
      // transpose pitch up or down by adding a variable called "interval" to its pitch
      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()+interval);
      			// Use NoteFactory to recalculate staff level, accidental, and stem direction
      			NoteFactory.setLevelPitch(note, note.getPitchData());
      		}
      	}
      }
      
 

Specified by:
operate in class NotePropertiesTransform