This topic is now archived and is closed to further replies.

Sound playing problem..

This topic is 6156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to play sounds using API in my console-text-game but it isnt quite working. I've included windows.h, and I'm trying to use sndPlaySound to play my wav file but it isnt working. My coding is sndPlaySound("c:\\windows\\desktop\\beep1.wav",0); Why won't this work? I'm getting the error.. Project1.obj : error LNK2001: unresolved external symbol __imp__sndPlaySoundA@8 Debug/Test Game.exe : fatal error LNK1120: 1 unresolved externals Any help for playing sounds using windows api? Edited by - ghostboy on January 31, 2001 8:04:24 PM

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Link winmm.lib into your project and #include mmsystem.h.

you should use PlaySound instead of sndPlaySound
I''ve cranked some shitty example code here...

// global variables
BOOL g_bPlaying = false;

// play sound using waveOut device
void PlayTheDingSound( BOOL bLooping )
g_bPlaying = PlaySound(
bLooping ? SND_LOOP : 0 );

// stop sound using waveOut device
void StopTheDingSound()
if( g_bPlaying )
g_bPlaying = !PlaySound( NULL, NULL, 0 );

Share this post

Link to post
Share on other sites

Try "c:\windows\desktop\beep1.wav"
instead of


If it doesn''t wokrs, iI''ve made a little program who use FMOD.

You can download the source caode on my site :

"Download" section and "FMOD-ENG" for english user.

Leyder Dylan

Share this post

Link to post
Share on other sites
That looks like it should have worked, regardless of slashes. Of course, try \\ instead of \

You might want to check out BASS - it''s a great free audio library for WAV, MP3, MOD, ...

Can''t find the link immediately, I know I have it here though:

(blatant website plug in the process

Brett Porter
PortaLib3D : A portable 3D game/demo libary for OpenGL

Share this post

Link to post
Share on other sites