diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 89ae1883a7..1b10a43687 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -373,6 +373,8 @@ public: _changemap = changemap; } + void get_cue_markers (CueMarkers&, bool abs = false) const; + protected: virtual XMLNode& state (); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 2682bfd27d..70990f6f2a 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -112,6 +112,8 @@ public: XrunPositions const& captured_xruns () const { return _xruns; } void set_captured_xruns (XrunPositions const& xruns) { _xruns = xruns; } + CueMarkers const & cue_markers() const { return _cue_markers; } + virtual samplepos_t natural_position() const { return _natural_position; } virtual void set_natural_position (samplepos_t pos); bool have_natural_position() const { return _have_natural_position; } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index c4c6d9534b..88a6eb5d6d 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1922,6 +1922,26 @@ Region::captured_xruns (XrunPositions& xruns, bool abs) const } } +void +Region::get_cue_markers (CueMarkers& cues, bool abs) const +{ + bool was_empty = cues.empty (); + for (SourceList::const_iterator i = _sources.begin (); i != _sources.end(); ++i) { + CueMarkers const& x = (*i)->cue_markers (); + for (CueMarkers::const_iterator p = x.begin (); p != x.end (); ++p) { + if (abs) { + cues.push_back (*p); + } else if (p->position() >= _start && p->position() < _start + _length) { + cues.push_back (CueMarker (p->text(), p->position() - _start)); + } + } + } + if (_sources.size () > 1 || !was_empty) { + sort (cues.begin (), cues.end ()); + cues.erase (unique (cues.begin (), cues.end ()), cues.end ()); + } +} + void Region::drop_sources () {