+ shared_ptr<Player> player (new Player (_film, _playlist));
+ player->set_ignore_video ();
+ player->set_ignore_text ();
+ player->set_fast ();
+ player->set_play_referenced ();
+ player->Audio.connect (bind (&AnalyseAudioJob::analyse, this, _1, _2));
+
+ DCPTime const length = _playlist->length ();
+
+ Frame const len = DCPTime (length - _start).frames_round (_film->audio_frame_rate());
+ _samples_per_point = max (int64_t (1), len / _num_points);
+
+ delete[] _current;
+ _current = new AudioPoint[_film->audio_channels ()];
+ _analysis.reset (new AudioAnalysis (_film->audio_channels ()));
+
+ bool has_any_audio = false;
+ BOOST_FOREACH (shared_ptr<Content> c, _playlist->content ()) {
+ if (c->audio) {
+ has_any_audio = true;
+ }
+ }
+
+ if (has_any_audio) {
+ player->seek (_start, true);
+ _done = 0;
+ while (!player->pass ()) {}
+ }
+
+ vector<AudioAnalysis::PeakTime> sample_peak;
+ for (int i = 0; i < _film->audio_channels(); ++i) {
+ sample_peak.push_back (
+ AudioAnalysis::PeakTime (_sample_peak[i], DCPTime::from_frames (_sample_peak_frame[i], _film->audio_frame_rate ()))
+ );