public void StartTraining(int duration, int port) { if (this.port != port || processor == null) { this.port = port; if (processor != null) { processor.StopAndJoin(); processor = null; } reader = new EEGOSCReader(port); Processor = new EEGProcessor(reader); EEGGameManager.Instance.SetProcessor(processor, false); reading = false; } else { Processor.Reset(); } trainingTimer = new CounterTimer(duration); statusTimer = new CounterTimer(Random.Range(minStatusDuration, maxStatusDuration)); Processor.Status = EyesStatus.OPEN; Processor.Training = true; training = true; StartReading(); }
// Use this for initialization void Start() { if (useFile) { reader = new EEGFileReader(filepath); } else { reader = new EEGOSCReader(port); } processor = new EEGProcessor(reader); }
public void SetProcessor(EEGProcessor processor, bool create) { if (processorContainer == null && create) { GameObject go = new GameObject(); processorContainer = go.AddComponent <ProcessorContainer> (); } if (processorContainer != null) { processorContainer.processor = processor; } }