I’m currently struggling with a Problem and start to wonder if it is even possible.
My intention is that a a Soundinterval that is playing will fadeout ,when a triggerevent occurs.
My Idea was to reduce the interval.volume over time after the event(within the update loop) but it seems like the interval ignores all changes to the volume variable till it has finished.
Is this the case?
And would changing the volume of the sfx file it is using have any effect on the already started interval?
I use this code and it works:
from direct.interval.IntervalGlobal import Sequence
from direct.interval.LerpInterval import LerpFunc
LerpFunc( s.setVolume, fromData = 1, toData = 0, duration = 4 )
s = loader.loadSfx( 'foo.ogg' )
base.accept( 'mouse1', startFade )
Aye setVolume of a loaded SFK file works all the time.
But my Question is about SoundIntervals.
mySound = loader.loadSfx("mySound.wav")
self.myInterval = SoundInterval(mySound, volume=1)
base.accept( 'mouse1', self.functionA )
Won’t reduce the audible volume of the Interval until it gets started again.
So I wonder if it is supposed to be that way and if reducing the volume of “mySound” as you did will effect the Soundinterval right away .
Ok, sorry, I overlooked the word “SoundInterval” (and it was in the title, lol), I assumed you were talking about intervals, generally, excuse me.
seems to show another precomputation behaviour for intervals. So, I think you can’t use:
interactively, but you can only modify:
Use tasks. They’re more flexible than intervals and the way to go for everything more than small, linear manipulations.