Sign in to follow this  
Guest jimcooper1

PlaySound from winmm

Recommended Posts

Hi!I wanted to add a simple AP - disconnect sound to my gauge.So I was looking for a easy sound function and found the WinAPI function PlaySound.PlaySound("SOUNDcaapdis.wav", NULL, SND_FILENAME | SND_ASYNC | SND_NODEFAULT);This function works fine in the gauge.But I was wondering why nobody uses this function although it is so easy to use. So, is there a problem with this function is connection to gauges and Flight Simulator?Regards,Harry

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

None that I'm aware of, although for AP disconnect it would have been simpler to modify your sound.cfg file:[AP_DISENGAGE_SOUND]filename=ccapdiscmaximum_volume=10000

Share this post


Link to post
Share on other sites

At one time there was a problem using Playsound with certain sound cards (SoundBlaster) but I don't know if that still applies to current hardware.Fred

Share this post


Link to post
Share on other sites

Hi!Thanks for your answers.So Playsound seems to be OK. I'm really wondering why things like fssound.dll were used so often if the way is that easy.@Bill: The AP is a generic gauge, so it should play the sound itself without the help of a sound.cfgOtherwise yourapproach would be the easiest.Harry

Share this post


Link to post
Share on other sites

If you need to do more than a simple one-shot sound effect, for example looping a sound, or having a sound depend on a variable such as engine rpm, you need more than this function.

Share this post


Link to post
Share on other sites

>If you need to do more than a simple one-shot sound effect,>for example looping a sound, or having a sound depend on a>variable such as engine rpm, you need more than this>function.Well, that's not precisely correct, Patrick!To play an gyrosound that loops we could write:PlaySound("gyro.wav", NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);Only one sound can play at once so if you play another sound before the first is finished it will be cut off. You can also stop a sound playing by passing NULL as the pszSound parameter.That last is the real problem with PlaySound: only one sound can play at once!

Share this post


Link to post
Share on other sites

Fred, I think you're correct that there is still an issue with PlaySound and Vista drivers for some SoundCards. Not sure that this has been resolved. I can't get PlaySound to work on a 680i MB (on-board sound) in Vista..but it works fine on the XP partition (same PC)RegardsJim

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this