openPlayback method

  1. @override
Future<PlaybackSession> openPlayback({
  1. required String sourcePath,
  2. required WaveformDocument document,
})
override

This method reads from sourcePath and opens a playback session over document.

The audio that the session plays is byte-identical to the audio that exportWav writes, because both run the same C loop. You listen to an edit before you commit to it. That is useful only when what you hear is what you get.

Web has no filesystem to read a source from, so this method is not available there.

Implementation

@override
Future<PlaybackSession> openPlayback({
  required String sourcePath,
  required WaveformDocument document,
}) async {
  final error = nextPlaybackError;
  if (error != null) {
    nextPlaybackError = null;
    throw error;
  }

  final session = FakePlaybackSession(document: document, sampleRate: 44100);
  playbacks.add(session);
  return session;
}