Class: AudiopointerList
Overview
Manages an audio buffer list. Instead of circular buffers and too many memmove/memcpy, this object maintains an audio buffer "chain". You can append, insert, truncate, slice, extend, etc. without the expensive memory operations.
Methods
constructor
METHODCreates instance of AudiopointerList classParametersReturnsName Type Default Description bytesPerFrame unsigned int
Frame size. For example: 4 for 16-bit stereo, 8 for 32-bit stereo audio. initialNumElements unsigned int
Each list item uses 52 bytes memory. This number sets the initial memory usage of this list. Type Description Superpowered::AudiopointerList
The constructed instance. append
METHODAppend a buffer to the end of the list. The list will increase the retain count of the buffer by 1, similar to Objective-C. Not safe to use in a real-time thread, because it may use blocking memory operations.ParametersReturnsName Type Default Description buffer AudiopointerlistElement *
The buffer to append. Noneclear
METHODRemove everything from the list. It will decrease the retain count of all buffers by 1. Safe to use in a real-time thread.ParametersNoneReturnsNonecopyAllBuffersTo
METHODAppend all buffers to another buffer list. The anotherList will increase the retain count of all buffers by 1. Not safe to use in a real-time thread, because it may use blocking memory operations.ParametersReturnsName Type Default Description anotherList AudiopointerList *
the other AudiopointerList NoneforwardToLastSliceBuffer
METHODJumps the enumerator to the last buffer. Safe to use in a real-time thread.ParametersNoneReturnsNonegetLengthFrames
METHODReturns with the length of audio in the list.ParametersNoneReturnsType Description int
Length of audio in the list. getNextPositionFrames
METHODReturns the end position in an audio file or stream, plus 1. Safe to use in a real-time thread.ParametersNoneReturnsType Description int
End position getPositionFrames
METHODReturns the start position in an audio file or stream. Safe to use in a real-time thread.ParametersNoneReturnsType Description int
Start position getSlicePositionFrames
METHODReturns the slice start position in an audio file or stream. Safe to use in a real-time thread.ParametersNoneReturnsType Description int
Slice start position insert
METHODInsert a buffer before the beginning of the list. The list will increase the retain count of the buffer by 1, similar to Objective-C. Not safe to use in a real-time thread, because it may use blocking memory operations.ParametersReturnsName Type Default Description buffer AudiopointerlistElement *
The buffer to insert. NonemakeSlice
METHODCreates a 'virtual slice' from this list. Safe to use in a real-time thread.ParametersReturnsName Type Default Description fromFrame int
The slice will start from this frame. lengthFrames int
The slice will contain this number of frames. Type Description bool
True if succeeded, false if could not provide a slice with these arguments. nextSliceItem
METHODThis the slice's forward enumerator method to go through all buffers in it. Safe to use in a real-time thread.ParametersReturnsName Type Default Description lengthFrames int *
Returns the number of frames in audio. framesUsed float *
0 Returns the number of original number of frames, creating this chunk of audio. Good for time-stretching for example, to track the movement of the playhead. stereoPairIndex int
0 Index of AudiopointerlistElement.buffers. Type Description void *
Pointer to the audio or NULL. prevSliceItem
METHODThis the slice's backwards (reverse) enumerator method to go through all buffers in it. Safe to use in a real-time thread.ParametersReturnsName Type Default Description lengthFrames int *
Returns the number of frames in audio. framesUsed float *
0 Returns the number of original number of frames, creating this chunk of audio. Good for time-stretching for example, to track the movement of the playhead. stereoPairIndex int
0 Index of AudiopointerlistElement.buffers. Type Description void *
Pointer to the audio or NULL. removeFromEnd
METHODRemove frames from the end. If all of a buffer's contents are from this list, it will decrease the buffer's retain count by 1. Safe to use in a real-time thread.ParametersReturnsName Type Default Description numFrames int
The number of frames to remove. NoneremoveFromStart
METHODRemove frames from the beginning. If all of a buffer's contents are from this list, it will decrease the buffer's retain count by 1. Safe to use in a real-time thread.ParametersReturnsName Type Default Description numFrames int
The number of frames to remove. NonerewindSlice
METHODReturns the slice enumerator to the first buffer. Safe to use in a real-time thread.ParametersNoneReturnsNone
is not supported here.