some libardour support for MIDI scene support

This commit is contained in:
Paul Davis 2024-04-08 18:34:33 -06:00
parent a0756429cf
commit 87f40ddc7f
3 changed files with 63 additions and 0 deletions

View File

@ -69,6 +69,7 @@ public:
IsXrun = 0x400,
IsCueMarker = 0x800,
IsSection = 0x1000,
IsScene = 0x2000
};
Location (Session &);
@ -125,6 +126,7 @@ public:
bool is_skipping() const { return (_flags & IsSkip) && (_flags & IsSkipping); }
bool is_xrun() const { return _flags & IsXrun; }
bool is_section() const { return _flags & IsSection; }
bool is_scene() const { return (bool) _scene_change && _flags & IsScene; }
bool matches (Flags f) const { return _flags & f; }
/* any range with start < end -- not a marker */
@ -274,6 +276,7 @@ public:
bool clear_ranges ();
bool clear_cue_markers (samplepos_t start, samplepos_t end);
bool clear_scene_markers (samplepos_t start, samplepos_t end);
void cut_copy_section (timepos_t const& start, timepos_t const& end, timepos_t const& to, SectionOperation const op);

View File

@ -612,6 +612,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Location, IsXrun);
REGISTER_CLASS_ENUM (Location, IsCueMarker);
REGISTER_CLASS_ENUM (Location, IsSection);
REGISTER_CLASS_ENUM (Location, IsScene);
REGISTER_BITS (_Location_Flags);
REGISTER_CLASS_ENUM (Track, NoFreeze);

View File

@ -801,6 +801,11 @@ Location::set_scene_change (std::shared_ptr<SceneChange> sc)
{
if (_scene_change != sc) {
_scene_change = sc;
if (_scene_change) {
_flags = Flags (_flags | IsScene);
} else {
_flags = Flags (_flags & ~IsScene);
}
_session.set_dirty ();
emit_signal (Scene); /* EMIT SIGNAL */
}
@ -2046,6 +2051,60 @@ Locations::clear_cue_markers (samplepos_t start, samplepos_t end)
return removed_at_least_one;
}
bool
Locations::clear_scene_markers (samplepos_t start, samplepos_t end)
{
TempoMap::SharedPtr tmap (TempoMap::use());
Temporal::Beats sb;
Temporal::Beats eb;
bool have_beats = false;
vector<Location*> r;
bool removed_at_least_one = false;
{
Glib::Threads::RWLock::WriterLock lm (_lock);
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
if ((*i)->is_scene()) {
Location* l (*i);
if (l->start().time_domain() == AudioTime) {
samplepos_t when = l->start().samples();
if (when >= start && when < end) {
i = locations.erase (i);
r.push_back (l);
continue;
}
} else {
if (!have_beats) {
sb = tmap->quarters_at (timepos_t (start));
eb = tmap->quarters_at (timepos_t (end));
have_beats = true;
}
Temporal::Beats when = l->start().beats();
if (when >= sb && when < eb) {
r.push_back (l);
i = locations.erase (i);
continue;
}
}
removed_at_least_one = true;
}
++i;
}
} /* end lock scope */
for (auto & l : r) {
removed (l); /* EMIT SIGNAL */
delete l;
}
return removed_at_least_one;
}
void
Locations::start_domain_bounce (Temporal::DomainBounceInfo& cmd)
{