Is it possible to utilize the Spatial Audio API on macOS without targeting Mac Catalyst?

The question speaks for itself. Is there any exposed API for accessing or implementing Spatial Audio, for virtual surround playback, say, from doing my own multi-channel decoding and outputting to discrete surround speaker positions, and having that track a user wearing a Spatial Audio compatible headphone or earphone device attached to their Mac via Bluetooth?

I maintain an audio player, and I currently implement a fixed position spatial audio downmixer for surround, as an option. I would also like to support Spatial Audio downmixing via the OS. And I do not want to have to convert my app to a Catalyst app and lose a good chunk of backwards compatibility with older macOS versions to do this.

Answered by kode54 in 719502022

I already solved my problem.

https://github.com/losnoco/Cog/blob/main/Audio/Output/OutputAVFoundation.m

AVSampleBufferAudioRenderer supports this perfectly on macOS Monterey (12.0). Plus, the API, even without spatial audio support, is supported all the way down to High Sierra (10.13). You can see where, in my implementation, that I use a function gated by if(@available(macOS 12.0, *)) to enable spatialization. I also use the timed event reporting observer to keep track of the playback position, since currentTime requires Mojave (10.14).

Accepted Answer

I already solved my problem.

https://github.com/losnoco/Cog/blob/main/Audio/Output/OutputAVFoundation.m

AVSampleBufferAudioRenderer supports this perfectly on macOS Monterey (12.0). Plus, the API, even without spatial audio support, is supported all the way down to High Sierra (10.13). You can see where, in my implementation, that I use a function gated by if(@available(macOS 12.0, *)) to enable spatialization. I also use the timed event reporting observer to keep track of the playback position, since currentTime requires Mojave (10.14).

Is it possible to utilize the Spatial Audio API on macOS without targeting Mac Catalyst?
 
 
Q