MediaPipeTasksCommon Framework Reference

FloatBuffer

final class FloatBuffer: Equatable

A contiguous buffer of 32-bit floating-point audio samples.

  • Creates a FloatBuffer by copying length elements from data, or zero-initializing when data is nil.

    Declaration

    Swift

    convenience init(data: UnsafePointer<Float>?, length: Int)
  • Creates a FloatBuffer copied from elements.

    Declaration

    Swift

    init(elements: [Float])
  • Creates a FloatBuffer of length elements initialized to zero.

    Declaration

    Swift

    convenience init(length: Int)
  • A copy of the buffer's elements.

    Declaration

    Swift

    final var elements: [Float] { get }
  • The number of elements in the buffer.

    Declaration

    Swift

    final var length: Int { get }
  • Resets all elements in the buffer to 0.0.

    Declaration

    Swift

    final func clear()
  • Returns an independent deep copy of this FloatBuffer.

    Declaration

    Swift

    final func copy() -> FloatBuffer
  • Calls body with an immutable UnsafeBufferPointer to the buffer's elements.

    Declaration

    Swift

    final func withUnsafeBufferPointer<Result>(_ body: (UnsafeBufferPointer<Float>) throws -> Result) rethrows -> Result
  • Calls body with an UnsafeMutableBufferPointer to the buffer's elements.

    Declaration

    Swift

    final func withUnsafeMutableBufferPointer<Result>(_ body: (UnsafeMutableBufferPointer<Float>) throws -> Result) rethrows -> Result