Q:

Is there a way to have sound balance affected by window position?

I think it would be great it I could control the sound balance by placing a window in different places on my desktop. For example, I could put a youtube video playing on the left-hand side, and hear it out of the left speaker. Simultaneously, I could be playing a game on the right-hand side that I'd hear through the right speaker. Is there anything I can do to get this behaviour?

A:

This is not supported by any system I know of.
But it wouldn't be that hard to do but it would require being able to match up mixer inputs with the windows that they appear to come from (this requirement is the hard part.) and then looking up the location of the window for an input and modifying the mixer balance for that input accordingly. 
Using X11 state change notification, it would be possible to update the balance for an input in realtime without polling the window locations.

