diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-04 12:33:41 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-04 12:33:41 +0100 |
| commit | 8102046b2f29e0c7b234c29bf204b056cb30e64f (patch) | |
| tree | 84933e8db7822e863ae9ab4e6524ab3176606b11 /src/wx | |
| parent | 3574212ee42b2bd924eb95d5c0f4f69ec9e0a2f0 (diff) | |
| parent | 82926443230084739cb673a83b2ab1f9d733a07b (diff) | |
Merge master.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_dialog.cc | 27 | ||||
| -rw-r--r-- | src/wx/audio_mapping_view.cc | 10 | ||||
| -rw-r--r-- | src/wx/audio_mapping_view.h | 2 | ||||
| -rw-r--r-- | src/wx/audio_plot.cc | 11 |
4 files changed, 32 insertions, 18 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index 0e1316cf3..1f882e61f 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -106,6 +106,7 @@ AudioDialog::try_to_load_analysis () } if (!boost::filesystem::exists (_content->audio_analysis_path())) { + _plot->set_analysis (shared_ptr<AudioAnalysis> ()); _analysis_finished_connection = _content->analyse_audio (bind (&AudioDialog::analysis_finished, this)); return; } @@ -115,14 +116,28 @@ AudioDialog::try_to_load_analysis () a.reset (new AudioAnalysis (_content->audio_analysis_path ())); _plot->set_analysis (a); - if (_channel_checkbox[0]) { + /* Set up some defaults if no check boxes are checked */ + + int i = 0; + while (i < MAX_DCP_AUDIO_CHANNELS && (!_channel_checkbox[i] || !_channel_checkbox[i]->GetValue ())) { + ++i; + } + + if (i == MAX_DCP_AUDIO_CHANNELS && _channel_checkbox[0]) { _channel_checkbox[0]->SetValue (true); + _plot->set_channel_visible (0, true); } - _plot->set_channel_visible (0, true); - for (int i = 0; i < AudioPoint::COUNT; ++i) { - _type_checkbox[i]->SetValue (true); - _plot->set_type_visible (i, true); + i = 0; + while (i < AudioPoint::COUNT && !_type_checkbox[i]->GetValue ()) { + i++; + } + + if (i == AudioPoint::COUNT) { + for (int i = 0; i < AudioPoint::COUNT; ++i) { + _type_checkbox[i]->SetValue (true); + _plot->set_type_visible (i, true); + } } } @@ -158,6 +173,8 @@ AudioDialog::content_changed (int p) { if (p == AudioContentProperty::AUDIO_GAIN) { _plot->set_gain (_content->audio_gain ()); + } else if (p == AudioContentProperty::AUDIO_MAPPING) { + try_to_load_analysis (); } } diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc index ac85407a2..c65eadd5a 100644 --- a/src/wx/audio_mapping_view.cc +++ b/src/wx/audio_mapping_view.cc @@ -44,7 +44,7 @@ using boost::lexical_cast; enum { ID_off = 1, ID_full = 2, - ID_minus3dB = 3, + ID_minus6dB = 3, ID_edit = 4 }; @@ -138,12 +138,12 @@ AudioMappingView::AudioMappingView (wxWindow* parent) _menu = new wxMenu; _menu->Append (ID_off, _("Off")); _menu->Append (ID_full, _("Full")); - _menu->Append (ID_minus3dB, _("-3dB")); + _menu->Append (ID_minus6dB, _("-6dB")); _menu->Append (ID_edit, _("Edit...")); Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::off, this), ID_off); Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::full, this), ID_full); - Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::minus3dB, this), ID_minus3dB); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::minus6dB, this), ID_minus6dB); Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::edit, this), ID_edit); } @@ -200,9 +200,9 @@ AudioMappingView::full () } void -AudioMappingView::minus3dB () +AudioMappingView::minus6dB () { - _map.set (_menu_row, static_cast<dcp::Channel> (_menu_column - 1), 1 / sqrt (2)); + _map.set (_menu_row, static_cast<dcp::Channel> (_menu_column - 1), pow (10, -6.0 / 20)); map_changed (); } diff --git a/src/wx/audio_mapping_view.h b/src/wx/audio_mapping_view.h index 3d8db0cff..7ed699463 100644 --- a/src/wx/audio_mapping_view.h +++ b/src/wx/audio_mapping_view.h @@ -49,7 +49,7 @@ private: void off (); void full (); - void minus3dB (); + void minus6dB (); void edit (); wxGrid* _grid; diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 69faf127e..c4e5d992f 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -40,7 +40,6 @@ AudioPlot::AudioPlot (wxWindow* parent) : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) , _gain (0) , _smoothing (max_smoothing / 2) - , _message (_("Please wait; audio is being analysed...")) { #ifndef __WXOSX__ SetDoubleBuffered (true); @@ -67,6 +66,8 @@ AudioPlot::AudioPlot (wxWindow* parent) _colours.push_back (wxColour (255, 0, 139)); _colours.push_back (wxColour (139, 0, 255)); + set_analysis (shared_ptr<AudioAnalysis> ()); + #if MAX_DCP_AUDIO_CHANNELS != 12 #warning AudioPlot::AudioPlot is expecting the wrong MAX_DCP_AUDIO_CHANNELS #endif @@ -81,14 +82,10 @@ AudioPlot::set_analysis (shared_ptr<AudioAnalysis> a) { _analysis = a; - for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) { - _channel_visible[i] = false; + if (!a) { + _message = _("Please wait; audio is being analysed..."); } - for (int i = 0; i < AudioPoint::COUNT; ++i) { - _type_visible[i] = false; - } - Refresh (); } |
