Skip to content

Instantly share code, notes, and snippets.

@eofster
Last active October 1, 2015 18:37
Show Gist options
  • Save eofster/68a7cc41996b60e5266c to your computer and use it in GitHub Desktop.
Save eofster/68a7cc41996b60e5266c to your computer and use it in GitHub Desktop.
private func audioBufferListWithObjectID(objectID: AudioObjectID, scope: AudioObjectPropertyScope) throws -> AudioBufferList {
var address = audioBufferListAddressWithScope(scope)
var length = try propertyDataSizeWithObjectID(objectID, address: address)
let bytes = UnsafeMutablePointer<AudioBufferList>.alloc(Int(length))
defer { bytes.destroy() }
let status = AudioObjectGetPropertyData(objectID, &address, 0, nil, &length, bytes)
if status != noErr {
throw TelephoneError.SystemAudioDevicePropertyDataGetError(systemErrorCode: Int(status))
}
return bytes.memory
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment