#include <boost/filesystem.hpp>
#include "lib/audio_analysis.h"
#include "lib/film.h"
+#include "lib/audio_content.h"
#include "audio_dialog.h"
#include "audio_plot.h"
#include "wx_util.h"
side->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
}
- for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
+ for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
_channel_checkbox[i] = new wxCheckBox (this, wxID_ANY, std_to_wx (audio_channel_name (i)));
side->Add (_channel_checkbox[i], 1, wxEXPAND | wxALL, 3);
_channel_checkbox[i]->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AudioDialog::channel_clicked, this, _1));
AudioDialog::set_content (shared_ptr<AudioContent> c)
{
_content_changed_connection.disconnect ();
-
+
_content = c;
try_to_load_analysis ();
_content_changed_connection = _content->Changed.connect (bind (&AudioDialog::content_changed, this, _2));
- SetTitle (wxString::Format (_("DCP-o-matic audio - %s"), std_to_wx(_content->path().filename().string()).data()));
+ SetTitle (wxString::Format (_("DCP-o-matic audio - %s"), std_to_wx(_content->path_summary()).data()));
}
void
AudioDialog::try_to_load_analysis ()
{
- if (!boost::filesystem::exists (_content->audio_analysis_path()) && IsShown ()) {
- _content->analyse_audio (bind (&AudioDialog::analysis_finished, this));
+ if (!IsShown ()) {
+ return;
+ }
+
+ if (!boost::filesystem::exists (_content->audio_analysis_path())) {
+ _analysis_finished_connection = _content->analyse_audio (bind (&AudioDialog::analysis_finished, this));
return;
}
AudioDialog::channel_clicked (wxCommandEvent& ev)
{
int c = 0;
- while (c < MAX_AUDIO_CHANNELS && ev.GetEventObject() != _channel_checkbox[c]) {
+ while (c < MAX_DCP_AUDIO_CHANNELS && ev.GetEventObject() != _channel_checkbox[c]) {
++c;
}
- assert (c < MAX_AUDIO_CHANNELS);
+ assert (c < MAX_DCP_AUDIO_CHANNELS);
_plot->set_channel_visible (c, _channel_checkbox[c]->GetValue ());
}