LSL4Unity icon indicating copy to clipboard operation
LSL4Unity copied to clipboard

Fix BaseInlet setup when receiving irregular rate stream

Open ThomasPrampart opened this issue 1 year ago • 1 comments

Looking at the BaseInlet class, the structures to receive data from a stream are initialized based on the sampling rate and channel count. When receiving a stream with irregular rate ( nominalSamplingRate = 0), the data buffer array is therefore of size 0. This prevents from reading any data from the stream.

Irregular rate is usually used for Markers streams. I am not sure of any other usages ? Those markers don't normally have a very high sampling rate. The fix I propose is therefore to initialize the structures with a size of 128 (as in 128 events per seconds), which should be more than enough to read such type of data.

A more flexible way to do this would be to read sample by sample until done in the pullChunk method but I thought this might not be as efficient and the fix as it is should be sufficient. What do you think about it ?

ThomasPrampart avatar Mar 06 '24 11:03 ThomasPrampart

Had this problem as well. You just saved me the trouble of searching where the issue is. I think a better approach would be to let the user initialize the buffer (size or "irregular rate") through the editor.

Other than that, I hope they see this PR sooner than later!

PS: Other usages include Eye-Gaze data which is not sampled by the device, but depends on camera frame-rate and software.

HeftyCoder avatar Jun 06 '24 23:06 HeftyCoder