I have a TV set up as a second monitor and it is connected to my PC via HDMI. I have a Xonar DS sound card. When I extend my display to the second monitor, the video comes through fine but sometimes the audio doesn't transfer over and still plays on my PC. I sometimes was successful by moving the display to a single monitor and then doing it again, but sometimes not. It's driving me crazy, there's probably some setting that needs to be changed, but I have no clue what it is and if that's the case, why does it work sometimes?
Any ideas? Thanks
		
		
	 
I think you're going through frustrations similar to mine -- trying to integrate an Onkyo AV/Receiver with HDMI passthrough to an HDTV -- with my PC.  In "Control-panel->Sound" you should find all the sound devices on your system listed for which drivers are installed.  Windows will recognize both digital and analog devices.  Your PC speakers (I have a Logitech Z640 5.1 system with subwoofer) are analog -- as I can see from the ports on that Xonar DS which I found at the Egg after reading your post.  
HDMI on the other hand, is digital."  There may be several issues that need to be cleared up which overlap substantively per the problems you are having and the problems I am having.
This is why some here have remarked that HTPC-duty is best left to a dedicated PC for that purpose, while I instead have elected to make it only part of my PC's usage.  
The easiest way to resolve this would be to use one, single speaker system and sound configuration for everything.  For me, this means less integration with my Onkyo/Home-theater system, and a subwoofer and center speaker on the opposite side of the room from where it should be -- unless I move my multi-use computer from my desk to that side of the room.
I can get stellar "integration" and surround-sound through the ONkyo -- IF -- IF -- I choose to leave the receiver turned on all the time and relegate analog-audio and the computer speakers to "communications device" status while the Onkyo is "default."
We're going to get this resolved, sooner or later, as some people wearing guru-halos respond to your thread, my thread "Switching between speaker systems" (or something similar), or both.
There are immediate options:  turn off HDMI audio, and allow the sound card to provide all sound -- whether "windows sounds," or TV audio -- is just one.
Are you using Media Center to watch TV?  Because every time you change from one speaker system to another, you need to run "Tasks->General->Media Center-set-up->Set up speakers."  
It ain't easy . . . . unless we can find more details and a way to resolve this that doesn't require a thousand mouse-clicks, "speaker tests" and other steps . . .