Hi there, especially the Core Audio team,
The documentation for AudioUnitGetProperty() says:
public func AudioUnitGetProperty(_ inUnit: AudioUnit, _ inID: AudioUnitPropertyID, _ inScope: AudioUnitScope, _ inElement: AudioUnitElement, _ outData: UnsafeMutableRawPointer, _ ioDataSize: UnsafeMutablePointer<UInt32>) -> OSStatus outData: … Set this parameter to NULL when calling this function if you only want to determine how much memory to allocate for a variable size property.
I cannot, for the life of me, get Swift 3 to create a NULL pointer. With Swift 2 it seems this was possible. With Swift 3 I am supposed to pass in nil instead. But since outData is a non-optional I am not allowed to do that.
Interestingly, AudioUnitGetPropertyInfo() also works with passing NULL for its inOut parameters, which are optionals:
public func AudioUnitGetPropertyInfo(_ inUnit: AudioUnit, _ inID: AudioUnitPropertyID, _ inScope: AudioUnitScope, _ inElement: AudioUnitElement, _ outDataSize: UnsafeMutablePointer<UInt32>?, _ outWritable: UnsafeMutablePointer<DarwinBoolean>?) -> OSStatus
Is outData being a non-optional intentional and, if so, how should I pass in NULL?
Thanks, Benjamin |