-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hi, I noticed that the LSL stream name is always the same "random" string from the getRandomString function. I think this is actually always the same string due to the way C implements rand()?
App-WearableSensing/CLI/dsi2lsl.c
Lines 171 to 177 in 827d177
| void getRandomString(char *s, const int len) | |
| { | |
| int i = 0; | |
| static const char alphanum[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | |
| for (i=0; i < len; ++i){ s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];} | |
| s[len] = 0; | |
| } |
This causes problems, for example, when trying to stream from multiple headsets to LSL at the same time. A simple fix would be to use the streamName variable for the LSL stream name instead of source_id here:
App-WearableSensing/CLI/dsi2lsl.c
Line 199 in 827d177
| info = lsl_create_streaminfo((char*)streamName,"EEG",numberOfChannels,samplingRate,cft_float32,source_id); |
This might be a bug in the LSL C API but the first parameter (streamName) doesn't actually seem to set the stream name. The stream name comes from the last parameter (source_id in this case).