private void OnDeviceConnected() { BatteryChannel = new BatteryChannel(_currentDevice); var deviceChannels = _currentDevice.Channels .Where(x => x.Type == ChannelType.Signal) .ToDictionary(channelInfo => channelInfo.Name, channelInfo => new EegChannel(_currentDevice, channelInfo)); if (deviceChannels.ContainsKey("T3") && deviceChannels.ContainsKey("O1")) { T3O1SignalChannel = new BipolarDoubleChannel(deviceChannels["T3"], deviceChannels["O1"]); T3O1SpectrumChannel = new SpectrumChannel(T3O1SignalChannel); if (deviceChannels.ContainsKey("T4") && deviceChannels.ContainsKey("O2")) { T4O21SignalChannel = new BipolarDoubleChannel(deviceChannels["T4"], deviceChannels["O2"]); T4O2SpectrumChannel = new SpectrumChannel(T4O21SignalChannel); IndexChannel = new EegIndexChannel(deviceChannels["T3"], deviceChannels["T4"], deviceChannels["O1"], deviceChannels["O2"]); IndexChannel.SetWeights(1.00, 1.00, 0.00, 0.00); IndexChannel.Delay = 0.0; IndexViewChannel = new EegIndexChannel(deviceChannels["T3"], deviceChannels["T4"], deviceChannels["O1"], deviceChannels["O2"]); IndexViewChannel.SetWeights(1.00, 1.00, 0.00, 1.00); IndexViewChannel.Delay = 0.0; AlphaLeftPowerChannel = new SpectrumPowerChannel(new List <SpectrumChannel> { T3O1SpectrumChannel }, 8, 14, "AlphaLeft"); BetaLeftPowerChannel = new SpectrumPowerChannel(new List <SpectrumChannel> { T3O1SpectrumChannel }, 14, 34, "BetaLeft"); AlphaRightPowerChannel = new SpectrumPowerChannel(new List <SpectrumChannel> { T4O2SpectrumChannel }, 8, 14, "AlphaRight"); BetaRightPowerChannel = new SpectrumPowerChannel(new List <SpectrumChannel> { T4O2SpectrumChannel }, 14, 34, "BetaRight"); ChannelsChanged?.Invoke(this, null); } } }
private void _control_SettingsChanged(object sender, System.EventArgs e) { _channel.Delay = _control.Delay; _channel.SetWeights(_control.AlphaWeight, _control.BetaWeight, _control.DeltaWeight, _control.ThetaWeight); }