Tone.Clock
↳ EXTENDS Tone.EmitterA sample accurate clock which provides a callback at the given rate. While the callback is not sample-accurate (it is still susceptible to loose JS timing), the time passed in as the argument to the callback is precise. For most applications, it is better to use Tone.Transport instead of the Clock by itself since you can synchronize multiple callbacks.
CONSTRUCTOR
new Tone.Clock (DEFAULTS
EXAMPLE
Members
.state
↝ Tone.State READONLY #Returns the playback state of the source, either “started”, “stopped” or “paused”.
Methods
.pause ( )
#The time when the clock should stop.
this
Pause the clock. Pausing does not reset the tick counter.
.setTicksAtTime ( )
#The tick value to set
When to set the tick value
this
Set the clock’s ticks at the given time.
.start ( )
#The time the clock should start
Where the tick counter starts counting from.
this
Start the clock at the given time. Optionally pass in an offset of where to start the tick counter from.
.stop ( )
#The time when the clock should stop.
this
Stop the clock. Stopping the clock resets the tick counter to 0.
EXAMPLE
.getSecondsAtTime ( )
#Return the elapsed seconds at the given time.
.getTicksAtTime ( )
#Get the clock’s ticks at the given time.
.nextTickTime ( )
#Get the time of the next tick
.emit ( )
#The name of the event.
The arguments to pass to the functions listening.
this
Invoke all of the callbacks bound to the event with any arguments passed in.
.once ( )
#The name of the event to listen for.
The callback to invoke when the event is emitted
this
Bind a callback which is only invoked once
.off ( )
#The event to stop listening to.
The callback which was bound to the event with Tone.Emitter.on. If no callback is given, all callbacks events are removed.
this
Remove the event listener.
.on ( )
#The name of the event to listen for.
The callback to invoke when the event is emitted
this
Bind a callback to a specific event.