Author | Message | Time |
---|---|---|
laurion | 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! | May 10, 2003, 11:06 AM |
Yoni | 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. | May 10, 2003, 1:24 PM |
Arta | I think he means playing wav files. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_9uxw.asp Example: [code] PlaySound("c:\mysound.wav", NULL, SND_ASYNC); [/code] Query: Do you also need to specify SND_FILENAME? I never have in the past but MSDN implies that you do. | May 10, 2003, 6:03 PM |
Yoni | [quote author=Arta[vL] link=board=5;threadid=1291;start=0#msg9631 date=1052589784] Query: Do you also need to specify SND_FILENAME? I never have in the past but MSDN implies that you do. [/quote] Yes... But it might work without it. | May 10, 2003, 6:13 PM |
laurion | 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'? | May 11, 2003, 12:11 PM |
K | Like Yoni, said, use the Beep API. [code]BOOL Beep( DWORD dwFreq, DWORD dwDuration );[/code] Bearing in mind that it wont work well or at all on any non-NT based platforms. [code]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.[/code] | May 11, 2003, 2:13 PM |
Yoni | [quote author=K link=board=5;threadid=1291;start=0#msg9687 date=1052662406] Bearing in mind that it wont work well or at all on any non-NT based platforms. [/quote]At all. It will just play the default Windows sound. | May 11, 2003, 7:50 PM |
MesiaH | [code] 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) [/code] 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. | May 13, 2003, 1:53 AM |