|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.soundhelix.misc.ActivityVector
public class ActivityVector
Represents a bit vector specifying for each tick whether a voice should be active or not. The bit vector grows dynamically as needed. This vector should be considered a strong hint for a SequenceEngine whether to add notes or to add pauses. However, it is not strictly forbidden to play notes while inactive. For example, after an activity interval, a final note could be played at the start of the following inactivity interval. An ActivityVector must always span the whole length of a song.
SequenceEngine| Constructor Summary | |
|---|---|
ActivityVector(String name)
Constructor. |
|
ActivityVector(String name,
int bits)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addActivity(int ticks)
Appends an activity interval with the specified number of ticks. |
void |
addInactivity(int ticks)
Appends an inactivity interval with the specified number of ticks. |
int |
getActiveTicks()
Returns the number of ticks this ActivityVector is active. |
int |
getActivitySegmentCount()
Counts the number of activity segments, which is the number of consecutive blocks of activity in the vector. |
int |
getFirstActiveTick()
Returns the tick where the ActivityVector becomes active for the first time. |
int |
getFirstInactiveTick()
Returns the tick where the ActivityVector becomes inactive for the first time. |
int |
getIntervalLength(int tick)
Returns the length of the interval beginning with the given tick, i.e., the number of ticks until the activity state changes or the end of the vector is reached. |
int |
getLastActiveTick()
Returns the tick where the ActivityVector is active for the last time. |
String |
getName()
Returns the name of this ActivityVector. |
int[] |
getSegmentLengths()
Returns an array that contains all activity and pause segment lengths in ticks, sorted by starting tick number. |
int |
getTicks()
Returns the total number of ticks this ActivityVector spans. |
boolean |
isActive(int tick)
Returns the activity state of the specified tick. |
void |
setActivityState(int from,
int till,
boolean state)
Modifies the ActivityVector so that it has the given state in the interval from from (inclusive) to till (exclusive). |
void |
shiftIntervalBoundaries(int startTicks,
int stopTicks)
Modifies the ActivityVector so that all interval changes from inactive to active are postponed by startTicks and all changes from active to inactive are postponed by stopTicks ticks. startTicks and stopTicks may also be negative to prepone instead of postpone. |
String |
toString()
Returns a string representation of the ActivityVector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ActivityVector(String name)
name - the name
public ActivityVector(String name,
int bits)
name - the namebits - the initial number of bits| Method Detail |
|---|
public void addActivity(int ticks)
ticks - the number of tickspublic void addInactivity(int ticks)
ticks - the number of tickspublic boolean isActive(int tick)
tick - the tick
public int getIntervalLength(int tick)
tick - the tick
public String getName()
public int getTicks()
public int getActiveTicks()
public int getFirstActiveTick()
public int getLastActiveTick()
public int getFirstInactiveTick()
public void setActivityState(int from,
int till,
boolean state)
from - the starting tick (inclusive)till - the ending tick (exclusive)state - the state of the interval
public void shiftIntervalBoundaries(int startTicks,
int stopTicks)
startTicks - the number of ticks to prepone or postpone startingstopTicks - the number of ticks to prepone or postpone stoppingpublic int getActivitySegmentCount()
public String toString()
toString in class Objectpublic int[] getSegmentLengths()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||