Skip to content

Instantly share code, notes, and snippets.

Created September 24, 2016 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4d55cd1ec55a5f71246780f4819c94b3 to your computer and use it in GitHub Desktop.
Save anonymous/4d55cd1ec55a5f71246780f4819c94b3 to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
import AVFoundation
var bufferList = AudioBufferList(
mNumberBuffers: 1,
mBuffers: AudioBuffer(
mNumberChannels: 1,
mDataByteSize: 4,
mData: nil))
// Pretend bufferList has been rendered. Now how do we get the samples?
let inNumberFrames = 2048
var monoSamples: [Float]!
withUnsafeMutablePointer(to: &bufferList.mBuffers.mData, {
let p = UnsafePointer($0)
monoSamples = [Float](UnsafeBufferPointer<Float>(start: p, count:Int(inNumberFrames)))
})
@designerfuzzi
Copy link

Cannot convert value of type 'UnsafePointer<UnsafeMutableRawPointer?>' to expected argument type 'UnsafePointer<_>?'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment