Cauldron2D.Audio.Rendered (Cauldron2D v0.1.0)

Copy Markdown View Source

Every sound a game plays, rendered once: a TuningFork.Voice at a rate becomes mono PCM the first time it is asked for and is kept in an ETS table for every stage on the node after, whatever its gain or pan, which are applied to the copy each time.

pcm = Cauldron2D.Audio.Rendered.fetch(voice, 44_100)

Voices are deterministic, so a rendering is the sound; a stage replays it in place of synthesising it again.

Summary

Functions

Returns a specification to start this module under a supervisor.

How many renderings are kept.

The mono rendering of voice at rate, at unit gain and centred, rendered now if it was not before.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count()

@spec count() :: non_neg_integer()

How many renderings are kept.

fetch(voice, rate)

@spec fetch(TuningFork.Voice.t(), pos_integer()) :: binary()

The mono rendering of voice at rate, at unit gain and centred, rendered now if it was not before.