Interface SongPart
- All Superinterfaces:
Transferable
A song part defines how a rhythm is played for a number of bars starting at startBarIndex.
Music generation is controlled by the RhythmParameter values. SongPart instances are mutable but they can be only modified via their SongStructure container.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener.Convenience method.getCopy(Rhythm r, int startBarIndex, int nbBars, CLI_Section parentSection) Create a new SongPart based on this object.getName()By default set to the parentSection's nameintThe size of the song part in bars (same as the parentSection size).The CLI_Section associated to this SongPart.<T> TgetRPValue(RhythmParameter<T> rp) Get the RhythmParameter value.intThe start barIndex of this song part.voidMethods inherited from interface Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
-
Field Details
-
PROP_RP_VALUE
Fired when a new rhythm parameter value was set (rhythm parameter values are immutable).oldValue=rhythm parameter, newValue=value.
- See Also:
-
PROP_START_BAR_INDEX
- See Also:
-
PROP_NB_BARS
- See Also:
-
PROP_NAME
- See Also:
-
PROP_RHYTHM_PARENT_SECTION
The rhythm and/or the parent section has changed.oldValue=old rhythm, newValue=old parent section.
- See Also:
-
DATA_FLAVOR
-
-
Method Details
-
getStartBarIndex
int getStartBarIndex()The start barIndex of this song part.- Returns:
-
getNbBars
int getNbBars()The size of the song part in bars (same as the parentSection size).- Returns:
-
getBarRange
IntRange getBarRange()Convenience method.- Returns:
- The range [getStartBarIndex(); getStartBarIndex()+getNbBars()-1]
-
getName
-
getParentSection
-
getRPValue
Get the RhythmParameter value.- Type Parameters:
T-- Parameters:
rp-- Returns:
- Cannot be null
- Throws:
IllegalArgumentException- If rp is not a valid RhythmParameter for this SongPart
-
getRhythm
Rhythm getRhythm()- Returns:
- Cannot be null
-
getContainer
SongStructure getContainer()- Returns:
- The SongStructure this object belong to. Cannot be null.
-
getClientProperties
StringProperties getClientProperties() -
getCopy
Create a new SongPart based on this object.If using a different rhythm, method tries to adapt the value of compatible RhythmParameters. ClientProperties are also copied.
- Parameters:
r- The new Rhythm to be used. If null Rhythm is unchanged.startBarIndex- The startBarIndex of the new SongPartnbBars- The nbBars of the new SongPartparentSection- The parentSection of the new SongPart. TimeSignature must match the specified rhythm. If null parent section is unchanged.- Returns:
- A new SongPart whose name and container are unchanged.
-
addPropertyChangeListener
Add a listener.Listeners will be called on the EDT. Because listeners are called outside read/write lock, listeners should rely on event's embedded data rather than on the model itself (which could theoretically be modified by another thread).
- Parameters:
l-
-
removePropertyChangeListener
-
toShortString
String toShortString()- Returns:
- "[name,startBarIndex]"
-