diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-25 11:41:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-25 16:16:37 +0100 |
| commit | 54038beb4437c027e584fc95110f6fd4dbf2207d (patch) | |
| tree | d72963f95eaa0f0aba26dfa1db90838f1c6292f2 /src/wx | |
| parent | b42066b7d664ac322e6d2c79c5b0fa8bb0eb75c9 (diff) | |
Add channel details to high-audio-level hints (#822).
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_dialog.cc | 45 | ||||
| -rw-r--r-- | src/wx/audio_panel.cc | 12 |
2 files changed, 29 insertions, 28 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index b7f1f613b..b0867823e 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -33,6 +33,8 @@ using std::cout; using std::list; +using std::vector; +using std::pair; using boost::shared_ptr; using boost::bind; using boost::optional; @@ -166,8 +168,12 @@ AudioDialog::try_to_load_analysis () try { _analysis.reset (new AudioAnalysis (path)); + } catch (OldFormatError& e) { + /* An old analysis file: recreate it */ + JobManager::instance()->analyse_audio (film, _playlist, _analysis_finished_connection, bind (&AudioDialog::analysis_finished, this)); + return; } catch (xmlpp::exception& e) { - /* Probably an old-style analysis file: recreate it */ + /* Probably a (very) old-style analysis file: recreate it */ JobManager::instance()->analyse_audio (film, _playlist, _analysis_finished_connection, bind (&AudioDialog::analysis_finished, this)); return; } @@ -300,27 +306,26 @@ AudioDialog::setup_statistics () return; } - if (static_cast<bool>(_analysis->sample_peak ())) { - - float const peak_dB = 20 * log10 (_analysis->sample_peak().get()) + _analysis->gain_correction (_playlist); - - _sample_peak->SetLabel ( - wxString::Format ( - _("Sample peak is %.2fdB at %s"), - peak_dB, - time_to_timecode (_analysis->sample_peak_time().get(), film->video_frame_rate ()).data () - ) - ); - - if (peak_dB > -3) { - _sample_peak->SetForegroundColour (wxColour (255, 0, 0)); - } else { - _sample_peak->SetForegroundColour (wxColour (0, 0, 0)); - } + pair<AudioAnalysis::PeakTime, int> const peak = _analysis->overall_sample_peak (); + float const peak_dB = 20 * log10 (peak.first.peak) + _analysis->gain_correction (_playlist); + _sample_peak->SetLabel ( + wxString::Format ( + _("Sample peak is %.2fdB at %s on %s"), + peak_dB, + time_to_timecode (peak.first.time, film->video_frame_rate ()).data (), + std_to_wx (short_audio_channel_name (peak.second)).data () + ) + ); + + if (peak_dB > -3) { + _sample_peak->SetForegroundColour (wxColour (255, 0, 0)); + } else { + _sample_peak->SetForegroundColour (wxColour (0, 0, 0)); } - if (static_cast<bool>(_analysis->true_peak ())) { - float const peak_dB = 20 * log10 (_analysis->true_peak().get()) + _analysis->gain_correction (_playlist); + if (_analysis->overall_true_peak()) { + float const peak = _analysis->overall_true_peak().get(); + float const peak_dB = 20 * log10 (peak) + _analysis->gain_correction (_playlist); _true_peak->SetLabel (wxString::Format (_("True peak is %.2fdB"), peak_dB)); diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index cda38eaf6..4801fab00 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -320,15 +320,11 @@ AudioPanel::setup_peak () playlist->add (sel.front ()); try { shared_ptr<AudioAnalysis> analysis (new AudioAnalysis (_parent->film()->audio_analysis_path (playlist))); - if (analysis->sample_peak ()) { - float const peak_dB = 20 * log10 (analysis->sample_peak().get()) + analysis->gain_correction (playlist); - if (peak_dB > -3) { - alert = true; - } - _peak->SetLabel (wxString::Format (_("Peak: %.2fdB"), peak_dB)); - } else { - _peak->SetLabel (_("Peak: unknown")); + float const peak_dB = 20 * log10 (analysis->overall_sample_peak().first.peak) + analysis->gain_correction (playlist); + if (peak_dB > -3) { + alert = true; } + _peak->SetLabel (wxString::Format (_("Peak: %.2fdB"), peak_dB)); } catch (...) { _peak->SetLabel (_("Peak: unknown")); } |
