add a callback argument to Playlist::ripple() so that the caller can arrange for a response after a single ripple
Also add Playlist::rdiff_and_add_command() to consolidate what is required to save playlist state in an (undo/redo) Command
This commit is contained in:
@@ -103,6 +103,8 @@ public:
|
||||
void clear_owned_changes ();
|
||||
void rdiff (std::vector<Command*>&) const;
|
||||
|
||||
void rdiff_and_add_command (Session*);
|
||||
|
||||
boost::shared_ptr<Region> region_by_id (const PBD::ID&) const;
|
||||
|
||||
uint32_t max_source_level () const;
|
||||
@@ -188,14 +190,17 @@ public:
|
||||
void uncombine (boost::shared_ptr<Region>);
|
||||
|
||||
void shuffle (boost::shared_ptr<Region>, int dir);
|
||||
void ripple (samplepos_t at, samplecnt_t distance, RegionList* exclude);
|
||||
void ripple (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
|
||||
typedef boost::function<void (Playlist&)> RippleCallback;
|
||||
|
||||
void ripple (samplepos_t at, samplecnt_t distance, RegionList* exclude, RippleCallback ripple_callback);
|
||||
void ripple (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude, RippleCallback ripple_callback)
|
||||
{
|
||||
RegionList el;
|
||||
if (exclude) {
|
||||
el.push_back (exclude);
|
||||
}
|
||||
ripple (at, distance, &el);
|
||||
ripple (at, distance, &el, ripple_callback);
|
||||
}
|
||||
|
||||
void update_after_tempo_map_change ();
|
||||
@@ -424,8 +429,8 @@ protected:
|
||||
void splice_locked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude);
|
||||
void splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude, ThawList& thawlist);
|
||||
|
||||
void ripple_locked (samplepos_t at, samplecnt_t distance, RegionList* exclude);
|
||||
void ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList* exclude, ThawList& thawlist, bool notify = true);
|
||||
void ripple_locked (samplepos_t at, samplecnt_t distance, RegionList* exclude, RippleCallback);
|
||||
void ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList* exclude, RippleCallback, ThawList& thawlist, bool notify = true);
|
||||
|
||||
virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {}
|
||||
virtual void region_going_away (boost::weak_ptr<Region> /*region*/) {}
|
||||
|
||||
@@ -878,6 +878,7 @@ Playlist::remove_gaps (samplepos_t gap_threshold, samplepos_t leave_gap, boost::
|
||||
RegionList::iterator i;
|
||||
RegionList::iterator nxt (regions.end());
|
||||
bool closed = false;
|
||||
boost::function<void (Playlist&)> null_ripple_callback;
|
||||
|
||||
if (regions.size() < 2) {
|
||||
return;
|
||||
@@ -906,7 +907,7 @@ Playlist::remove_gaps (samplepos_t gap_threshold, samplepos_t leave_gap, boost::
|
||||
|
||||
const samplepos_t shift = gap - leave_gap;
|
||||
|
||||
ripple_unlocked ((*nxt)->position(), -shift, 0, rlock.thawlist, false);
|
||||
ripple_unlocked ((*nxt)->position(), -shift, 0, null_ripple_callback, rlock.thawlist, false);
|
||||
|
||||
gap_callback ((*nxt)->position(), shift);
|
||||
|
||||
@@ -1653,14 +1654,14 @@ Playlist::splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_p
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::ripple_locked (samplepos_t at, samplecnt_t distance, RegionList* exclude)
|
||||
Playlist::ripple_locked (samplepos_t at, samplecnt_t distance, RegionList* exclude, RippleCallback ripple_callback)
|
||||
{
|
||||
RegionWriteLock rl (this);
|
||||
ripple_unlocked (at, distance, exclude, rl.thawlist);
|
||||
ripple_unlocked (at, distance, exclude, ripple_callback, rl.thawlist);
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList* exclude, ThawList& thawlist, bool notify)
|
||||
Playlist::ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList* exclude, RippleCallback ripple_callback, ThawList& thawlist, bool notify)
|
||||
{
|
||||
if (distance == 0) {
|
||||
return;
|
||||
@@ -1693,6 +1694,8 @@ Playlist::ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList* exc
|
||||
|
||||
_rippling = false;
|
||||
|
||||
ripple_callback (*this);
|
||||
|
||||
if (notify) {
|
||||
notify_contents_changed ();
|
||||
}
|
||||
@@ -3010,7 +3013,7 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
|
||||
}
|
||||
|
||||
bool
|
||||
Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>)
|
||||
Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>)
|
||||
{
|
||||
RegionReadLock rlock (const_cast<Playlist*> (this));
|
||||
|
||||
@@ -3022,9 +3025,9 @@ bool
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::ripple (samplepos_t at, samplecnt_t distance, RegionList* exclude)
|
||||
Playlist::ripple (samplepos_t at, samplecnt_t distance, RegionList* exclude, RippleCallback ripple_callback)
|
||||
{
|
||||
ripple_locked (at, distance, exclude);
|
||||
ripple_locked (at, distance, exclude, ripple_callback);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3504,3 +3507,13 @@ Playlist::set_capture_insertion_in_progress (bool yn)
|
||||
{
|
||||
_capture_insertion_underway = yn;
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::rdiff_and_add_command (Session* session)
|
||||
{
|
||||
|
||||
vector<Command*> cmds;
|
||||
rdiff (cmds);
|
||||
session->add_commands (cmds);
|
||||
session->add_command (new StatefulDiffCommand (shared_from_this ()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user