summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_region_view.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-02 19:35:18 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-02 19:35:18 +0000
commitd537434b6b85b342cd9fcabfc49ca626de049d12 (patch)
treeb02d04edbac178ebd41c44ebc973f5acd2610ed6 /gtk2_ardour/midi_region_view.cc
parenta1cf2bba3622e6301c9f5fc2ecb649141ddfba28 (diff)
use new parameter that controls display of MTC and MIDI clock, as well as attempt to do the first step of something vaguely smart with showing them only a very-zoomed-in levels even if requested
git-svn-id: svn://localhost/ardour2/branches/3.0@10865 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r--gtk2_ardour/midi_region_view.cc55
1 files changed, 52 insertions, 3 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 00bdb94dce..c852e656a9 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -41,6 +41,7 @@
#include "evoral/Parameter.hpp"
#include "evoral/MIDIParameters.hpp"
+#include "evoral/MIDIEvent.hpp"
#include "evoral/Control.hpp"
#include "evoral/midi_util.h"
@@ -1232,9 +1233,58 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel)
void
MidiRegionView::display_sysexes()
{
+ bool have_periodic_system_messages = false;
+ bool display_periodic_messages = true;
+
+ if (!Config->get_never_display_periodic_midi()) {
+
+ for (MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) {
+ const boost::shared_ptr<const Evoral::MIDIEvent<Evoral::MusicalTime> > mev =
+ boost::dynamic_pointer_cast<const Evoral::MIDIEvent<Evoral::MusicalTime> > (*i);
+
+ if (mev) {
+ if (mev->is_spp() || mev->is_mtc_quarter() || mev->is_mtc_full()) {
+ have_periodic_system_messages = true;
+ break;
+ }
+ }
+ }
+
+ if (have_periodic_system_messages) {
+ double zoom = trackview.editor().get_current_zoom (); // frames per pixel
+
+ /* get an approximate value for the number of samples per video frame */
+
+ double video_frame = trackview.session()->frame_rate() * (1.0/30);
+
+ /* if we are zoomed out beyond than the cutoff (i.e. more
+ * frames per pixel than frames per 4 video frames), don't
+ * show periodic sysex messages.
+ */
+
+ if (zoom > (video_frame*4)) {
+ display_periodic_messages = false;
+ }
+ }
+ } else {
+ display_periodic_messages = false;
+ }
+
for (MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) {
+
+ const boost::shared_ptr<const Evoral::MIDIEvent<Evoral::MusicalTime> > mev =
+ boost::dynamic_pointer_cast<const Evoral::MIDIEvent<Evoral::MusicalTime> > (*i);
+
Evoral::MusicalTime time = (*i)->time();
- assert(time >= 0);
+ assert (time >= 0);
+
+ if (mev) {
+ if (mev->is_spp() || mev->is_mtc_quarter() || mev->is_mtc_full()) {
+ if (!display_periodic_messages) {
+ continue;
+ }
+ }
+ }
ostringstream str;
str << hex;
@@ -1253,7 +1303,7 @@ MidiRegionView::display_sysexes()
boost::shared_ptr<CanvasSysEx> sysex = boost::shared_ptr<CanvasSysEx>(
new CanvasSysEx(*this, *_note_group, text, height, x, 1.0));
- // Show unless patch change is beyond the region bounds
+ // Show unless message is beyond the region bounds
if (time - _region->start() >= _region->length() || time < _region->start()) {
sysex->hide();
} else {
@@ -1264,7 +1314,6 @@ MidiRegionView::display_sysexes()
}
}
-
MidiRegionView::~MidiRegionView ()
{
in_destructor = true;