View Single Post
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 202
Join Date: Feb 2011
Default 08-05-2011, 01:40 PM

Quote:
Originally Posted by zero00 View Post
To change volume while the sound is playing:
  1. Set the volume of sound you're playing to a variable (VolumeLevel = World.SoundVolume, for example)
  2. As the sound plays, you can change the variable and the volume will change accordingly (If you set "SoundVolume" to 0.5, the sound will play at half its volume)

As for changing volume based on range
, multiply that "SoundVolume" variable by a percentage of how close you are to something. If you're 50% within range, multiply the variable by 0.5 (or 0.25 if you're 75% away from the object)
Well, I understand how to do that. It's in my flight simulator if you want to see (Flight Simulator with AI thread). I did it with the gunshots, which was okay because they don't loop and the sound is very short. But, I also want to add a jet engine sound, which is longer. If I change the variable, it doesn't change the volume while the sound is playing. It does when the sound stops and plays again. That's the problem.

It also keeps pausing before starting again. I'm guessing it has to do with the sound loading again. Is there any way to program it so it doesn't load the sound over and over again?


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote