Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 39dca4a1 authored by MONSEIGNE Thibaut's avatar MONSEIGNE Thibaut
Browse files

:pencil: Update Documentation

parent e66fa773
No related branches found
No related tags found
No related merge requests found
Showing with 170195 additions and 329 deletions
name: Build and deploy documentation
on:
push:
branches:
- master
jobs:
# Build the documentation
build:
runs-on: windows-latest # Required by DocFX
steps:
- name: Checkout
uses: actions/checkout@v1
# with:
# submodules: true
- name: Install DocFX
run: choco install -y docfx
- name: Build
run: |
cp README.md Documentation/index.md
docfx Documentation/docfx.json
# Upload the generated documentation
- name: Upload site artifact
uses: actions/upload-artifact@v1
with:
name: site
path: _site # Must equals the 'build.dest' value on your docfx.json
# Deploy the generated documentation to the gh-pages branch
deploy:
needs: build
runs-on: ubuntu-latest # Required by 'JamesIves/github-pages-deploy-action'
steps:
- name: Checkout
uses: actions/checkout@v1
# with:
# submodules: true
# Download the generated documentation
- name: Download site artifact
uses: actions/download-artifact@v1
with:
name: site
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.AccessToken }} # You need some setup, see https://github.com/JamesIves/github-pages-deploy-action
BRANCH: gh-pages
FOLDER: site
CLEAN: true
\ No newline at end of file
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
# Autogenerated VS/MD solution and project files
/*.csproj
/*.unityproj
/*.sln
/*.suo
/*.user
/*.userprefs
/*.pidb
/*.booproj
#Unity3D Generated File On Crash Reports
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
**/[Ll]ibrary/**
**/[Tt]emp/**
**/[Oo]bj/**
**/[Bb]uild/**
**/[Bb]uilds/**
**/[Ll]ogs/**
**/[Mm]emoryCaptures/**
# Documentation
Documentation/api/
public/
_site/
Assets/Scripts/**/obj*
# Never ignore Asset meta data
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# TextMesh Pro files
[Aa]ssets/TextMesh*Pro/
# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
.vscode/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
Plugins/*.meta
\ No newline at end of file
# Builds
*.apk
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Avoid setting files (I don't know why it doesn't work)
*.DotSettings
.editorconfig
**.meta
Documentation/index.md
\ No newline at end of file
......@@ -8,7 +8,8 @@ namespace LSL4Unity.Demos
private const string UNIQUE_SOURCE_ID = "D256CFBDBA3145978CFA641403219531";
private liblsl.StreamOutlet outlet;
private liblsl.StreamInfo info;
private liblsl.StreamInfo info;
//public liblsl.StreamInfo GetStreamInfo() { return info; }
public string streamName = "BeMoBI.Unity.Orientation.<Add_a_entity_id_here>";
......@@ -29,10 +30,10 @@ namespace LSL4Unity.Demos
private void Start()
{
// initialize the array once
sample = new float[channelCount];
dataRate = LSLUtils.GetSamplingRateFor(sampling);
info = new liblsl.StreamInfo(streamName, streamType, channelCount, dataRate, liblsl.channel_format_t.cf_float32, UNIQUE_SOURCE_ID);
outlet = new liblsl.StreamOutlet(info);
sample = new float[channelCount];
dataRate = LSLUtils.GetSamplingRateFor(sampling);
info = new liblsl.StreamInfo(streamName, streamType, channelCount, dataRate, liblsl.channel_format_t.cf_float32, UNIQUE_SOURCE_ID);
outlet = new liblsl.StreamOutlet(info);
}
private void PushSample()
......
{
"metadata": [
{
"src": [
{
"src": "..",
"files": [
"**.cs"
]
}
],
"globalNamespaceId": "Global",
"filter": "filterConfig.yml",
"dest": "api"
}
],
"build": {
"globalMetadata": {
"_appTitle": "LSL 4 Unity documentation",
"_appFooter": "LSL 4 Unity documentation",
"_enableSearch": true
},
"content": [
{
"files": [
"toc.yml",
"index.md"
]
},
{
"src": "api",
"files": [
"*.yml"
],
"dest": "api"
}
],
"resource": [
{
"files": [
"resources/**/*"
]
}
],
"sitemap": {
"baseUrl": "https://tmonseigne.github.io/LSL4Unity/",
"changefreq": "weekly",
"fileOptions": {
"api/*": {
"changefreq": "daily"
}
}
},
"xref": [ "https://tmonseigne.github.io/LSL4Unity/xrefmap.yml" ],
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ],
"dest": "../_site"
}
}
\ No newline at end of file
apiRules:
- include: # The namespaces to generate
uidRegex: ^LSL4Unity
type: Namespace
- exclude:
uidRegex: .* # Every other namespaces are ignored
type: Namespace
\ No newline at end of file
- name: Scripting API
href: api/
\ No newline at end of file
This diff is collapsed.
......@@ -11,28 +11,31 @@ namespace LSL4Unity.Editor
private const string PLUGIN_DIR = "Plugins";
[PostProcessBuild(1)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
public static void OnPostprocessBuild(BuildTarget target, string buildPath)
{
var buildDir = Path.GetFileNameWithoutExtension(pathToBuiltProject);
var buildHostDir = pathToBuiltProject.Replace(Path.GetFileName(pathToBuiltProject), "");
var dataDir = buildDir + "_Data";
var pathToDataDir = Path.Combine(buildHostDir, dataDir);
var pluginDir = Path.Combine(pathToDataDir, PLUGIN_DIR);
switch (target)
if (buildPath != null)
{
case BuildTarget.StandaloneWindows:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.DLL_ENDING);
break;
case BuildTarget.StandaloneWindows64:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.DLL_ENDING);
break;
case BuildTarget.StandaloneLinux64:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.SO_ENDING);
break;
case BuildTarget.StandaloneOSX:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.BUNDLE_ENDING);
break;
var buildDir = Path.GetFileNameWithoutExtension(buildPath);
var buildHostDir = buildPath.Replace(Path.GetFileName(buildPath), "");
var dataDir = buildDir + "_Data";
var dataPath = Path.Combine(buildHostDir, dataDir);
var pluginDir = Path.Combine(dataPath, PLUGIN_DIR);
switch (target)
{
case BuildTarget.StandaloneWindows:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.DLL_ENDING);
break;
case BuildTarget.StandaloneWindows64:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.DLL_ENDING);
break;
case BuildTarget.StandaloneLinux64:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.SO_ENDING);
break;
case BuildTarget.StandaloneOSX:
RenameLibFile(pluginDir, LSLEditorIntegration.LIB64_NAME, LSLEditorIntegration.LIB32_NAME, LSLEditorIntegration.BUNDLE_ENDING);
break;
}
}
}
......
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
......@@ -38,7 +39,7 @@ namespace LSL4Unity.Editor
titleContent = new GUIContent("LSL Utility");
}
private liblsl.StreamInfo[] _streamInfos = null;
private liblsl.StreamInfo[] streamInfos = null;
private void OnGUI()
{
......@@ -66,10 +67,20 @@ namespace LSL4Unity.Editor
EditorGUILayout.LabelField("Data Rate", EditorStyles.boldLabel, fieldWidth);
EditorGUILayout.EndHorizontal();
foreach (string item in namesOfStreams)
//foreach (string item in namesOfStreams)
//{
// string[] s = item.Split(' ');
//
// EditorGUILayout.BeginHorizontal();
// EditorGUILayout.LabelField(new GUIContent(s[0], s[0]), fieldWidth);
// EditorGUILayout.LabelField(new GUIContent(s[1], s[1]), fieldWidth);
// EditorGUILayout.LabelField(new GUIContent(s[2], s[2]), fieldWidth);
// EditorGUILayout.LabelField(new GUIContent(s[3], s[3]), fieldWidth);
// EditorGUILayout.EndHorizontal();
//}
//Replace by LINQ Expression
foreach (string[] s in namesOfStreams.Select(item => item.Split(' ')))
{
string[] s = item.Split(' ');
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent(s[0], s[0]), fieldWidth);
EditorGUILayout.LabelField(new GUIContent(s[1], s[1]), fieldWidth);
......@@ -77,6 +88,7 @@ namespace LSL4Unity.Editor
EditorGUILayout.LabelField(new GUIContent(s[3], s[3]), fieldWidth);
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
EditorGUILayout.EndVertical();
}
......@@ -84,12 +96,12 @@ namespace LSL4Unity.Editor
private void UpdateStreams()
{
namesOfStreams.Clear();
_streamInfos = resolver.Results();
streamInfos = resolver.Results();
if (_streamInfos.Length == 0) { streamLookUpResult = NO_STREAMS_FOUND; }
if (streamInfos.Length == 0) { streamLookUpResult = NO_STREAMS_FOUND; }
else
{
foreach (liblsl.StreamInfo item in _streamInfos) { namesOfStreams.Add($"{item.Name()} {item.Type()} {item.Hostname()} {item.Sampling()}"); }
foreach (liblsl.StreamInfo item in streamInfos) { namesOfStreams.Add($"{item.Name()} {item.Type()} {item.Hostname()} {item.Sampling()}"); }
streamLookUpResult = namesOfStreams.Count + N_STREAMS_FOUND;
}
}
......
......@@ -15,7 +15,7 @@ namespace LSL4Unity.Editor
foreach (Attribute a in Attribute.GetCustomAttributes(monoScript.GetClass(), typeof(ScriptOrder)))
{
int currentOrder = MonoImporter.GetExecutionOrder(monoScript);
int newOrder = ((ScriptOrder)a).order;
int newOrder = ((ScriptOrder) a).order;
if (currentOrder != newOrder) { MonoImporter.SetExecutionOrder(monoScript, newOrder); }
}
}
......
This diff is collapsed.
# LSL4Unity
A integration approach of the LabStreamingLayer Framework for Unity3D providing the following features.
* Simple Editor Integration to lookup LSL streams.
[![Build Status](https://github.com/tmonseigne/LSL4Unity/workflows/Build%20and%20deploy%20documentation/badge.svg)](https://tmonseigne.github.io/LSL4Unity/)
**It's a Forks** of an integration approach of the LabStreamingLayer Framework for Unity3D providing the following features.
* Simple Editor Integration to lookup LSL streams.
* Provides a ready to use Marker stream implementation.
* Basic implementations and examples for LSL inlets and outlets.
* Build hooks to copy correct platform library to the build directory
......@@ -16,25 +19,39 @@ Contributions are welcome!
Good question - LSL4Unity tries to provide an enhanced user experience within Unity.
It is intented to solve several issues,
* instable framerates results in irregular sampling intervalls
* plattform dependent compilation
when using an Game Engine - in this case Unity - as a data provider within your experiments.
We also try to provide an easy start with predefined implementations which supports a integration into the EEGLAB, BCILAB and MoBILAB ecosystem. **Far from finished :X**
## Compatibility info
# Compatibility info
Currently LSL ~~works only with x64 builds~~ might work x64 and x86 builds of Unity3D projects!
I got the whole thing running on both platforms under Windows.
I got the whole thing running on both platforms under Windows.
Linux and MacOS X Support seems to be working at least in the editor but more testing is necessary.
Contributions are welcome! Just try to build the example scene on your platform and report potential errors as issues!
Contributions are welcome! Just try to build the example scene on your platform and report potential errors as issues!
## Dependencies
# Dependencies
In the current Version, the Asset package ships a sligthly modified version of the C# LSL API and the plugin binaries.
The LabStreaming Layer is original created by SCCN und could be found at <https://github.com/sccn/labstreaminglayer>.
It's highly recommended to read the section about the [Time Synchronization](https://labstreaminglayer.readthedocs.io/info/time_synchronization.html) before building your own experiments!
## My changes
**V1.0** :
* Update of coding rules and standard uses.
* Documenting of source code.
* Add OpenViBE Inlets and templates.
**Current Version** :
* Remove Original Examples and demos.
* Add Github Action to auto-generate doc.
* Update Documentation.
......@@ -476,7 +476,7 @@ namespace LSL4Unity
yield return new WaitUntil(() => results.Length > 0);
inlet = new liblsl.StreamInlet(results[0]);
inlet = new liblsl.StreamInlet(results[0]);
expectedChannels = inlet.Info().ChannelCount();
yield return null;
......
......@@ -93,9 +93,9 @@ namespace LSL4Unity
public abstract class InletFloatSamples : ABaseInlet
{
/// <summary> Override this method in the subclass to specify what should happen when samples are available. </summary>
/// <param name="sample"> The Incomming Sample. </param>
/// <param name="data"> The Incomming Sample. </param>
/// <param name="time"> The current Time. </param>
protected abstract void Process(float[] sample, double time);
protected abstract void Process(float[] data, double time);
protected float[] sample;
......
......@@ -39,14 +39,14 @@ namespace LSL4Unity.Examples
/// coroutines for more complexe processing tasks to distribute processing time over
/// several frames
/// </summary>
/// <param name="sample"> The Incomming Sample. </param>
/// <param name="data"> The Incomming Sample. </param>
/// <param name="time"> The current Time. </param>
protected override void Process(float[] sample, double time)
protected override void Process(float[] data, double time)
{
//Assuming that a samples contains at least 3 values for x,y,z
float x = useX ? sample[0] : 1;
float y = useY ? sample[1] : 1;
float z = useZ ? sample[2] : 1;
float x = useX ? data[0] : 1;
float y = useY ? data[1] : 1;
float z = useZ ? data[2] : 1;
// we map the data to the scale factors
Vector3 targetScale = new Vector3(x, y, z);
......
......@@ -6,8 +6,7 @@ namespace LSL4Unity.OV
}
/// <summary> List of GDF Stimulations. </summary>
/// <remarks> You cna use nameof operator to see the name instead of the value of the staimulation in log or other. </remarks>
/// <seealso cref="https://docs.microsoft.com/dotnet/csharp/language-reference/operators/nameof"/>
/// <remarks> You can use [nameof operator (C# reference)](https://docs.microsoft.com/dotnet/csharp/language-reference/operators/nameof) to see the name instead of the value of the staimulation in log or other. </remarks>
public static class GDFStimulations
{
public const int GDF_ARTIFACT_EOG_LARGE = 00257;
......@@ -126,8 +125,7 @@ namespace LSL4Unity.OV
}
/// <summary> List of OpenViBE Stimulations. </summary>
/// <remarks> You cna use nameof operator to see the name instead of the value of the staimulation in log or other. </remarks>
/// <seealso cref="https://docs.microsoft.com/dotnet/csharp/language-reference/operators/nameof"/>
/// <remarks> You can use [nameof operator (C# reference)](https://docs.microsoft.com/dotnet/csharp/language-reference/operators/nameof) to see the name instead of the value of the staimulation in log or other. </remarks>
public static class Stimulations
{
public const int NUMBER_00 = 00000;
......
......@@ -5,48 +5,48 @@ namespace LSL4Unity.OV.Template
/// @todo Je dois d'abord vérifier si je ne peux pas envoyer le tableau d'un coup par LSL et le double ou float Inlet sera suffisant.
public class MatrixInlet : OVDoubleInlet
{
public int NChannel = -1;
public int NSample = -1;
public double[,] Matrix;
public bool ReadyToSend = false;
public int nChannel = -1;
public int nSample = -1;
public double[,] matrix;
public bool readyToSend = false;
private int _curChannel = -1;
private int _curSample = -1;
private int curChannel = -1;
private int curSample = -1;
private void ResetMatrix()
{
for (int i = 0; i < NChannel; i++)
for (int i = 0; i < nChannel; i++)
{
for (int j = 0; j < NSample; j++) { Matrix[i, j] = 0; }
for (int j = 0; j < nSample; j++) { matrix[i, j] = 0; }
}
_curChannel = 0;
_curSample = 0;
curChannel = 0;
curSample = 0;
}
protected override void Process(double[] input, double time)
{
if (NChannel == -1) { NChannel = (int) input[0]; }
else if (NSample == -1)
if (nChannel == -1) { nChannel = (int) input[0]; }
else if (nSample == -1)
{
NSample = (int) input[0];
Matrix = new double[NChannel, NSample];
nSample = (int) input[0];
matrix = new double[nChannel, nSample];
ResetMatrix();
}
else
{
// If We have complete the matrix
if (_curChannel == NChannel && _curSample == NSample) { ResetMatrix(); }
if (curChannel == nChannel && curSample == nSample) { ResetMatrix(); }
// Update Row and column
if (_curSample == NSample)
if (curSample == nSample)
{
_curChannel++;
_curSample = 0;
curChannel++;
curSample = 0;
}
else { _curSample++; }
else { curSample++; }
// If Now the matrix is completed
if (_curChannel == NChannel && _curSample == NSample) { ReadyToSend = true; }
if (curChannel == nChannel && curSample == nSample) { readyToSend = true; }
}
}
}
......
......@@ -28,7 +28,7 @@ namespace LSL4Unity
public bool IsStreamAvailable(out LSLStreamInfoWrapper info, string streamName = "", string streamType = "", string hostName = "")
{
var result = streams.Where(i => (streamName.Length == 0 || i.name.Equals(streamName)) && (streamType.Length == 0 || i.type.Equals(streamType))
&& (hostName.Length == 0 || i.type.Equals(hostName)))
&& (hostName.Length == 0 || i.type.Equals(hostName)))
.ToList();
if (result.Any())
......@@ -46,13 +46,13 @@ namespace LSL4Unity
{
var results = resolver.Results();
foreach (var item in streams)
{
if (!results.Any(r => r.Name().Equals(item.name)))
{
if (onStreamLost.GetPersistentEventCount() > 0) { onStreamLost.Invoke(item); }
}
}
//foreach (var item in streams) {
//if (!results.Any(r => r.Name().Equals(item.name))) {
//if (onStreamLost.GetPersistentEventCount() > 0) { onStreamLost.Invoke(item); } } }
//Replace by LINQ Expression
foreach (LSLStreamInfoWrapper item in streams.Where(item => !results.Any(r => r.Name().Equals(item.name)))
.Where(item => onStreamLost.GetPersistentEventCount() > 0)) { onStreamLost.Invoke(item); }
// remove lost streams from cache
streams.RemoveAll(s => !results.Any(r => r.Name().Equals(s.name)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment