All Packages Class Hierarchy This Package Previous Next Index
Class com.nosuch.midi.MidiPhrase
java.lang.Object
|
+----com.nosuch.midi.MidiPhrase
- public class MidiPhrase
- extends Object
- implements Cloneable, Serializable
A MidiPhrase is an ordered (by time) list of MidiMsg objects.
A MidiPhrase also has a "length" attribute that is the number
of clicks from its beginning to its end. This length is used
when concatenating phrases, among other things. The length is
completely independent of the MidiMsg objects within the phrase,
allowing for phrases with leading space, or phrases that are
entirely space.
-
MidiPhrase()
- Construct a new phrase with no MidiMsgs and 0 length.
-
MidiPhrase(MidiMsg)
- Construct a new phrase with a specified MidiMsg
-
MidiPhrase(MidiMsg, long)
- Construct a new phrase with a specified MidiMsg and length
-
MidiPhrase(String)
- Construct a new phrase from a KeyKit-style constant string.
-
addTime(long)
- Add a time to all MidiMsgs in this phrase
-
append(MidiMsg)
- Append a MidiMsg to the phrase
The starting time of the added MidiMsg is set to the current
length of this phrase, and the length of this phrase is
incremented by the duration of the MidiMsg.
-
append(MidiPhrase)
- Append a MidiPhrase to this phrase
The starting time of the added MidiPhrase (i.e.
-
clone()
- Return a copy of this phrase
-
cloneStartingFrom(MidiMsg)
- Return a copy of this phrase, starting at m
-
equals(MidiPhrase)
-
-
getAt(int)
- Return the Nth (0-based) message of the phrase
-
getEnumeration()
- Return an enumeration of the MidiMsgs in the phrase.
-
getLength()
- Return the current length of the phrase (in clicks).
-
getNth(int)
- Return the Nth (1-based) message of the phrase
This method is 1-based to make it easier to convert Keynote code.
-
isEmpty()
- Return the first message in the phrase
-
main(String[])
-
-
merge(MidiMsg)
- Merge a MidiMsg into this phrase
The new MidiMsg is merged with this phrase, putting it in
the appropriate time-ordered location within this phrase's
list of MidiMsgs.
-
merge(MidiPhrase)
- Merge a Midiphrase into this phrase
-
multiplyVelocity(double)
- Adjust by a factor the velocity of all MidiMsgs in this phrase
-
peekFirstMsg()
- Return the first message in the phrase.
-
removeFirstMsg()
- Return and remove the first message in the phrase
-
removeMsg(MidiMsg)
- Remove a particular message from the phrase
-
reOrder()
- Make sure the order of MidiMsgs in this phrase is correct.
-
replace(MidiMsg, MidiMsg)
- Replace a particular message in the phrase with a new message.
-
setChannel(int)
- Set channel of all MidiMsgs in this phrase
-
setDuration(long)
- Set duration of all MidiMsgs in this phrase
-
setLength(long)
- Set the length of the phrase (in clicks).
-
setPitch(int)
- Set pitch of all MidiMsgs in this phrase
-
setTime(long)
- Set time of all MidiMsgs in this phrase
-
size()
- Return the number of MidiMsgs in the phrase.
-
toString()
- Return a human-readable version of this phrase, in KeyKit format.
MidiPhrase
public MidiPhrase(MidiMsg n,
long l)
- Construct a new phrase with a specified MidiMsg and length
- Parameters:
- n - MidiMsg
- l - length of phrase (in clicks)
MidiPhrase
public MidiPhrase(MidiMsg n)
- Construct a new phrase with a specified MidiMsg
- Parameters:
- n - MidiMsg
MidiPhrase
public MidiPhrase()
- Construct a new phrase with no MidiMsgs and 0 length.
MidiPhrase
public MidiPhrase(String s)
- Construct a new phrase from a KeyKit-style constant string.
getLength
public long getLength()
- Return the current length of the phrase (in clicks).
getEnumeration
public Enumeration getEnumeration()
- Return an enumeration of the MidiMsgs in the phrase.
size
public int size()
- Return the number of MidiMsgs in the phrase.
setLength
public MidiPhrase setLength(long l)
- Set the length of the phrase (in clicks).
- Parameters:
- l - length (in clicks)
isEmpty
public boolean isEmpty()
- Return the first message in the phrase
peekFirstMsg
public MidiMsg peekFirstMsg()
- Return the first message in the phrase. The name is peek* so that
people won't be tempted to actually modify it.
removeFirstMsg
public MidiMsg removeFirstMsg()
- Return and remove the first message in the phrase
removeMsg
public MidiPhrase removeMsg(MidiMsg mtoremove)
- Remove a particular message from the phrase
getNth
public MidiMsg getNth(int n)
- Return the Nth (1-based) message of the phrase
This method is 1-based to make it easier to convert Keynote code.
Use getAt() for the 0-based version.
- Parameters:
- n - Number (1-based) of message to get
getAt
public MidiMsg getAt(int n)
- Return the Nth (0-based) message of the phrase
- Parameters:
- n - Index (0-based) of message to get
replace
public MidiPhrase replace(MidiMsg oldmsg,
MidiMsg newmsg)
- Replace a particular message in the phrase with a new message.
- Parameters:
- oldmsg - MidiMsg to look for.
- newmsg - MidiMsg to replace it with.
append
public MidiPhrase append(MidiMsg newm)
- Append a MidiMsg to the phrase
The starting time of the added MidiMsg is set to the current
length of this phrase, and the length of this phrase is
incremented by the duration of the MidiMsg.
- Parameters:
- n - MidiMsg to append
append
public MidiPhrase append(MidiPhrase newp)
- Append a MidiPhrase to this phrase
The starting time of the added MidiPhrase (i.e. of all the MidiMsgs
in the phrase) is set to the current length of this phrase,
and the length of this phrase is incremented by the length
of the added phrase.
- Parameters:
- newp - MidiPhrase to append
merge
public MidiPhrase merge(MidiMsg newmsg)
- Merge a MidiMsg into this phrase
The new MidiMsg is merged with this phrase, putting it in
the appropriate time-ordered location within this phrase's
list of MidiMsgs.
- Parameters:
- newmsg - MidiMsg to merge.
merge
public MidiPhrase merge(MidiPhrase p)
- Merge a Midiphrase into this phrase
- Parameters:
- newphr - MidiPhrase to merge.
clone
public Object clone()
- Return a copy of this phrase
- Overrides:
- clone in class Object
cloneStartingFrom
public Object cloneStartingFrom(MidiMsg m)
- Return a copy of this phrase, starting at m
equals
public boolean equals(MidiPhrase p2)
setTime
public MidiPhrase setTime(long tm)
- Set time of all MidiMsgs in this phrase
- Parameters:
- tm - time (in clicks)
setPitch
public MidiPhrase setPitch(int p)
- Set pitch of all MidiMsgs in this phrase
- Parameters:
- p - pitch (0-127)
setChannel
public MidiPhrase setChannel(int c)
- Set channel of all MidiMsgs in this phrase
- Parameters:
- c - channel (1-16)
setDuration
public MidiPhrase setDuration(long d)
- Set duration of all MidiMsgs in this phrase
- Parameters:
- d - duration (in clicks)
addTime
public MidiPhrase addTime(long tm)
- Add a time to all MidiMsgs in this phrase
- Parameters:
- tm - time (in clicks)
multiplyVelocity
public MidiPhrase multiplyVelocity(double f)
- Adjust by a factor the velocity of all MidiMsgs in this phrase
- Parameters:
- f - multiplication factor
reOrder
public MidiPhrase reOrder()
- Make sure the order of MidiMsgs in this phrase is correct.
This is used after doing appending and other things that may
have resulted in things being out of order.
toString
public String toString()
- Return a human-readable version of this phrase, in KeyKit format.
- Overrides:
- toString in class Object
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index