Created
September 24, 2016 20:29
-
-
Save anonymous/4d55cd1ec55a5f71246780f4819c94b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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))) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cannot convert value of type 'UnsafePointer<UnsafeMutableRawPointer?>' to expected argument type 'UnsafePointer<_>?'