Computer Science Canada

WinAPI Beep through external speakers

Author:  Phazor [ Fri May 09, 2008 7:23 pm ]
Post subject:  WinAPI Beep through external speakers

hey guys, im tryin 2 figure out if there is a way to make the beep function come out of the external speakers, cuz the winapi beep function comes out of the internal pc speaker. im using the winapi beep as opposed to the built in beep function because i want to be able to choose the frequency and duration. im pretty sure that it can be done cuz my computer at work beep through speakers, but it was a laptop, i dunno if thats y, since the speakers are built into the system. plz help

in case u were wondering, this is the code i used for declaring the function:
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

Author:  btiffin [ Sat May 10, 2008 3:24 am ]
Post subject:  Re: WinAPI Beep through external speakers

You may want to look into the PlaySound library routines in winmm.dll. A little bit more work, as you may either have to link to an external .wav resource or generate the wav on the fly. Or, user32.dll has MessageBeep that already links to the stock windows wav resources (type code of 0, 16, 32, 48, 64) or -1 for the same as VB beep (internal speaker beep, no control over freq and dur). I don't remember the other sound routines but there are others.

Or, use GNU/Linux and then write a soundcard driver and a kernel interface and an open source VB clone and a ... (kidding).

Cheers

Author:  Phazor [ Sat May 10, 2008 12:38 pm ]
Post subject:  Re: WinAPI Beep through external speakers

could u tell me how to generate .wav on the fly, iv never heard of doin that before


: