Skip to content

Fix BaseInlet setup when receiving irregular rate stream #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Runtime/Scripts/BaseInlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ public virtual void AStreamIsFound(StreamInfo stream_info)
Debug.Log(string.Format("LSL Stream {0} found for {1}", stream_info.name(), name));

inlet = new StreamInlet(stream_info);
int buf_samples = (int)Mathf.Ceil((float)(inlet.info().nominal_srate() * maxChunkDuration));
double samplingRate = inlet.info().nominal_srate();
if (samplingRate == LSL.LSL.IRREGULAR_RATE) {
// Irregular rates are usually used for markers. This sampling rate will allow init of buffers that should largely cover normal use cases.
samplingRate = 128;
}
int buf_samples = (int)Mathf.Ceil((float)(samplingRate * maxChunkDuration));
int nChannels = inlet.info().channel_count();

timestamp_buffer = new double[buf_samples];
Expand Down