pullSampleInto method
Pulls a sample into the provided reusable buffer.
@param buffer The buffer / LSLReusableBuffer.buffer to store the
sample.
@param inlet The inlet to pull the sample from.
@param channels The number of channels in the sample.
@param timeout The timeout in seconds.
@return LSLSample The sample.
@note This function is asynchronous and returns a Future.
@note The buffer must be allocated with the same number of channels
as the sample.
@note The buffer must be freed after use.
Implementation
Future<LSLSamplePointer<T>> pullSampleInto(
Pointer<T> buffer,
lsl_inlet inlet,
int channels,
double timeout,
Pointer<Int32> ec,
) async {
final double timestamp = _pullFn(inlet, buffer, channels, timeout, ec);
final int errorCode = ec.value;
if (LSLObj.error(errorCode)) {
return LSLSamplePointer<T>(timestamp, errorCode, 0);
}
return LSLSamplePointer<T>(timestamp, errorCode, buffer.address);
}