create method

Creates the stream info object, allocates memory, etc.

Implementation

@override
LSLStreamInfo create() {
  if (created) {
    throw LSLException('StreamInfo already created');
  }
  final streamNamePtr = streamName
      .toNativeUtf8(allocator: allocate)
      .cast<Char>();
  final sourceIdPtr = sourceId.toNativeUtf8(allocator: allocate).cast<Char>();
  final streamTypePtr = streamType.charPtr;

  addAllocList([streamNamePtr, sourceIdPtr, streamTypePtr]);
  _streamInfo = lsl_create_streaminfo(
    streamNamePtr,
    streamTypePtr,
    channelCount,
    sampleRate,
    channelFormat.lslFormat,
    sourceIdPtr,
  );
  // if the UID is not set, we create a new one
  if (uid == null) {
    resetUid();
  }
  super.create();
  return this;
}