Exemple #1
0
 protected override void DataAvailable(DataInputPort port)
 {
     foreach (var sample in _dataIn.Read().ZipWithValueInput(_threshIn))
     {
         if (sample.Value >= sample.Scalar)
         {
             if ((sample.Stamp - LastEventTime).AsSeconds() * 1000 > CooldownTimeMs)
             {
                 System.Diagnostics.Debug.WriteLine("event triggered @ " + sample.Stamp);
                 _eventOut.PlanEvent(sample.Stamp);
                 LastEventTime = sample.Stamp;
             }
         }
     }
 }
Exemple #2
0
        private void ProcessBuffers(int samples)
        {
            var bufA = _portInA.Read(samples);
            var bufB = _portInB.Read(samples);

            System.Diagnostics.Debug.Assert(bufA.WrittenSamples == bufB.WrittenSamples);

            var samplesA = bufA.GetSamples();
            var samplesB = bufB.GetSamples();
            var samplesC = _outputBuffer.GetSamples();


            for (var i = 0; i < bufA.WrittenSamples; i++)
            {
                samplesC[i] = samplesA[i] + samplesB[i];
            }

            _outputBuffer.SetWritten(_portInA.Buffer.WrittenSamples);
            _portOut.SendData(_outputBuffer);
        }
Exemple #3
0
 protected override void DataAvailable(DataInputPort port)
 {
     Accumulator += port.Read().GetSamples()
                    .Take(port.Buffer.WrittenSamples)
                    .Sum();
 }
 protected override void DataAvailable(DataInputPort port)
 {
     LastValue = port.Read().CurrentTime;
     UpdateUi();
 }