|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jfugue.Pattern
public class Pattern
This class represents a segment of music. By representing segments of music as patterns, JFugue gives users the opportunity to play around with pieces of music in new and interesting ways. Patterns may be added together, transformed, or otherwise manipulated to expand the possibilities of creative music.
| Field Summary | |
|---|---|
static java.lang.String |
TITLE
|
| Constructor Summary | |
|---|---|
Pattern()
Instantiates a new pattern |
|
Pattern(Pattern... patterns)
This constructor creates a new Pattern that contains each of the given patterns |
|
Pattern(Pattern pattern)
Copy constructor |
|
Pattern(java.lang.String musicString)
Instantiates a new pattern using the given music string |
|
| Method Summary | |
|---|---|
void |
add(Pattern... patterns)
Adds a number of patterns sequentially |
void |
add(Pattern pattern)
Adds an additional pattern to the end of this pattern. |
void |
add(Pattern pattern,
int numTimes)
Adds an additional pattern to the end of this pattern. |
void |
add(java.lang.String... musicStrings)
Adds a number of patterns sequentially |
void |
add(java.lang.String musicString)
Adds a music string to the end of this pattern. |
void |
add(java.lang.String musicString,
int numTimes)
Adds a music string to the end of this pattern. |
void |
addElement(JFugueElement element)
Adds an individual element to the pattern. |
void |
addPatternListener(PatternListener l)
Adds a PatternListener. |
java.lang.String |
getMusicString()
Returns the music string kept in this pattern |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Get all properties set on this pattern, such as "author" or "date". |
java.lang.String |
getPropertiesAsParagraph()
Returns a String containing key-value pairs stored in this object's properties, separated by newline characters. |
java.lang.String |
getPropertiesAsSentence()
Returns a String containing key-value pairs stored in this object's properties, separated by semicolons and spaces. |
java.lang.String |
getProperty(java.lang.String key)
Get a property on this pattern, such as "author" or "date". |
java.lang.String |
getTitle()
Returns the title of this Pattern As of JFugue 4.0, the title is set as a property with the key Pattern.TITLE |
java.lang.String[] |
getTokens()
Returns an array of strings representing each token in the Pattern. |
void |
insert(java.lang.String musicString)
Inserts a MusicString before this music string. |
static Pattern |
loadPattern(java.io.File file)
|
void |
offset(long offsetTime)
Changes all timestamp values by the offsetTime passed in. |
void |
removePatternListener(PatternListener l)
Removes a PatternListener. |
void |
repeat(int times)
Repeats the music string in this pattern by the given number of times. |
void |
repeat(int times,
int beginIndex)
Only repeats the portion of this music string that starts at the string index provided. |
void |
repeat(int times,
int beginIndex,
int endIndex)
Only repeats the portion of this music string that starts and ends at the string indices provided. |
void |
savePattern(java.io.File file)
Saves the pattern as a text file |
void |
setMusicString(java.lang.String musicString)
Sets the music string kept by this pattern. |
void |
setProperty(java.lang.String key,
java.lang.String value)
Set a property on this pattern, such as "author" or "date". |
void |
setTitle(java.lang.String title)
Sets the title for this Pattern. |
Pattern |
subPattern(int beginIndex)
Returns a new Pattern that is a subpattern of this pattern. |
Pattern |
subPattern(int beginIndex,
int endIndex)
Returns a new Pattern that is a subpattern of this pattern. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TITLE
| Constructor Detail |
|---|
public Pattern()
public Pattern(java.lang.String musicString)
s - the music stringpublic Pattern(Pattern pattern)
public Pattern(Pattern... patterns)
| Method Detail |
|---|
public void setMusicString(java.lang.String musicString)
s - the music stringpublic java.lang.String getMusicString()
public void insert(java.lang.String musicString)
musicString - the string to insertpublic void add(Pattern pattern)
pattern - the pattern to addpublic void add(java.lang.String musicString)
musicString - the music string to add
public void add(Pattern pattern,
int numTimes)
pattern - the pattern to add
public void add(java.lang.String musicString,
int numTimes)
musicString - the music string to addpublic void add(Pattern... patterns)
musicString - the music string to addpublic void add(java.lang.String... musicStrings)
musicString - the music string to addpublic void addElement(JFugueElement element)
element - the element to addpublic void setTitle(java.lang.String title)
title - the title for this Patternpublic java.lang.String getTitle()
public java.lang.String getProperty(java.lang.String key)
public void setProperty(java.lang.String key,
java.lang.String value)
public java.util.Map<java.lang.String,java.lang.String> getProperties()
public void repeat(int times)
repeat(4) will
make the pattern "A B A B A B A B".
public void repeat(int times,
int beginIndex)
repeat(4, 3) will
make the pattern "T0 A B A B A B A B".
public void repeat(int times,
int beginIndex,
int endIndex)
repeat(4, 3, 5)
will make the pattern "T0 A B A B A B A B C".
public Pattern subPattern(int beginIndex)
public Pattern subPattern(int beginIndex,
int endIndex)
public static Pattern loadPattern(java.io.File file)
throws java.io.IOException
java.io.IOException
public void savePattern(java.io.File file)
throws java.io.IOException
filename - the filename to save under
java.io.IOExceptionpublic java.lang.String getPropertiesAsSentence()
public java.lang.String getPropertiesAsParagraph()
public void offset(long offsetTime)
offsetTime - public java.lang.String[] getTokens()
public void addPatternListener(PatternListener l)
PatternListener. The listener will receive events when new
parts are added to the pattern.
listener - the listener that is to be notified when new parts are added to the patternpublic void removePatternListener(PatternListener l)
PatternListener.
listener - the listener to removepublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||