preResolveReactive method

  1. @override
Future<void> preResolveReactive(
  1. Iterable<AudioSource> sources, {
  2. required BeatDetectionService beatDetector,
  3. required FrequencyAnalyzer analyzer,
  4. required int fps,
  5. required int totalFrames,
})
override

Analyses every reactive audio source in sources into a BeatGrid and a BandTable before the frame loop.

Kept separate from preResolveAudio so the encoder-file-materialize concern (which the encoder -is) and the reactive analysis concern (which the ReactiveScope and Trigger.beat read) stay independent. Each source is decoded once and run through beatDetector / analyzer at fps over totalFrames; the results feed beatGridFor / bandTableFor synchronously during the frame loop, so no frame ever awaits audio analysis. Idempotent: an already-analysed source is skipped. The reactive inputs are precomputed before frame 0 exactly like media.

Implementation

@override
Future<void> preResolveReactive(
  Iterable<AudioSource> sources, {
  required BeatDetectionService beatDetector,
  required FrequencyAnalyzer analyzer,
  required int fps,
  required int totalFrames,
}) async {
  if (sources.isNotEmpty) {
    throw FluvieRenderException(
      'NoMediaResolver cannot analyse audio (got ${sources.length} source(s), '
      'first: "${sources.first}"). Wire a MediaRepository through '
      'mediaResolverProvider for beat-reactive and spectrum-reactive '
      'animations, or keep this resolver for non-reactive compositions.',
    );
  }
}