Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: sounds

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    102

    sounds

    How do I play sounds in CPP? Whats the command? I know it ain't a opengl question, but usually game programmers know much about this stuff too...

    I hope so anyway...
    CyBBe

  2. #2
    Intern Contributor
    Join Date
    Feb 2000
    Location
    San Diego Ca, USA
    Posts
    51

    Re: sounds

    you have to have a sound library to handle all of the necessary routines...
    either you code one yourself or you use one
    written by someone else

    DirectSound is an probably a good choice
    if your coding for Win32.. there are others
    for different platforms

    there is also a promising library that is
    being built which is very similar in concept
    to OpenGL - its a cross platform 3D library
    for sound
    check it out at www.openal.org

  3. #3
    Intern Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    95

    Re: sounds

    The "PlaySound" function defined in <mmsystem.h> may do well for your purpose.
    It's as simple as that:
    - PlaySound("wavefile.wav",0,SND_ASYNC|SND_FILENAME)
    for playing wavefiles directly.
    - PlaySound((char*)snd_addr,0,SND_ASYNC|SND_MEMORY)
    for playing a wavefile loaded into memory.
    For more complex stuff (e.g. surround-sound etc.) you'll have to stick to DirectSound.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    102

    Re: sounds

    thanx, I'll try that...
    CyBBe

  5. #5
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    124

    Re: sounds

    For playing digital music, you can use the Midas Sound System. This library can play the *.MOD *.S3M *.IT *.XM ... music-formats. I think it is able to play single sounds, too. Setup is really simple but if you like you can also choose, which sound output should be used (DirectSound ...).

    Marc

Posting Permissions

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