Thread: Beep();

  1. #1
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269

    Beep();

    After reading some posts about the Beep(); function, I learned that Windows 95, 98, and ME ignore the parameters. I'm using Windows ME (I want to get XP ), so shouldn't it do the default beep, no matter what parameters I use? It won't beep at all. I also tried '\a', which didn't work either.

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    '\a' should ring a bell, so to speak

    Any examples on your implementation?

  3. #3
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Code:
    #include <iostream>
    
    int main( void )
    {
      std::cout << '\a';
      std::cin.get();  
      return 0;
    }
    Code:
    #include <iostream>
    #include <windows.h>
    
    int main( void )
    {
      Beep( 1000, 1000 );
      std::cin.get();
      return 0;
    }
    - SirCrono6
    Last edited by SirCrono6; 02-22-2004 at 12:42 PM.
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Windows Me/98/95: On computers with a sound card, the function plays the default sound event. On computers without a sound card, the function plays the standard system beep.
    Are your speakers turned on? Also try MessageBeep().

    EDIT: I meant to add that if your "default beep" is silence, you will not hear anything(dah!). Look in the "Sounds" control panel entry.
    Last edited by anonytmouse; 02-22-2004 at 02:36 PM.

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Is your OS configured to use the speaker? Is there even a speaker for it to be configured to use? It will often NOT use your sound card, it will use the PC's internal speaker, unless the internal speaker connection is running to your soundcard (which sometimes is the case). Not all machines HAVE an internal speaker connected, and you can enable or disable the speaker in the multimedia control panel.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    You should always flush your output streams when you want stuff to appear. Note that endl flushes the stream after placing a new line character.
    Code:
    std::cout << '\a' << std::flush;

  7. #7
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Thanks, anonytmouse. I opened up Sounds and Multimedia in the control panel and on Default Sound it was blank. So, I set it to a beeping sound.

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  8. #8
    Registered User
    Join Date
    Jan 2003
    Posts
    361
    Theres a parameter for printf() that makes a beep. Not sure if it works on all OS.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. beep when even?
    By Ahmed29 in forum C++ Programming
    Replies: 7
    Last Post: 11-07-2008, 05:14 AM
  2. linux beep function
    By Calef13 in forum C++ Programming
    Replies: 7
    Last Post: 07-14-2007, 01:39 AM
  3. I need to play a pre recorded vox file using C
    By m.sudhakar in forum C Programming
    Replies: 4
    Last Post: 11-17-2006, 06:59 PM
  4. alert beep sound
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 02-14-2006, 02:24 PM
  5. Something Like beep()
    By Trauts in forum C++ Programming
    Replies: 3
    Last Post: 02-02-2003, 02:51 PM