Skip to content

Commit

Permalink
Merge branch 'master' into unity-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dmedine authored Oct 28, 2021
2 parents d93c348 + bb0f510 commit 048aaa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions LSL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ protected override void DestroyLSLObject(IntPtr obj)
* Wait until some consumer shows up (without wasting resources).
* @return True if the wait was successful, false if the timeout expired.
*/
public bool wait_for_consumers(double timeout = LSL.FOREVER) { return dll.lsl_wait_for_consumers(obj) > 0; }
public bool wait_for_consumers(double timeout = LSL.FOREVER) { return dll.lsl_wait_for_consumers(obj, timeout) > 0; }

/**
* Retrieve the stream info provided by this outlet.
Expand Down Expand Up @@ -1023,7 +1023,7 @@ class dll
public static extern int lsl_have_consumers(IntPtr obj);

[DllImport(libname, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
public static extern int lsl_wait_for_consumers(IntPtr obj);
public static extern int lsl_wait_for_consumers(IntPtr obj, double timeout);

[DllImport(libname, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
public static extern IntPtr lsl_get_info(IntPtr obj);
Expand Down
8 changes: 6 additions & 2 deletions README-Unity.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,24 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LSL;
using static LSL.LSL;

public class LSLInput : MonoBehaviour
{
public string StreamType = "EEG";
public float scaleInput = 0.1f;

StreamInfo[] streamInfos;
StreamInlet streamInlet;

float[] sample;
private int channelCount = 0;

void Update()
{
if (streamInlet == null)
{
streamInfos = resolve_stream("type", StreamType, 1, 0.0);

streamInfos = LSL.resolve_stream("type", StreamType, 1, 0.0);
if (streamInfos.Length > 0)
{
streamInlet = new StreamInlet(streamInfos[0]);
Expand Down Expand Up @@ -91,6 +93,7 @@ public class LSLOutput : MonoBehaviour
private StreamOutlet outlet;
private float[] currentSample;


public string StreamName = "Unity.ExampleStream";
public string StreamType = "Unity.StreamType";
public string StreamId = "MyStreamID-Unity1234";
Expand All @@ -107,6 +110,7 @@ public class LSLOutput : MonoBehaviour
currentSample = new float[3];
}


// Update is called once per frame
void FixedUpdate()
{
Expand Down

0 comments on commit 048aaa2

Please sign in to comment.