View Full Version : Easy way to do sound?

04-01-2000, 12:38 PM
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...

04-01-2000, 02:17 PM
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.

04-02-2000, 01:59 AM

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.


04-02-2000, 07:10 PM
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!!?!?!?!

04-02-2000, 10:04 PM
Thanks for the help....
just type...
PlaySound("pinball4.wav", NULL, SND_ASYNC|SND_FILENAME);

And sound works....

04-02-2000, 11:25 PM
I still get an unresolved external http://www.opengl.org/discussion_boards/ubb/frown.gif

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:

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

04-02-2000, 11:56 PM
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.


04-03-2000, 05:31 PM
thanks, for some really wierd reason... it works without the lib now http://www.opengl.org/discussion_boards/ubb/smile.gif

05-21-2002, 01:23 PM
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

05-21-2002, 02:35 PM
Also if you want to play mp3 music or something i can recommend Bass library...

You can get it at www.un4seen.com (http://www.un4seen.com)

05-22-2002, 10:49 PM
Other great sound libraries (check them out):

libMikMod: www.mikmod.org (http://www.mikmod.org)
FMOD: www.fmod.org (http://www.fmod.org)
MIDAS: www.s2.org/midas (http://www.s2.org/midas)
SEAL: www.sonicspot.com/sealsdk/sealsdk.html (http://www.sonicspot.com/sealsdk/sealsdk.html)

I like libMikMode because it's easy to use, plays up to 32 wave sounds, plays most MOD format music, and is mighty portable. Otherwise I believe that FMOD is probably the most competent audio library out there (MP3, CD audio, 3D sound etc).