Beispiel #1
0
            public StepCollection(EnvelopeCore parent, EnvelopePhase phase)
            {
                ParentEnvelope = parent;
                Phase          = phase;

                HandleStepChanged(null, null);
            }
Beispiel #2
0
        public void SetNormalizedTime(float normalizedTime, EnvelopePhase phase)
        {
            this.phase = phase;
            switch (phase)
            {
            case EnvelopePhase.Attack:
                elapsedTime        = attackTime * normalizedTime;
                currentPhaseAmount = attackCurve.Evaluate(normalizedTime);
                break;

            case EnvelopePhase.Decay:
                elapsedTime        = decayTime * normalizedTime;
                currentPhaseAmount = decayCurve.Evaluate(normalizedTime);
                break;

            case EnvelopePhase.Sustain:
                elapsedTime        = sustainTime * normalizedTime;
                currentPhaseAmount = sustainValue;
                break;

            case EnvelopePhase.Release:
                elapsedTime        = releaseTime * normalizedTime;
                currentPhaseAmount = releaseCurve.Evaluate(normalizedTime);
                break;

            case EnvelopePhase.None:
            default:
                elapsedTime        = 0;
                currentPhaseAmount = 0;
                break;
            }
        }
Beispiel #3
0
 private void InitializePhase(EnvelopePhase newPhase)
 {
     _phase        = newPhase;
     _currentSteps = _steps.FirstOrDefault(sc => sc.Phase == newPhase);
     _timePositionInCurrentStep = null;
     _currentStepIndex          = 0;
     _stepStartValue            = _currentRawOutput;
 }
Beispiel #4
0
        private void OnStepsChanged(EnvelopePhase phase)
        {
            EventHandler <EventArgs <EnvelopePhase> > evt = StepsChanged;

            if (evt != null)
            {
                evt.Invoke(this, new EventArgs <EnvelopePhase>(phase));
            }
        }