Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IIRC, the AudioObject* APIs replaced AudioHardware* some time ago. It’s been a while since I’ve done anything that uses them, but I did notice this in the last version of the Learning Core Audio sample code that I uploaded as errata:
- // AudioHardwareGetProperty() is deprecated
- // CheckError (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
- // &propertySize,
- // &defaultDevice),
- // "Couldn't get default input device");
- // AudioObjectProperty stuff new in 10.6, replaces AudioHardwareGetProperty() call
- // TODO: need to update ch08 to explain, use this call. need CoreAudio.framework
- AudioObjectPropertyAddress defaultDeviceProperty;
- defaultDeviceProperty.mSelector = kAudioHardwarePropertyDefaultInputDevice;
- defaultDeviceProperty.mScope = kAudioObjectPropertyScopeGlobal;
- defaultDeviceProperty.mElement = kAudioObjectPropertyElementMaster;
- CheckError (AudioObjectGetPropertyData(kAudioObjectSystemObject,
- &defaultDeviceProperty,
- 0,
- NULL,
- &propertySize,
- &defaultDevice),
- "Couldn't get default input device");
- Also, calling AudioObject from Swift will work just as well/poorly as AudioHardware. Any C function in a public API can be called from Swift just fine… it’s just highly unintuitive Swift since it uses lots of inout and free functions and UnsafeMutableRawPointerWillKillYouInYourSleep and all that.
- Hopefully that’ll at least get you pointed in the right direction. Sorry the docs aren’t better.
- —Chris
- On Jul 13, 2017, at 8:13 PM, Rick Mann <email-hidden> wrote:
- >
- > Apple's docs are sorely lacking. A whole suite of APIs is deprecated, with no indication of what to use in their stead, and no accessibility from Swift:
- >
- > https://developer.apple.com/documentation/coreaudio/1580716-audiohardwaregetpropertyinfo
- >
- > What's the replacement set of APIs for switching the current audio input on macOS?
- >
- > Thanks,
Advertisement
Add Comment
Please, Sign In to add comment