org.jfugue
Class KeySignature

java.lang.Object
  extended by org.jfugue.KeySignature
All Implemented Interfaces:
JFugueElement

public class KeySignature
extends java.lang.Object
implements JFugueElement

Represents key signature changes. Key signatures are kept for the whole song, independent of tracks. You may change the key signature during a song. The Player will automatically adjust note values based on the current key signature - for example, in an F Major key signature, B will be converted to B-flat automatically, unless the B is noted as a natural B (i.e., "Bn")

Version:
3.0
Author:
David Koelle

Constructor Summary
KeySignature(byte keySig, byte scale)
          Creates a new key signature object, with the specified tempo value.
 
Method Summary
 byte getKeySig()
          Returns the key signature for this object.
 java.lang.String getMusicString()
          Returns the Music String representing this element and all of its settings.
 byte getScale()
          Returns the scale for this object.
 void setKeySig(byte keySig)
          Sets the key signature, from -7 to +7, for this object.
 void setScale(byte scale)
          Sets the scale - 0 for major, 1 for minor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeySignature

public KeySignature(byte keySig,
                    byte scale)
Creates a new key signature object, with the specified tempo value.

Parameters:
keySig - the key signature for this object, -7 to +7 - see MIDI specification for more details
scale - whether this is a major (0) or minor (1) key signature
Method Detail

setKeySig

public void setKeySig(byte keySig)
Sets the key signature, from -7 to +7, for this object. See the MIDI specification for more details

Parameters:
keySig - the key signature for this object

setScale

public void setScale(byte scale)
Sets the scale - 0 for major, 1 for minor. See the MIDI specification for more details

Parameters:
scale - the scale for this object

getKeySig

public byte getKeySig()
Returns the key signature for this object.

Returns:
the key signature for this object

getScale

public byte getScale()
Returns the scale for this object.

Returns:
the scale for this object

getMusicString

public java.lang.String getMusicString()
Returns the Music String representing this element and all of its settings. For a key signature object, the Music String is Kkeysig, where 'keysig' is a root note followed by 'maj' or 'min' (i.e., Cbmaj for C-flat major)

Specified by:
getMusicString in interface JFugueElement
Returns:
the Music String for this element