/* {"description" : "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."} */
interface AudioTrack {
/* {"@description" : "Instantiate a new audio track, with initial samples. If loop is set to true, the sample set will be looped in playback until either append() or finish() is called. If loop is set to true, the parameters loopToFrame and loopAtFrame can optionally be used to specify the looped region of the sample set using frame indices, otherwise the sample will be looped after its last frame back to its first frame."} */
AudioTrack(int4 samples[], opt bool loop, opt int loopToFrame, opt int loopAtFrame)
/* {"@description" : "Set the volume of this track, in the range 0-100. Values higher than 100 are clipped to 100."} */
void setVolume(int1 volume)
/* {"@description" : "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. Note that, once this newly-appended sample begins playing, any prior sample is removed and cleaned up.",
"@return" : "True if the audio track is still playing (and will therefore play these samples), or false if the audio track is not currently playing."} */
bool append(int4 samples[], opt bool loop, opt int loopToFrame, opt int loopAtFrame)
/* {"@description" : "If the most recently added set of samples has been set to loop, this will end playback after the end of the current loop of that sample set. The loop status of the sample is still set to 'true' after this operation, such that the audio will loop again if/when it is played again via an audio device."} */
void finish()
/* {"@description" : "Get the current playback frame index (how many frames in total have been played)."} */
int getFrameIndex()
/* {"@description" : "Set the current playback frame index, relative to the start of the most recently added sample set."} */
void setFrameIndex(int index)
}To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n io.audio.AudioTrack -m "reason for update" -u yourUsername
Version 3 (this version) by barry
Notes for this version: Adds a setFrameIndex() function, clarifies documentation strings on existing functions.