if you're on osx you can do this with applescript. but it'll be pretty
slow switching and you'll need to check the 'enable access for
assistive devices' in systemprefs/universal access for it to work.
probably possible to also do this with the terminal command defaults
write com.apple.sound... or something similar but i haven't tried that.
example scripts below.
>> shell object? what command?
--save as outputDeviceInternal.scpt in home dir (make different scripts
for each device and just change the first line)
set outputDevice to "Internal speakers"
tell application "System Preferences"
set current pane to pane "com.apple.preference.sound"
tell application "System Events"
tell process "System Preferences"
tell tab group 1 in window "sound"
click radio button "Output"
repeat with r in every row of table 1 of scroll area 1
if (value of text field 1 of r) is equal to outputDevice then