public class Rhythm extends java.lang.Object implements PatternProducer
Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.Character,java.lang.String> |
DEFAULT_RHYTHM_KIT |
Constructor and Description |
---|
Rhythm() |
Rhythm(java.util.Map<java.lang.Character,java.lang.String> rhythmKit) |
Rhythm(java.util.Map<java.lang.Character,java.lang.String> rhythmKit,
java.lang.String... layers) |
Rhythm(java.lang.String... layers) |
Modifier and Type | Method and Description |
---|---|
Rhythm |
addAltLayerProvider(int layer,
RhythmAltLayerProvider altLayerProvider)
Gives a RhythmAltLayerProvider, which will make its own determination about what type of
alt layer to play, and when to play it.
|
Rhythm |
addAltLayerProvider(int layer,
RhythmAltLayerProvider altLayerProvider,
int zOrder)
Gives a RhythmAltLayerProvider, which will make its own determination about what type of
alt layer to play, and when to play it.
|
Rhythm |
addLayer(java.lang.String layer)
Adds a layer to this Rhythm, but fails silently if
the rhythm already has MAX_LAYERS layers.
|
Rhythm |
addOneTimeAltLayer(int layer,
int oneTime,
java.lang.String rhythmString)
Sets an alt layer that will play one time, at the given segment.
|
Rhythm |
addOneTimeAltLayer(int layer,
int oneTime,
java.lang.String rhythmString,
int zOrder)
Sets an alt layer that will play one time, at the given segment.
|
Rhythm |
addRangedAltLayer(int layer,
int start,
int end,
java.lang.String rhythmString)
Sets an alt layer that will play between and including the start and end indices.
|
Rhythm |
addRangedAltLayer(int layer,
int start,
int end,
java.lang.String rhythmString,
int zOrder)
Sets an alt layer that will play between and including the start and end indices.
|
Rhythm |
addRecurringAltLayer(int layer,
int start,
int end,
int recurrence,
java.lang.String rhythmString)
Sets an alt layer that will recur every recurrence times *after* the start index is reached.
|
Rhythm |
addRecurringAltLayer(int layer,
int start,
int end,
int recurrence,
java.lang.String rhythmString,
int zOrder)
Sets an alt layer that will recur every recurrence times *after* the start index is reached.
|
boolean |
canAddLayer()
Returns true if the number of layers is less than MAX_LAYERS, which is limited to
16 by the MIDI Specification
|
Rhythm |
clone() |
static Rhythm |
combine(Rhythm... rhythms)
Combines rhythms into multiple layers.
|
java.util.List<org.jfugue.rhythm.Rhythm.AltLayer> |
getAltLayersForLayer(int layer)
Returns all AltLayers for the given layer; the resulting list is unsorted by z-order
|
java.lang.String |
getLayer(int layer) |
java.util.List<java.lang.String> |
getLayers()
Returns all layers that have been added with the traditional addLayer() method - but to
truly find out what the layer will sound like at a given segment, use getLayersForSegment(),
which takes alt layers into account.
|
java.lang.String[] |
getLayersAt(int segment)
Returns all layers, including altLayers, for the given segment
|
int |
getLength() |
Pattern |
getPattern()
Returns a pattern
|
Pattern |
getPatternAt(int segment) |
java.lang.String[] |
getRhythm()
Returns the full rhythm, including alt layers, but not translated into Staccato music strings by looking up rhythm entries into the RhythmKit
|
java.util.Map<java.lang.Character,java.lang.String> |
getRhythmKit() |
java.util.List<org.jfugue.rhythm.Rhythm.AltLayer> |
getSortedAltLayersForLayer(int layer)
Returns all AltLayers for the given layer sorted by each AltLayer's z-order
|
java.lang.String |
getStaccatoStringForRhythm(java.lang.String rhythm)
Uses the RhythmKit to translate the given rhythm into a Staccato music string.
|
Rhythm |
setLayers(java.util.List<java.lang.String> layers)
Sets all of the layers
|
Rhythm |
setLength(int length)
Sets the length of the rhythm, which is the number of times that a single
pattern is repeated.
|
Rhythm |
setRhythmKit(java.util.Map<java.lang.Character,java.lang.String> rhythmKit) |
public static final java.util.Map<java.lang.Character,java.lang.String> DEFAULT_RHYTHM_KIT
public Rhythm()
public Rhythm(java.lang.String... layers)
public Rhythm(java.util.Map<java.lang.Character,java.lang.String> rhythmKit)
public Rhythm(java.util.Map<java.lang.Character,java.lang.String> rhythmKit, java.lang.String... layers)
public Rhythm setRhythmKit(java.util.Map<java.lang.Character,java.lang.String> rhythmKit)
public java.util.Map<java.lang.Character,java.lang.String> getRhythmKit()
public Rhythm addLayer(java.lang.String layer)
layer
- public java.lang.String getLayer(int layer)
public java.util.List<java.lang.String> getLayers()
getLayersForSegment
public Rhythm setLayers(java.util.List<java.lang.String> layers)
public java.lang.String[] getLayersAt(int segment)
getLayers
public boolean canAddLayer()
public Rhythm clone()
clone
in class java.lang.Object
public java.util.List<org.jfugue.rhythm.Rhythm.AltLayer> getAltLayersForLayer(int layer)
getSortedAltLatersForLayer
public java.util.List<org.jfugue.rhythm.Rhythm.AltLayer> getSortedAltLayersForLayer(int layer)
public Rhythm addRecurringAltLayer(int layer, int start, int end, int recurrence, java.lang.String rhythmString)
public Rhythm addRecurringAltLayer(int layer, int start, int end, int recurrence, java.lang.String rhythmString, int zOrder)
public Rhythm addRangedAltLayer(int layer, int start, int end, java.lang.String rhythmString)
public Rhythm addRangedAltLayer(int layer, int start, int end, java.lang.String rhythmString, int zOrder)
public Rhythm addOneTimeAltLayer(int layer, int oneTime, java.lang.String rhythmString)
public Rhythm addOneTimeAltLayer(int layer, int oneTime, java.lang.String rhythmString, int zOrder)
public Rhythm addAltLayerProvider(int layer, RhythmAltLayerProvider altLayerProvider)
RhythmAltLayerProvider
public Rhythm addAltLayerProvider(int layer, RhythmAltLayerProvider altLayerProvider, int zOrder)
RhythmAltLayerProvider
public static Rhythm combine(Rhythm... rhythms)
rhythms
- the rhythms to combinepublic Rhythm setLength(int length)
public int getLength()
public java.lang.String getStaccatoStringForRhythm(java.lang.String rhythm)
getPattern
public Pattern getPatternAt(int segment)
public Pattern getPattern()
PatternProducer
getPattern
in interface PatternProducer
public java.lang.String[] getRhythm()