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

    METHOD
    Creates instance of AudiopointerList class
    Parameters
    NameTypeDefaultDescription
    bytesPerFrameunsigned intFrame size. For example: 4 for 16-bit stereo, 8 for 32-bit stereo audio.
    initialNumElementsunsigned intEach list item uses 52 bytes memory. This number sets the initial memory usage of this list.
    Returns
    TypeDescription
    Superpowered::AudiopointerListThe constructed instance.
  • append

    METHOD
    Append 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.
    Parameters
    NameTypeDefaultDescription
    bufferAudiopointerlistElement *The buffer to append.
    Returns
    None
  • clear

    METHOD
    Remove everything from the list. It will decrease the retain count of all buffers by 1. Safe to use in a real-time thread.
    Parameters
    None
    Returns
    None
  • copyAllBuffersTo

    METHOD
    Append 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.
    Parameters
    NameTypeDefaultDescription
    anotherListAudiopointerList *the other AudiopointerList
    Returns
    None
  • forwardToLastSliceBuffer

    METHOD
    Jumps the enumerator to the last buffer. Safe to use in a real-time thread.
    Parameters
    None
    Returns
    None
  • getLengthFrames

    METHOD
    Returns with the length of audio in the list.
    Parameters
    None
    Returns
    TypeDescription
    intLength of audio in the list.
  • getNextPositionFrames

    METHOD
    Returns the end position in an audio file or stream, plus 1. Safe to use in a real-time thread.
    Parameters
    None
    Returns
    TypeDescription
    intEnd position
  • getPositionFrames

    METHOD
    Returns the start position in an audio file or stream. Safe to use in a real-time thread.
    Parameters
    None
    Returns
    TypeDescription
    intStart position
  • getSlicePositionFrames

    METHOD
    Returns the slice start position in an audio file or stream. Safe to use in a real-time thread.
    Parameters
    None
    Returns
    TypeDescription
    intSlice start position
  • insert

    METHOD
    Insert 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.
    Parameters
    NameTypeDefaultDescription
    bufferAudiopointerlistElement *The buffer to insert.
    Returns
    None
  • makeSlice

    METHOD
    Creates a 'virtual slice' from this list. Safe to use in a real-time thread.
    Parameters
    NameTypeDefaultDescription
    fromFrameintThe slice will start from this frame.
    lengthFramesintThe slice will contain this number of frames.
    Returns
    TypeDescription
    boolTrue if succeeded, false if could not provide a slice with these arguments.
  • nextSliceItem

    METHOD
    This the slice's forward enumerator method to go through all buffers in it. Safe to use in a real-time thread.
    Parameters
    NameTypeDefaultDescription
    lengthFramesint *Returns the number of frames in audio.
    framesUsedfloat *0Returns 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.
    stereoPairIndexint0Index of AudiopointerlistElement.buffers.
    Returns
    TypeDescription
    void *Pointer to the audio or NULL.
  • prevSliceItem

    METHOD
    This the slice's backwards (reverse) enumerator method to go through all buffers in it. Safe to use in a real-time thread.
    Parameters
    NameTypeDefaultDescription
    lengthFramesint *Returns the number of frames in audio.
    framesUsedfloat *0Returns 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.
    stereoPairIndexint0Index of AudiopointerlistElement.buffers.
    Returns
    TypeDescription
    void *Pointer to the audio or NULL.
  • removeFromEnd

    METHOD
    Remove 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.
    Parameters
    NameTypeDefaultDescription
    numFramesintThe number of frames to remove.
    Returns
    None
  • removeFromStart

    METHOD
    Remove 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.
    Parameters
    NameTypeDefaultDescription
    numFramesintThe number of frames to remove.
    Returns
    None
  • rewindSlice

    METHOD
    Returns the slice enumerator to the first buffer. Safe to use in a real-time thread.
    Parameters
    None
    Returns
    None
Javascript

is not supported here.

v2.7.2