TuningFork.Sink behaviour (TuningFork v0.1.11)

Copy Markdown View Source

The behaviour of an output for mixed samples: opened once, written to in chunks, closed.

Summary

Callbacks

Release the sink.

Open the sink with the stage's options, which always include :rate (samples per second) and :channels (samples per frame). Returns the state the other callbacks receive.

Take one chunk of signed 16-bit little-endian PCM.

Functions

The sink named by the :tuning_fork, :sink setting, defaulting to TuningFork.Sink.Silent.

Types

t()

@type t() :: term()

Callbacks

close(t)

@callback close(t()) :: :ok

Release the sink.

open(keyword)

@callback open(keyword()) :: {:ok, t()} | {:error, term()}

Open the sink with the stage's options, which always include :rate (samples per second) and :channels (samples per frame). Returns the state the other callbacks receive.

write(t, binary)

@callback write(t(), binary()) :: :ok | {:error, term()}

Take one chunk of signed 16-bit little-endian PCM.

Must not block for longer than the audio the chunk represents. Must return {:error, reason} when the destination can no longer take samples; the stage then stops feeding this sink.

Functions

configured()

@spec configured() :: module()

The sink named by the :tuning_fork, :sink setting, defaulting to TuningFork.Sink.Silent.