Is it possible to route audio to a specific output device on a per-program basis? And if yes, what's the best way?

So, here's the situation - I have two audio output devices (sound card and HDMI). I would like to have one program output through the HDMI and another program output through the sound card.

I am using Ubuntu 12.04