void SetBoardProperties(StreamInlet inlet) { var info = inlet.info(); BoardId = int.Parse(info.desc().child_value("boardId")); SampleRate = int.Parse(info.desc().child_value("sampleRate")); }
public static void Main(string[] args) { // wait until an EEG stream shows up StreamInfo[] results = LSL.LSL.resolve_stream("type", "EEG"); // open an inlet, with post-processing enabled, and print meta-data // Note: The use of post-processing makes it impossible to recover // the original timestamps and is not recommended for applications // that store data to disk. using StreamInlet inlet = new StreamInlet(results[0], postproc_flags: processing_options_t.proc_ALL); results.DisposeArray(); System.Console.Write(inlet.info().as_xml()); // read samples float[,] buffer = new float[512, 8]; double[] timestamps = new double[512]; while (!Console.KeyAvailable) { int num = inlet.pull_chunk(buffer, timestamps); for (int s = 0; s < num; s++) { for (int c = 0; c < 8; c++) { Console.Write("\t{0}", buffer[s, c]); } Console.WriteLine(); } } }
public static void Main(string[] args) { { using StreamInfo inf_ = new StreamInfo("Test", "EEG", 8, 100, channel_format_t.cf_double64, "test1234"); Console.Out.WriteLine("Test"); } // create a new StreamInfo and declare some meta-data (in accordance with XDF format) using StreamInfo info = new StreamInfo("MetaTester", "EEG", 8, 100, channel_format_t.cf_float32, "myuid323457"); XMLElement chns = info.desc().append_child("channels"); String[] labels = { "C3", "C4", "Cz", "FPz", "POz", "CPz", "O1", "O2" }; for (int k = 0; k < labels.Length; k++) { chns.append_child("channel") .append_child_value("label", labels[k]) .append_child_value("unit", "microvolts") .append_child_value("type", "EEG"); } info.desc().append_child_value("manufacturer", "SCCN"); info.desc().append_child("cap") .append_child_value("name", "EasyCap") .append_child_value("size", "54") .append_child_value("labelscheme", "10-20"); // create outlet for the stream StreamOutlet outlet = new StreamOutlet(info); // === the following could run on another computer === // resolve the stream and open an inlet StreamInfo[] results = LSL.LSL.resolve_stream("name", "MetaTester"); using StreamInlet inlet = new StreamInlet(results[0]); results.DisposeArray(); // get the full stream info (including custom meta-data) and dissect it using StreamInfo inf = inlet.info(); Console.WriteLine("The stream's XML meta-data is: "); Console.WriteLine(inf.as_xml()); Console.WriteLine("The manufacturer is: " + inf.desc().child_value("manufacturer")); Console.WriteLine("The cap circumference is: " + inf.desc().child("cap").child_value("size")); Console.WriteLine("The channel labels are as follows:"); XMLElement ch = inf.desc().child("channels").child("channel"); for (int k = 0; k < info.channel_count(); k++) { Console.WriteLine(" " + ch.child_value("label")); ch = ch.next_sibling(); } Console.ReadKey(); }
public static void Main(string[] args) { // wait until an EEG stream shows up StreamInfo[] results = LSL.LSL.resolve_stream("type", "Markers"); // open an inlet and print meta-data using StreamInlet inlet = new StreamInlet(results[0]); results.DisposeArray(); Console.Write(inlet.info().as_xml()); // read samples string[] sample = new string[1]; while (!Console.KeyAvailable) { inlet.pull_sample(sample); Console.WriteLine(sample[0]); } }
public static void Main(string[] args) { // wait until an EEG stream shows up StreamInfo[] results = LSL.LSL.resolve_stream("type", "EEG"); // open an inlet and print some interesting info about the stream (meta-data, etc.) using StreamInlet inlet = new StreamInlet(results[0]); results.DisposeArray(); System.Console.Write(inlet.info().as_xml()); // read samples float[] sample = new float[8]; while (!System.Console.KeyAvailable) { inlet.pull_sample(sample); foreach (float f in sample) { System.Console.Write("\t{0}", f); } System.Console.WriteLine(); } }