An atomic reference to a global audio context that gets created the first
time you call clock
and is reused for any subsequent clocks.
An atomic reference to a global audio context that gets created the first time you call `clock` and is reused for any subsequent clocks.
(callback-at-time! clock-atom f deadline & {:as opts})
Schedules f
to run before deadline
. Returns the event.
opts
may contain :tolerance-early and :tolerance-late for optionally
overriding the clock's timing window for events.
Schedules `f` to run before `deadline`. Returns the event. `opts` may contain :tolerance-early and :tolerance-late for optionally overriding the clock's timing window for events.
(clear! {:keys [clock-id] :as event})
Unschedules an event by removing it from its clock's event queue.
Unschedules an event by removing it from its clock's event queue.
(current-time {:keys [context]})
Returns the current time of a clock's audio context, in milliseconds.
Returns the current time of a clock's audio context, in milliseconds.
(repeat! {:keys [deadline] :as event} time)
Sets the event to repeat every time
milliseconds
Sets the event to repeat every `time` milliseconds
(set-timeout! clock-atom f delay-ms & {:as opts})
Schedules f
after delay-ms
milliseconds. Returns the event.
opts
may contain :tolerance-early and :tolerance-late for optionally
overriding the clock's timing window for events.
Schedules `f` after `delay-ms` milliseconds. Returns the event. `opts` may contain :tolerance-early and :tolerance-late for optionally overriding the clock's timing window for events.
(start! clock-atom)
Remove all scheduled events and start the clock.
Remove all scheduled events and start the clock.
(time-stretch! e ratio)
(time-stretch! e time-reference ratio)
Reschedules events according to a time-reference
and a ratio
.
If the event is a repeating event, adjusts its repeat-time accordingly.
The first argument can be either a single event or a list of events. Returns the rescheduled event, or a list of rescheduled events, depending on the input type.
e.g.
(time-stretch! e (current-time clock) 0.5)
^-- makes an event e
occur twice as soon as it would otherwise
If time-reference
is omitted, the default value is the current time of the
event's clock.
Reschedules events according to a `time-reference` and a `ratio`. If the event is a repeating event, adjusts its repeat-time accordingly. The first argument can be either a single event or a list of events. Returns the rescheduled event, or a list of rescheduled events, depending on the input type. e.g. (time-stretch! e (current-time clock) 0.5) ^-- makes an event `e` occur twice as soon as it would otherwise If `time-reference` is omitted, the default value is the current time of the event's clock.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close