Skip to content

LSL Stream Name #1

@dav0dea

Description

@dav0dea

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()?

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:

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions