Esempio n. 1
0
        public double ModifyValue(double currentValue, int sampleNumber)
        {
            var gain = Gain.Value;

            if (DSPFunctions.IsZero(gain))
            {
                return(currentValue);
            }

            var amplitude = GetCurrentAmplitude(sampleNumber);

            gain *= amplitude * Math.Min(currentValue, 1 - currentValue);

            return(DSPFunctions.Clamp01(currentValue + gain));
        }
Esempio n. 2
0
        protected Parameter(string name, string description, string label,
                            double min, double max, double step, bool canBeAutomated = true) :
            base(name, description, label, canBeAutomated)
        {
            if (max <= min ||
                step > (max - min))
            {
                throw new ArgumentException();
            }

            Min = min;
            Max = max;

            Step     = Range / Math.Max(1, (int)(1 / DSPFunctions.Clamp01(step / Range)));
            RealStep = Step / Range;
        }
Esempio n. 3
0
        private void Knob_OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_isMouseDown)
            {
                var position = e.GetPosition(this);
                var delta    = position.Y - _mouseStartPoint.Y;

                _value = _knobStartValue - delta * KDeltaFactor;
                _value = DSPFunctions.Clamp01(_value);
                _value = (int)(_value * _invertedStep) / _invertedStep;

                if (_parameter != null)
                {
                    SetValue();
                }
                else
                {
                    UpdateController();
                }
            }
        }