|
||||||||||
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 | |
---|---|
protected javax.swing.event.EventListenerList |
listenerList
List of ParserListeners |
Constructor Summary | |
---|---|
|
Pattern()
Instantiates a new pattern |
protected |
Pattern(java.io.File file)
Creates a Pattern given a MIDI file |
|
Pattern(Pattern pattern)
Copy constructor |
|
Pattern(java.lang.String musicString)
Instantiates a new pattern using the given music string |
Method Summary | |
---|---|
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 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 . |
protected void |
clearPatternListeners()
|
java.lang.String |
getMusicString()
Returns the music string kept in this pattern |
java.lang.String |
getTitle()
Returns the title of this Pattern |
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 |
loadMusicString(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)
Returns a new Pattern that repeats the music string in this pattern by the given number of times. |
void |
repeat(int times,
int beginIndex)
Returns a new Pattern that only repeats the portion of this music string that starts at the string index provided. |
void |
repeat(int times,
int beginIndex,
int endIndex)
Returns a new Pattern that only repeats the portion of this music string that starts and ends at the string indices provided. |
void |
saveMusicString(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 |
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. |
protected java.lang.String |
substring(int beginIndex)
|
protected java.lang.String |
substring(int beginIndex,
int endIndex)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected javax.swing.event.EventListenerList listenerList
Constructor Detail |
---|
public Pattern()
public Pattern(java.lang.String musicString)
s
- the music stringpublic Pattern(Pattern pattern)
protected Pattern(java.io.File file) throws java.io.IOException, javax.sound.midi.InvalidMidiDataException
file
-
java.io.IOException
javax.sound.midi.InvalidMidiDataException
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 addpublic void add(Pattern pattern, int numTimes)
pattern
- the pattern to addpublic void add(java.lang.String musicString, int numTimes)
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 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)
protected java.lang.String substring(int beginIndex)
protected java.lang.String substring(int beginIndex, int endIndex)
public static Pattern loadMusicString(java.io.File file) throws java.io.IOException
java.io.IOException
public void saveMusicString(java.io.File file) throws java.io.IOException
filename
- the filename to save under
java.io.IOException
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 removeprotected void clearPatternListeners()
public 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 |