|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.soundhelix.misc.Sequence
public class Sequence
Represents a sequence, i.e., the notes and pauses of a single voice. A note consists of a pitch (with 0 being c', 1 being c#' and so on), a velocity (between 0 and Short.MAX_VALUE) and a positive length in ticks. A pause is represented by an arbitrary pitch, a velocity of -1 and a positive length in ticks. The velocity can be used to represent a note's volume, but after all, it is up to the playback device how it interprets the velocity. For example, a device might always play a note at its full volume and use the velocity to control filter cut-off instead.
| Nested Class Summary | |
|---|---|
static class |
Sequence.SequenceEntry
A container for a sequence entry. |
| Constructor Summary | |
|---|---|
Sequence()
|
|
| Method Summary | |
|---|---|
void |
addNote(int pitch,
int ticks)
Calls addNote(pitch,ticks,Short.MAX_VALUE). |
void |
addNote(int pitch,
int ticks,
short velocity)
Calls addNote(pitch,Short.MAX_VALUE,ticks,false). |
void |
addNote(int pitch,
int ticks,
short velocity,
boolean legato)
Appends a new note with the given pitch, velocity and number of ticks, which logically means a note-down for the given number of ticks and a note-up afterwards. |
void |
addPause(int ticks)
Appends a pause with the given number of ticks. |
void |
extendNote(int ticks)
Extends the previous sequence entry (which must be note) by the given number of ticks. |
Sequence.SequenceEntry |
get(int index)
Returns the sequence entry with the given index. |
int |
getTicks()
Returns the total number of ticks this sequence spans. |
void |
replaceEntry(int tick,
Sequence.SequenceEntry entry)
Replaces the entry at the given tick by the given entry. |
int |
size()
Returns the number of sequence entries this sequence contains. |
String |
toString()
|
void |
transpose(int halftones)
Transposes all notes of this sequence up by the given number of halftones. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Sequence()
| Method Detail |
|---|
public void addNote(int pitch,
int ticks)
pitch - the pitchticks - the ticks
public void addNote(int pitch,
int ticks,
short velocity)
pitch - the pitchticks - the ticksvelocity - the velocity
public void addNote(int pitch,
int ticks,
short velocity,
boolean legato)
pitch - the pitchvelocity - the velocity (between 0 and 32767)ticks - the tickslegato - the legato flagpublic void addPause(int ticks)
ticks - the tickspublic void extendNote(int ticks)
ticks - the number of tickspublic int getTicks()
size()public Sequence.SequenceEntry get(int index)
index - the index
public int size()
getTicks()public String toString()
toString in class Objectpublic void transpose(int halftones)
halftones - the number of halftones (positive or negative)
public void replaceEntry(int tick,
Sequence.SequenceEntry entry)
tick - the tick where the replacement should take placeentry - the SequenceEntry to insert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||