Click to See Complete Forum and Search --> : How do I do an asynchrnous Beep?
Ian Wills
July 22nd, 1999, 05:11 AM
For NT 4.0
I want generate a beep with frequency and duration: the api 'Beep' is synchronous, however. So how can I do something similar asynchronously.
(I've tried using a separate thread just for beeping, but because the thread isn't actually sleeping during the
beep call, it prevents the rest of the process running as well.)
bimmer boy
July 22nd, 1999, 07:26 AM
try using the separate thread, but make it lowest thread priority. that may help. don't know for sure.
miked
Imran Rajwani
July 22nd, 1999, 10:09 AM
You can also use PlaySound() and MessageBeep() which gives you option to play sounds async. These function however donot give you the option of playing sound at different frequency and duration.
Ian Wills
July 23rd, 1999, 04:12 AM
Yeah that's the problem! Also the target platform does not have a sound card, so playsound is not an option. The separtae thread at a lower priority doesn't work either.
Imran Rajwani
July 23rd, 1999, 10:27 AM
How long are you trying to play the sound any way? I am curuious why a separate thread didn't solve your problem. What exactly happens to your application when you run the other thread to make the beep?
Any way if you absolutely want to make this work, you can do so by directly programming your speaker port. You will however need a KDD (kernel mode device driver) to access the i/o Port. If you are interested in this route, let me know.
Ian Wills
July 29th, 1999, 03:13 AM
Okay, okay. I was wrong! (Sorry)
The lower priority thread did work...once I sorted out a problem with statis timer procs, and calling
SetTimer from the correct thread!
Thanks.
sk8ajoe
October 19th, 2008, 11:40 AM
To Ian Wills:
This may sound absurd but, could I peak at your code as to how you got the beep to work asynchronously? The reason I ask is because I haven't learned anything about lower priority threads and such.
golanshahar
October 19th, 2008, 01:47 PM
To Ian Wills:
This may sound absurd but, could I peak at your code as to how you got the beep to work asynchronously? The reason I ask is because I haven't learned anything about lower priority threads and such.
There are dozens of samples of creating threads (MSDN/Codeguru/etc) all you have to do is create the thread and in the thread PROC call the ::Beep() function.
Cheers
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.