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

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!

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...