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…

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.


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.


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!!?!?!?!

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

And sound works…

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:

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

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.


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

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

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

You can get it at www.un4seen.com

Other great sound libraries (check them out):

libMikMod: www.mikmod.org
FMOD: www.fmod.org
MIDAS: www.s2.org/midas
SEAL: 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).