Thanks, Matt Unfortunately this does not work. Since the line creates an explicitly unwrapped optional containing nil, AudioUnitGetProperty fails at runtime, just as passing in nil directly would (if the compiler would allow it):
fatal error: unexpectedly found nil while unwrapping an Optional value For what it’s worth I am currently querying the maximum property size using AudioUnitGetPropertyInfo, then getting the property data using AudioUnitGetProperty and finally slicing off the portion of relevant data reported by the ioDataSize out value. Benjamin > Am 19.10.2016 um 15:21 schrieb Matt Grippaldi <[email protected]>: > > Try this… > > let nullPtr:UnsafeMutableRawPointer! = nil > > Matt Grippaldi > [email protected] <mailto:[email protected]> > > > > > > > > > > >> On Oct 19, 2016, at 7:13 AM, Benjamin Federer <[email protected] >> <mailto:[email protected]>> wrote: >> >> 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 >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Coreaudio-api mailing list ([email protected] >> <mailto:[email protected]>) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/coreaudio-api/mattg%40kinematicsystems.com >> >> <https://lists.apple.com/mailman/options/coreaudio-api/mattg%40kinematicsystems.com> >> >> This email sent to [email protected] >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
