java.lang.ObjectBeatBox
The BeatBox is a class that can play rhythm tracks. The tracks to play are defined by a sequence of calls to the beat box as follows:
newTrack - start the definition of a new track. addBeat* - add a beat to the track (call multiple times). endTrack - end the definition of a track. start - start playing the defined track. stop - stop playing the currently palying track.The beat box can also be used to do a single hit on an instrument by using the 'beat(..)' method.
Constructor Summary | |
BeatBox()
Create a beatbox engine. |
Method Summary | |
void |
addBeat(int tick,
int instrument)
Add a beat to the current beat track. |
void |
beat(int instrument)
Do a single hit on a single instrument and stop again. |
void |
endTrack()
End the definition of a beat track. |
boolean |
isPlaying()
Tell whether the beat box is currently playing. |
void |
newTrack(int length)
Start defining a new track. |
void |
setLoop(boolean loop)
Set the beat box looping mode: When 'loop' is true, the track is played in a loop indefinitely until stopped. |
void |
setTempo(int newTempo)
Set the playback tempo (in beats per minute). |
void |
start()
Start playing the current track. |
void |
stop()
Stop playing the current track. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BeatBox()
Method Detail |
public void addBeat(int tick, int instrument)
tick
- The tick number of this beat in the track.instrument
- The instrument type used.public void beat(int instrument)
instrument
- The instument constant (see interface Instruments).public void endTrack()
public boolean isPlaying()
public void newTrack(int length)
length
- The length of the track in ticks.public void setLoop(boolean loop)
public void setTempo(int newTempo)
public void start()
public void stop()