|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--Chord
Represents a musical chord and the operations that can be performed on it.
| Constructor Summary | |
Chord()
Creates an empty chord with default values for the minimum and maximum notes for the clefs. |
|
Chord(Chord toCopy)
Copy constructor. |
|
Chord(int[] midiVals,
java.lang.String breakpoint)
Creates a chord from an array of integers representing MIDI values. Resolution is done as much as possible. |
|
Chord(int[] midiVals,
java.lang.String breakpoint,
java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
Creates a chord from an array of integers representing MIDI values. Resolution is done as much as possible. Given values used for clef limits. |
|
Chord(java.lang.String notes)
Creates a chord from a string of notes in standard designation. The CLEF_DIVIDER in the string, determines which staff notes go on. Notes before it are added to the bass clef and notes after it are added to the treble clef. If there is not s bar, the string is not valid input. Default values used for clef limits. |
|
Chord(java.lang.String notes,
java.lang.String breakpoint)
Creates a chord from a string of notes in standard designation. The break point determines which staff the notes go on.  If there is a CLEF_DIVIDER in the string, it overrides the break point and notes before it are added to the bass clef and notes after it are added to the treble clef.  Default values used for clef limits. |
|
Chord(java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
Creates an empty chord using passed values for the minimum and maximum notes for the clefs. |
|
Chord(java.lang.String notes,
java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
Creates a chord from a string of notes in standard designation. The CLEF_DIVIDER in the string, determines which staff notes go on. Notes before it are added to the bass clef and notes after it are added to the treble clef. If there is not s bar, the string is not valid input. |
|
Chord(java.lang.String notes,
java.lang.String breakpoint,
java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
Creates a chord from a string of notes in standard designation. The break point determines which staff the notes go on. |
|
| Method Summary | |
void |
addNote(int midiVal,
char staff)
Adds note represented by the MIDI value to the staff designated. If the note is already there and on the correct staff, it does nothing. |
void |
addNote(int midiVal,
java.lang.String breakpoint)
Adds note represented by the MIDI value as determined by the breakpoint. If the note is already there, it does nothing. |
void |
addNote(java.lang.String stdDes,
char staff)
Adds note represented by stdDes to the staff designated. If the note is already there with the same representation, it does nothing. If it is there with an alternate representation, it toggles the value of the note. Conflicts are not resolved because it is assumed that if a note is being added by standard designation, its position is intentional. |
void |
addNote(java.lang.String stdDes,
java.lang.String breakpoint)
Adds note represented by stdDes by the breakpoint given. If the note is already there with the same representation, it does nothing. If it is there with an alternate representation, it toggles the value of the note. Conflicts are not resolved because it is assumed that if a note is being added by standard designation, its position is intentional. |
void |
addNotes(int[] midiVals,
java.lang.String breakpoint)
Adds all of the notes represented by the values in midiVals according to the breakpoint. Conflict resolution is done as much as possible. |
void |
addNotes(java.lang.String notes)
Adds all of the notes represented by notes according to the CLEF_DIVIDER. Resolution is not done and toggling standards are the same as for adding a single note by standard designation and staff. |
void |
addNotes(java.lang.String notes,
java.lang.String breakpoint)
Adds all of the notes represented by notes according to the breakpoint.  A CLEF_DIVIDER in the string overrides the breakpoint.  Resolution is not done and toggling standards are the same as for adding a single note by standard designation and breakpoint or standard designation and staff if the bar is present. |
boolean |
canTranspose(int numSteps)
False if transposing numSteps half steps will cause any of the notes in the chord to go out of valid MIDI bounds. |
void |
clear()
Clears all notes from the chord. |
void |
flipPres(int midiVal,
char staff)
Adds the note represented by midiVal if it is not present and adds it if it is. If necessary, uses the staff to determine where to put it. |
void |
flipPres(int midiVal,
java.lang.String breakpoint)
Adds the note represented by midiVal if it is not present and adds it if it is. If necessary, uses the breakpoint to determine where to put it. |
void |
flipPres(java.lang.String stdDes,
char staff)
Adds the note represented by stdDes if it is not present and adds it if it is. |
void |
flipPres(java.lang.String stdDes,
java.lang.String breakpoint)
Adds the note represented by stdDes if it is not present and adds it if it is. If necessary, uses the breakpoint to determine where to put it. |
java.lang.String |
getBassMax()
Returns the highest note that can be put on the bass clef. |
int[] |
getBassMIDI()
Returns an array of ints. Each int is the MIDI value of one of the notes from the bass clef. Notes will be sorted and in order based on their standard designation representation. |
java.lang.String |
getBassMin()
Returns the lowest note that can be put on the bass clef. |
java.lang.String[] |
getBassStdDes()
Returns an array of strings. Each string is the standard desination value of one of the notes from the bass clef. Notes will be sorted and in order based on their standard designation representation. |
java.lang.String |
getTitle()
Returns the string representing the chord title. |
java.lang.String |
getTrebleMax()
Returns the highest note that can be put on the treble clef. |
int[] |
getTrebleMIDI()
Returns an array of ints. |
java.lang.String |
getTrebleMin()
Returns the lowest note that can be put on the treble clef. |
java.lang.String[] |
getTrebleStdDes()
Returns an array of strings. Each string is the standard desination value of one of the notes from the treble clef. Notes will be sorted and in order based on their standard designation representation. |
boolean |
isCleared()
True if there are no notes in the chord and the title has no value. |
boolean |
isEmpty()
True if there are no notes in the chord. |
char |
locate(int midiVal)
Returns BASS if the note is on the bass clef, TREBLE if it is on the treble, and ' ' if the note is not part of the chord. |
char |
locate(java.lang.String stdDes)
Returns BASS if the note is on the bass clef, TREBLE if it is on the treble, and ' ' if the note is not part of the chord. |
void |
play()
Creates a new thread with a ChordPlayer object to play this chord. |
java.lang.String |
removeNote(int midiVal)
Removes note with MIDI value corresponding to midiVal. Returns the standard designation string of the note removed. |
java.lang.String |
removeNote(java.lang.String stdDes)
Removes note with MIDI value corresponding that of the note represented by stdDes. Returns the standard designation string of the note removed. A note with a different standard desination than the one sent may be removed. |
int |
sameLine(java.lang.String note,
char staff)
Returns a set of flags encoded in an integer which state what variations of a note are on that line. The sharp is the 3rd least significant bit; i.e. , 4 or 0100b. Natural is the 2nd least significant bit; 2 or 0010b. Flat is the least significant bit; 1 or 0001b. These are OR'ed together to get the return value. |
void |
setTitle(java.lang.String title)
Sets the chord title equal to the value of the string given. |
void |
transpose(int numSteps)
Tranposing the chord by numSteps half steps. The user is responsible for making sure each chord can be transposed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Chord()
public Chord(java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
bassMin - Standard designation value of lowest note that can
go on the bass clef.bassMax - Standard designation value of the highest note that
can go on the bass clef.trebleMin - Standard designation value of the lowest note that
can go on the treble clef.trebleMax - Standard designation value of the highest note that
can go on the treble clef.
public Chord(int[] midiVals,
java.lang.String breakpoint)
midiVals - MIDI values of the notes to be put into the Chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public Chord(int[] midiVals,
java.lang.String breakpoint,
java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
midiVals - MIDI values of the notes to be put into the Chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.bassMin - Standard designation value of lowest note that can
go on the bass clef.bassMax - Standard designation value of the highest note that
can go on the bass clef.trebleMin - Standard designation value of the lowest note that
can go on the treble clef.trebleMax - Standard designation value of the highest note that
can go on the treble clef.
public Chord(java.lang.String notes,
java.lang.String breakpoint)
notes - Notes in standard designation that are to be put
into the chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public Chord(java.lang.String notes,
java.lang.String breakpoint,
java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
notes - Notes in standard designation that are to be put
into the chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.bassMin - Standard designation value of lowest note that can
go on the bass clef.bassMax - Standard designation value of the highest note that
can go on the bass clef.trebleMin - Standard designation value of the lowest note that
can go on the treble clef.trebleMax - Standard designation value of the highest note that
can go on the treble clef.public Chord(java.lang.String notes)
notes - Notes in standard designation that are to be put
into the chord.
public Chord(java.lang.String notes,
java.lang.String bassMin,
java.lang.String bassMax,
java.lang.String trebleMin,
java.lang.String trebleMax)
notes - Notes in standard designation that are to be put
into the chord.bassMin - Standard designation value of lowest note that can
go on the bass clef.bassMax - Standard designation value of the highest note that
can go on the bass clef.trebleMin - Standard designation value of the lowest note that
can go on the treble clef.trebleMax - Standard designation value of the highest note that
can go on the treble clef.public Chord(Chord toCopy)
toCopy - Chord that is copied.| Method Detail |
public void addNotes(int[] midiVals,
java.lang.String breakpoint)
midiVals - MIDI values of the notes to be put into the Chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public void addNotes(java.lang.String notes,
java.lang.String breakpoint)
notes - Notes in standard designation that are to be put
into the chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.public void addNotes(java.lang.String notes)
notes - Notes in standard designation that are to be put
into the chord.
public void addNote(int midiVal,
java.lang.String breakpoint)
midiVal - MIDI value of the note to be put into the Chord.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public void addNote(int midiVal,
char staff)
midiVal - MIDI value of the note to be put into the Chord.staff - Staff (TREBLE or BASS) that the note should go on.
public void addNote(java.lang.String stdDes,
java.lang.String breakpoint)
stdDes - Standard designation string of the note to be added.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public void addNote(java.lang.String stdDes,
char staff)
stdDes - Standard designation string of the note to be added.staff - Staff (TREBLE or BASS) that the note should go on.public java.lang.String removeNote(int midiVal)
midiVal - MIDI number of the note to be removed.public java.lang.String removeNote(java.lang.String stdDes)
stdDes - Standard designation value of the note to be
removed.
public void flipPres(int midiVal,
java.lang.String breakpoint)
midiVal - MIDI number of the note being flipped.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public void flipPres(int midiVal,
char staff)
midiVal - MIDI number of the note being flipped.staff - Staff (TREBLE or BASS) that the note should go on.
public void flipPres(java.lang.String stdDes,
java.lang.String breakpoint)
stdDes - Standard designation value of the note to be
flipped.breakpoint - Notes lower than this value go on the bass clef,
rest go on the treble clef.
public void flipPres(java.lang.String stdDes,
char staff)
stdDes - Standard designation value of the note to be
flipped.staff - Staff (TREBLE or BASS) that the note should go on.public void clear()
public boolean isEmpty()
public boolean isCleared()
public char locate(java.lang.String stdDes)
stdDes - Standard designation value of the note to be
located.public char locate(int midiVal)
midiVal - MIDI number of the note to be located.public boolean canTranspose(int numSteps)
numSteps - Number of half steps in the transposition.public void transpose(int numSteps)
numSteps - Number of half steps in the transposition.public void play()
public void setTitle(java.lang.String title)
title - New title for the chord.public java.lang.String[] getBassStdDes()
public int[] getBassMIDI()
public java.lang.String[] getTrebleStdDes()
public int[] getTrebleMIDI()
public int sameLine(java.lang.String note,
char staff)
note - Note to be tested against.public java.lang.String getTitle()
public java.lang.String getBassMin()
public java.lang.String getBassMax()
public java.lang.String getTrebleMin()
public java.lang.String getTrebleMax()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||