How do you play sounds (different beeps) out of the HD in vb or c++? I
've seen many programs do it, and I think it's very neat and would be nice to have it on my program. Thanks!
Ehh?? Hard drives are supposed to keep silent... If they make strange noises, that's a very bad sign ;)
If you meant the PC speaker instead of HD, you can do it in WinNT using the Beep function (kernel32.dll). But note that many users find these beeps annoying - use them only where appropriate.
I think he means playing wav files.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_9uxw.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_9uxw.asp)
Example:
PlaySound("c:\mysound.wav", NULL, SND_ASYNC);
Query: Do you also need to specify SND_FILENAME? I never have in the past but MSDN implies that you do.
Quote from: Arta[vL] on May 10, 2003, 01:03 PM
Query: Do you also need to specify SND_FILENAME? I never have in the past but MSDN implies that you do.
Yes... But it might work without it.
Yes, I meant different 'beeps'. All (most) old dos games use this, they use beeps as the sound. How can I get a different toned beep than just 'beep'?
Like Yoni, said, use the Beep API.
BOOL Beep(
DWORD dwFreq,
DWORD dwDuration
);
Bearing in mind that it wont work well or at all on any non-NT based platforms.
dwFreq :Frequency of the sound, in hertz. (0x25 through 0x7FFF).
Windows Me/98/95: The Beep function ignores this parameter.
dwDuration: Duration of the sound, in milliseconds.
Windows Me/98/95: The Beep function ignores this parameter.
Quote from: K on May 11, 2003, 09:13 AM
Bearing in mind that it wont work well or at all on any non-NT based platforms.
At all. It will just play the default Windows sound.
Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
How to use this:
Dim X%
X% = Beep(1500, 300)
This will make the analogue speaker in your computer (used for bios errors and startup confirmations) beep at the specified frequency, for a specified amount of time.