Class ExtChordSymbol
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
AltExtChordSymbol
,NCExtChordSymbol
- Chord rendering information
- An optional conditionnally-enabled alternate chord symbol.
This is an immutable class.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate a 'C' chord symbol with a standard rendering info and no alternate chord symbol.Create an ExtChordSymbol with a standard RenderingInfo and no alternate chord symbol.ExtChordSymbol
(ChordSymbol cs, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Create an ExtChordSymbol from the specified ChordSymbol with the specified parameters.ExtChordSymbol
(Note rootDg, Note bassDg, ChordType ct) Create an ExtChordSymbol with a standard RenderingInfo and no alternate chord symbol.ExtChordSymbol
(Note rootDg, Note bassDg, ChordType ct, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Create an ExtChordSymbol from the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic ExtChordSymbol
boolean
Comparison is based on rootNote and bassNote relative pitch, ChordType and originalName.int
fitNote
(int srcRelPitch, ExtChordSymbol destEcs) Adapt a source note from this chord symbol to a destination chord symbol.static ExtChordSymbol
Create a ChordSymbol from a chord string specification, with a standard RenderingInfo and no alternate chord symbol.static ExtChordSymbol
get
(String s, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Create a ChordSymbol from a chord string specification, with the specified RenderingInfo and alternate chord symbol.Get the optional alternate chord symbol.Get the optional filter used to check if we need to use the alternate chord symbol.getChordSymbol
(String altDataFilterString) Get this object or the alternate chord symbol, depending on the specified string.getCopy
(ChordSymbol cs, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Get a copy of this ExtChordSymbol, possibly modified with the specified parameters.getTransposedChordSymbol
(int t, Note.Alteration alt) Get a transposed ExtChordSymbol.int
hashCode()
boolean
True if this object's chord type is the same that cs chord type, and if root/bass relative pitches are the same.Methods inherited from class org.jjazz.harmony.api.ChordSymbol
clone, dump, getBassNote, getChord, getChordType, getName, getOriginalName, getRandom, getRelativePitch, getRelativePitch, getRelativePitch, getRootNote, getSimplified, isSameChordType, toNoteString, toString
-
Constructor Details
-
ExtChordSymbol
public ExtChordSymbol()Create a 'C' chord symbol with a standard rendering info and no alternate chord symbol. -
ExtChordSymbol
Create an ExtChordSymbol with a standard RenderingInfo and no alternate chord symbol.- Parameters:
rootDg
-bassDg
-ct
-
-
ExtChordSymbol
Create an ExtChordSymbol with a standard RenderingInfo and no alternate chord symbol.- Parameters:
cs
-
-
ExtChordSymbol
public ExtChordSymbol(ChordSymbol cs, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Create an ExtChordSymbol from the specified ChordSymbol with the specified parameters.- Parameters:
cs
-rInfo
-altChordSymbol
- Can be null if altFilter is also nullaltFilter
- Can be null if altChordSymbol is also null
-
ExtChordSymbol
public ExtChordSymbol(Note rootDg, Note bassDg, ChordType ct, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Create an ExtChordSymbol from the specified parameters.- Parameters:
rootDg
-bassDg
-ct
-rInfo
-altChordSymbol
- Optional alternate chord symbol. If not null altFilter must be also non-null.altFilter
- Optional filter to enable the use of the alternate chord symbol. If not null altChordSymbol must be also non-null.
-
-
Method Details
-
get
Create a ChordSymbol from a chord string specification, with a standard RenderingInfo and no alternate chord symbol.If string contains a '/', use ChordRenderingInfo.BassLineModifier.PEDAL_BASS as bassLineModifier. If string is "NC" returns the special NCExtChordSymbol instance.
- Parameters:
s
- Eg 'C7' or 'NC'- Returns:
- Throws:
ParseException
-
get
public static ExtChordSymbol get(String s, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) throws ParseException Create a ChordSymbol from a chord string specification, with the specified RenderingInfo and alternate chord symbol.- Parameters:
s
- Eg 'C7' or 'NC'rInfo
- Can't be nullaltChordSymbol
- Optional alternate chord symbol. If not null altFilter must be also non-null.altFilter
- Optional filter to enable the use of the alternate chord symbol. If not null altChordSymbol must be also non-null.- Returns:
- Throws:
ParseException
-
getCopy
public ExtChordSymbol getCopy(ChordSymbol cs, ChordRenderingInfo rInfo, AltExtChordSymbol altChordSymbol, AltDataFilter altFilter) Get a copy of this ExtChordSymbol, possibly modified with the specified parameters.- Parameters:
cs
- If not null return value will use this parameter.rInfo
- If not null return value will use this parameter.altChordSymbol
- If not null return value will use this parameter. If not null altFilter must be also non-null.altFilter
- If not null return value will use this parameter. If not null altChordSymbol must be also non-null.- Returns:
-
hashCode
public int hashCode()- Overrides:
hashCode
in classChordSymbol
-
equals
Description copied from class:ChordSymbol
Comparison is based on rootNote and bassNote relative pitch, ChordType and originalName.- Overrides:
equals
in classChordSymbol
-
getChordSymbol
Get this object or the alternate chord symbol, depending on the specified string.Return this object if :
- altDataFilterString is null, or
- alternate ChordSymbol is null, or
- the AltDataFilter is null, or
- the non-null AltDataFilter does not accept the specified string.Otherwise return getAlternateChordSymbol().
- Parameters:
altDataFilterString
- String to be passed to the AltDataFilter- Returns:
-
getAlternateChordSymbol
Get the optional alternate chord symbol.- Returns:
- If null getAlternateFilter() will also return null.
-
getAlternateFilter
Get the optional filter used to check if we need to use the alternate chord symbol.- Returns:
- If null getAlternateChordSymbol() will also return null.
-
fitNote
Adapt a source note from this chord symbol to a destination chord symbol.If source note is a degree of the source chord symbol (ex: G=b7 for A7) :
- Try to reapply it to the destination chord symbol. Ex: G becomes B for C7M dest chord.
- If NOK(Ex: G=b7 becomes ? for C dest chord), try to use the destination scales if present.
- If scales NOK, make some assumptions to find the "best" possible note.If source note is NOT a source chord symbol degree (ex: D for A7), return -1.
- Parameters:
srcRelPitch
- The relative pitch of the source note (eg 2 for note D)destEcs
-- Returns:
- The relative pitch of the destination note, or -1 if source note could not be fitted.
-
getRenderingInfo
- Returns:
- Additional info to help music generation programs render this chord. Can't be null.
-
getTransposedChordSymbol
Get a transposed ExtChordSymbol.- Overrides:
getTransposedChordSymbol
in classChordSymbol
- Parameters:
t
- The amount of transposition in semi-tons.alt
- If not null alteration is unchanged, otherwise use alt- Returns:
- A new transposed ExtChordSymbol.
-
isSameChordSymbol
True if this object's chord type is the same that cs chord type, and if root/bass relative pitches are the same.- Parameters:
cs
-- Returns:
-
createRandomChordSymbol
- Returns:
- ExtChordSymbol A random chord symbol (random degree, random chord type)
-