Exactly the title. I am trying to use Beep
from windows.h
in C, however the beep sound (I'm talking about the one similar to the "BIOS beep") does not work as intended unless I have my headphones on. Even the alternative MessageBeep(-1)
does not produce any sound without headphones, however BEL
or '\a'
gives the MessageBox
sound as intended.
I do have speakers on without the help of the headphones, since I can play music without them. I did notice a suspecting thing though -- when I press the volume mixer it should play a sound, but that only happens when I am on headphones. No such sound when I'm using the internal speaker.
I also did a sound test of my internal speaker from the Windows Settings; both left and right play the test sound okay.
Anyway, here's a summary snippet.
#include <stdio.h>
#include <windows.h>
int main(void) {
// Plays nothing on internal, basically equivalent to Sleep(2000).
// Meanwhile, it does its intended function on headphones.
Beep(1000, 2000);
// This produces a message box sound on headphones,
// but does not produce anything on the internal speaker.
MessageBeep(-1);
// This produces a message box sound, not the BIOS beep sound.
printf("\a");
return 0;
}
I appreciate any help, thank you!
Okay, this is going to be so stupid, I must have touched that part of the Control Panel long before.
I just noticed that even the UAC sound is not working. I also tried a test MessageBox
on Visual Basic Script and the sound is also not working. I have concluded and, it turned out, that my system sounds were actually muted when I checked the old Control Panel.
However, the Speaker was on, so \a
was actually using the speaker. I do not know what is the case for MessageBeep(-1)
, though, because it still does not work for me.
So... I guess check your volumes.