Cannot Record While Headphones/Speakers are Plugged In

Hello, I’m currently running the most updated version of Audacity on Windows 7, and I’m attempting to record my computer’s audio. The application has no trouble recording while I use the computers internal speakers as the output, but as soon as I jack in a pair of headphones or my speakers, the audio recording ends (or will not start if it was plugged in at the beginning of the recording). I’ve tried to resolve the issue myself, but I can’t seem to make it work. I’m recording music as I play it on a virtual keyboard, so I’d prefer to do it with my headphones in to ensure that I’m hearing it at the best quality, and I’d like to be able to record at night without bothering my roommate. On my previous computer (also running Windows 7) I was able to do this without any issues. I have a strong feeling that it’s either a simple fix, or it’s because my computer is incapable of providing this function.