public class Pattern extends Object implements Iterable<Pattern.PatternEntry>
Modifier and Type | Class and Description |
---|---|
static class |
Pattern.PatternEntry
Represents a pattern entry.
|
Constructor and Description |
---|
Pattern(Pattern.PatternEntry[] pattern)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static String |
expandPatternString(String patternString)
Expands the given pattern string until no more expansion is possible.
|
Pattern.PatternEntry |
get(int index)
Returns the pattern entry with the given index.
|
static int |
getStringTicks(String patternString)
Returns the number of ticks of the given pattern string.
|
int |
getTicks()
Returns the total number of ticks this pattern spans.
|
boolean |
isLegatoLegal(ActivityVector activityVector,
int tick,
int patternOffset)
Checks whether it is legal to use legato at the note that ends on the given tick.
|
Iterator<Pattern.PatternEntry> |
iterator()
Provides an iterator that iterates over all PatternEntries of this pattern.
|
static Pattern |
parseString(SongContext songContext,
String patternString,
int targetTPB)
Parses the given pattern string using no wildcards.
|
static Pattern |
parseString(SongContext songContext,
String patternString,
String wildcardString,
int targetTPB)
Parses the given pattern string using the given wildcard string.
|
Pattern |
scale(double factor)
Returns a new pattern whose entries' ticks are scaled by the given factor.
|
int |
size()
Returns the number of pattern entries this pattern contains.
|
String |
toString() |
Pattern |
transpose(int pitch)
Transposes the pattern up by the given pitch (which may be negative) and returns it as a new pattern (or the original pattern if pitch is 0).
|
public Pattern(Pattern.PatternEntry[] pattern)
pattern
- the patternpublic static Pattern parseString(SongContext songContext, String patternString, int targetTPB)
songContext
- the song contextpatternString
- the pattern stringtargetTPB
- the ticks per beat the pattern is forpublic static Pattern parseString(SongContext songContext, String patternString, String wildcardString, int targetTPB)
songContext
- the song contextpatternString
- the pattern stringwildcardString
- the wildcard stringtargetTPB
- the ticks per beat the pattern is forpublic static String expandPatternString(String patternString)
patternString
- the pattern stringpublic static int getStringTicks(String patternString)
patternString
- the pattern stringpublic Pattern transpose(int pitch)
pitch
- the number of halftones to transpose up (may be negative)public Pattern scale(double factor)
factor
- the scale factorpublic int getTicks()
size()
public Pattern.PatternEntry get(int index)
index
- the indexpublic int size()
getTicks()
public boolean isLegatoLegal(ActivityVector activityVector, int tick, int patternOffset)
activityVector
- the activity vectortick
- the tickpatternOffset
- the pattern offsetpublic Iterator<Pattern.PatternEntry> iterator()
iterator
in interface Iterable<Pattern.PatternEntry>