deweller / switchaudio-osx

Change the audio source for Mac OS X from the command line.
Other
1.19k stars 88 forks source link

Reliance on deprecated CoreAudio APIs #45

Closed allquixotic closed 1 year ago

allquixotic commented 2 years ago

There are a lot of CoreAudio deprecated APIs, and some of them are used in switchaudio-osx. Once Apple drops these functions, a future version of MacOS (something newer than Ventura, since it works on Ventura) will drop support for the current version of switchaudio-osx.

Example of deprecated APIs: https://github.com/deweller/switchaudio-osx/blob/master/audio_switch.c#L478

Proof of deprecation: https://developer.apple.com/documentation/coreaudio/1580716-audiohardwaregetpropertyinfo?language=objc

What to do instead: Apparently you can use AudioObjectGetPropertyData and AudioObjectPropertyAddress. See https://www.mail-archive.com/coreaudio-api@lists.apple.com/msg01214.html

Also useful collateral: https://stackoverflow.com/questions/4575408/audioobjectgetpropertydata-to-get-a-list-of-input-devices

deweller commented 1 year ago

Thanks!