Right now when I plug my HDTV into my laptop's HDMI input I have to run 'xrandr' for it to recognize the display and then manually switch the audio hardware selection.
Is there a way that Ubuntu can detect when the HDMI is plugged in and invoke a script that calls xrandr and switches the hardware and then does likewise when disconnected?
It is possible, some Linux graphics drivers have HDMI hot-plug events, some require special options to be enabled for them to fire. Graphics driver developers though haven't been focusing much time on the functionality so I don't know if it will work for your brand of graphics card:
RadeonHD details: http://wiki.x.org/wiki/radeonhd
In Ubuntu 11.10 pulseaudio will recognize when you plug hdmi (or phone jack) and will make the switch automatically.
See this:
http://voices.canonical.com/david.henningsson/?p=15