+ if (has_any_audio) {
+ _done = 0;
+ DCPTime const block = DCPTime::from_seconds (1.0 / 8);
+ for (DCPTime t = start; t < length; t += block) {
+ analyse (player->get_audio (t, block, false));
+ set_progress ((t.seconds() - start.seconds()) / (length.seconds() - start.seconds()));
+ }
+ }
+
+ _analysis->set_peak (_overall_peak, DCPTime::from_frames (_overall_peak_frame, _film->audio_frame_rate ()));
+
+ if (_playlist->content().size() == 1) {
+ /* If there was only one piece of content in this analysis we may later need to know what its
+ gain was when we analysed it.
+ */
+ shared_ptr<const AudioContent> ac = dynamic_pointer_cast<const AudioContent> (_playlist->content().front ());
+ DCPOMATIC_ASSERT (ac);
+ _analysis->set_analysis_gain (ac->audio_gain ());
+ }
+
+ _analysis->write (_film->audio_analysis_path (_playlist));
+