Jump to content
Sign in to follow this  
Guest jimcooper1

PlaySound from winmm

Recommended Posts

Guest harry3

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

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


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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
Guest harry3

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
Guest Patrick_Waugh

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!


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest jimcooper1

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...