createFromPointer method

Future<LSLInlet<T>> createFromPointer(
  1. lsl_inlet pointer, {
  2. bool takeOwnership = false,
})

Creates an inlet from an existing lsl_inlet pointer. Parameters:

  • pointer: The existing lsl_inlet pointer.
  • takeOwnership: Whether destroy closes and destroys pointer. Defaults to false, for a pointer some other object still owns. Pass true when handing over an inlet opened elsewhere — on another isolate, say — that nothing else will destroy, or it leaks, connection and all. Returns: A LSLInlet instance wrapping the existing pointer. Throws: LSLException if inlet creation fails or if useIsolates: true.

Implementation

Future<LSLInlet<T>> createFromPointer(
  lsl_inlet pointer, {
  bool takeOwnership = false,
}) async {
  if (created) {
    throw LSLException('Inlet already created');
  }
  if (useIsolates) {
    throw LSLException(
      'Creating inlet from pointer is not supported in isolated mode',
    );
  }
  _managed = takeOwnership;
  super.create();
  _inlet = pointer;
  setupPullBuffer();
  return this;
}