audio-clip
Audio playback engine
Prev:update-audio ( audio-engine -- )
Next:play-clip ( audio-clip -- )


Vocabulary
audio.engine

Class description
Opaque type of clips being played by an audio-engine. There are two subclasses provided:
static-audio-clip, constructed by <static-audio-clip> or play-static-audio-clip
streaming-audio-clip, constructed by <streaming-audio-clip> or play-streaming-audio-clip

Clip objects are transient. They get disposed and invalidated by the controlling audio-engine when their playback finishes or is stopped. The play-clip, pause-clip, and stop-clip words control playback of individual clips. play-clips, pause-clips, and stop-clips synchronize the playing, pausing, or stopping of multiple clips.

Definition
USING: destructors math ;

IN: audio.engine

TUPLE: audio-clip < disposable
{ audio-engine audio-engine initial: T{ audio-engine } }
source { al-source integer initial: 0 } ;


Methods
USING: accessors audio.engine audio.engine.private destructors
kernel sequences ;

M: audio-clip dispose*
[ dup audio-engine>> clips>> remove! drop ]
[ al-source>> flush-source ] bi ;