private float GetValue(SetRampValueEvent x, float elapsedTime) { // Number of slices to break up the duration. const float slices = 10; float endValue = x.InitialSlope * x.Duration * slices + x.InitialValue; // FIXME: Incorporate 2nd derivative into the interpolated pitch. float amount = MathHelper.Clamp( (elapsedTime - Timestamp / 1000.0f) / x.Duration, 0.0f, 1.0f ); return(MathHelper.Lerp(x.InitialValue, endValue, amount)); }
public override void Apply(Cue cue, XACTClip track, float elapsedTime) { SetRampValueEvent evt = (SetRampValueEvent)Event; if (elapsedTime <= Timestamp / 1000.0f + evt.Duration) { switch (evt.Property) { case CueProperty.Volume: cue.eventVolume = GetValue(evt, elapsedTime); break; case CueProperty.Pitch: cue.eventPitch = GetValue(evt, elapsedTime); break; } } else { HandleRepeating(); } }
public SetRampValueEventInstance(SetRampValueEvent evt) : base(evt) { }