Interface AudioTrack
access this type via: io.audio.AudioTrack (provides, requires or uses)
This interface wraps audio samples for playback on an audio output instance. All audio samples must be encoded in signed 32-bit integers. An AudioTrack is a use-once entity for playback; samples are discarded immediately after they have been played.
Functions
AudioTrack(int4 samples[], optional bool loop)
void setVolume(int1 volume)
bool append(int4 samples[], optional bool loop)
void finish()
int getFrameIndex()
AudioTrack(int4 samples[], optional bool loop)
Instantiate a new audio track, with initial samples. If loop is set to true, the sample set is looped until either append() or finish() is called.
void setVolume(int1 volume)
Set the volume of this track, in the range 0-100. Values higher than 100 are clipped to 100.
bool append(int4 samples[], optional bool loop)
Append a further set of audio samples, to be played immediately after the prior set of samples has completed playback. If loop is set to true, this sample set is looped until append() or finish() is called.
void finish()
If the most recently added set of samples has been set to loop, this function removes that loop status and will end playback after the end of the current loop of that sample set.
int getFrameIndex()
Get the current playback frame index (how many frames in total have been played).