+
+void
+AudioContent::set_audio_delay (int d)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _audio_delay = d;
+ }
+
+ signal_changed (AudioContentProperty::AUDIO_DELAY);
+}
+
+boost::signals2::connection
+AudioContent::analyse_audio (boost::function<void()> finished)
+{
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
+ shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, dynamic_pointer_cast<AudioContent> (shared_from_this())));
+ boost::signals2::connection c = job->Finished.connect (finished);
+ JobManager::instance()->add (job);
+
+ return c;
+}
+
+boost::filesystem::path
+AudioContent::audio_analysis_path () const
+{
+ shared_ptr<const Film> film = _film.lock ();
+ if (!film) {
+ return boost::filesystem::path ();
+ }
+
+ boost::filesystem::path p = film->audio_analysis_dir ();
+ p /= digest() + "_" + audio_mapping().digest();
+ return p;
+}
+
+string
+AudioContent::technical_summary () const
+{
+ return String::compose ("audio: channels %1, length %2, raw rate %3, out rate %4", audio_channels(), audio_length(), content_audio_frame_rate(), output_audio_frame_rate());
+}
+
+int
+AudioContent::output_audio_frame_rate () const
+{
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
+ /* Resample to a DCI-approved sample rate */
+ double t = dcp_audio_frame_rate (content_audio_frame_rate ());
+
+ FrameRateChange frc (video_frame_rate(), film->video_frame_rate());
+
+ /* Compensate if the DCP is being run at a different frame rate
+ to the source; that is, if the video is run such that it will
+ look different in the DCP compared to the source (slower or faster).
+ skip/repeat doesn't come into effect here.
+ */
+
+ if (frc.change_speed) {
+ t /= frc.speed_up;
+ }
+
+ return rint (t);
+}
+