Ok, so here it goes. For the past couple of days I've been struggling with this issue immensely. Basically, what I've done is I have created an audio driver for macOS that successfully routes audio to a virtual speaker (I used the sample code from Apple:
2.And if it is a correct approach, how can I compile the driver with the TFLite library so that it shows up in the sound preferences?
The so-called sound preferences app is MIID(Audio MIDI setup.app
).
If the init lifecycle of your ASP is good. Then your ASP should show up here. For the first few days, my ASP compiles but never shows up in the MIDI. It takes me a lot of time trouble shooting.
Here is some tips:
You cannot attach to the ASP in its init stage. The system launches your ASP as an independent process. But you can find its PID with this command
ps -ef|grep "Core Audio",
and then you can attach to this process with this PID in Xcode. This will help you a lot when debugging yourxxxDoIOOperation.
Add more logs in every COM method. It helps you to understand the lifecycle.
$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist && sudo launchctl load /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist
this command helps you reload all ASPs. Then you can use theconsole
app to check ASP's logs. This filterprocess:com.apple.audio.Core-Audio-Driver-Service
will help you to filter the logs.