示例#1
0
        public SsvepSpellerWindow(Session session, SpellerController spellerController) : base(session, spellerController)
        {
            SuspendLayout();
            ControlBox   = false;
            IsFullscreen = true;
            // ReSharper disable once VirtualMemberCallInConstructor
            DoubleBuffered  = false;
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            ResumeLayout(true);

            SpellerController.CancellingTrial += (sender, e) =>
            {
                if (_trial != null)
                {
                    StageProgram.Skip();
                    TrialCancelled = true;
                }
            };

            _stimulationPatterns = Paradigm.Config.Test.StimulationPatterns;

            if (session.StreamerCollection.TryFindFirst(out _biosignalStreamer))
            {
                _hybridSsvepIdentifier = new HybridSsvepIdentifier(session.Clock, Paradigm.Config.Test.ComputeParallelLevel,
                                                                   _stimulationPatterns, Paradigm.Config.Test.FilterBank, Paradigm.Config.Test.SubBandMixingParams,
                                                                   Paradigm.Config.Test.HarmonicsCount, Paradigm.Config.Test.CcaThreshold,
                                                                   Paradigm.Config.Test.Channels.Enumerate(1, _biosignalStreamer.BiosignalSource.ChannelNum).Select(i => (uint)(i - 1)).ToArray(),
                                                                   _biosignalStreamer.BiosignalSource.Frequency, Paradigm.Config.Test.Trial.Duration,
                                                                   Paradigm.Config.Test.SsvepDelay);
                _biosignalStreamer.AttachConsumer(_hybridSsvepIdentifier);
            }
        }
        public void Start()
        {
            _server.Start();
            _dwellTrialController.Start();

            _navigatingSsvepDetector.IsActive = false;
            _spellingSsvepDetector.IsActive   = false;

            _markerStreamer.AttachFilter(_modeOnSetInterceptor);
            _biosignalStreamer.AttachConsumer(_navigatingSsvepDetector);
            _biosignalStreamer.AttachConsumer(_spellingSsvepDetector);
            _gazePointStreamer.AttachConsumer(_gazePointProvider);

            (_thread = new Thread(RunTrials)
            {
                IsBackground = true
            }).Start();
        }