Mac OS X

Logic Pro scripty bits: tracking current Input device

Got a call recently for a post house that wants to have a dashboard of what input devices are running in Logic Pro across a fleet of audio edit bays. Logic still uses a standard .plist format to store settings in ~/Library/Preferences/com.apple.logic10.plist. So it’s easy enough to read and write settings. There’s a lot in there but let’s focus on just the Current Hardware, which is in a dictionary called AudioHardwarePreferences. We can find that by running the defaults command on the defaults domain com.apple.logic10 followed by the dictionary name:

defaults read com.apple.logic10 AudioHardwarePreferences

The output then shows us the last few and some other information (e.g. we can actually use that DeviceID to control things using the core audio frameworks):

{ CurrentCoreAudioDeviceID = 97; CurrentCoreAudioDeviceName = "External Headphones"; CurrentCoreAudioDeviceUID = BuiltInHeadphoneOutputDevice; CurrentCoreAudioInputDeviceID = 108; CurrentCoreAudioInputDeviceName = "RODE NT-USB"; CurrentCoreAudioInputDeviceUID = "AppleUSBAudioEngine:RODE Microphones:RODE NT-USB:14210000:2"; CurrentCoreAudioInputModelUID = "RODE NT-USB:19F7:0003"; CurrentCoreAudioModelUID = "Codec Output"; LastUsedCoreAudioDeviceNames = ( "External Headphones", "RODE NT-USB", "Scarlett Solo USB", PA248, "MacBook Pro Speakers" ); LastUsedCoreAudioInputDeviceNames = ( "RODE NT-USB", "External Microphone", "Scarlett Solo USB", "MacBook Pro Microphone" ); }

To then parse out just the current audio device we need to see what the CurrentCoreAudioInputDeviceName key in the AudioHardwarePreferences dictionary is, so we can turn to PlistBuddy for that operation:

/usr/libexec/PlistBuddy -c "print 'AudioHardwarePreferences':CurrentCoreAudioInputDeviceName" ~/Library/Preferences/com.apple.logic10.plist

The output in my case would then just be:

RODE NT-USB