Problem with fading sound in 3d (not reaching 0 volume)

Started by
4 comments, last by Dave Hunt 18 years, 5 months ago
Edit: USING FMOD! Sorry, lol. I am using 3d virtual channels to play sound effects in my game. I'm using the Code: sound->set3DMinMaxDistance( min, max ) for the sounds to set exactly how far I want it to hear. It seems to be fading out perfectly with the ranges I use, EXCEPT when it reaches the maximum distance, the volume is not 0. I can still hear the sound very faintly well after the maximum distance. Is there a specific way I can force it to fade out to 0?? My current solution is to do a distance formula check between the object and the listener and if it is outside the distance I want, I force volume to 0, and when it comes back inside set it to the original volume. This works, but there is a very noticeable enabling and disabling of the sound since it doesnt get as quiet as I would want....if the listener were to go back and forth at certain spots sounds would just enable and disable. While they would be quiet, it isnt correct. I have been playing with the examples and even on those they do not go to 0... Perhaps I am misunderstanding what I need to do with the virtual channels and distances, or I am missing something basic??? Any help would be MUCH appreciated!!!!! Thanks! -JoMasta out [Edited by - JoMasta on December 2, 2005 8:29:53 PM]
Advertisement
What sound API are you using?

Ordinarily, the max distance specifies the distances at which the sound ceases to be attenuated, not when the sound stops being audible.

If you're using DirectSound, you have to specify the DSBCAPS_MUTE3DATMAXDISTANCE when creating the buffer if you want the volume to drop to zero at max distance.

For another API, there may be a setting/flag that accomplishes the same thing.
First, yeah I am using FMOD...whoops, lol.

Now then, what you said about where it stops attenuated is correct. That is the first thing I was incorrect in thinking.

I wish I would have found a function is fmod that is as clear as the one you list for direct3d hehe

I have been searching through the API under system, channels, and sound, and have not found anything like that yet.

If anyone knows a similar function in FMOD I would be super greatful!

Thanks for the response!
For FMOD, you can include FMOD_3D_LINEARROLLOFF in the mode parameter to createSound(). This will result in silence at max distance. The attenuation isn't as realistic as FMOD_3D_LOGROLLOFF (the default), but it will accomplish what you are after.
Thank you! This does exactly as I wanted!

It makes it more like how I was originally thinking (incorrectly) about how the max distance is where it ends...more similar to that idea now.

Thank you very much!

edit: Also, my game is only 2D so this sounds perfectly fine/correct since objects will only be to the right or left usually. Thanks again! :)
Your welcome! Good luck with the rest of your project.

This topic is closed to new replies.

Advertisement