Interface SongPart

All Superinterfaces:
Transferable

public interface SongPart extends 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 Details

  • 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

      String getName()
      By default set to the parentSection's name
      Returns:
      Cannot be null
    • getParentSection

      CLI_Section getParentSection()
      The CLI_Section associated to this SongPart.
      Returns:
      Cannot be null
    • getRPValue

      <T> T getRPValue(RhythmParameter<T> rp)
      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

      SongPart getCopy(Rhythm r, int startBarIndex, int nbBars, CLI_Section parentSection)
      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 SongPart
      nbBars - The nbBars of the new SongPart
      parentSection - 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

      void addPropertyChangeListener(PropertyChangeListener l)
      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

      void removePropertyChangeListener(PropertyChangeListener l)
    • toShortString

      String toShortString()
      Returns:
      "[name,startBarIndex]"