Beeeeep!

This is a discussion on Beeeeep! within the Game Programming forums, part of the General Programming Boards category; I just wondered how to make my program "beep". I saw someone else do it in a console game. I ...

  1. #1
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46

    Beeeeep!

    I just wondered how to make my program "beep". I saw someone
    else do it in a console game. I want to be able to in my console
    games too. Is there a function or something? Like Beep() or
    MakeNoise()? That's all I want to know.

    Compiler: Dev-Cpp 4.9.8.0
    OS: Windows ME


    Thanks...

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    63
    Code:
    std::cout << '\a' << endl;
    That should give a beeping sound.

  3. #3
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    Thanks. I'm still open to any other ways to do the same thing.

    EDIT: It still doesn't work, Hmmmm.


    YET ANOTHER EDIT: None of my other programs that did make
    beeps before work now, It's not your mothod, I just have something disabled. My speakers are on, so that's not it.
    Last edited by Dagger; 02-24-2006 at 04:22 PM.

  4. #4
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    That \a thing has never worked for me, might be windows

    http://msdn.microsoft.com/library/de.../base/beep.asp

    that method is less simple then just Beep() and is sync, meaning it probably will be of no use for a game

  5. #5
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Um.....how about use Beep(). That is in <windows.h>. It should work. Note the capitalization.

  6. #6
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    Won't including windows.h make me have to declare main as

    Code:
    int WINAPI WinMain(HINSTANCE hthisin, HINSTANCE hprevin,
                                     LPSTR cmdlin, int cmb)
    ? or can I just use

    good old main()?
    Last edited by Dagger; 02-24-2006 at 05:51 PM.

  7. #7
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    good old main

  8. #8
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    Okay, I tryed it... What are the paramiters to Beep()? I says too few arguments...

  9. #9
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    check my link...
    Code:
    BOOL Beep(
      DWORD dwFreq,
      DWORD dwDuration
    );
    And as I said that is not suitable to games because it is not async.

    Anyways, remember to include this
    #define WIN32_LEAN_AND_MEAN
    for most uses of windows.h

  10. #10
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    Okay, thanks. I'll check it out, I don't ghet why it's not good for a game, all I need it to
    do is beep. Well, meybe not, but it will still work, for now.

  11. #11
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    Hmmm, well, I see what you mean. I was hoping for something alterable. I have windows
    ME, so it gives me a windows beep, What is the point of accepting two args if it won't
    do anything but one tone? Ferthermore, it will end a loop instantly.

  12. #12
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Seems it would be easier to just emulate a PC speaker through a normal sound system. I've never done it before but I imagine you'd just produce a square wave and set the volume and duration of it.

  13. #13
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    How might I do that?
    My logic isn't simple, it's twisted, but it's also simply twisted.

    Code:
    Programmer Me;
    
    if (IsItDead(Me) == true) {
    DieASecondDeath(&Me);
    }
    Compiler: Dev-Cpp 4.9.8.2
    OS: Windows ME

  14. #14
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    No idea. I'm trying to figure it out myself.

  15. #15
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Ummmm...it would be easier to use DirectSound/Music. But that's probably too obvious so no one will do it.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21