RE: Replacements for AudioHardwareGetPropertyInfo() et al.?
RE: Replacements for AudioHardwareGetPropertyInfo() et al.?
- Subject: RE: Replacements for AudioHardwareGetPropertyInfo() et al.?
- From: Waverly Edwards <email@hidden>
- Date: Fri, 14 Jul 2017 16:46:56 +0000
- Thread-topic: Replacements for AudioHardwareGetPropertyInfo() et al.?
I’ll look around for some code I should have on my machine but I believe you’ll
need to use AudioUnitSetProperty or AudioObjectSetPropertyData
>>… highly unintuitive Swift since it uses lots of inout and free functions and
>>UnsafeMutableRawPointerWillKillYouInYourSleep and all that.
Oh, I’ve had LOTS of (miserable) experience with
UnsafeMutableRawPointerWillKillYouInYourSleep.
I really like Swift but Coreaudio + Swift = SometimesIncrediblyPainful
W.
From: Coreaudio-api
[mailto:coreaudio-api-bounces+wedwards=email@hidden] On Behalf Of
Rick Mann
Sent: Thursday, July 13, 2017 9:38 PM
To: Chris Adamson <email@hidden>
Cc: Core Audio List <email@hidden>
Subject: Re: Replacements for AudioHardwareGetPropertyInfo() et al.?
Thanks, I’ll check it out.
Can’t call the deprecated one from Swift because it won’t let me (anything
deprecated before 10.9).
--
Rick Mann
email@hidden<mailto:email@hidden>
On Jul 13, 2017, at 18:30, Chris Adamson
<email@hidden<mailto:email@hidden>> wrote:
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<mailto: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,
--
Rick Mann
email@hidden<mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list
(email@hidden<mailto:email@hidden>)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden<mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden