Core Audio has a C API that copies some data into memory you supply. In one case, I need to pass in a pointer to an AudioBufferList, which is defined as:
st
You can create a buffer pointer that starts at the given address and has the given number of elements:
let buffers = UnsafeBufferPointer<AudioBuffer>(start: &bufferList.memory.mBuffers,
count: Int(bufferList.memory.mNumberBuffers))
for buf in buffers {
// ...
}
Update for Swift 3 (and later):
let buffers = UnsafeBufferPointer<AudioBuffer>(start: &bufferList.pointee.mBuffers,
count: Int(bufferList.pointee.mNumberBuffers))
for buf in buffers {
// ...
}