Archived

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

Guest Anonymous Poster

PlaySound() causes error on exit...

This topic is 6675 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

We need a little more info...

What kind of error? Does it happen while debugging? Have you determined what line of code is causing the problem?

------------------

-Kentamanos

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Borland 4.5 will only let me debug 16 bit programs, but the program runs fine if I omit the PlaySound(). The little ufo beeps away fine during the game, but when I exit the This Program has Performed an Illegal Operation message occurs. Is there some kind of sound shutdown command that cleans up and lets the program exit gracefully? Or am I not using the PlaySound() function correctly? The ufo beeps about every five seconds so I don't need anything fancy. thx

Share this post


Link to post
Share on other sites
I'll be honest with you, I've never used PlaySound before, but I can't see what the problem would be according to your implementation. You MIGHT try adding the SND_NOWAIT flag, but I can't really see that helping either. You could also try the waveOut function, but this is not as easy to use. In the long run if you ever need more that one sound, you'll need to go with DSound, but you probably know that.

You really need to be able to debug it, and determine what line of code is causing this problem.

If you want, send me the source code and I'll try to compile it in VC++. I'm a bit curious about this as well, and I'd be happy to help you.

------------------

-Kentamanos

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Got it working!! I was gathering the project files together to mail to you and decided to set up another project to see if I had all I needed. Fiddled around with some project settings and... now it works fine! I guess I don't have enough experience using Borland. Thanks for your help, it caused me to figure it out.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi, I just started directx programming. I made a very basic game where you fly a little ufo around the screen, using a directx template I found on the web. The UFO beeps using:
PlaySound("beep.wav", NULL, SND_ASYNC | SND_FILENAME);
Upon exiting the program(esc kills the game), an error occurs. Is there some kind of cleanup command for PlaySound(), I tried:
PlaySound(NULL, NULL, SND_PURGE);
which kills the sound, but the error still occurs. I'm using Borland 4.5 if that helps. I do realize that using dsound is the way to go, but there has got to be a way to make this work.

thx

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think turning multithreaded on is what did it... Not sure though. Wish I knew more about setting up compilers and such. I can't figure out how to change some of the project options without creating a whole new project, so fiddling with the some of the settings is too time consuming. But its set up properly now(I think). I'll post the URL of my little game when its complete. Thanks again for your help.

Share this post


Link to post
Share on other sites