Advertisement

How to beep with the PC Speaker?

Started by July 21, 2000 09:28 AM
8 comments, last by Ridcully 24 years, 5 months ago
How can i emit a signal from the PC Speaker under a Win32 platform? There doesn''t seem to be an appropiate API function (at least i didn''t find one). I cannot use the normal sound system because that could be captured by fullscreen apps. So I thought using the PC Speaker would be a good idea because it should always be avaible... Any suggestions? thanks ridcully
MessageBeep(0xFFFFFFFF);
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Advertisement
yeah, i found that one in the sdk documentation, but it doesn''t work if said app has the sound in exclusive mode captured.

i need some low-level code for that i suppose
Well, there''s the Beep(DWORD dwFreq, DWORD dwDuration); command, but that doesn''t work in Win95 and I''m not sure if it would be happy with exclusive mode.

I seem to recall that there was a control character you could use to produce a system beep, I think it was \a or possibly \g. I can''t find anything on it tho. It''s supposed to be a native C/C++ escape sequence for alerts, but I don''t know that it was retained in Windows. Try using a cout with one of those and see if it works.

Personally I try not to put my sound library in exclusive mode. It''s usually happy in normal mode.

Tell me if one of those works, I''m curious.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Hmmm, apparently it''s \a, it was listed under "escape sequences" but not "control characters".
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
no, it''s a pity but it doesn''t seem to work.

my intent is to emit any kind of signal to the user while he is playing a fullscreen game (that has captured both sound and video in exclusive mode).
can you think of any other way to do that?
Advertisement
Hmm. Well, I''m out of ideas. I don''t know the assembly commands to make stuff beep, and even that would probably be processed through the sound card first and therefore get lost.

It kind of surprises me that you''ve found a game with that problem... even Everquest, which locks you out of alt-tab, is in normal mode and allows sounds from other apps to get through.

~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
have you tried fputc(''\07'', stdout)?
Hu... guys? I thought modern PCs came without a Speaker... I might (am?) wrong though
wrong

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911

This topic is closed to new replies.

Advertisement