seek method

void seek(
  1. int sampleIndex
)

Seeks to the specified sampleIndex position frame in the file.

Implementation

void seek(int sampleIndex) {
  if (_isClosed) throw StateError("WavReader is closed");
  if (sampleIndex < 0 || sampleIndex > totalSamples) {
    throw RangeError.range(sampleIndex, 0, totalSamples, "sampleIndex");
  }
  _currentSample = sampleIndex;
  file.setPositionSync(_dataStartOffset + sampleIndex * format.blockAlign);
}