I'm really going crazy with a stupid and apparently simple problem...
I have to convert a Data
to an AVAudioPCMBuffer
.
Looking to this question it seems to be easy, but all has changed with Swift 3. This cursed language which is continuously changing (sorry for the outburst)!
I have this snippet of code
let audioBuffer = AVAudioPCMBuffer(pcmFormat: audioFormat!, frameCapacity: UInt32(data.count)/(audioFormat?.streamDescription.pointee.mBytesPerFrame)!)
audioBuffer.frameLength = audioBuffer.frameCapacity
let channels = UnsafeBufferPointer(start: audioBuffer.floatChannelData, count: Int(audioFormat!.channelCount))
data.copyBytes(to: UnsafeMutablePointer<Float>(channels[0]))
But this last line gives me this error:
Cannot convert value of type 'UnsafeMutablePointer<Float>' to expected
argument type 'UnsafeMutablePointer<_>'
May someone has a solution to this?