public class Sequence extends Object implements Iterable<Sequence.SequenceEntry>
| Modifier and Type | Class and Description |
|---|---|
static class |
Sequence.SequenceEntry
A container for a sequence entry.
|
| Constructor and Description |
|---|
Sequence(SongContext songContext)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNote(int pitch,
int ticks)
Calls addNote(pitch,ticks,maxVelocity).
|
void |
addNote(int pitch,
int ticks,
int velocity)
Calls addNote(pitch,ticks,velocity,false).
|
void |
addNote(int pitch,
int ticks,
int 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.
|
Iterator<Sequence.SequenceEntry> |
iterator() |
void |
replaceEntry(int tick,
Sequence.SequenceEntry entry)
Replaces the entry at the given tick by the given entry.
|
void |
scaleVelocity(int velocity)
Scales the velocity of all notes by velocity/maxVelocity.
|
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.
|
public Sequence(SongContext songContext)
songContext - the song contextpublic Iterator<Sequence.SequenceEntry> iterator()
iterator in interface Iterable<Sequence.SequenceEntry>public void addNote(int pitch,
int ticks)
pitch - the pitchticks - the tickspublic void addNote(int pitch,
int ticks,
int velocity)
pitch - the pitchticks - the ticksvelocity - the velocitypublic void addNote(int pitch,
int ticks,
int velocity,
boolean legato)
pitch - the pitchvelocity - the velocity (between 0 and maxVelocity)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 indexpublic int size()
getTicks()public void transpose(int halftones)
halftones - the number of halftones (positive or negative)public void scaleVelocity(int velocity)
velocity - the velocitypublic void replaceEntry(int tick,
Sequence.SequenceEntry entry)
tick - the tick where the replacement should take placeentry - the SequenceEntry to insert