Search code examples
macosaudiodrivercore-audiohal

How to share data between application written in swift And Hal driver


enter image description here I have control app and Hal driver and I want to share data between them How can I done this ? the application written in swift and Hal driver in c


Solution

  • You can use XPC to communicate with your Audio Server Plugin. See QA1811 for more info and code samples.

    However that document doesn't mention that you can also define your own AudioObjectPropertySelectors and send a few CoreFoundation objects back and forth between your ASP and any app that can call CoreAudio.

    There's more information on custom properties in AudioServerPlugInCustomPropertyInfo in AudioServerPlugIn.h.

    The objects you can send and receive from your ASP are:

    1. kAudioServerPlugInCustomPropertyDataTypeNone (nothing !)
    2. kAudioServerPlugInCustomPropertyDataTypeCFString (a string)
    3. kAudioServerPlugInCustomPropertyDataTypeCFPropertyList (what ever you can serialise into a property list)