I'd like to be able to switch the sound output source in Mac OS X without any GUI interaction.
There are tools to do control the sound output, such as SoundSource and an applescript to open the preferences dialog.
What I am looking for is something that switches the preference instantly, like SoundSource but it has to be scriptable. The goal is to switch between my digital and analog output with one keystroke. I have a helper application that will launch a program or applescript on one keypress. All I need now is the applescript or application that switches the sound source quickly without any user interaction.
I'm willing to write some Objective-C if that is what it takes, but I'm pretty much a newbie at Cocoa development.
Do you have a one-click solution or can point me to a good tutorial on controlling sound system preferences from a Cocoa App or command line?
EDIT: I created a command-line application to do exactly this. You may download it at http://code.google.com/p/switchaudio-osx/downloads. Source code is available on the project site as well.