-
Beeeeep!
I just wondered how to make my program "beep". I saw someone
else do it in a console game. I want to be able to in my console
games too. Is there a function or something? Like Beep() or
MakeNoise()? That's all I want to know.
Compiler: Dev-Cpp 4.9.8.0
OS: Windows ME
Thanks...
-
Code:
std::cout << '\a' << endl;
That should give a beeping sound.
-
Thanks. I'm still open to any other ways to do the same thing.
EDIT: It still doesn't work, Hmmmm.
YET ANOTHER EDIT: None of my other programs that did make
beeps before work now, It's not your mothod, I just have something disabled. My speakers are on, so that's not it.
-
That \a thing has never worked for me, might be windows
http://msdn.microsoft.com/library/de.../base/beep.asp
that method is less simple then just Beep() and is sync, meaning it probably will be of no use for a game
-
Um.....how about use Beep(). That is in <windows.h>. It should work. Note the capitalization.
-
Won't including windows.h make me have to declare main as
Code:
int WINAPI WinMain(HINSTANCE hthisin, HINSTANCE hprevin,
LPSTR cmdlin, int cmb)
? or can I just use
good old main()?
-
-
Okay, I tryed it... What are the paramiters to Beep()? I says too few arguments...
-
check my link...
Code:
BOOL Beep(
DWORD dwFreq,
DWORD dwDuration
);
And as I said that is not suitable to games because it is not async.
Anyways, remember to include this
#define WIN32_LEAN_AND_MEAN
for most uses of windows.h
-
Okay, thanks. I'll check it out, I don't ghet why it's not good for a game, all I need it to
do is beep. Well, meybe not, but it will still work, for now.
-
Hmmm, well, I see what you mean. I was hoping for something alterable. I have windows
ME, so it gives me a windows beep, What is the point of accepting two args if it won't
do anything but one tone? Ferthermore, it will end a loop instantly.
-
Seems it would be easier to just emulate a PC speaker through a normal sound system. I've never done it before but I imagine you'd just produce a square wave and set the volume and duration of it. ;)
-
-
No idea. I'm trying to figure it out myself. :D
-
Ummmm...it would be easier to use DirectSound/Music. But that's probably too obvious so no one will do it.