Interface Rhythm

All Superinterfaces:
Comparable<Rhythm>
All Known Subinterfaces:
AdaptedRhythm
All Known Implementing Classes:
DummyRhythm

public interface Rhythm extends Comparable<Rhythm>
A rhythm descriptor.

This interface provides all the descriptive attributes of a rhythm. In order to be able to actually generate music, a Rhythm instance must also implement the MusicGenerator interface.

The framework will call the rhythm's loadResources() before accessing the MidiMusicGenerator object(s). This allow to save memory usage when rhythm object is only used in catalogs.

  • Field Details

  • Method Details

    • getFeatures

      RhythmFeatures getFeatures()
      The general features of this rhythm.
      Returns:
    • loadResources

      void loadResources() throws MusicGenerationException
      Tell the rhythm it may load any memory-heavy resources.

      This will fire a PROP_RESOURCES_LOADED change event with newValue=true.

      Throws:
      MusicGenerationException
      See Also:
    • releaseResources

      void releaseResources()
      Ask the rhythm to release any memory-heavy resources.

      This will fire a PROP_RESOURCES_LOADED change event with newValue=false.

      See Also:
    • isResourcesLoaded

      boolean isResourcesLoaded()
    • getRhythmVoices

      List<RhythmVoice> getRhythmVoices()
      Returns:
      The voices for which this rhythm can generate music. Each voice must have a unique name.
    • getRhythmParameters

      List<RhythmParameter<?>> getRhythmParameters()
      Returns:
      The RhythmParameters that influence the way this rhythm generates music.
    • getFile

      File getFile()
      Optional file from which this rhythm was loaded.
      Returns:
      Can't be null, but can be an empty path ("") if no file associated.
    • getUniqueId

      String getUniqueId()
      A unique string identifier representing this rhythm.

      It will be used by other serialized objects who want to refer this rhythm -typically a Song object.

      Returns:
      A non-empty String with spaces trimmed.
    • getDescription

      String getDescription()
    • getPreferredTempo

      int getPreferredTempo()
    • getTimeSignature

      TimeSignature getTimeSignature()
    • getName

      String getName()
    • getAuthor

      String getAuthor()
    • getVersion

      default String getVersion()
      Returns:
      Default to "1"
    • getTags

      default String[] getTags()
      Can be any keyword strings used to describe the rhythm.
      Returns:
      Default to an empty array.
    • compareTo

      default int compareTo(Rhythm o)
      Compare alphabetically on the rhythm's name.
      Specified by:
      compareTo in interface Comparable<Rhythm>
      Parameters:
      o -
      Returns:
    • addPropertyChangeListener

      void addPropertyChangeListener(PropertyChangeListener l)
    • removePropertyChangeListener

      void removePropertyChangeListener(PropertyChangeListener l)