// bad duplication here, but the unity requirements with generics make it hard to do differently:
 void GenerateBoolEvent(TimeStampedBoolDataEvent dataEvent, TimeStampedBoolList values)
 {
     if (values != null & values.Count > 0) {
         dataEvent.Invoke(values);
     }
 }
 public TimeStampedBoolList RetrieveNewSCRValues()
 {
     TimeStampedBoolList values = NewSCRValues;
     NewSCRValues = null;
     return values;
 }
    public void SCRUpdated(TimeStampedBoolList values)
    {
        foreach (TimeStampedValue<bool> v in values) {
            numOfPeaks++;
            recentPeaks.Insert (0, PhySigTK.HiResTiming.getDateTimeForTimestamp (v.TimeStamp));
            if (recentPeaks.Count > 5) {
                frequency = 5 / Convert.ToSingle ((recentPeaks.First () - recentPeaks [4]).TotalSeconds);
            }

            if (currentSegment != null && currentSegment.isRecording) {
                currentSegment.AddRecording (frequency, EMG);
            }
            if (gatheringBaseline) {
                basePeaks++;
            }
            if (saveData) {
                System.IO.File.AppendAllText (AVPath, frequency + " " + EMG + " " + sceneManager.scene.ToString () + " " + sceneManager.currentSegment + Environment.NewLine);
                System.IO.File.AppendAllText (peaksPath, PhySigTK.HiResTiming.getDateTimeForTimestamp (v.TimeStamp) + " " + frequency + " " + sceneManager.scene.ToString () + " " + sceneManager.currentSegment + Environment.NewLine);
            }
        }
    }
 private void InitLists()
 {
     if (NewEMGValues == null) {
         NewEMGValues = new TimeStampedFloatList();
     }
     if (NewECGValues == null) {
         NewECGValues = new TimeStampedFloatList();
     }
     if (NewSCLValues == null) {
         NewSCLValues = new TimeStampedFloatList();
     }
     if (NewSCRValues == null) {
         NewSCRValues = new TimeStampedBoolList();
     }
 }