Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Easy way to do sound?

  1. #1
    Intern Contributor
    Join Date
    Mar 2000
    Posts
    94

    Easy way to do sound?

    Is there a simple way(for a beginner) to use sound(of any type in Opengl under Windows98) I've written a very simple bouncing ball type game and would like to add some sound effects...I'm not an advanced Opengl or c++ programer which is why I've asked for a simple technique...It doesn't have to be efficient or do any error checking. I can't sem to find anything on the internet about this...

  2. #2
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,345

    Re: Easy way to do sound?

    Hmmm ... doesn't seam to belong to an OpenGL board ...
    However, the easiest way to do sound i guess is to use the standard windows function PlaySound. Just give it the name of a wavfile and it plays it.

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: Easy way to do sound?

    Hello

    There is a new API called OpenAL (open audio library), http://www.openal.org . It's a API simlilar to OpenGL, and it's supposed to be working on most platforms supporting OpenGL. Maybe it's worth a try.

    Bob

  4. #4
    Guest

    Re: Easy way to do sound?

    dude, I still get unresolved external error, is there something I should link to get PlaySound to work?

    I took a simple windows program that worked!
    and added PlaySound in it with #include <mmsystem.h>

    what am I doing wrong!!?!?!?!

  5. #5
    Intern Contributor
    Join Date
    Mar 2000
    Posts
    94

    Re: Easy way to do sound?

    Thanks for the help....
    just type...
    PlaySound("pinball4.wav", NULL, SND_ASYNC|SND_FILENAME);

    And sound works....

  6. #6
    Guest

    Re: Easy way to do sound?

    I still get an unresolved external

    even w/
    PlaySound("chimes.wav", NULL, SND_ASYNC|SND_FILENAME); //chimes.wav is in the directory

    I placed it it WinMain...

    here is the error i get:

    Compiling...
    sound.cpp
    Linking...
    sound.obj : error LNK2001: unresolved external symbol __imp__PlaySoundA@12
    Debug/sound.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: Easy way to do sound?

    It looks like you forgot to add a library. Try to add winmm.lib to your project.

    It's called winmm.lib in MSVC, dunno if it's called the same in other environments.

    Bob

  8. #8
    Guest

    Re: Easy way to do sound?

    thanks, for some really wierd reason... it works without the lib now

  9. #9
    Guest

    Re: Easy way to do sound?

    where do you put the code and when is the sound supposed to play.... because i am hearing nothing... and yes the volume is turned up

  10. #10
    Guest

    Re: Easy way to do sound?

    Also if you want to play mp3 music or something i can recommend Bass library...

    You can get it at www.un4seen.com

Posting Permissions

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