Beispiel #1
0
        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));
        }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
 public SetRampValueEventInstance(SetRampValueEvent evt)
     : base(evt)
 {
 }