How can I programmatically create a Multi-Output Device in Mac OS X?
The Audio Midi Setup program provides a GUI interface for creating one, but I would like to be able to create one in code.
I've found some resources already for creating aggregate devices, but multi-output devices function differently and I can't find anything on creating them. Here's what I've got so far:
I had the same need to create a Multi Output Device programmatically. This example: http://daveaddey.com/?p=51 covers the needs.
I managed to do it by studying /Library/Preferences/Audio/com.apple.audio.SystemSettings.plist. This is the place where the Audio MIDI Setup saves the configuration (on my box, El Capitan).
Create a Multi-Output Device and an Aggregate Device and study the plist. They're pretty much the same, except the fact that the Aggregate Device has a master device, while the MOD does not.
Considering the example from Dave Addey: I for one, managed to create the MOD by removing the master device and adding my own devices as outputs. (in my case, Soundflower and the Default Output)
Besides this, add the "stacked" boolean key to the CF Dictionary. According to the CoreAudio sources, this key ensures that the same output is sent to all output channels, as opposed to the Aggregate Device which is not stacked, and combines multiple devices to make itself 'look' as a single device with a lot of channels.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With