public class Clock extends UGen implements IntegerBead
BeadArray
of listeners at each tick. These listeners can query the Clock to find out the current tick count, if it is on a beat, and the current beat count. The rate of ticking of the Clock is controlled by an interval envelope.UGen.OutputInitializationRegime, UGen.OutputPauseRegime
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
Constructor and Description |
---|
Clock(AudioContext context)
Instantiates a new Clock with a static interval of 1000ms.
|
Clock(AudioContext context,
float interval)
Instantiates a new Clock with the given static interval in milliseconds.
|
Clock(AudioContext context,
UGen env)
Instantiates a new Clock with the given interval enveliope.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(Bead newListener)
Adds a new message listener.
|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data.
|
void |
clearMessageListeners() |
int |
getBeatCount()
Gets the current beat count.
|
long |
getCount()
Gets the tick count.
|
int |
getInt()
Gets the intger value.
|
UGen |
getIntervalEnvelope()
Deprecated.
|
UGen |
getIntervalUGen()
Gets the interval envelope.
|
double |
getSubTickAtIndex(int i) |
double |
getSubTickNow() |
float |
getTempo() |
int |
getTicksPerBeat()
Gets the ticks per beat.
|
boolean |
isBeat()
Checks if the current tick is on a beat.
|
boolean |
isBeat(int mod)
Checks if the Clock is on a beat at the given modulo level.
|
boolean |
isClicking()
Checks if the Clock is set to make an audible click.
|
void |
removeMessageListener(Bead newListener)
Removes the given message listener.
|
void |
reset()
Resets the Clock immediately.
|
void |
setClick(boolean click)
Starts/stops the audible click.
|
void |
setIntervalEnvelope(UGen intervalEnvelope)
Sets the interval envelope.
|
void |
setTicksPerBeat(int ticksPerBeat)
Sets the ticks per beat.
|
addDependent, addInput, addInput, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start, toString
public Clock(AudioContext context)
context
- the AudioContext.public Clock(AudioContext context, float interval)
context
- the AudioContext.interval
- the interval in milliseconds.public Clock(AudioContext context, UGen env)
context
- the AudioContext.env
- the interval envelope.public boolean isClicking()
public void setClick(boolean click)
click
- true for audible click.public void addMessageListener(Bead newListener)
newListener
- the new message listener.public void removeMessageListener(Bead newListener)
newListener
- the listener being removed.public void reset()
public long getCount()
public void setIntervalEnvelope(UGen intervalEnvelope)
intervalEnvelope
- the new interval envelope.public UGen getIntervalEnvelope()
public UGen getIntervalUGen()
public float getTempo()
public void calculateBuffer()
UGen
UGen.bufIn
and putting data
into UGen.bufOut
in some way. UGen.bufIn
and UGen.bufOut
are 2D arrays of floats of the form float[numChannels][bufferSize]. The length of the buffers is given by
UGen.bufferSize
, and the number of channels of the input and output buffers are given by UGen.ins
and UGen.outs
respectively.calculateBuffer
in class UGen
public int getInt()
IntegerBead
getInt
in interface IntegerBead
public int getTicksPerBeat()
public void setTicksPerBeat(int ticksPerBeat)
ticksPerBeat
- the new ticks per beat.public boolean isBeat()
public boolean isBeat(int mod)
mod
- the modulo.public int getBeatCount()
public double getSubTickAtIndex(int i)
public double getSubTickNow()
public void clearMessageListeners()