I have experienced this with my HP Pavillion dm4 as well, and it drove me nuts.
The reason this occurs is that the audio chipset in some HP laptops is configured so that the headphones are used as a "communication device" and the speakers are used to play other sounds. Whenever you use a communication program, like Skype or Google Video Chat, it sends the audio for your communication to the communication device (headphones) and the rest of the audio to the "default audio device", the speakers.
There are two solutions:
Disable this "functionality" completely:
In the system tray, find the IDT Audio Settings icon. Double-click it to open the IDT audio settings dialog
Go to "speakers and headphones" on the left and then select "settings" under that. Click the little bubble icon next to "Set as default communication device" so that it turns green.
- Go to "Independent headphones" and choose "settings". Make sure that "set as default communications device" is not green.
Change the communication device settings in Skype and Google Video Chat
- In Gmail, go to the Chat tab under Settings. Choose Speakers and Headphones from the dropdown options for Speaker settings.
- In Skype, go to the Options dialog, choose Audio Settings, then click on Advanced Settings. From there, choose Speakers and Headphones once again.
First off... if you examined where your audio header connects to your motherboard, you will most likely find that you don't only have left and right Out, as well as ground connections for each, but that you also have left and right In.
Wait... what?
Image courtesy of Intel (believe it or not).
With some header connectors, there are just two loops (red and white usually, but not always) of wire from the out pin to the return pin.
Image Courtesy of bjorn3d.com
However... the whole reason for this out/return setup is simple, and it sounds like your case is making use of it. Better quality cases use headphone jacks that include a physical "switch" within them.
Found that image on Tomshardware.it
This is simply a contact that is broken when you insert the 3.5mm plug. When that contact is broken, no return signal is sent to the motherboard, so no audio is sent to the rear speaker port. When the headphone plug is removed from the front jack, the connection is re-established, so the audio signal is sent once again to the return pins, and thus to the rear audio out port.
In newer/better quality motherboards, this can be controlled via software... where if you are using a program that can interact properly with your audio hardware and drivers, you can actually tell the software whether to send audio to the headphones, or the speakers. However, this functionality all depends on having the most up to date drivers, a motherboard that has audio hardware that offers this functionality, and software that offers the ability to send audio to different outputs.
From what you say and show, you are dealing with a hardware function only. You could try to update your drivers, and you can see if you are given "expert" or "advanced" options...
but it is just as likely (if not more so) that it is just the design of your case front audio header and your specific motherboard that switches your speakers on and off depending on the presence of something plugged in the front.
Best Answer
I don't believe that you can get around the requirement for restarting the application after a sound switch.
For making this less painful, you could maybe use the free Vista Audio Changer :
See also Switch default Audio Sound Card from system tray, using the free STADS (System Tray Audio Device Switcher).
Another commercial option may be Coastal Audio Changer (trial available).