#include "lib/job_manager.h"
#include "lib/dcp_content.h"
#include <wx/spinctrl.h>
-#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <iostream>
using std::list;
using std::pair;
using boost::dynamic_pointer_cast;
-using boost::lexical_cast;
using boost::shared_ptr;
using boost::optional;
grid->Add (_reference, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _show = new wxButton (this, wxID_ANY, _("Show graph of audio levels..."));
- s->Add (_show);
- _peak = new wxStaticText (this, wxID_ANY, wxT (""));
- s->Add (_peak, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
- grid->Add (s, wxGBPosition (r, 0), wxGBSpan (1, 2));
- ++r;
- }
+ _show = new wxButton (this, wxID_ANY, _("Show graph of audio levels..."));
+ grid->Add (_show, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ _peak = new wxStaticText (this, wxID_ANY, wxT (""));
+ grid->Add (_peak, wxGBPosition (r, 2), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL);
+ ++r;
- add_label_to_grid_bag_sizer (grid, this, _("Gain"), true, wxGBPosition (r, 0));
+ add_label_to_sizer (grid, this, _("Gain"), true, wxGBPosition (r, 0));
_gain = new ContentSpinCtrlDouble<AudioContent> (
this,
new wxSpinCtrlDouble (this),
);
_gain->add (grid, wxGBPosition (r, 1));
- add_label_to_grid_bag_sizer (grid, this, _("dB"), false, wxGBPosition (r, 2));
+ add_label_to_sizer (grid, this, _("dB"), false, wxGBPosition (r, 2));
_gain_calculate_button = new wxButton (this, wxID_ANY, _("Calculate..."));
grid->Add (_gain_calculate_button, wxGBPosition (r, 3));
++r;
- add_label_to_grid_bag_sizer (grid, this, _("Delay"), true, wxGBPosition (r, 0));
+ add_label_to_sizer (grid, this, _("Delay"), true, wxGBPosition (r, 0));
_delay = new ContentSpinCtrl<AudioContent> (
this,
new wxSpinCtrl (this),
_delay->add (grid, wxGBPosition (r, 1));
/// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time
- add_label_to_grid_bag_sizer (grid, this, _("ms"), false, wxGBPosition (r, 2));
+ add_label_to_sizer (grid, this, _("ms"), false, wxGBPosition (r, 2));
++r;
_mapping = new AudioMappingView (this);
case Film::VIDEO_FRAME_RATE:
setup_description ();
break;
+ case Film::REEL_TYPE:
+ setup_sensitivity ();
default:
break;
}
}
setup_sensitivity ();
+ } else if (property == AudioContentProperty::AUDIO_VIDEO_FRAME_RATE) {
+ setup_description ();
}
}
_delay->set_content (sel);
film_content_changed (AudioContentProperty::AUDIO_STREAMS);
+ film_content_changed (DCPContentProperty::REFERENCE_AUDIO);
setup_sensitivity ();
}
AudioPanel::setup_sensitivity ()
{
AudioContentList sel = _parent->selected_audio ();
- _reference->Enable (sel.size() == 1 && dynamic_pointer_cast<DCPContent> (sel.front ()));
+
+ shared_ptr<DCPContent> dcp;
+ if (sel.size() == 1) {
+ dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
+ }
+
+ list<string> why_not;
+ bool const can_reference = dcp && dcp->can_reference_audio (why_not);
+ setup_refer_button (_reference, dcp, can_reference, why_not);
if (_reference->GetValue ()) {
_gain->wrapped()->Enable (false);
playlist->add (sel.front ());
try {
shared_ptr<AudioAnalysis> analysis (new AudioAnalysis (_parent->film()->audio_analysis_path (playlist)));
- if (analysis->peak ()) {
- float const peak_dB = 20 * log10 (analysis->peak().get()) + analysis->gain_correction (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;
}