Jump to content

  • Log In with Google      Sign In   
  • Create Account

PlaySound() causes error on exit...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 October 1999 - 06:25 AM

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


Sponsor:

#2 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 1999 - 10:13 AM

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


#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 07 October 1999 - 10:31 AM

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

#4 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 1999 - 11:51 AM

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


#5 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 07 October 1999 - 04:35 PM

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.

#6 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 1999 - 04:51 PM

Hehehe...glad I could "help". What did it end up being?

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

-Kentamanos


#7 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 October 1999 - 06:25 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS