andrewrk / libsoundio

C library for cross-platform real-time audio input and output
http://libsound.io/
MIT License
1.93k stars 228 forks source link

Use `kAudioObjectPropertyElementMain` instead of `kAudioObjectPropertyElementMaster` in `coreaudio.c`, since it is deprecated in macOS 12.0 #259

Closed khiner closed 1 year ago

khiner commented 2 years ago

Fixes build error

error: 'kAudioObjectPropertyElementMaster' is deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]
        kAudioObjectPropertyElementMaster
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        kAudioObjectPropertyElementMain

See coreaudio docs

cryptocode commented 1 year ago

I think this needs to check the macOS version and pick the right function. Here's one way to do that:

https://github.com/MusicPlayerDaemon/MPD/commit/bbc088ae4ea19767c102ca740765a30b98ffa96b

qemu does it like this:

https://github.com/qemu/qemu/blob/04ddcda6a2387274b3f31a501be3affd172aea3d/audio/coreaudio.m#L47-L56

barracuda156 commented 1 year ago

@khiner Yes, please choose the correct version conditional on macOS version. We do not want to break build on all macOS before 12 :)

There are macros in AvailabilityMacros.h which can be used (make sure to include that header for Apple).

autoantwort commented 1 year ago

280 was merged