summaryrefslogtreecommitdiff
path: root/src/wx/audio_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-03-26 23:51:02 +0100
committerCarl Hetherington <cth@carlh.net>2018-03-26 23:51:02 +0100
commita423c0a0a6c891d0cacd42a3ac04c110c5f2be2e (patch)
treed8634e266267edb77b78f101adc0ec98424f87e7 /src/wx/audio_dialog.cc
parent37c28f4c76df89bc84d773beda1bb90be1cedd1a (diff)
Add real-time mouse cursor readout in audio analysis (rest of #1082).
Diffstat (limited to 'src/wx/audio_dialog.cc')
-rw-r--r--src/wx/audio_dialog.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index 938ecd1d3..b5d5634ef 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -74,6 +74,8 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, shared_ptr<Co
wxBoxSizer* left = new wxBoxSizer (wxVERTICAL);
+ _cursor = new wxStaticText (this, wxID_ANY, wxT("Cursor: none"));
+ left->Add (_cursor, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP);
_plot = new AudioPlot (this);
left->Add (_plot, 1, wxTOP | wxEXPAND, 12);
_sample_peak = new wxStaticText (this, wxID_ANY, wxT (""));
@@ -157,6 +159,8 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, shared_ptr<Co
} else {
_playlist = film->playlist ();
}
+
+ _plot->Cursor.connect (bind (&AudioDialog::set_cursor, this, _1, _2));
}
void
@@ -383,3 +387,16 @@ AudioDialog::Show (bool show)
try_to_load_analysis ();
return r;
}
+
+void
+AudioDialog::set_cursor (optional<DCPTime> time, optional<float> db)
+{
+ if (!time || !db) {
+ _cursor->SetLabel (_("Cursor: none"));
+ return;
+ }
+
+ shared_ptr<Film> film = _film.lock();
+ DCPOMATIC_ASSERT (film);
+ _cursor->SetLabel (wxString::Format (_("Cursor: %.1fdB at %s"), *db, time->timecode(film->video_frame_rate())));
+}