|
| 1 | +# C# bindings |
| 2 | + |
| 3 | +The is the C# interface to the lab streaming layer. To use it, you need to include the file LSL.cs in |
| 4 | +your project, and make sure that the library liblsl32.dll is found (e.g., in your application's root |
| 5 | +directory or in a system path). |
| 6 | + |
| 7 | +If you are deploying on a platform that requires a different binary than liblsl32.dll (e.g., liblsl64.so |
| 8 | +on 64-bit Linux, or liblsl64.dylib on Mac OS, then you need to replace the libname constant in LSL.cs |
| 9 | +by the corresponding file name). |
| 10 | + |
| 11 | +## C# Example Programs |
| 12 | + |
| 13 | +These examples show how to transmit a numeric multi-channel time series through LSL: |
| 14 | + |
| 15 | +- [Sending a multi-channel time series into LSL.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/SendData.cs) |
| 16 | +- [Receiving a multi-channel time series from LSL.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/ReceiveData.cs) |
| 17 | + |
| 18 | +The following examples show how to transmit data in form of chunks instead of samples, which can be |
| 19 | +more convenient. |
| 20 | + |
| 21 | +- [Sending a multi-channel time series in chunks.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/SendDataInChunks.cs) |
| 22 | +- [Receiving a multi-channel time series in chunks.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/ReceiveDataInChunks.cs) |
| 23 | + |
| 24 | +These examples show a special-purpose use case that is mostly relevant for stimulus-presentation |
| 25 | +programs or other applications that want to emit 'event' markers or other application state. |
| 26 | + |
| 27 | +The stream here is single-channel and has irregular sampling rate, but the value per channel is a string: |
| 28 | +- [Sending string-formatted irregular streams.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/SendStringMarkers.cs) |
| 29 | +- [Receiving string-formatted irregular streams.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/ReceiveStringMarkers.cs) |
| 30 | + |
| 31 | +The last example shows how to attach properly formatted meta-data to a stream, and how to read it |
| 32 | +out again at the receiving end. |
| 33 | +While meta-data is strictly optional, it is very useful to make streams self-describing. |
| 34 | +LSL has adopted the convention to name meta-data fields according to the XDF file format |
| 35 | +specification whenever the content type matches (for example EEG, Gaze, MoCap, VideoRaw, etc); |
| 36 | +the spec is [here](https://github.com/sccn/xdf/wiki/Meta-Data). |
| 37 | + |
| 38 | +- [Handling stream meta-data.](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/examples/HandleMetaData.cs) |
0 commit comments