A TuningFork.Pattern.Player rendered ahead of time in a process of its own, so the
stage takes its chunks ready-made and the pattern's synthesis runs on another core.
{:ok, ahead} = TuningFork.Pattern.Ahead.start_link(player: player, chunk: 256, channels: 2)
pcm = TuningFork.Pattern.Ahead.next(ahead)
TuningFork.Pattern.Ahead.apply(ahead, &TuningFork.Pattern.Player.gain(&1, 0.5))Up to :depth chunks are kept rendered (default 8); next/1 returns the oldest and
renders one on the spot when none is ready. A change made with apply/2 reaches the
player at the render frontier, at most :depth chunks ahead of what next/1 has
handed out.
Summary
Functions
Change the player with fun from the render frontier on.
Returns a specification to start this module under a supervisor.
Where the player has reached at the render frontier, in cycles.
The next chunk.
How many chunks are rendered and waiting.
Start rendering :player in chunks of :chunk frames for :channels channels, :depth chunks ahead.
Stop rendering.
Functions
@spec apply(GenServer.server(), (TuningFork.Pattern.Player.t() -> TuningFork.Pattern.Player.t())) :: :ok
Change the player with fun from the render frontier on.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec cycle(GenServer.server()) :: float()
Where the player has reached at the render frontier, in cycles.
@spec next(GenServer.server()) :: binary()
The next chunk.
@spec rendered(GenServer.server()) :: non_neg_integer()
How many chunks are rendered and waiting.
@spec start_link(keyword()) :: GenServer.on_start()
Start rendering :player in chunks of :chunk frames for :channels channels, :depth chunks ahead.
@spec stop(GenServer.server()) :: :ok
Stop rendering.