private void ProcessCC(double value) { value = movingAverage.process(value); double lastSample = Buffer.GetSample(0); if (Math.Abs(lastSample - value) < InputConfig.CCHisteresis) { value = lastSample; } Buffer.Add(value); // assign the value to the power. In CC mode power = processed signal outputPower = InputConfig.Velocity.Map(value); outputValue = value; // execute the trigger event once TriggerLength has passed if (value != lastSample) { if (InputConfig.Enabled) { TriggerEvent.Invoke(this); } } }
public void AddData(int data) { double value = data / 256.0; if (InputConfig.ContinuousControl) { ProcessCC(value); } else { ProcessTrigger(value); } if (DataEvent != null) { DataEvent.Invoke(this); } currentSample++; }