PDA

View Full Version : How



Vicious
05-09-2002, 11:08 PM
How do you get a short wav sound to play at a certain time?
Like if some one types in a number and hits enter it beeps.

In QB it was easy



CLS
BEEP
End

lol

ihsir
05-09-2002, 11:37 PM
this is the way i do it.. it is non-std i think.

sound()/nosound()/delay() - all in dos.h



---
---
cout<<"enter sound value [Hz] : ";
cin>>sval;
cout<<"enter play duration [Sec] : ":
cin>>dur

sound(num);
delay(dur);
nosound();
---
---



...or if you want just a beep sound use --> cout<<"\a";

Vicious
05-10-2002, 08:54 AM
Is there a list of these "\" commands?

All I know are:

\n, \t, and now \a



:rolleyes:

vsriharsha
05-10-2002, 09:47 AM
HELP IS THE BEST PLACE...

Find it in ur IDE.

-Sriharsha.

ihsir
05-10-2002, 10:23 AM
here are what i know...


\a : bell-beep
\b : backspace
\f : formfeed
\n : newline-linefeed
\r : carriage return
\t : horizontal tab
\v : vertical tab
\\ : backslash
\' : single quote
\" : double quote
\0 : NULL

Da-Spit
05-11-2002, 03:09 AM
why doesn't \a work for me?
It's supposed to beep right?
I still don't get how that would make a beep... :confused:

btw: I'm using Dev-C++ 4.0

vsriharsha
05-11-2002, 09:48 AM
Then try the SOUND()/DELAY()/and NOSOUND() function combination only.

Sriharsha.

Vicious
05-12-2002, 10:27 PM
cout<<"BEEP!!! \a";

that gets he wav "bep" from your windows current sound scheme. You might have that sound disabled.

Vicious
05-12-2002, 10:28 PM
Originally posted by Vicious
cout<<"BEEP!!! \a";

that gets the wav "beep" or "ding" from your windows current sound scheme. You might have that sound disabled.

VirtualAce
05-12-2002, 11:53 PM
Well those are not exactly wav sounds. The beep is just Windows catching your beep which prob activates an interrupt and Windows has a handler there. Instead of the default beep, it plays the beep sound for your sound scheme. They just converted the system beep into something else. In pure DOS, that will still just beep the PC speaker.

To actually play wav files you must load them, mix them if needed into a final sample, and then play them via the sound card.

For info:

http://www.cae.wisc.edu/~brodskye//
http://developer.creative.com/LEFTMENU/DC_LM_Downloads.asp

Vicious
05-12-2002, 11:58 PM
Im goin wit wat he said...

Im new here but I know always go with what bubba says.
:)