CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 1999
    Posts
    8

    How do I do an asynchrnous Beep?

    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.)


  2. #2
    Join Date
    Jun 1999
    Posts
    315

    Re: How do I do an asynchrnous Beep?

    try using the separate thread, but make it lowest thread priority. that may help. don't know for sure.

    miked

  3. #3

    Re: How do I do an asynchrnous Beep?

    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.


  4. #4
    Join Date
    Jul 1999
    Posts
    8

    Re: How do I do an asynchrnous Beep?

    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.


  5. #5

    Re: How do I do an asynchrnous Beep?

    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.


  6. #6
    Join Date
    Jul 1999
    Posts
    8

    Re: How do I do an asynchrnous Beep?

    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.


  7. #7
    Join Date
    Oct 2008
    Posts
    2

    Re: How do I do an asynchrnous Beep?

    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.

  8. #8
    Join Date
    May 2005
    Posts
    4,954

    Re: How do I do an asynchrnous Beep?

    Quote Originally Posted by sk8ajoe
    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
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured