TuningFork.Tick (TuningFork v0.1.11)

Copy Markdown View Source

Counters that step once each time a loop comes round.

part(bpm: 120, synth: Kit.voice("bd", 0.3))
|> play(Ring.at(~w(c2 e2 g2 a2)a, tick()), 1)

Summary

Functions

The counter's value, without stepping it.

Put a counter back to zero. With no name, every counter.

Put a counter at count. With no name, the loop's own.

Step the counter on and give the value it was at.

Functions

look(name \\ nil)

@spec look(term()) :: non_neg_integer()

The counter's value, without stepping it.

iex> TuningFork.Tick.reset()
iex> TuningFork.Tick.tick(:look_here)
iex> TuningFork.Tick.look(:look_here)
1

reset(name \\ :all)

@spec reset(term()) :: :ok

Put a counter back to zero. With no name, every counter.

set(name \\ nil, count)

@spec set(term(), non_neg_integer()) :: :ok

Put a counter at count. With no name, the loop's own.

tick(name \\ nil)

@spec tick(term()) :: non_neg_integer()

Step the counter on and give the value it was at.

iex> TuningFork.Tick.reset()
iex> {TuningFork.Tick.tick(:walk), TuningFork.Tick.tick(:walk)}
{0, 1}