getSegmentCallback method

void getSegmentCallback(
  1. Pointer<whisper_context> ctx,
  2. Pointer<whisper_state> state,
  3. int nNew,
  4. Pointer<Void> userData,
)

Implementation

void getSegmentCallback(Pointer<whisper_context> ctx,
    Pointer<whisper_state> state, int nNew, Pointer<Void> userData) {
  if (this.ctx == nullptr) {
    this.ctx = ctx;
  }

  int nSegments = WhisperLibrary.binding.whisper_full_n_segments(ctx);

  if (lastNSegments != nSegments) {
    result.value += output(lastNSegments, nSegments, timeOffset: timeOffset);
    lastNSegments = nSegments;
  }
}