Sound functions
by Samuel Marcus · in Torque Game Builder · 04/18/2007 (8:35 pm) · 1 replies
Does anyone know how you might fade sound in and out? I suppose you could throw a loop in that slowly dec/incremented the volume, but that seems kinda kludgey (and could conceivably lock up the system during the fade, no?)... any other ideas?
(apologies if this is covered elsewhere: I tried searching and found nothing)
Thanks,
Sam
(apologies if this is covered elsewhere: I tried searching and found nothing)
Thanks,
Sam
About the author
Torque Owner Eric Robinson
VMPlayer: this thing is awesome. Takes care of SO MUCH for you. Also handles fading.
Fade: This tutorial is incomplete. I started it before falling into a kind of crunch mode and have been unable to finish it. There should be enough there to get you started, though. You can see at the bottom that there's a section outlined for generalization. The idea is that instead of calling the function "setBlendAlpha()" on an object you would call a function to change the audio by the increment specified. Shouldn't be too hard to modify the fade function in that tutorial to do what you need it to (wouldn't have to rewrite all of your audio code to support it either... the VMPlayer route if you didn't start with it...). The nice thing about this is that there's no constant loop to pause your system over time. It utilizes scheduling to get through stuff. Oh, and with the fading function you can specify a callback for when the audio fades completely if you like.
That help?