play sound through speakers when headphones are on?

I want to create a simple program what is able to
play sound through speakers even when headphones are on.

Is it doable?
Any library what allows to do such thing?

Thanks!
It depends entirely on your hardware.

For example, my desktop motherboard has two separate sound cards; one for the rear I/O and one for the front headphone and microphone jacks. I can give either sound card priority over the other, such that if one is connected it uses it by default, or vice versa. I can also direct the output of individual applications explicitly to either card or to the system's default.

However, not all motherboards are set up like this. My laptop has only one sound card that controls both the speakers and the headphone jack. When the headphone jack is plugged in, the hardware automatically disables the built-in speakers, and when it's unplugged it automatically enables them. I have no way of controlling this from the software because it's functionality that's implemented in the hardware.
Topic archived. No new replies allowed.