+/** @return If there is one selected piece of audio content, return its peak value in dB (if known) */
+optional<float>
+AudioPanel::peak () const
+{
+ optional<float> peak_dB;
+
+ ContentList sel = _parent->selected_audio ();
+ if (sel.size() == 1) {
+ shared_ptr<Playlist> playlist (new Playlist);
+ playlist->add (_parent->film(), sel.front());
+ try {
+ shared_ptr<AudioAnalysis> analysis (new AudioAnalysis(_parent->film()->audio_analysis_path(playlist)));
+ peak_dB = linear_to_db(analysis->overall_sample_peak().first.peak) + analysis->gain_correction(playlist);
+ } catch (...) {
+
+ }
+ }
+
+ return peak_dB;
+}
+