getEngineTime method

Duration getEngineTime()

Get the engine's global stream time.

This is the clock the mixer advances at the start of every output buffer and the time base used by playScheduled, stopScheduled and fadeScheduled. Read it once, then schedule a batch of sounds against it — everything lands sample-accurately on the engine's own timeline.

Note: the engine time only advances while the audio device is mixing. A pending playScheduled voice keeps the device running, so the clock keeps advancing while anything is scheduled.

Not to be confused with getStreamTime, which returns the stream time of a single voice.

Throws SoLoudNotInitializedException if the engine is not initialized.

Implementation

Duration getEngineTime() {
  if (!isInitialized) {
    throw const SoLoudNotInitializedException();
  }
  return _controller.soLoudFFI.getEngineTime();
}