Package org.jjazz.rhythm.api
Interface Rhythm
- All Superinterfaces:
Comparable<Rhythm>
- All Known Subinterfaces:
AdaptedRhythm
- All Known Implementing Classes:
DummyRhythm
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
default int
Compare alphabetically on the rhythm's name.The general features of this rhythm.getFile()
Optional file from which this rhythm was loaded.getName()
int
List<RhythmParameter<?>>
default String[]
getTags()
Can be any keyword strings used to describe the rhythm.A unique string identifier representing this rhythm.default String
boolean
void
Tell the rhythm it may load any memory-heavy resources.void
Ask the rhythm to release any memory-heavy resources.void
-
Field Details
-
PROP_RESOURCES_LOADED
- See Also:
-
-
Method Details
-
getFeatures
RhythmFeatures getFeatures()The general features of this rhythm.- Returns:
-
loadResources
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
- Returns:
- Default to "1"
-
getTags
Can be any keyword strings used to describe the rhythm.- Returns:
- Default to an empty array.
-
compareTo
Compare alphabetically on the rhythm's name.- Specified by:
compareTo
in interfaceComparable<Rhythm>
- Parameters:
o
-- Returns:
-
addPropertyChangeListener
-
removePropertyChangeListener
-