Thread: How

  1. #1
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    How

    How do you get a short wav sound to play at a certain time?
    Like if some one types in a number and hits enter it beeps.

    In QB it was easy

    Code:
    CLS
    BEEP
    End
    lol
    What is C++?

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    this is the way i do it.. it is non-std i think.

    sound()/nosound()/delay() - all in dos.h

    Code:
    ---
    ---
    cout<<"enter sound value [Hz] : ";
    cin>>sval;
    cout<<"enter play duration [Sec] : ":
    cin>>dur
    
    sound(num);
    delay(dur);
    nosound();
    ---
    ---

    ...or if you want just a beep sound use --> cout<<"\a";
    Last edited by ihsir; 05-09-2002 at 11:43 PM.
    -

  3. #3
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    \a ????

    Is there a list of these "\" commands?

    All I know are:

    \n, \t, and now \a



    What is C++?

  4. #4
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Thumbs up

    HELP IS THE BEST PLACE...

    Find it in ur IDE.

    -Sriharsha.
    Help everyone you can

  5. #5
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    here are what i know...


    \a : bell-beep
    \b : backspace
    \f : formfeed
    \n : newline-linefeed
    \r : carriage return
    \t : horizontal tab
    \v : vertical tab
    \\ : backslash
    \' : single quote
    \" : double quote
    \0 : NULL
    -

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    99

    Grrr

    why doesn't \a work for me?
    It's supposed to beep right?
    I still don't get how that would make a beep...

    btw: I'm using Dev-C++ 4.0

  7. #7
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192
    Then try the SOUND()/DELAY()/and NOSOUND() function combination only.

    Sriharsha.
    Help everyone you can

  8. #8
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    \a

    cout<<"BEEP!!! \a";

    that gets he wav "bep" from your windows current sound scheme. You might have that sound disabled.
    What is C++?

  9. #9
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    Re: \a

    Originally posted by Vicious
    cout<<"BEEP!!! \a";

    that gets the wav "beep" or "ding" from your windows current sound scheme. You might have that sound disabled.
    What is C++?

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Well those are not exactly wav sounds. The beep is just Windows catching your beep which prob activates an interrupt and Windows has a handler there. Instead of the default beep, it plays the beep sound for your sound scheme. They just converted the system beep into something else. In pure DOS, that will still just beep the PC speaker.

    To actually play wav files you must load them, mix them if needed into a final sample, and then play them via the sound card.

    For info:

    http://www.cae.wisc.edu/~brodskye//
    http://developer.creative.com/LEFTME..._Downloads.asp

  11. #11
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Im goin wit wat he said...

    Im new here but I know always go with what bubba says.
    What is C++?

Popular pages Recent additions subscribe to a feed