createSample method

  1. @protected
LSLSample<D> createSample(
  1. Pointer<T> buffer,
  2. lsl_inlet inlet,
  3. int channels,
  4. double timeout,
)

Implementation

@protected
LSLSample<D> createSample(
  Pointer<T> buffer,
  lsl_inlet inlet,
  int channels,
  double timeout,
) {
  final Pointer<Int32> ec = allocate<Int32>();
  final double timestamp = _pullFn(inlet, buffer, channels, timeout, ec);
  final int errorCode = ec.value;
  if (LSLObj.error(errorCode)) {
    return LSLSample<D>(IList(), timestamp, errorCode);
  }
  ec.free();
  if (timestamp > 0) {
    final IList<D> result = bufferToList(buffer, channels);
    buffer.free();
    return LSLSample<D>(result, timestamp, errorCode);
  }
  buffer.free();
  return LSLSample<D>(IList(), timestamp, errorCode);
}