Skip to content

Vhi.LSLWrapper

VHI_godot

Vhi

LSLWrapper Class

Wrapper for SharpLSL that avoids static initialization hang in Godot. Uses reflection to dynamically load and call LSL methods.

public static class LSLWrapper

Inheritance System.Object → LSLWrapper

Methods

LSLWrapper.CreateStreamInfo(string, string, int, double, string, string) Method

Create a StreamInfo object

public static object CreateStreamInfo(string name, string type, int channelCount, double nominalSrate, string channelFormat, string sourceId);

Returns

System.Object

LSLWrapper.CreateStreamInlet(object, int, int, bool) Method

Create a StreamInlet from a StreamInfo

public static object CreateStreamInlet(object streamInfo, int maxChunkLength=0, int maxBufferLength=360, bool recover=true);

Returns

System.Object

LSLWrapper.CreateStreamOutlet(object, int, int) Method

Create a StreamOutlet from a StreamInfo

public static object CreateStreamOutlet(object streamInfo, int chunkSize=0, int maxBuffered=360);

Returns

System.Object

LSLWrapper.Dispose(object) Method

Dispose an LSL object (StreamInlet or StreamOutlet)

public static void Dispose(object lslObject);

LSLWrapper.GetStreamInfoChannelCount(object) Method

Get StreamInfo channel count

public static int GetStreamInfoChannelCount(object streamInfo);

Returns

System.Int32

LSLWrapper.GetStreamInfoName(object) Method

Get StreamInfo name

public static string GetStreamInfoName(object streamInfo);

Returns

System.String

LSLWrapper.Initialize() Method

Initialize LSL types via reflection. Call this once before using LSL.

public static void Initialize();

LSLWrapper.PullSample(object, float[], double) Method

Pull a sample from a StreamInlet (non-blocking)

public static double PullSample(object inlet, float[] buffer, double timeout=0.0);

Returns

System.Double

Remarks

Returns 0.0 on failure, which ends the caller's drain loop for this frame. Failures are rate-limited rather than silenced: an inlet whose producer has gone keeps failing until the staleness clock re-resolves it, and printing each one buries everything else.

LSLWrapper.PushSample(object, float[]) Method

Push a sample to a StreamOutlet

public static void PushSample(object outlet, float[] sample);

LSLWrapper.ResolveAll(double) Method

Every LSL stream visible on the network right now.

public static object[] ResolveAll(double timeout=1.0);

Returns

System.Object[]

Remarks

One network resolve, whatever the caller is after. This used to filter by name here, which read as "resolve one stream" and was not — liblsl resolved everything either way, so a caller wanting several streams paid a full resolve per name. That matters now that VHI subscribes to one stream per DOF: concurrent liblsl resolves kernel- panicked a machine here, so the caller matches names against one answer instead.

LSLWrapper.SetChannelLabels(object, string[]) Method

Set channel labels in StreamInfo description XML

public static void SetChannelLabels(object streamInfo, string[] labels);

LSLWrapper.SetStreamMetadata(object, string, string) Method

Add initial state/schema to StreamInfo metadata

public static void SetStreamMetadata(object streamInfo, string fieldName, string value);