setLoopEndPoint method

void setLoopEndPoint(
  1. SoundHandle handle,
  2. Duration? time
)

Set the exclusive loop end point of a currently playing sound.

Set time to null to loop at the sound's natural end. Getters reflect the requested region immediately. Playback applies a live change at the next source refill, so up to 512 already-decoded source frames, plus backend latency, can still use the previous region. Pass loop bounds to play or play3d when they must apply before the first decoded sample.

Throws SoLoudNotInitializedException if the engine is not initialized.

Implementation

void setLoopEndPoint(SoundHandle handle, Duration? time) {
  if (!isInitialized) {
    throw const SoLoudNotInitializedException();
  }
  if (time != null) {
    validateLoopRegion(
      start: _controller.soLoudFFI.getLoopPoint(handle),
      end: time,
    );
  }
  _controller.soLoudFFI.setLoopEndPoint(handle, time);
}