Last active
October 1, 2015 18:37
-
-
Save eofster/68a7cc41996b60e5266c 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
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