|
-
Mar 26th, 2002, 05:57 PM
#1
Thread Starter
PowerPoster
Beep noise in C++
I remember in QBasic you could use the motherboard speaker to play some tones, and it was pretty easy too. How would i do this in C++?
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Mar 26th, 2002, 05:58 PM
#2
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 26th, 2002, 06:18 PM
#3
Thread Starter
PowerPoster
Does that work on 2k? Because isin't direct hardware access forbidden? It compiles great, but i get some "Privledged Instruction" error
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Mar 26th, 2002, 06:31 PM
#4
For use in the NT family, use the PlaySound api
Code:
int retval;
LPSTR file = "c:\mybeep.wav"
retval = PlaySound(
file,
NULL,
SND_ASYNC) ;
You need to find a sound file that emulates the beep sound you want.
-
Mar 26th, 2002, 06:39 PM
#5
Monday Morning Lunatic
Originally posted by jim mcnamara
For use in the NT family, use the PlaySound api
Code:
int retval;
LPSTR file = "c:\mybeep.wav"
retval = PlaySound(
file,
NULL,
SND_ASYNC) ;
You need to find a sound file that emulates the beep sound you want.
Don't you need to use LPCSTR, since string literals are const char*?
Is the motherboard speaker actually available at all under NT?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 26th, 2002, 07:46 PM
#6
Use the MessageBeep() API, I think =).
Z.
[edit]
Dont remember if it will beep on the PC Speaker, if you have a sound card installed, but it should otherwise.
-
Mar 29th, 2002, 02:39 AM
#7
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|